chrome-devtools-frontend 1.0.956401 → 1.0.956812
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/gni/devtools_grd_files.gni +0 -1
- package/front_end/Images/generate-css-vars.js +2 -2
- package/front_end/core/common/ParsedURL.ts +35 -2
- package/front_end/core/common/Settings.ts +1 -1
- package/front_end/core/host/InspectorFrontendHost.ts +2 -1
- package/front_end/core/i18n/i18nImpl.ts +2 -3
- package/front_end/core/root/Runtime.ts +0 -72
- package/front_end/core/root/root-legacy.ts +0 -2
- package/front_end/entrypoints/lighthouse_worker/LighthouseService.ts +4 -7
- package/front_end/entrypoints/main/MainImpl.ts +1 -1
- package/front_end/models/extensions/ExtensionServer.ts +1 -22
- package/front_end/panels/console/ConsoleSidebar.ts +9 -9
- package/front_end/panels/elements/ElementsPanel.ts +1 -1
- package/front_end/panels/elements/components/LayoutPane.ts +1 -1
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +2 -1
- package/front_end/third_party/acorn/acorn.ts +1 -1
- package/front_end/ui/legacy/ResizerWidget.ts +4 -2
- package/front_end/ui/legacy/SoftDropDown.ts +2 -1
- package/front_end/ui/legacy/TextPrompt.ts +2 -2
- package/front_end/ui/legacy/Treeoutline.ts +2 -1
- package/front_end/ui/legacy/ViewManager.ts +1 -1
- package/front_end/ui/legacy/Widget.ts +3 -2
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +1 -0
- package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +2 -1
- package/front_end/ui/legacy/components/perf_ui/TimelineGrid.ts +1 -2
- package/front_end/ui/legacy/softContextMenu.css +4 -1
- package/front_end/ui/legacy/theme_support/theme_support_impl.ts +1 -5
- package/front_end/ui/legacy/utils/create-shadow-root-with-core-styles.ts +3 -2
- package/front_end/ui/legacy/utils/inject-core-styles.ts +3 -31
- package/front_end/ui/legacy/utils/utils.ts +1 -5
- package/front_end/ui/lit-html/lit-html.ts +1 -1
- package/package.json +1 -1
- package/scripts/build/generate_css_js_files.js +2 -2
- package/scripts/build/ninja/generate_css.gni +3 -0
- package/front_end/ui/legacy/utils/append-style.ts +0 -9
|
@@ -1577,7 +1577,6 @@ grd_files_debug_sources = [
|
|
|
1577
1577
|
"front_end/ui/legacy/theme_support/theme_support_impl.js",
|
|
1578
1578
|
"front_end/ui/legacy/toolbar.css.legacy.js",
|
|
1579
1579
|
"front_end/ui/legacy/treeoutline.css.legacy.js",
|
|
1580
|
-
"front_end/ui/legacy/utils/append-style.js",
|
|
1581
1580
|
"front_end/ui/legacy/utils/create-shadow-root-with-core-styles.js",
|
|
1582
1581
|
"front_end/ui/legacy/utils/focus-changed.js",
|
|
1583
1582
|
"front_end/ui/legacy/utils/inject-core-styles.js",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
6
|
-
const [, , targetGenDir, targetName, ...imageSources] = process.argv;
|
|
6
|
+
const [, , buildTimestamp, targetGenDir, targetName, ...imageSources] = process.argv;
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @param {string} fileName
|
|
@@ -18,7 +18,7 @@ function generateCSSVariableDefinition(fileName) {
|
|
|
18
18
|
fileName}', import.meta.url).toString() + '\\")');`;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const CURRENT_YEAR = new Date().getFullYear();
|
|
21
|
+
const CURRENT_YEAR = new Date(Number(buildTimestamp) * 1000).getFullYear();
|
|
22
22
|
const fileContent = `
|
|
23
23
|
// Copyright ${CURRENT_YEAR} The Chromium Authors. All rights reserved.
|
|
24
24
|
// Use of this source code is governed by a BSD-style license that can be
|
|
@@ -29,7 +29,40 @@
|
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
31
|
import * as Platform from '../platform/platform.js';
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* http://tools.ietf.org/html/rfc3986#section-5.2.4
|
|
35
|
+
*/
|
|
36
|
+
export function normalizePath(path: string): string {
|
|
37
|
+
if (path.indexOf('..') === -1 && path.indexOf('.') === -1) {
|
|
38
|
+
return path;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const normalizedSegments = [];
|
|
42
|
+
const segments = path.split('/');
|
|
43
|
+
for (const segment of segments) {
|
|
44
|
+
if (segment === '.') {
|
|
45
|
+
continue;
|
|
46
|
+
} else if (segment === '..') {
|
|
47
|
+
normalizedSegments.pop();
|
|
48
|
+
} else if (segment) {
|
|
49
|
+
normalizedSegments.push(segment);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
let normalizedPath = normalizedSegments.join('/');
|
|
53
|
+
if (normalizedPath[normalizedPath.length - 1] === '/') {
|
|
54
|
+
return normalizedPath;
|
|
55
|
+
}
|
|
56
|
+
if (path[0] === '/' && normalizedPath) {
|
|
57
|
+
normalizedPath = '/' + normalizedPath;
|
|
58
|
+
}
|
|
59
|
+
if ((path[path.length - 1] === '/') || (segments[segments.length - 1] === '.') ||
|
|
60
|
+
(segments[segments.length - 1] === '..')) {
|
|
61
|
+
normalizedPath = normalizedPath + '/';
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return normalizedPath;
|
|
65
|
+
}
|
|
33
66
|
|
|
34
67
|
export class ParsedURL {
|
|
35
68
|
isValid: boolean;
|
|
@@ -291,7 +324,7 @@ export class ParsedURL {
|
|
|
291
324
|
if (hrefPath.charAt(0) !== '/') {
|
|
292
325
|
hrefPath = parsedURL.folderPathComponents + '/' + hrefPath;
|
|
293
326
|
}
|
|
294
|
-
return securityOrigin +
|
|
327
|
+
return securityOrigin + normalizePath(hrefPath) + hrefSuffix;
|
|
295
328
|
}
|
|
296
329
|
|
|
297
330
|
static splitLineAndColumn(string: string): {
|
|
@@ -36,7 +36,7 @@ import {Format} from './Color.js';
|
|
|
36
36
|
import {Console} from './Console.js';
|
|
37
37
|
import type {GenericEvents, EventDescriptor, EventTargetEvent} from './EventTarget.js';
|
|
38
38
|
import {ObjectWrapper} from './Object.js';
|
|
39
|
-
import {getLocalizedSettingsCategory, getRegisteredSettings, maybeRemoveSettingExtension, RegExpSettingItem, registerSettingExtension, registerSettingsForTest, resetSettings, SettingCategory, SettingExtensionOption, SettingRegistration, SettingType} from './SettingRegistration.js';
|
|
39
|
+
import {getLocalizedSettingsCategory, getRegisteredSettings, maybeRemoveSettingExtension, type RegExpSettingItem, registerSettingExtension, registerSettingsForTest, resetSettings, SettingCategory, type SettingExtensionOption, type SettingRegistration, SettingType} from './SettingRegistration.js';
|
|
40
40
|
|
|
41
41
|
let settingsInstance: Settings|undefined;
|
|
42
42
|
|
|
@@ -220,7 +220,8 @@ export class InspectorFrontendHostStub implements InspectorFrontendHostAPI {
|
|
|
220
220
|
|
|
221
221
|
loadNetworkResource(
|
|
222
222
|
url: string, headers: string, streamId: number, callback: (arg0: LoadNetworkResourceResult) => void): void {
|
|
223
|
-
|
|
223
|
+
fetch(url)
|
|
224
|
+
.then(result => result.text())
|
|
224
225
|
.then(function(text) {
|
|
225
226
|
resourceLoaderStreamWrite(streamId, text);
|
|
226
227
|
callback({
|
|
@@ -56,11 +56,10 @@ function getLocaleFetchUrl(locale: Intl.UnicodeBCP47LocaleIdentifier): string {
|
|
|
56
56
|
* fetched locally or remotely.
|
|
57
57
|
*/
|
|
58
58
|
export async function fetchAndRegisterLocaleData(locale: Intl.UnicodeBCP47LocaleIdentifier): Promise<void> {
|
|
59
|
-
const localeDataTextPromise =
|
|
59
|
+
const localeDataTextPromise = fetch(getLocaleFetchUrl(locale)).then(result => result.json());
|
|
60
60
|
const timeoutPromise =
|
|
61
61
|
new Promise((resolve, reject) => setTimeout(() => reject(new Error('timed out fetching locale')), 5000));
|
|
62
|
-
const
|
|
63
|
-
const localeData = JSON.parse(localeDataText as string);
|
|
62
|
+
const localeData = await Promise.race([timeoutPromise, localeDataTextPromise]);
|
|
64
63
|
i18nInstance.registerLocaleData(locale, localeData);
|
|
65
64
|
}
|
|
66
65
|
|
|
@@ -47,40 +47,6 @@ export class Runtime {
|
|
|
47
47
|
runtimeInstance = undefined;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
/**
|
|
51
|
-
* http://tools.ietf.org/html/rfc3986#section-5.2.4
|
|
52
|
-
*/
|
|
53
|
-
static normalizePath(path: string): string {
|
|
54
|
-
if (path.indexOf('..') === -1 && path.indexOf('.') === -1) {
|
|
55
|
-
return path;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const normalizedSegments = [];
|
|
59
|
-
const segments = path.split('/');
|
|
60
|
-
for (const segment of segments) {
|
|
61
|
-
if (segment === '.') {
|
|
62
|
-
continue;
|
|
63
|
-
} else if (segment === '..') {
|
|
64
|
-
normalizedSegments.pop();
|
|
65
|
-
} else if (segment) {
|
|
66
|
-
normalizedSegments.push(segment);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
let normalizedPath = normalizedSegments.join('/');
|
|
70
|
-
if (normalizedPath[normalizedPath.length - 1] === '/') {
|
|
71
|
-
return normalizedPath;
|
|
72
|
-
}
|
|
73
|
-
if (path[0] === '/' && normalizedPath) {
|
|
74
|
-
normalizedPath = '/' + normalizedPath;
|
|
75
|
-
}
|
|
76
|
-
if ((path[path.length - 1] === '/') || (segments[segments.length - 1] === '.') ||
|
|
77
|
-
(segments[segments.length - 1] === '..')) {
|
|
78
|
-
normalizedPath = normalizedPath + '/';
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
return normalizedPath;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
50
|
static queryParam(name: string): string|null {
|
|
85
51
|
return queryParamsObject.get(name);
|
|
86
52
|
}
|
|
@@ -132,15 +98,6 @@ export class Runtime {
|
|
|
132
98
|
return true;
|
|
133
99
|
}
|
|
134
100
|
|
|
135
|
-
static resolveSourceURL(path: string): string {
|
|
136
|
-
let sourceURL: string = self.location.href;
|
|
137
|
-
if (self.location.search) {
|
|
138
|
-
sourceURL = sourceURL.replace(self.location.search, '');
|
|
139
|
-
}
|
|
140
|
-
sourceURL = sourceURL.substring(0, sourceURL.lastIndexOf('/') + 1) + path;
|
|
141
|
-
return '\n/*# sourceURL=' + sourceURL + ' */';
|
|
142
|
-
}
|
|
143
|
-
|
|
144
101
|
loadLegacyModule(modulePath: string): Promise<void> {
|
|
145
102
|
return import(`../../${modulePath}`);
|
|
146
103
|
}
|
|
@@ -297,35 +254,6 @@ export class Experiment {
|
|
|
297
254
|
}
|
|
298
255
|
}
|
|
299
256
|
|
|
300
|
-
export function loadResourcePromise(url: string): Promise<string> {
|
|
301
|
-
return new Promise<string>(load);
|
|
302
|
-
|
|
303
|
-
function load(fulfill: (arg0: string) => void, reject: (arg0: Error) => void): void {
|
|
304
|
-
const xhr = new XMLHttpRequest();
|
|
305
|
-
xhr.open('GET', url, true);
|
|
306
|
-
xhr.onreadystatechange = onreadystatechange;
|
|
307
|
-
|
|
308
|
-
function onreadystatechange(this: XMLHttpRequest, _e: Event): void {
|
|
309
|
-
if (xhr.readyState !== XMLHttpRequest.DONE) {
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
const response: string = this.response;
|
|
314
|
-
|
|
315
|
-
// DevTools Proxy server can mask 404s as 200s, check the body to be sure
|
|
316
|
-
const status = /^HTTP\/1.1 404/.test(response) ? 404 : xhr.status;
|
|
317
|
-
|
|
318
|
-
if ([0, 200, 304].indexOf(status) === -1) // Testing harness file:/// results in 0.
|
|
319
|
-
{
|
|
320
|
-
reject(new Error('While loading from url ' + url + ' server responded with a status of ' + status));
|
|
321
|
-
} else {
|
|
322
|
-
fulfill(response);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
xhr.send(null);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
|
|
329
257
|
// This must be constructed after the query parameters have been parsed.
|
|
330
258
|
export const experiments = new ExperimentsSupport();
|
|
331
259
|
|
|
@@ -20,8 +20,6 @@ Root.Runtime.queryParam = RootModule.Runtime.Runtime.queryParam;
|
|
|
20
20
|
/** @type {!RootModule.Runtime.Runtime} */
|
|
21
21
|
Root.runtime;
|
|
22
22
|
|
|
23
|
-
Root.Runtime.loadResourcePromise = RootModule.Runtime.loadResourcePromise;
|
|
24
|
-
|
|
25
23
|
/** @constructor */
|
|
26
24
|
Root.Runtime.Extension = RootModule.Runtime.Extension;
|
|
27
25
|
|
|
@@ -87,20 +87,17 @@ async function fetchLocaleData(locales: string[]): Promise<string|void> {
|
|
|
87
87
|
|
|
88
88
|
// Try to load the locale data.
|
|
89
89
|
try {
|
|
90
|
-
let localeDataTextPromise;
|
|
91
90
|
const remoteBase = Root.Runtime.getRemoteBase();
|
|
91
|
+
let localeUrl: string;
|
|
92
92
|
if (remoteBase && remoteBase.base) {
|
|
93
|
-
|
|
94
|
-
localeDataTextPromise = Root.Runtime.loadResourcePromise(localeUrl);
|
|
93
|
+
localeUrl = `${remoteBase.base}third_party/lighthouse/locales/${locale}.json`;
|
|
95
94
|
} else {
|
|
96
|
-
|
|
97
|
-
localeDataTextPromise = Root.Runtime.loadResourcePromise(localeUrl.toString());
|
|
95
|
+
localeUrl = new URL(`../../third_party/lighthouse/locales/${locale}.json`, import.meta.url).toString();
|
|
98
96
|
}
|
|
99
97
|
|
|
100
98
|
const timeoutPromise = new Promise<string>(
|
|
101
99
|
(resolve, reject) => setTimeout(() => reject(new Error('timed out fetching locale')), 5000));
|
|
102
|
-
const
|
|
103
|
-
const localeData = JSON.parse(localeDataText);
|
|
100
|
+
const localeData = await Promise.race([timeoutPromise, fetch(localeUrl).then(result => result.json())]);
|
|
104
101
|
// @ts-expect-error https://github.com/GoogleChrome/lighthouse/issues/11628
|
|
105
102
|
self.registerLocaleData(locale, localeData);
|
|
106
103
|
return locale;
|
|
@@ -806,7 +806,7 @@ export class MainMenuItem implements UI.Toolbar.Provider {
|
|
|
806
806
|
dockItemElement.classList.add('flex-auto');
|
|
807
807
|
dockItemElement.tabIndex = -1;
|
|
808
808
|
UI.ARIAUtils.setAccessibleName(dockItemElement, UIStrings.dockSide);
|
|
809
|
-
const titleElement = dockItemElement.createChild('span', '
|
|
809
|
+
const titleElement = dockItemElement.createChild('span', 'dockside-title');
|
|
810
810
|
titleElement.textContent = i18nString(UIStrings.dockSide);
|
|
811
811
|
const toggleDockSideShorcuts =
|
|
812
812
|
UI.ShortcutRegistry.ShortcutRegistry.instance().shortcutsForAction('main.toggle-dock');
|
|
@@ -952,28 +952,7 @@ export class ExtensionServer extends Common.ObjectWrapper.ObjectWrapper<EventTyp
|
|
|
952
952
|
}
|
|
953
953
|
|
|
954
954
|
private expandResourcePath(extensionPath: string, resourcePath: string): string {
|
|
955
|
-
return extensionPath +
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
private normalizePath(path: string): string {
|
|
959
|
-
const source = path.split('/');
|
|
960
|
-
const result = [];
|
|
961
|
-
|
|
962
|
-
for (let i = 0; i < source.length; ++i) {
|
|
963
|
-
if (source[i] === '.') {
|
|
964
|
-
continue;
|
|
965
|
-
}
|
|
966
|
-
// Ignore empty path components resulting from //, as well as a leading and traling slashes.
|
|
967
|
-
if (source[i] === '') {
|
|
968
|
-
continue;
|
|
969
|
-
}
|
|
970
|
-
if (source[i] === '..') {
|
|
971
|
-
result.pop();
|
|
972
|
-
} else {
|
|
973
|
-
result.push(source[i]);
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
return '/' + result.join('/');
|
|
955
|
+
return extensionPath + '/' + Common.ParsedURL.normalizePath(resourcePath);
|
|
977
956
|
}
|
|
978
957
|
|
|
979
958
|
evaluate(
|
|
@@ -178,6 +178,15 @@ export class URLGroupTreeElement extends ConsoleSidebarTreeElement {
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
+
const enum GroupName {
|
|
182
|
+
ConsoleAPI = 'user message',
|
|
183
|
+
All = 'message',
|
|
184
|
+
Error = 'error',
|
|
185
|
+
Warning = 'warning',
|
|
186
|
+
Info = 'info',
|
|
187
|
+
Verbose = 'verbose',
|
|
188
|
+
}
|
|
189
|
+
|
|
181
190
|
/**
|
|
182
191
|
* Maps the GroupName for a filter to the UIString used to render messages.
|
|
183
192
|
* Stored here so we only construct it once at runtime, rather than everytime we
|
|
@@ -274,12 +283,3 @@ export class FilterTreeElement extends ConsoleSidebarTreeElement {
|
|
|
274
283
|
return child;
|
|
275
284
|
}
|
|
276
285
|
}
|
|
277
|
-
|
|
278
|
-
const enum GroupName {
|
|
279
|
-
ConsoleAPI = 'user message',
|
|
280
|
-
All = 'message',
|
|
281
|
-
Error = 'error',
|
|
282
|
-
Warning = 'warning',
|
|
283
|
-
Info = 'info',
|
|
284
|
-
Verbose = 'verbose',
|
|
285
|
-
}
|
|
@@ -1369,7 +1369,7 @@ export class ElementsActionDelegate implements UI.ActionRegistration.ActionDeleg
|
|
|
1369
1369
|
treeOutline.duplicateNode(node);
|
|
1370
1370
|
return true;
|
|
1371
1371
|
case 'elements.copy-styles':
|
|
1372
|
-
treeOutline.findTreeElement(node)?.copyStyles();
|
|
1372
|
+
void treeOutline.findTreeElement(node)?.copyStyles();
|
|
1373
1373
|
return true;
|
|
1374
1374
|
case 'elements.undo':
|
|
1375
1375
|
void SDK.DOMModel.DOMModelUndoStack.instance().undo();
|
|
@@ -8,7 +8,7 @@ import * as UI from '../../../ui/legacy/legacy.js';
|
|
|
8
8
|
import * as LitHtml from '../../../ui/lit-html/lit-html.js';
|
|
9
9
|
|
|
10
10
|
import type {BooleanSetting, EnumSetting, Setting} from './LayoutPaneUtils.js';
|
|
11
|
-
import {LayoutElement} from './LayoutPaneUtils.js';
|
|
11
|
+
import type {LayoutElement} from './LayoutPaneUtils.js';
|
|
12
12
|
|
|
13
13
|
import type {NodeTextData} from './NodeText.js';
|
|
14
14
|
import {NodeText} from './NodeText.js';
|
|
@@ -257,7 +257,8 @@ export class PerformanceMonitorImpl extends UI.Widget.HBox implements
|
|
|
257
257
|
color: metricInfo.color,
|
|
258
258
|
});
|
|
259
259
|
}
|
|
260
|
-
const backgroundColor =
|
|
260
|
+
const backgroundColor =
|
|
261
|
+
Common.Color.Color.parse(ThemeSupport.ThemeSupport.instance().getComputedValue('--color-background'));
|
|
261
262
|
|
|
262
263
|
if (backgroundColor) {
|
|
263
264
|
for (const path of paths.reverse()) {
|
|
@@ -7,7 +7,7 @@ import * as acorn from './package/dist/acorn.mjs';
|
|
|
7
7
|
import type * as ESTree from './estree-legacy';
|
|
8
8
|
export {ESTree};
|
|
9
9
|
|
|
10
|
-
export { Comment, defaultOptions, getLineInfo, isNewLine, lineBreak, lineBreakG, Node, SourceLocation, Token, tokTypes, tokContexts} from './package/dist/acorn.mjs';
|
|
10
|
+
export { type Comment, defaultOptions, getLineInfo, isNewLine, lineBreak, lineBreakG, Node, SourceLocation, Token, tokTypes, tokContexts} from './package/dist/acorn.mjs';
|
|
11
11
|
|
|
12
12
|
export const Parser = acorn.Parser;
|
|
13
13
|
export const tokenizer = acorn.Parser.tokenizer.bind(acorn.Parser);
|
|
@@ -38,7 +38,7 @@ export class ResizerWidget extends Common.ObjectWrapper.ObjectWrapper<EventTypes
|
|
|
38
38
|
addElement(element: HTMLElement): void {
|
|
39
39
|
if (!this.elementsInternal.has(element)) {
|
|
40
40
|
this.elementsInternal.add(element);
|
|
41
|
-
element.addEventListener('
|
|
41
|
+
element.addEventListener('pointerdown', this.installDragOnMouseDownBound, false);
|
|
42
42
|
this.updateElementCursor(element);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -46,7 +46,7 @@ export class ResizerWidget extends Common.ObjectWrapper.ObjectWrapper<EventTypes
|
|
|
46
46
|
removeElement(element: HTMLElement): void {
|
|
47
47
|
if (this.elementsInternal.has(element)) {
|
|
48
48
|
this.elementsInternal.delete(element);
|
|
49
|
-
element.removeEventListener('
|
|
49
|
+
element.removeEventListener('pointerdown', this.installDragOnMouseDownBound, false);
|
|
50
50
|
element.style.removeProperty('cursor');
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -58,8 +58,10 @@ export class ResizerWidget extends Common.ObjectWrapper.ObjectWrapper<EventTypes
|
|
|
58
58
|
private updateElementCursor(element: HTMLElement): void {
|
|
59
59
|
if (this.isEnabledInternal) {
|
|
60
60
|
element.style.setProperty('cursor', this.cursor());
|
|
61
|
+
element.style.setProperty('touch-action', 'none');
|
|
61
62
|
} else {
|
|
62
63
|
element.style.removeProperty('cursor');
|
|
64
|
+
element.style.removeProperty('touch-action');
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import type * as Common from '../../core/common/common.js';
|
|
6
6
|
import * as i18n from '../../core/i18n/i18n.js';
|
|
7
|
+
import * as ThemeSupport from './theme_support/theme_support.js';
|
|
7
8
|
import * as Utils from './utils/utils.js';
|
|
8
9
|
|
|
9
10
|
import * as ARIAUtils from './ARIAUtils.js';
|
|
@@ -48,7 +49,7 @@ export class SoftDropDown<T> implements ListDelegate<T> {
|
|
|
48
49
|
|
|
49
50
|
this.element = document.createElement('button');
|
|
50
51
|
this.element.classList.add('soft-dropdown');
|
|
51
|
-
|
|
52
|
+
ThemeSupport.ThemeSupport.instance().appendStyle(this.element, softDropDownButtonStyles);
|
|
52
53
|
this.titleElement = this.element.createChild('span', 'title');
|
|
53
54
|
const dropdownArrowIcon = Icon.create('smallicon-triangle-down');
|
|
54
55
|
this.element.appendChild(dropdownArrowIcon);
|
|
@@ -37,7 +37,7 @@ import * as Platform from '../../core/platform/platform.js';
|
|
|
37
37
|
import * as TextUtils from '../../models/text_utils/text_utils.js';
|
|
38
38
|
|
|
39
39
|
import * as ARIAUtils from './ARIAUtils.js';
|
|
40
|
-
import * as
|
|
40
|
+
import * as ThemeSupport from './theme_support/theme_support.js';
|
|
41
41
|
|
|
42
42
|
import type {SuggestBoxDelegate, Suggestion} from './SuggestBox.js';
|
|
43
43
|
import {SuggestBox} from './SuggestBox.js';
|
|
@@ -136,7 +136,7 @@ export class TextPrompt extends Common.ObjectWrapper.ObjectWrapper<EventTypes> i
|
|
|
136
136
|
this.boundOnMouseWheel = this.onMouseWheel.bind(this);
|
|
137
137
|
this.boundClearAutocomplete = this.clearAutocomplete.bind(this);
|
|
138
138
|
this.proxyElement = element.ownerDocument.createElement('span');
|
|
139
|
-
|
|
139
|
+
ThemeSupport.ThemeSupport.instance().appendStyle(this.proxyElement, textPromptStyles);
|
|
140
140
|
this.contentElement = this.proxyElement.createChild('div', 'text-prompt-root');
|
|
141
141
|
this.proxyElement.style.display = this.proxyElementDisplay;
|
|
142
142
|
if (element.parentElement) {
|
|
@@ -37,6 +37,7 @@ import * as Common from '../../core/common/common.js';
|
|
|
37
37
|
import * as Platform from '../../core/platform/platform.js';
|
|
38
38
|
|
|
39
39
|
import * as ARIAUtils from './ARIAUtils.js';
|
|
40
|
+
import * as ThemeSupport from './theme_support/theme_support.js';
|
|
40
41
|
import * as Utils from './utils/utils.js';
|
|
41
42
|
|
|
42
43
|
import type {Icon} from './Icon.js';
|
|
@@ -400,7 +401,7 @@ export class TreeOutlineInShadow extends TreeOutline {
|
|
|
400
401
|
}
|
|
401
402
|
|
|
402
403
|
registerRequiredCSS(cssFile: {cssContent: string}): void {
|
|
403
|
-
|
|
404
|
+
ThemeSupport.ThemeSupport.instance().appendStyle(this.shadowRoot, cssFile);
|
|
404
405
|
}
|
|
405
406
|
|
|
406
407
|
registerCSSFiles(cssFiles: CSSStyleSheet[]): void {
|
|
@@ -15,7 +15,7 @@ import type {ToolbarItem} from './Toolbar.js';
|
|
|
15
15
|
import {Toolbar, ToolbarMenuButton} from './Toolbar.js';
|
|
16
16
|
import {createTextChild} from './UIUtils.js';
|
|
17
17
|
import type {TabbedViewLocation, View, ViewLocation, ViewLocationResolver} from './View.js';
|
|
18
|
-
import {getRegisteredLocationResolvers, getRegisteredViewExtensions, maybeRemoveViewExtension, registerLocationResolver, registerViewExtension, ViewLocationCategoryValues, ViewLocationValues, ViewPersistence, ViewRegistration} from './ViewRegistration.js';
|
|
18
|
+
import {getRegisteredLocationResolvers, getRegisteredViewExtensions, maybeRemoveViewExtension, registerLocationResolver, registerViewExtension, ViewLocationCategoryValues, ViewLocationValues, ViewPersistence, type ViewRegistration} from './ViewRegistration.js';
|
|
19
19
|
import type {Widget, WidgetElement} from './Widget.js';
|
|
20
20
|
import {VBox} from './Widget.js';
|
|
21
21
|
import viewContainersStyles from './viewContainers.css.legacy.js';
|
|
@@ -32,6 +32,7 @@ import * as DOMExtension from '../../core/dom_extension/dom_extension.js';
|
|
|
32
32
|
import * as Helpers from '../components/helpers/helpers.js';
|
|
33
33
|
|
|
34
34
|
import {Constraints, Size} from './Geometry.js';
|
|
35
|
+
import * as ThemeSupport from './theme_support/theme_support.js';
|
|
35
36
|
import * as Utils from './utils/utils.js';
|
|
36
37
|
import {XWidget} from './XWidget.js';
|
|
37
38
|
|
|
@@ -460,9 +461,9 @@ export class Widget {
|
|
|
460
461
|
|
|
461
462
|
registerRequiredCSS(cssFile: {cssContent: string}): void {
|
|
462
463
|
if (this.isWebComponent) {
|
|
463
|
-
|
|
464
|
+
ThemeSupport.ThemeSupport.instance().appendStyle((this.shadowRoot as DocumentFragment), cssFile);
|
|
464
465
|
} else {
|
|
465
|
-
|
|
466
|
+
ThemeSupport.ThemeSupport.instance().appendStyle(this.element, cssFile);
|
|
466
467
|
}
|
|
467
468
|
}
|
|
468
469
|
|
|
@@ -32,6 +32,7 @@ import * as Common from '../../../../core/common/common.js';
|
|
|
32
32
|
import * as i18n from '../../../../core/i18n/i18n.js';
|
|
33
33
|
import * as Platform from '../../../../core/platform/platform.js';
|
|
34
34
|
import * as UI from '../../legacy.js';
|
|
35
|
+
import * as ThemeSupport from '../../theme_support/theme_support.js';
|
|
35
36
|
|
|
36
37
|
import type {Calculator} from './TimelineGrid.js';
|
|
37
38
|
import {TimelineGrid} from './TimelineGrid.js';
|
|
@@ -162,7 +163,7 @@ export class Window extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
|
|
|
162
163
|
|
|
163
164
|
this.parentElement.addEventListener('wheel', this.onMouseWheel.bind(this), true);
|
|
164
165
|
this.parentElement.addEventListener('dblclick', this.resizeWindowMaximum.bind(this), true);
|
|
165
|
-
|
|
166
|
+
ThemeSupport.ThemeSupport.instance().appendStyle(this.parentElement, overviewGridStyles);
|
|
166
167
|
|
|
167
168
|
this.leftResizeElement = parentElement.createChild('div', 'overview-grid-window-resizer') as HTMLElement;
|
|
168
169
|
UI.UIUtils.installDragHandle(
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
35
|
import * as Host from '../../../../core/host/host.js';
|
|
36
|
-
import * as UI from '../../legacy.js';
|
|
37
36
|
import * as ThemeSupport from '../../theme_support/theme_support.js';
|
|
38
37
|
|
|
39
38
|
import timelineGridStyles from './timelineGrid.css.legacy.js';
|
|
@@ -49,7 +48,7 @@ export class TimelineGrid {
|
|
|
49
48
|
|
|
50
49
|
constructor() {
|
|
51
50
|
this.element = document.createElement('div');
|
|
52
|
-
|
|
51
|
+
ThemeSupport.ThemeSupport.instance().appendStyle(this.element, timelineGridStyles);
|
|
53
52
|
|
|
54
53
|
this.dividersElementInternal = this.element.createChild('div', 'resources-dividers');
|
|
55
54
|
|
|
@@ -35,12 +35,15 @@
|
|
|
35
35
|
box-shadow: var(--override-mac-specific-box-shadow);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
.dockside-title {
|
|
39
|
+
padding-right: 13px;
|
|
40
|
+
}
|
|
41
|
+
|
|
38
42
|
.soft-context-menu-item {
|
|
39
43
|
display: flex;
|
|
40
44
|
width: 100%;
|
|
41
45
|
font-size: 12px;
|
|
42
46
|
padding: 3px 7px 3px 8px;
|
|
43
|
-
margin: 0 13px 0 0;
|
|
44
47
|
white-space: nowrap;
|
|
45
48
|
align-items: center;
|
|
46
49
|
}
|
|
@@ -116,11 +116,7 @@ export class ThemeSupport extends EventTarget {
|
|
|
116
116
|
this.appendStyle(element, inspectorSyntaxHighlightStyles);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
* Note: this is a duplicate of the function in ui/utils. It exists here
|
|
121
|
-
* so there is no circular dependency between ui/utils and theme_support.
|
|
122
|
-
*/
|
|
123
|
-
private appendStyle(node: Node, {cssContent}: {cssContent: string}): void {
|
|
119
|
+
appendStyle(node: Node, {cssContent}: {cssContent: string}): void {
|
|
124
120
|
const styleElement = document.createElement('style');
|
|
125
121
|
styleElement.textContent = cssContent;
|
|
126
122
|
node.appendChild(styleElement);
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as ThemeSupport from '../theme_support/theme_support.js';
|
|
6
|
+
|
|
6
7
|
import {focusChanged} from './focus-changed.js';
|
|
7
8
|
import {injectCoreStyles} from './inject-core-styles.js';
|
|
8
9
|
|
|
@@ -24,7 +25,7 @@ export function createShadowRootWithCoreStyles(element: Element, options: Option
|
|
|
24
25
|
injectCoreStyles(shadowRoot);
|
|
25
26
|
if (cssFile) {
|
|
26
27
|
if ('cssContent' in cssFile) {
|
|
27
|
-
appendStyle(shadowRoot, cssFile);
|
|
28
|
+
ThemeSupport.ThemeSupport.instance().appendStyle(shadowRoot, cssFile);
|
|
28
29
|
} else {
|
|
29
30
|
shadowRoot.adoptedStyleSheets = cssFile;
|
|
30
31
|
}
|
|
@@ -7,39 +7,11 @@ import textButtonStyles from '../textButton.css.legacy.js';
|
|
|
7
7
|
import * as ThemeSupport from '../theme_support/theme_support.js';
|
|
8
8
|
import themeColorsStyles from '../themeColors.css.legacy.js';
|
|
9
9
|
|
|
10
|
-
import {appendStyle} from './append-style.js';
|
|
11
|
-
|
|
12
10
|
export function injectCoreStyles(root: Element|ShadowRoot): void {
|
|
13
|
-
appendStyle(root, inspectorCommonStyles);
|
|
14
|
-
appendStyle(root, textButtonStyles);
|
|
15
|
-
appendStyle(root, themeColorsStyles);
|
|
11
|
+
ThemeSupport.ThemeSupport.instance().appendStyle(root, inspectorCommonStyles);
|
|
12
|
+
ThemeSupport.ThemeSupport.instance().appendStyle(root, textButtonStyles);
|
|
13
|
+
ThemeSupport.ThemeSupport.instance().appendStyle(root, themeColorsStyles);
|
|
16
14
|
|
|
17
15
|
ThemeSupport.ThemeSupport.instance().injectHighlightStyleSheets(root);
|
|
18
16
|
ThemeSupport.ThemeSupport.instance().injectCustomStyleSheets(root);
|
|
19
17
|
}
|
|
20
|
-
|
|
21
|
-
let bodyComputedStylesCached: CSSStyleDeclaration|null = null;
|
|
22
|
-
export function getThemeColorValue(variableName: string): string {
|
|
23
|
-
if (!bodyComputedStylesCached) {
|
|
24
|
-
/**
|
|
25
|
-
* We are safe to cache this value as we're only using this code to look up
|
|
26
|
-
* theme variables, and they do not change during runtime. And if the user
|
|
27
|
-
* swaps from light => dark theme, or vice-versa, DevTools is entirely
|
|
28
|
-
* reloaded, removing this cache.
|
|
29
|
-
*/
|
|
30
|
-
bodyComputedStylesCached = window.getComputedStyle(document.body);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const colorValue = bodyComputedStylesCached.getPropertyValue(variableName);
|
|
34
|
-
if (!colorValue) {
|
|
35
|
-
throw new Error(`Could not find theme color for variable ${variableName}.`);
|
|
36
|
-
}
|
|
37
|
-
return colorValue;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function getCurrentTheme(): 'light'|'dark' {
|
|
41
|
-
if (document.documentElement.classList.contains('-theme-with-dark-background')) {
|
|
42
|
-
return 'dark';
|
|
43
|
-
}
|
|
44
|
-
return 'light';
|
|
45
|
-
}
|
|
@@ -4,19 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
/* eslint-disable rulesdir/es_modules_import */
|
|
6
6
|
|
|
7
|
-
import {appendStyle} from './append-style.js';
|
|
8
7
|
import {createShadowRootWithCoreStyles} from './create-shadow-root-with-core-styles.js';
|
|
9
8
|
import {focusChanged} from './focus-changed.js';
|
|
10
|
-
import {
|
|
9
|
+
import {injectCoreStyles} from './inject-core-styles.js';
|
|
11
10
|
import {measuredScrollbarWidth, resetMeasuredScrollbarWidthForTest} from './measured-scrollbar-width.js';
|
|
12
11
|
import {registerCustomElement} from './register-custom-element.js';
|
|
13
12
|
|
|
14
13
|
export {
|
|
15
|
-
appendStyle,
|
|
16
14
|
createShadowRootWithCoreStyles,
|
|
17
15
|
focusChanged,
|
|
18
|
-
getCurrentTheme,
|
|
19
|
-
getThemeColorValue,
|
|
20
16
|
injectCoreStyles,
|
|
21
17
|
measuredScrollbarWidth,
|
|
22
18
|
registerCustomElement,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as LitHtml from '../../third_party/lit-html/lit-html.js';
|
|
6
6
|
import * as Static from './static.js';
|
|
7
|
-
export {Directive, TemplateResult} from '../../third_party/lit-html/lit-html.js';
|
|
7
|
+
export {Directive, type TemplateResult} from '../../third_party/lit-html/lit-html.js';
|
|
8
8
|
|
|
9
9
|
const {render, svg, Directives, nothing, noChange} = LitHtml;
|
|
10
10
|
const {html, literal, flattenTemplate} = Static;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const path = require('path');
|
|
6
6
|
const CleanCSS = require('clean-css');
|
|
7
|
-
const [, , isDebugString, legacyString, targetName, srcDir, targetGenDir, files] = process.argv;
|
|
7
|
+
const [, , buildTimestamp, isDebugString, legacyString, targetName, srcDir, targetGenDir, files] = process.argv;
|
|
8
8
|
|
|
9
9
|
const filenames = files.split(',');
|
|
10
10
|
const configFiles = [];
|
|
@@ -37,7 +37,7 @@ export default styles;`;
|
|
|
37
37
|
|
|
38
38
|
fs.writeFileSync(
|
|
39
39
|
path.join(targetGenDir, generatedFileName),
|
|
40
|
-
`// Copyright ${new Date().getFullYear()} The Chromium Authors. All rights reserved.
|
|
40
|
+
`// Copyright ${new Date(Number(buildTimestamp) * 1000).getFullYear()} The Chromium Authors. All rights reserved.
|
|
41
41
|
// Use of this source code is governed by a BSD-style license that can be
|
|
42
42
|
// found in the LICENSE file.
|
|
43
43
|
// IMPORTANT: this file is auto generated. Please do not edit this file.
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
# Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
# found in the LICENSE file.
|
|
4
4
|
|
|
5
|
+
import("//build/timestamp.gni")
|
|
5
6
|
import("./node.gni")
|
|
6
7
|
import("./vars.gni")
|
|
8
|
+
|
|
7
9
|
template("generate_css") {
|
|
8
10
|
node_action(target_name) {
|
|
9
11
|
forward_variables_from(invoker, [ "sources" ])
|
|
@@ -17,6 +19,7 @@ template("generate_css") {
|
|
|
17
19
|
[ devtools_location_prepend + "node_modules/clean-css/package.json" ]
|
|
18
20
|
|
|
19
21
|
args = [
|
|
22
|
+
build_timestamp,
|
|
20
23
|
"$is_debug",
|
|
21
24
|
"${invoker.legacy}",
|
|
22
25
|
target_name,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// Copyright 2019 The Chromium Authors. All rights reserved.
|
|
2
|
-
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
-
// found in the LICENSE file.
|
|
4
|
-
|
|
5
|
-
export function appendStyle(node: Node, {cssContent}: {cssContent: string}): void {
|
|
6
|
-
const styleElement = document.createElement('style');
|
|
7
|
-
styleElement.textContent = cssContent;
|
|
8
|
-
node.appendChild(styleElement);
|
|
9
|
-
}
|