chrome-devtools-frontend 1.0.927127 → 1.0.928589
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/AUTHORS +1 -0
- package/config/gni/all_devtools_files.gni +0 -1
- package/config/gni/devtools_grd_files.gni +30 -4
- package/config/gni/devtools_image_files.gni +1 -0
- package/front_end/Images/src/ic_preview_feature.svg +3 -0
- package/front_end/Tests.js +2 -3
- package/front_end/core/common/Settings.ts +26 -45
- package/front_end/core/host/UserMetrics.ts +2 -2
- package/front_end/core/i18n/locales/en-US.json +60 -15
- package/front_end/core/i18n/locales/en-XL.json +60 -15
- package/front_end/core/platform/keyboard-utilities.ts +1 -0
- package/front_end/core/root/Runtime.ts +62 -61
- package/front_end/core/sdk/AccessibilityModel.ts +73 -73
- package/front_end/core/sdk/CPUProfileDataModel.ts +14 -14
- package/front_end/core/sdk/CPUProfilerModel.ts +33 -33
- package/front_end/core/sdk/CPUThrottlingManager.ts +8 -8
- package/front_end/core/sdk/CSSFontFace.ts +10 -10
- package/front_end/core/sdk/CSSMatchedStyles.ts +114 -114
- package/front_end/core/sdk/CSSMedia.ts +22 -22
- package/front_end/core/sdk/CSSMetadata.ts +53 -49
- package/front_end/core/sdk/CSSModel.ts +139 -135
- package/front_end/core/sdk/CSSProperty.ts +18 -18
- package/front_end/core/sdk/CSSRule.ts +15 -15
- package/front_end/core/sdk/CSSStyleDeclaration.ts +49 -47
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +12 -12
- package/front_end/core/sdk/ChildTargetManager.ts +41 -40
- package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +10 -10
- package/front_end/core/sdk/Connections.ts +81 -81
- package/front_end/core/sdk/ConsoleModel.ts +68 -68
- package/front_end/core/sdk/Cookie.ts +48 -48
- package/front_end/core/sdk/CookieModel.ts +13 -13
- package/front_end/core/sdk/CookieParser.ts +45 -45
- package/front_end/core/sdk/DOMDebuggerModel.ts +131 -131
- package/front_end/core/sdk/DOMModel.ts +264 -252
- package/front_end/core/sdk/DebuggerModel.ts +209 -205
- package/front_end/core/sdk/EmulationModel.ts +76 -76
- package/front_end/core/sdk/FilmStripModel.ts +29 -29
- package/front_end/core/sdk/FrameManager.ts +43 -42
- package/front_end/core/sdk/HeapProfilerModel.ts +36 -36
- package/front_end/core/sdk/IsolateManager.ts +82 -82
- package/front_end/core/sdk/IssuesModel.ts +6 -6
- package/front_end/core/sdk/LayerTreeBase.ts +37 -37
- package/front_end/core/sdk/LogModel.ts +5 -5
- package/front_end/core/sdk/NetworkManager.ts +229 -225
- package/front_end/core/sdk/NetworkRequest.ts +368 -360
- package/front_end/core/sdk/OverlayColorGenerator.ts +9 -9
- package/front_end/core/sdk/OverlayModel.ts +155 -153
- package/front_end/core/sdk/OverlayPersistentHighlighter.ts +100 -101
- package/front_end/core/sdk/PageResourceLoader.ts +30 -30
- package/front_end/core/sdk/PaintProfiler.ts +16 -16
- package/front_end/core/sdk/PerformanceMetricsModel.ts +12 -12
- package/front_end/core/sdk/ProfileTreeModel.ts +3 -3
- package/front_end/core/sdk/RemoteObject.ts +108 -104
- package/front_end/core/sdk/Resource.ts +85 -84
- package/front_end/core/sdk/ResourceTreeModel.ts +150 -145
- package/front_end/core/sdk/RuntimeModel.ts +38 -34
- package/front_end/core/sdk/SDKModel.ts +3 -3
- package/front_end/core/sdk/ScreenCaptureModel.ts +19 -19
- package/front_end/core/sdk/Script.ts +29 -29
- package/front_end/core/sdk/SecurityOriginManager.ts +19 -19
- package/front_end/core/sdk/ServerTiming.ts +2 -2
- package/front_end/core/sdk/ServiceWorkerCacheModel.ts +43 -43
- package/front_end/core/sdk/ServiceWorkerManager.ts +72 -68
- package/front_end/core/sdk/SourceMap.ts +40 -36
- package/front_end/core/sdk/SourceMapManager.ts +57 -57
- package/front_end/core/sdk/Target.ts +64 -63
- package/front_end/core/sdk/TargetManager.ts +60 -56
- package/front_end/core/sdk/TracingManager.ts +39 -39
- package/front_end/core/sdk/TracingModel.ts +125 -125
- package/front_end/core/sdk/WebAuthnModel.ts +9 -9
- package/front_end/entrypoints/lighthouse_worker/{LighthouseService.js → LighthouseService.ts} +20 -45
- package/front_end/entrypoints/lighthouse_worker/{lighthouse_worker.js → lighthouse_worker.ts} +0 -0
- package/front_end/entrypoints/main/MainImpl.ts +7 -2
- package/front_end/legacy_test_runner/elements_test_runner/ElementsTestRunner.js +4 -4
- package/front_end/legacy_test_runner/sdk_test_runner/sdk_test_runner.js +1 -1
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -6
- package/front_end/models/issues_manager/GenericIssue.ts +86 -0
- package/front_end/models/issues_manager/Issue.ts +24 -0
- package/front_end/models/issues_manager/IssuesManager.ts +18 -6
- package/front_end/models/issues_manager/descriptions/genericCrossOriginPortalPostMessageError.md +3 -0
- package/front_end/models/issues_manager/issues_manager.ts +2 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +5422 -1
- package/front_end/panels/console/ConsoleSidebar.ts +0 -3
- package/front_end/panels/elements/ElementsTreeElement.ts +53 -61
- package/front_end/panels/elements/ElementsTreeOutline.ts +0 -1
- package/front_end/panels/elements/components/LayoutPane.ts +5 -1
- package/front_end/panels/issues/GenericIssueDetailsView.ts +68 -0
- package/front_end/panels/issues/IssueAggregator.ts +16 -0
- package/front_end/panels/issues/IssueKindView.ts +95 -0
- package/front_end/panels/issues/IssueView.ts +6 -0
- package/front_end/panels/issues/IssuesPane.ts +81 -18
- package/front_end/panels/issues/issuesTree.css +8 -3
- package/front_end/panels/lighthouse/LighthouseController.ts +3 -1
- package/front_end/panels/network/NetworkItemView.ts +1 -1
- package/front_end/panels/network/networkLogView.css +5 -0
- package/front_end/panels/sensors/LocationsSettingsTab.ts +1 -1
- package/front_end/panels/settings/SettingsScreen.ts +1 -0
- package/front_end/panels/settings/settingsScreen.css +24 -0
- package/front_end/panels/snippets/SnippetsQuickOpen.ts +8 -3
- package/front_end/panels/sources/TabbedEditorContainer.ts +1 -1
- package/front_end/panels/sources/sources-meta.ts +22 -7
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +4 -4
- package/front_end/ui/components/code_highlighter/CodeHighlighter.ts +137 -0
- package/front_end/ui/components/code_highlighter/codeHighlighter.css +51 -0
- package/front_end/ui/components/code_highlighter/code_highlighter.ts +11 -0
- package/front_end/ui/components/docs/text_editor/basic.html +28 -0
- package/front_end/ui/components/docs/text_editor/basic.ts +14 -0
- package/front_end/ui/components/docs/text_prompt/basic.html +35 -0
- package/front_end/ui/components/docs/text_prompt/basic.ts +19 -0
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +1 -0
- package/front_end/ui/components/render_coordinator/RenderCoordinator.ts +17 -0
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -0
- package/front_end/ui/components/text_editor/TextEditor.ts +161 -0
- package/front_end/ui/components/text_editor/config.ts +264 -0
- package/front_end/{panels/console/components/components.ts → ui/components/text_editor/text_editor.ts} +2 -5
- package/front_end/ui/components/text_editor/theme.ts +113 -0
- package/front_end/ui/components/text_prompt/TextPrompt.ts +144 -0
- package/front_end/ui/components/text_prompt/textPrompt.css +33 -0
- package/front_end/ui/components/text_prompt/text_prompt.ts +9 -0
- package/front_end/ui/legacy/ARIAUtils.ts +14 -11
- package/front_end/ui/legacy/TabbedPane.ts +32 -3
- package/front_end/ui/legacy/UIUtils.ts +3 -1
- package/front_end/ui/legacy/View.ts +6 -0
- package/front_end/ui/legacy/ViewManager.ts +5 -1
- package/front_end/ui/legacy/ViewRegistration.ts +5 -0
- package/front_end/ui/legacy/XLink.ts +1 -1
- package/front_end/ui/legacy/closeButton.css +6 -0
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +8 -3
- package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +38 -38
- package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +10 -4
- package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +23 -6
- package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +14 -16
- package/front_end/ui/legacy/filter.css +1 -0
- package/front_end/ui/legacy/tabbedPane.css +24 -0
- package/front_end/ui/legacy/toolbar.css +5 -0
- package/inspector_overlay/main.ts +2 -1
- package/inspector_overlay/tool_screenshot.ts +8 -1
- package/package.json +1 -1
- package/scripts/build/rollup.config.js +9 -0
- package/scripts/migration/class-fields/migrate.js +56 -0
- package/scripts/migration/class-fields/package.json +5 -0
- package/front_end/panels/console/components/SidebarDeprecation.ts +0 -58
- package/front_end/panels/console/components/sidebarDeprecation.css +0 -17
|
@@ -24,11 +24,11 @@ export class CSSProperty {
|
|
|
24
24
|
implicit: boolean;
|
|
25
25
|
text: string|null|undefined;
|
|
26
26
|
range: TextUtils.TextRange.TextRange|null;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
#active: boolean;
|
|
28
|
+
#nameRangeInternal: TextUtils.TextRange.TextRange|null;
|
|
29
|
+
#valueRangeInternal: TextUtils.TextRange.TextRange|null;
|
|
30
|
+
readonly #invalidProperty: string|null;
|
|
31
|
+
#invalidString?: Common.UIString.LocalizedString;
|
|
32
32
|
|
|
33
33
|
constructor(
|
|
34
34
|
ownerStyle: CSSStyleDeclaration, index: number, name: string, value: string, important: boolean,
|
|
@@ -43,10 +43,10 @@ export class CSSProperty {
|
|
|
43
43
|
this.implicit = implicit; // A longhand, implicitly set by missing values of shorthand.
|
|
44
44
|
this.text = text;
|
|
45
45
|
this.range = range ? TextUtils.TextRange.TextRange.fromObject(range) : null;
|
|
46
|
-
this
|
|
47
|
-
this
|
|
48
|
-
this
|
|
49
|
-
this
|
|
46
|
+
this.#active = true;
|
|
47
|
+
this.#nameRangeInternal = null;
|
|
48
|
+
this.#valueRangeInternal = null;
|
|
49
|
+
this.#invalidProperty = null;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
static parsePayload(ownerStyle: CSSStyleDeclaration, index: number, payload: Protocol.CSS.CSSProperty): CSSProperty {
|
|
@@ -63,7 +63,7 @@ export class CSSProperty {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
private ensureRanges(): void {
|
|
66
|
-
if (this
|
|
66
|
+
if (this.#nameRangeInternal && this.#valueRangeInternal) {
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
const range = this.range;
|
|
@@ -81,8 +81,8 @@ export class CSSProperty {
|
|
|
81
81
|
const nameSourceRange = new TextUtils.TextRange.SourceRange(nameIndex, this.name.length);
|
|
82
82
|
const valueSourceRange = new TextUtils.TextRange.SourceRange(valueIndex, this.value.length);
|
|
83
83
|
|
|
84
|
-
this
|
|
85
|
-
this
|
|
84
|
+
this.#nameRangeInternal = rebase(text.toTextRange(nameSourceRange), range.startLine, range.startColumn);
|
|
85
|
+
this.#valueRangeInternal = rebase(text.toTextRange(valueSourceRange), range.startLine, range.startColumn);
|
|
86
86
|
|
|
87
87
|
function rebase(oneLineRange: TextUtils.TextRange.TextRange, lineOffset: number, columnOffset: number):
|
|
88
88
|
TextUtils.TextRange.TextRange {
|
|
@@ -98,12 +98,12 @@ export class CSSProperty {
|
|
|
98
98
|
|
|
99
99
|
nameRange(): TextUtils.TextRange.TextRange|null {
|
|
100
100
|
this.ensureRanges();
|
|
101
|
-
return this
|
|
101
|
+
return this.#nameRangeInternal;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
valueRange(): TextUtils.TextRange.TextRange|null {
|
|
105
105
|
this.ensureRanges();
|
|
106
|
-
return this
|
|
106
|
+
return this.#valueRangeInternal;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
rebase(edit: Edit): void {
|
|
@@ -116,7 +116,7 @@ export class CSSProperty {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
setActive(active: boolean): void {
|
|
119
|
-
this
|
|
119
|
+
this.#active = active;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
get propertyText(): string|null {
|
|
@@ -131,7 +131,7 @@ export class CSSProperty {
|
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
activeInStyle(): boolean {
|
|
134
|
-
return this
|
|
134
|
+
return this.#active;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
trimmedValueWithoutImportant(): string {
|
|
@@ -291,13 +291,13 @@ export class CSSProperty {
|
|
|
291
291
|
* This stores the warning string when a CSS Property is improperly parsed.
|
|
292
292
|
*/
|
|
293
293
|
setDisplayedStringForInvalidProperty(invalidString: Common.UIString.LocalizedString): void {
|
|
294
|
-
this
|
|
294
|
+
this.#invalidString = invalidString;
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
/**
|
|
298
298
|
* Retrieve the warning string for a screen reader to announce when editing the property.
|
|
299
299
|
*/
|
|
300
300
|
getInvalidStringForInvalidProperty(): Common.UIString.LocalizedString|undefined {
|
|
301
|
-
return this
|
|
301
|
+
return this.#invalidString;
|
|
302
302
|
}
|
|
303
303
|
}
|
|
@@ -203,26 +203,26 @@ export class CSSStyleRule extends CSSRule {
|
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
export class CSSKeyframesRule {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
206
|
+
readonly #cssModel: CSSModel;
|
|
207
|
+
readonly #animationName: CSSValue;
|
|
208
|
+
readonly #keyframesInternal: CSSKeyframeRule[];
|
|
209
209
|
constructor(cssModel: CSSModel, payload: Protocol.CSS.CSSKeyframesRule) {
|
|
210
|
-
this
|
|
211
|
-
this
|
|
212
|
-
this
|
|
210
|
+
this.#cssModel = cssModel;
|
|
211
|
+
this.#animationName = new CSSValue(payload.animationName);
|
|
212
|
+
this.#keyframesInternal = payload.keyframes.map(keyframeRule => new CSSKeyframeRule(cssModel, keyframeRule));
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
name(): CSSValue {
|
|
216
|
-
return this
|
|
216
|
+
return this.#animationName;
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
keyframes(): CSSKeyframeRule[] {
|
|
220
|
-
return this
|
|
220
|
+
return this.#keyframesInternal;
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
export class CSSKeyframeRule extends CSSRule {
|
|
225
|
-
|
|
225
|
+
#keyText!: CSSValue;
|
|
226
226
|
constructor(cssModel: CSSModel, payload: Protocol.CSS.CSSKeyframeRule) {
|
|
227
227
|
// TODO(crbug.com/1011811): Replace with spread operator or better types once Closure is gone.
|
|
228
228
|
super(cssModel, {origin: payload.origin, style: payload.style, styleSheetId: payload.styleSheetId});
|
|
@@ -230,21 +230,21 @@ export class CSSKeyframeRule extends CSSRule {
|
|
|
230
230
|
}
|
|
231
231
|
|
|
232
232
|
key(): CSSValue {
|
|
233
|
-
return this
|
|
233
|
+
return this.#keyText;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
private reinitializeKey(payload: Protocol.CSS.Value): void {
|
|
237
|
-
this
|
|
237
|
+
this.#keyText = new CSSValue(payload);
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
rebase(edit: Edit): void {
|
|
241
|
-
if (this.styleSheetId !== edit.styleSheetId || !this
|
|
241
|
+
if (this.styleSheetId !== edit.styleSheetId || !this.#keyText.range) {
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
|
-
if (edit.oldRange.equal(this
|
|
244
|
+
if (edit.oldRange.equal(this.#keyText.range)) {
|
|
245
245
|
this.reinitializeKey((edit.payload as Protocol.CSS.Value));
|
|
246
246
|
} else {
|
|
247
|
-
this
|
|
247
|
+
this.#keyText.rebase(edit);
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
super.rebase(edit);
|
|
@@ -255,7 +255,7 @@ export class CSSKeyframeRule extends CSSRule {
|
|
|
255
255
|
if (!styleSheetId) {
|
|
256
256
|
throw 'No rule stylesheet id';
|
|
257
257
|
}
|
|
258
|
-
const range = this
|
|
258
|
+
const range = this.#keyText.range;
|
|
259
259
|
if (!range) {
|
|
260
260
|
throw 'Keyframe key is not editable';
|
|
261
261
|
}
|
|
@@ -12,19 +12,19 @@ import type {CSSRule} from './CSSRule.js';
|
|
|
12
12
|
import type {Target} from './Target.js';
|
|
13
13
|
|
|
14
14
|
export class CSSStyleDeclaration {
|
|
15
|
-
|
|
15
|
+
readonly #cssModelInternal: CSSModel;
|
|
16
16
|
parentRule: CSSRule|null;
|
|
17
|
-
|
|
17
|
+
#allPropertiesInternal!: CSSProperty[];
|
|
18
18
|
styleSheetId!: Protocol.CSS.StyleSheetId|undefined;
|
|
19
19
|
range!: TextUtils.TextRange.TextRange|null;
|
|
20
20
|
cssText!: string|undefined;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
#shorthandValues!: Map<string, string>;
|
|
22
|
+
#shorthandIsImportant!: Set<string>;
|
|
23
|
+
#activePropertyMap!: Map<string, CSSProperty>;
|
|
24
|
+
#leadingPropertiesInternal!: CSSProperty[]|null;
|
|
25
25
|
type: Type;
|
|
26
26
|
constructor(cssModel: CSSModel, parentRule: CSSRule|null, payload: Protocol.CSS.CSSStyle, type: Type) {
|
|
27
|
-
this
|
|
27
|
+
this.#cssModelInternal = cssModel;
|
|
28
28
|
this.parentRule = parentRule;
|
|
29
29
|
this.reinitialize(payload);
|
|
30
30
|
this.type = type;
|
|
@@ -38,8 +38,8 @@ export class CSSStyleDeclaration {
|
|
|
38
38
|
this.reinitialize((edit.payload as Protocol.CSS.CSSStyle));
|
|
39
39
|
} else {
|
|
40
40
|
this.range = this.range.rebaseAfterTextEdit(edit.oldRange, edit.newRange);
|
|
41
|
-
for (let i = 0; i < this
|
|
42
|
-
this
|
|
41
|
+
for (let i = 0; i < this.#allPropertiesInternal.length; ++i) {
|
|
42
|
+
this.#allPropertiesInternal[i].rebase(edit);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -49,16 +49,16 @@ export class CSSStyleDeclaration {
|
|
|
49
49
|
this.range = payload.range ? TextUtils.TextRange.TextRange.fromObject(payload.range) : null;
|
|
50
50
|
|
|
51
51
|
const shorthandEntries = payload.shorthandEntries;
|
|
52
|
-
this
|
|
53
|
-
this
|
|
52
|
+
this.#shorthandValues = new Map();
|
|
53
|
+
this.#shorthandIsImportant = new Set();
|
|
54
54
|
for (let i = 0; i < shorthandEntries.length; ++i) {
|
|
55
|
-
this
|
|
55
|
+
this.#shorthandValues.set(shorthandEntries[i].name, shorthandEntries[i].value);
|
|
56
56
|
if (shorthandEntries[i].important) {
|
|
57
|
-
this
|
|
57
|
+
this.#shorthandIsImportant.add(shorthandEntries[i].name);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
this
|
|
61
|
+
this.#allPropertiesInternal = [];
|
|
62
62
|
|
|
63
63
|
if (payload.cssText && this.range) {
|
|
64
64
|
const cssText = new TextUtils.Text.Text(payload.cssText);
|
|
@@ -75,28 +75,30 @@ export class CSSStyleDeclaration {
|
|
|
75
75
|
parseUnusedText.call(this, cssText, start.line, start.column, range.startLine, range.startColumn);
|
|
76
76
|
start = {line: range.endLine, column: range.endColumn};
|
|
77
77
|
}
|
|
78
|
-
this
|
|
78
|
+
this.#allPropertiesInternal.push(
|
|
79
|
+
CSSProperty.parsePayload(this, this.#allPropertiesInternal.length, cssProperty));
|
|
79
80
|
}
|
|
80
81
|
parseUnusedText.call(this, cssText, start.line, start.column, this.range.endLine, this.range.endColumn);
|
|
81
82
|
} else {
|
|
82
83
|
for (const cssProperty of payload.cssProperties) {
|
|
83
|
-
this
|
|
84
|
+
this.#allPropertiesInternal.push(
|
|
85
|
+
CSSProperty.parsePayload(this, this.#allPropertiesInternal.length, cssProperty));
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
this.generateSyntheticPropertiesIfNeeded();
|
|
88
90
|
this.computeInactiveProperties();
|
|
89
91
|
|
|
90
|
-
this
|
|
91
|
-
for (const property of this
|
|
92
|
+
this.#activePropertyMap = new Map();
|
|
93
|
+
for (const property of this.#allPropertiesInternal) {
|
|
92
94
|
if (!property.activeInStyle()) {
|
|
93
95
|
continue;
|
|
94
96
|
}
|
|
95
|
-
this
|
|
97
|
+
this.#activePropertyMap.set(property.name, property);
|
|
96
98
|
}
|
|
97
99
|
|
|
98
100
|
this.cssText = payload.cssText;
|
|
99
|
-
this
|
|
101
|
+
this.#leadingPropertiesInternal = null;
|
|
100
102
|
|
|
101
103
|
function parseUnusedText(
|
|
102
104
|
this: CSSStyleDeclaration, cssText: TextUtils.Text.Text, startLine: number, startColumn: number,
|
|
@@ -130,8 +132,8 @@ export class CSSStyleDeclaration {
|
|
|
130
132
|
value = trimmedProperty.substring(colonIndex + 1).trim();
|
|
131
133
|
}
|
|
132
134
|
const range = new TextUtils.TextRange.TextRange(lineNumber, column, lineNumber, column + property.length);
|
|
133
|
-
this
|
|
134
|
-
this, this
|
|
135
|
+
this.#allPropertiesInternal.push(new CSSProperty(
|
|
136
|
+
this, this.#allPropertiesInternal.length, name, value, false, false, false, false, property,
|
|
135
137
|
range.relativeFrom(startLine, startColumn)));
|
|
136
138
|
}
|
|
137
139
|
column += property.length + 1;
|
|
@@ -165,38 +167,38 @@ export class CSSStyleDeclaration {
|
|
|
165
167
|
return;
|
|
166
168
|
}
|
|
167
169
|
|
|
168
|
-
if (!this
|
|
170
|
+
if (!this.#shorthandValues.size) {
|
|
169
171
|
return;
|
|
170
172
|
}
|
|
171
173
|
|
|
172
174
|
const propertiesSet = new Set<string>();
|
|
173
|
-
for (const property of this
|
|
175
|
+
for (const property of this.#allPropertiesInternal) {
|
|
174
176
|
propertiesSet.add(property.name);
|
|
175
177
|
}
|
|
176
178
|
|
|
177
179
|
const generatedProperties = [];
|
|
178
|
-
// For style-based properties, generate shorthands with values when possible.
|
|
179
|
-
for (const property of this
|
|
180
|
-
// For style-based properties, try generating shorthands.
|
|
180
|
+
// For style-based properties, generate #shorthands with values when possible.
|
|
181
|
+
for (const property of this.#allPropertiesInternal) {
|
|
182
|
+
// For style-based properties, try generating #shorthands.
|
|
181
183
|
const shorthands = cssMetadata().getShorthands(property.name) || [];
|
|
182
184
|
for (const shorthand of shorthands) {
|
|
183
185
|
if (propertiesSet.has(shorthand)) {
|
|
184
186
|
continue;
|
|
185
|
-
} // There already is a shorthand this longhands falls under.
|
|
186
|
-
const shorthandValue = this
|
|
187
|
+
} // There already is a shorthand this #longhands falls under.
|
|
188
|
+
const shorthandValue = this.#shorthandValues.get(shorthand);
|
|
187
189
|
if (!shorthandValue) {
|
|
188
190
|
continue;
|
|
189
|
-
} // Never generate synthetic shorthands when no value is available.
|
|
191
|
+
} // Never generate synthetic #shorthands when no value is available.
|
|
190
192
|
|
|
191
193
|
// Generate synthetic shorthand we have a value for.
|
|
192
|
-
const shorthandImportance = Boolean(this
|
|
194
|
+
const shorthandImportance = Boolean(this.#shorthandIsImportant.has(shorthand));
|
|
193
195
|
const shorthandProperty = new CSSProperty(
|
|
194
196
|
this, this.allProperties().length, shorthand, shorthandValue, shorthandImportance, false, true, false);
|
|
195
197
|
generatedProperties.push(shorthandProperty);
|
|
196
198
|
propertiesSet.add(shorthand);
|
|
197
199
|
}
|
|
198
200
|
}
|
|
199
|
-
this
|
|
201
|
+
this.#allPropertiesInternal = this.#allPropertiesInternal.concat(generatedProperties);
|
|
200
202
|
}
|
|
201
203
|
|
|
202
204
|
private computeLeadingProperties(): CSSProperty[] {
|
|
@@ -205,15 +207,15 @@ export class CSSStyleDeclaration {
|
|
|
205
207
|
}
|
|
206
208
|
|
|
207
209
|
if (this.range) {
|
|
208
|
-
return this
|
|
210
|
+
return this.#allPropertiesInternal.filter(propertyHasRange);
|
|
209
211
|
}
|
|
210
212
|
|
|
211
213
|
const leadingProperties = [];
|
|
212
|
-
for (const property of this
|
|
214
|
+
for (const property of this.#allPropertiesInternal) {
|
|
213
215
|
const shorthands = cssMetadata().getShorthands(property.name) || [];
|
|
214
216
|
let belongToAnyShorthand = false;
|
|
215
217
|
for (const shorthand of shorthands) {
|
|
216
|
-
if (this
|
|
218
|
+
if (this.#shorthandValues.get(shorthand)) {
|
|
217
219
|
belongToAnyShorthand = true;
|
|
218
220
|
break;
|
|
219
221
|
}
|
|
@@ -227,24 +229,24 @@ export class CSSStyleDeclaration {
|
|
|
227
229
|
}
|
|
228
230
|
|
|
229
231
|
leadingProperties(): CSSProperty[] {
|
|
230
|
-
if (!this
|
|
231
|
-
this
|
|
232
|
+
if (!this.#leadingPropertiesInternal) {
|
|
233
|
+
this.#leadingPropertiesInternal = this.computeLeadingProperties();
|
|
232
234
|
}
|
|
233
|
-
return this
|
|
235
|
+
return this.#leadingPropertiesInternal;
|
|
234
236
|
}
|
|
235
237
|
|
|
236
238
|
target(): Target {
|
|
237
|
-
return this
|
|
239
|
+
return this.#cssModelInternal.target();
|
|
238
240
|
}
|
|
239
241
|
|
|
240
242
|
cssModel(): CSSModel {
|
|
241
|
-
return this
|
|
243
|
+
return this.#cssModelInternal;
|
|
242
244
|
}
|
|
243
245
|
|
|
244
246
|
private computeInactiveProperties(): void {
|
|
245
247
|
const activeProperties = new Map<string, CSSProperty>();
|
|
246
|
-
for (let i = 0; i < this
|
|
247
|
-
const property = this
|
|
248
|
+
for (let i = 0; i < this.#allPropertiesInternal.length; ++i) {
|
|
249
|
+
const property = this.#allPropertiesInternal[i];
|
|
248
250
|
if (property.disabled || !property.parsedOk) {
|
|
249
251
|
property.setActive(false);
|
|
250
252
|
continue;
|
|
@@ -284,16 +286,16 @@ export class CSSStyleDeclaration {
|
|
|
284
286
|
}
|
|
285
287
|
|
|
286
288
|
allProperties(): CSSProperty[] {
|
|
287
|
-
return this
|
|
289
|
+
return this.#allPropertiesInternal;
|
|
288
290
|
}
|
|
289
291
|
|
|
290
292
|
getPropertyValue(name: string): string {
|
|
291
|
-
const property = this
|
|
293
|
+
const property = this.#activePropertyMap.get(name);
|
|
292
294
|
return property ? property.value : '';
|
|
293
295
|
}
|
|
294
296
|
|
|
295
297
|
isPropertyImplicit(name: string): boolean {
|
|
296
|
-
const property = this
|
|
298
|
+
const property = this.#activePropertyMap.get(name);
|
|
297
299
|
return property ? property.implicit : false;
|
|
298
300
|
}
|
|
299
301
|
|
|
@@ -301,7 +303,7 @@ export class CSSStyleDeclaration {
|
|
|
301
303
|
const longhands = cssMetadata().getLonghands(name.toLowerCase());
|
|
302
304
|
const result = [];
|
|
303
305
|
for (let i = 0; longhands && i < longhands.length; ++i) {
|
|
304
|
-
const property = this
|
|
306
|
+
const property = this.#activePropertyMap.get(longhands[i]);
|
|
305
307
|
if (property) {
|
|
306
308
|
result.push(property);
|
|
307
309
|
}
|
|
@@ -343,7 +345,7 @@ export class CSSStyleDeclaration {
|
|
|
343
345
|
if (!this.range || !this.styleSheetId) {
|
|
344
346
|
return Promise.resolve(false);
|
|
345
347
|
}
|
|
346
|
-
return this
|
|
348
|
+
return this.#cssModelInternal.setStyleText(this.styleSheetId, this.range, text, majorChange);
|
|
347
349
|
}
|
|
348
350
|
|
|
349
351
|
insertPropertyAt(index: number, name: string, value: string, userCallback?: ((arg0: boolean) => void)): void {
|
|
@@ -27,7 +27,7 @@ const str_ = i18n.i18n.registerUIStrings('core/sdk/CSSStyleSheetHeader.ts', UISt
|
|
|
27
27
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
28
28
|
|
|
29
29
|
export class CSSStyleSheetHeader implements TextUtils.ContentProvider.ContentProvider, FrameAssociated {
|
|
30
|
-
|
|
30
|
+
#cssModelInternal: CSSModel;
|
|
31
31
|
id: Protocol.CSS.StyleSheetId;
|
|
32
32
|
frameId: Protocol.Page.FrameId;
|
|
33
33
|
sourceURL: string;
|
|
@@ -45,10 +45,10 @@ export class CSSStyleSheetHeader implements TextUtils.ContentProvider.ContentPro
|
|
|
45
45
|
contentLength: number;
|
|
46
46
|
ownerNode: DeferredDOMNode|undefined;
|
|
47
47
|
sourceMapURL: string|undefined;
|
|
48
|
-
|
|
48
|
+
#originalContentProviderInternal: TextUtils.StaticContentProvider.StaticContentProvider|null;
|
|
49
49
|
|
|
50
50
|
constructor(cssModel: CSSModel, payload: Protocol.CSS.CSSStyleSheetHeader) {
|
|
51
|
-
this
|
|
51
|
+
this.#cssModelInternal = cssModel;
|
|
52
52
|
this.id = payload.styleSheetId;
|
|
53
53
|
this.frameId = payload.frameId;
|
|
54
54
|
this.sourceURL = payload.sourceURL;
|
|
@@ -68,22 +68,22 @@ export class CSSStyleSheetHeader implements TextUtils.ContentProvider.ContentPro
|
|
|
68
68
|
this.ownerNode = new DeferredDOMNode(cssModel.target(), payload.ownerNode);
|
|
69
69
|
}
|
|
70
70
|
this.sourceMapURL = payload.sourceMapURL;
|
|
71
|
-
this
|
|
71
|
+
this.#originalContentProviderInternal = null;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
originalContentProvider(): TextUtils.ContentProvider.ContentProvider {
|
|
75
|
-
if (!this
|
|
75
|
+
if (!this.#originalContentProviderInternal) {
|
|
76
76
|
const lazyContent = (async(): Promise<TextUtils.ContentProvider.DeferredContent> => {
|
|
77
|
-
const originalText = await this
|
|
77
|
+
const originalText = await this.#cssModelInternal.originalStyleSheetText(this);
|
|
78
78
|
if (originalText === null) {
|
|
79
79
|
return {content: null, error: i18nString(UIStrings.couldNotFindTheOriginalStyle), isEncoded: false};
|
|
80
80
|
}
|
|
81
81
|
return {content: originalText, isEncoded: false};
|
|
82
82
|
});
|
|
83
|
-
this
|
|
83
|
+
this.#originalContentProviderInternal =
|
|
84
84
|
new TextUtils.StaticContentProvider.StaticContentProvider(this.contentURL(), this.contentType(), lazyContent);
|
|
85
85
|
}
|
|
86
|
-
return this
|
|
86
|
+
return this.#originalContentProviderInternal;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
setSourceMapURL(sourceMapURL?: string): void {
|
|
@@ -91,11 +91,11 @@ export class CSSStyleSheetHeader implements TextUtils.ContentProvider.ContentPro
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
cssModel(): CSSModel {
|
|
94
|
-
return this
|
|
94
|
+
return this.#cssModelInternal;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
isAnonymousInlineStyleSheet(): boolean {
|
|
98
|
-
return !this.resourceURL() && !this
|
|
98
|
+
return !this.resourceURL() && !this.#cssModelInternal.sourceMapManager().sourceMapForClient(this);
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
isConstructedByNew(): boolean {
|
|
@@ -107,7 +107,7 @@ export class CSSStyleSheetHeader implements TextUtils.ContentProvider.ContentPro
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
private viaInspectorResourceURL(): string {
|
|
110
|
-
const model = this
|
|
110
|
+
const model = this.#cssModelInternal.target().model(ResourceTreeModel);
|
|
111
111
|
console.assert(Boolean(model));
|
|
112
112
|
if (!model) {
|
|
113
113
|
return '';
|
|
@@ -159,7 +159,7 @@ export class CSSStyleSheetHeader implements TextUtils.ContentProvider.ContentPro
|
|
|
159
159
|
|
|
160
160
|
async requestContent(): Promise<TextUtils.ContentProvider.DeferredContent> {
|
|
161
161
|
try {
|
|
162
|
-
const cssText = await this
|
|
162
|
+
const cssText = await this.#cssModelInternal.getStyleSheetText(this.id);
|
|
163
163
|
return {content: (cssText as string), isEncoded: false};
|
|
164
164
|
} catch (err) {
|
|
165
165
|
return {
|