Skip to content

Commit c5b19b2

Browse files
authored
Merge branch 'ChromeDevTools:main' into main
2 parents 1452d74 + 808905c commit c5b19b2

File tree

558 files changed

+53870
-12017
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

558 files changed

+53870
-12017
lines changed

DEPS

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@ vars = {
1212
'build_with_chromium': False,
1313

1414
'build_url': 'https://chromium.googlesource.com/chromium/src/build.git',
15-
'build_revision': '3f69beb61e8cc5cd868c39fb860c1e81c759e81e',
15+
'build_revision': '800bdadb6c11e7152551824e98cfce9ffd85d386',
1616

1717
'buildtools_url': 'https://chromium.googlesource.com/chromium/src/buildtools.git',
1818
'buildtools_revision': 'b0b6f725c28dbe2d5d7ca6edc9b81a352965eee9',
1919

2020
'depot_tools_url': 'https://chromium.googlesource.com/chromium/tools/depot_tools.git',
21-
'depot_tools_revision': '9e9b885a7b85483e59723d5e1e69235dcb577077',
21+
'depot_tools_revision': '0699a53d841453368d0ad17deb1c7d29b6db09a6',
2222

2323
'inspector_protocol_url': 'https://chromium.googlesource.com/deps/inspector_protocol',
2424
'inspector_protocol_revision': '07272ab9a30fd555890fda0718f4c2c25931653a',
2525

2626
# Keeping track of the last time we rolled the browser protocol files.
27-
'chromium_browser_protocol_revision' : '3bf451b0bf3beb7acf5f343700e2d8115c187e00',
27+
'chromium_browser_protocol_revision' : '67b3be36a4efb989a69c585f68bee1d86f193768',
2828

2929
'clang_format_url': 'https://chromium.googlesource.com/external/github.com/llvm/llvm-project/clang/tools/clang-format.git',
3030
'clang_format_revision': '37f6e68a107df43b7d7e044fd36a13cbae3413f2',
3131

3232
'emscripten_tag': 'ade9d780ff17c88d81aa13860361743e3c1e1396',
3333

3434
# GN CIPD package version.
35-
'gn_version': 'git_revision:037970ef8d8e5b1d9d3d6defc9aa3886dbfea29a',
35+
'gn_version': 'git_revision:5d0a4153b0bcc86c5a23310d5b648a587be3c56d',
3636

3737
'cmake_version': 'version:[email protected]',
3838

build

Submodule build updated from 3f69beb to 800bdad

eslint.config.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ export default defineConfig([
695695
// errors on {describe, it}.only
696696
'mocha/no-exclusive-tests': 'error',
697697

698-
'mocha/no-async-suite': 'error',
698+
'mocha/no-async-describe': 'error',
699699
'mocha/no-global-tests': 'error',
700700
'mocha/no-nested-tests': 'error',
701701

@@ -739,22 +739,22 @@ export default defineConfig([
739739
{
740740
name: 'describeWithDevtoolsExtension',
741741
type: 'suite',
742-
interface: 'BDD',
742+
interfaces: ['BDD', 'TDD'],
743743
},
744744
{
745745
name: 'describeWithEnvironment',
746746
type: 'suite',
747-
interface: 'BDD',
747+
interfaces: ['BDD', 'TDD'],
748748
},
749749
{
750750
name: 'describeWithLocale',
751751
type: 'suite',
752-
interface: 'BDD',
752+
interfaces: ['BDD', 'TDD'],
753753
},
754754
{
755755
name: 'describeWithMockConnection',
756756
type: 'suite',
757-
interface: 'BDD',
757+
interfaces: ['BDD', 'TDD'],
758758
},
759759
],
760760
},

front_end/core/host/AidaClient.test.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -559,10 +559,6 @@ describeWithEnvironment('AidaClient', () => {
559559
});
560560
}
561561

562-
beforeEach(() => {
563-
sinon.restore();
564-
});
565-
566562
it('should return NO_INTERNET when navigator is not online', async () => {
567563
const navigatorDescriptor = Object.getOwnPropertyDescriptor(globalThis, 'navigator')!;
568564
Object.defineProperty(globalThis, 'navigator', {
@@ -631,10 +627,6 @@ describeWithEnvironment('AidaClient', () => {
631627
});
632628

633629
describe('completeCode', () => {
634-
beforeEach(() => {
635-
sinon.restore();
636-
});
637-
638630
it('handles successful response', async () => {
639631
const mockResult: AidaCodeCompleteResult = {
640632
response: JSON.stringify({

front_end/core/host/AidaClient.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,27 @@ export enum EditType {
228228
ACCEPT_COMPLETION = 6,
229229
}
230230

231+
export enum Reason {
232+
// Unknown reason.
233+
UNKNOWN = 0,
234+
235+
// The file is currently open.
236+
CURRENTLY_OPEN = 1,
237+
238+
// The file is opened recently.
239+
RECENTLY_OPENED = 2,
240+
241+
// The file is edited recently.
242+
RECENTLY_EDITED = 3,
243+
244+
// The file is located within the same directory.
245+
COLOCATED = 4,
246+
247+
// Included based on relation to code around the cursor (e.g: could be
248+
// provided by local IDE analysis)
249+
RELATED_FILE = 5,
250+
}
251+
231252
/* eslint-disable @typescript-eslint/naming-convention */
232253
export interface CompletionRequest {
233254
client: string;
@@ -236,6 +257,11 @@ export interface CompletionRequest {
236257
options?: CompleteCodeOptions;
237258
metadata: RequestMetadata;
238259
last_user_action?: EditType;
260+
additional_files?: Array<{
261+
path: string,
262+
content: string,
263+
included_reason: Reason,
264+
}>;
239265
}
240266
/* eslint-enable @typescript-eslint/naming-convention */
241267

front_end/entrypoints/main/GlobalAiButton.test.ts

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import * as UI from '../../ui/legacy/legacy.js';
1313
import * as Main from './main.js';
1414

1515
const CLICK_COUNT_LIMIT = 2;
16+
const DELAY_BEFORE_PROMOTION_COLLAPSE_IN_MS = 5000;
1617

1718
const {GlobalAiButton} = Main.GlobalAiButton;
1819

@@ -78,7 +79,7 @@ describeWithEnvironment('GlobalAiButton', () => {
7879
Common.Settings.Settings.instance().settingForTest('global-ai-button-click-count').set(CLICK_COUNT_LIMIT - 1);
7980

8081
const {view} = await createWidget();
81-
clock.tick(5000);
82+
clock.tick(DELAY_BEFORE_PROMOTION_COLLAPSE_IN_MS);
8283

8384
const finalInput = await view.nextInput;
8485
assert.strictEqual(finalInput.state, Main.GlobalAiButton.GlobalAiButtonState.DEFAULT);
@@ -129,4 +130,40 @@ describeWithEnvironment('GlobalAiButton', () => {
129130
assert.strictEqual(view.input.state, Main.GlobalAiButton.GlobalAiButtonState.DEFAULT);
130131
});
131132
});
133+
134+
describe('promotion lifecycle with toolbar hover', () => {
135+
let headerElement: HTMLElement;
136+
beforeEach(() => {
137+
headerElement = document.createElement('div');
138+
sinon.stub(UI.InspectorView.InspectorView.instance().tabbedPane, 'headerElement').returns(headerElement);
139+
});
140+
141+
it('does not revert from PROMOTION to DEFAULT state while the toolbar is hovered', async () => {
142+
updateHostConfig({
143+
devToolsGlobalAiButton: {
144+
promotionEnabled: true,
145+
},
146+
});
147+
clock = sinon.useFakeTimers({now: new Date('2025-01-01'), toFake: ['setTimeout', 'Date']});
148+
Common.Settings.Settings.instance().settingForTest('global-ai-button-click-count').set(CLICK_COUNT_LIMIT - 1);
149+
150+
const {view} = await createWidget();
151+
assert.strictEqual(view.input.state, Main.GlobalAiButton.GlobalAiButtonState.PROMOTION);
152+
153+
// Simulate hovering over the toolbar.
154+
headerElement.dispatchEvent(new MouseEvent('mouseenter'));
155+
clock.tick(DELAY_BEFORE_PROMOTION_COLLAPSE_IN_MS);
156+
157+
// The button should still be in the promotion state.
158+
assert.strictEqual(view.input.state, Main.GlobalAiButton.GlobalAiButtonState.PROMOTION);
159+
160+
// Simulate hovering out of the toolbar.
161+
headerElement.dispatchEvent(new MouseEvent('mouseleave'));
162+
clock.tick(DELAY_BEFORE_PROMOTION_COLLAPSE_IN_MS);
163+
164+
// The button should now be in the default state.
165+
const finalInput = await view.nextInput;
166+
assert.strictEqual(finalInput.state, Main.GlobalAiButton.GlobalAiButtonState.DEFAULT);
167+
});
168+
});
132169
});

front_end/entrypoints/main/GlobalAiButton.ts

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ export type View = typeof DEFAULT_VIEW;
6868
export class GlobalAiButton extends UI.Widget.Widget {
6969
#view: View;
7070
#buttonState: GlobalAiButtonState = GlobalAiButtonState.DEFAULT;
71+
#mouseOnMainToolbar = false;
72+
#returnToDefaultStateTimeout?: number;
7173

7274
constructor(element?: HTMLElement, view?: View) {
7375
super(element);
@@ -79,6 +81,36 @@ export class GlobalAiButton extends UI.Widget.Widget {
7981
}
8082
}
8183

84+
override willHide(): void {
85+
this.#removeHoverEventListeners();
86+
87+
if (this.#returnToDefaultStateTimeout) {
88+
window.clearTimeout(this.#returnToDefaultStateTimeout);
89+
}
90+
}
91+
92+
#handleMainToolbarMouseEnter = (): void => {
93+
this.#mouseOnMainToolbar = true;
94+
};
95+
96+
#handleMainToolbarMouseLeave = (): void => {
97+
this.#mouseOnMainToolbar = false;
98+
};
99+
100+
#addHoverEventListeners(): void {
101+
UI.InspectorView.InspectorView.instance().tabbedPane.headerElement().addEventListener(
102+
'mouseenter', this.#handleMainToolbarMouseEnter);
103+
UI.InspectorView.InspectorView.instance().tabbedPane.headerElement().addEventListener(
104+
'mouseleave', this.#handleMainToolbarMouseLeave);
105+
}
106+
107+
#removeHoverEventListeners(): void {
108+
UI.InspectorView.InspectorView.instance().tabbedPane.headerElement().removeEventListener(
109+
'mouseenter', this.#handleMainToolbarMouseEnter);
110+
UI.InspectorView.InspectorView.instance().tabbedPane.headerElement().removeEventListener(
111+
'mouseleave', this.#handleMainToolbarMouseLeave);
112+
}
113+
82114
// We only want to enable promotion when:
83115
// * The flag is enabled,
84116
// * The current date is before the promotion end date,
@@ -90,11 +122,33 @@ export class GlobalAiButton extends UI.Widget.Widget {
90122
}
91123

92124
#triggerPromotion(): void {
125+
// Set up hover listeners for making sure that we don't return to default state from promotion state
126+
// when the user's cursor is on the main toolbar.
93127
this.#buttonState = GlobalAiButtonState.PROMOTION;
94128
this.requestUpdate();
95-
window.setTimeout(() => {
129+
this.#addHoverEventListeners();
130+
this.#scheduleReturnToDefaultState();
131+
}
132+
133+
#scheduleReturnToDefaultState(): void {
134+
if (this.#returnToDefaultStateTimeout) {
135+
window.clearTimeout(this.#returnToDefaultStateTimeout);
136+
}
137+
138+
this.#returnToDefaultStateTimeout = window.setTimeout(() => {
139+
// If the mouse is currently on the main toolbar,
140+
// we don't want to trigger the animation from promotion & to the default
141+
// state to not cause a layout shift when the user is not expecting it
142+
// (e.g. while they were going to click on a button on the toolbar).
143+
if (this.#mouseOnMainToolbar) {
144+
this.#scheduleReturnToDefaultState();
145+
return;
146+
}
147+
96148
this.#buttonState = GlobalAiButtonState.DEFAULT;
97149
this.requestUpdate();
150+
// Remove hover listeners once the button is in its default state.
151+
this.#removeHoverEventListeners();
98152
}, DELAY_BEFORE_PROMOTION_COLLAPSE_IN_MS);
99153
}
100154

front_end/entrypoints/main/globalAiButton.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
@scope to (devtools-widget > *) {
88
.global-ai-button-container {
99
margin-left: var(--sys-size-3);
10-
margin-right: var(--sys-size-1);
10+
margin-right: var(--sys-size-2);
1111
}
1212

1313
.global-ai-button {

front_end/generated/InspectorBackendCommands.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

front_end/generated/SupportedCSSProperties.js

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const generatedProperties = [
77
{
88
"longhands": [
99
"max-lines",
10+
"block-ellipsis",
1011
"continue"
1112
],
1213
"name": "-alternative-webkit-line-clamp"
@@ -94,14 +95,12 @@ export const generatedProperties = [
9495
"name": "-webkit-font-smoothing"
9596
},
9697
{
97-
"inherited": true,
9898
"keywords": [
9999
"auto",
100100
"loose",
101101
"normal",
102102
"strict",
103-
"after-white-space",
104-
"anywhere"
103+
"after-white-space"
105104
],
106105
"name": "-webkit-line-break"
107106
},
@@ -352,6 +351,7 @@ export const generatedProperties = [
352351
"base-palette",
353352
"baseline-shift",
354353
"baseline-source",
354+
"block-ellipsis",
355355
"block-size",
356356
"border-block-end-color",
357357
"border-block-end-style",
@@ -1042,6 +1042,14 @@ export const generatedProperties = [
10421042
],
10431043
"name": "baseline-source"
10441044
},
1045+
{
1046+
"inherited": true,
1047+
"keywords": [
1048+
"auto",
1049+
"no-ellipsis"
1050+
],
1051+
"name": "block-ellipsis"
1052+
},
10451053
{
10461054
"keywords": [
10471055
"auto"
@@ -2807,13 +2815,15 @@ export const generatedProperties = [
28072815
"loose",
28082816
"normal",
28092817
"strict",
2810-
"anywhere"
2818+
"anywhere",
2819+
"after-white-space"
28112820
],
28122821
"name": "line-break"
28132822
},
28142823
{
28152824
"longhands": [
28162825
"max-lines",
2826+
"block-ellipsis",
28172827
"continue"
28182828
],
28192829
"name": "line-clamp"
@@ -4738,8 +4748,7 @@ export const generatedPropertyValues = {
47384748
"loose",
47394749
"normal",
47404750
"strict",
4741-
"after-white-space",
4742-
"anywhere"
4751+
"after-white-space"
47434752
]
47444753
},
47454754
"-webkit-line-clamp": {
@@ -4965,6 +4974,12 @@ export const generatedPropertyValues = {
49654974
"last"
49664975
]
49674976
},
4977+
"block-ellipsis": {
4978+
"values": [
4979+
"auto",
4980+
"no-ellipsis"
4981+
]
4982+
},
49684983
"block-size": {
49694984
"values": [
49704985
"auto"
@@ -5939,7 +5954,8 @@ export const generatedPropertyValues = {
59395954
"loose",
59405955
"normal",
59415956
"strict",
5942-
"anywhere"
5957+
"anywhere",
5958+
"after-white-space"
59435959
]
59445960
},
59455961
"line-height": {

0 commit comments

Comments
 (0)