chrome-devtools-frontend 1.0.961109 → 1.0.963415
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/.eslintignore +5 -4
- package/AUTHORS +1 -0
- package/config/gni/devtools_grd_files.gni +1 -4
- package/front_end/core/common/ParsedURL.ts +12 -10
- package/front_end/core/host/UserMetrics.ts +2 -1
- package/front_end/core/i18n/locales/en-US.json +6 -24
- package/front_end/core/i18n/locales/en-XL.json +6 -24
- package/front_end/core/protocol_client/InspectorBackend.ts +7 -7
- package/front_end/core/root/Runtime.ts +2 -0
- package/front_end/core/sdk/CSSProperty.ts +22 -110
- package/front_end/core/sdk/DebuggerModel.ts +1 -1
- package/front_end/entrypoints/main/MainImpl.ts +7 -2
- package/front_end/generated/protocol-tsconfig.json +2 -2
- package/front_end/generated/protocol.ts +16772 -0
- package/front_end/models/emulation/EmulatedDevices.ts +3 -3
- package/front_end/models/issues_manager/IssuesManager.ts +0 -5
- package/front_end/models/issues_manager/issues_manager.ts +0 -2
- package/front_end/models/persistence/IsolatedFileSystem.ts +3 -2
- package/front_end/models/persistence/PersistenceActions.ts +2 -2
- package/front_end/models/text_utils/text_utils-legacy.ts +0 -5
- package/front_end/models/text_utils/text_utils.ts +0 -2
- package/front_end/panels/application/AppManifestView.ts +7 -1
- package/front_end/panels/application/components/FrameDetailsView.ts +6 -1
- package/front_end/panels/application/components/PermissionsPolicySection.ts +16 -4
- package/front_end/panels/elements/StylePropertyTreeElement.ts +13 -0
- package/front_end/panels/elements/StylesSidebarPane.ts +67 -0
- package/front_end/panels/elements/stylesSectionTree.css +28 -0
- package/front_end/panels/issues/IssueAggregator.ts +0 -10
- package/front_end/panels/issues/IssueView.ts +0 -2
- package/front_end/panels/media/PlayerListView.ts +2 -0
- package/front_end/panels/media/playerListView.css +3 -0
- package/front_end/panels/sensors/sensors-meta.ts +2 -2
- package/front_end/panels/sources/NavigatorView.ts +1 -1
- package/front_end/third_party/additional_readme_paths.json +1 -0
- package/front_end/ui/components/diff_view/DiffView.ts +2 -2
- package/front_end/ui/components/docs/icon_button/basic.ts +2 -7
- package/front_end/ui/components/icon_button/IconButton.ts +1 -1
- package/front_end/ui/components/text_editor/TextEditor.ts +8 -1
- package/front_end/ui/components/text_editor/config.ts +3 -2
- package/front_end/ui/legacy/GlassPane.ts +2 -0
- package/front_end/ui/legacy/UIUtils.ts +1 -1
- package/front_end/ui/legacy/softDropDownButton.css +2 -0
- package/front_end/ui/legacy/themeColors.css +2 -0
- package/front_end/ui/legacy/toolbar.css +6 -0
- package/package.json +1 -1
- package/scripts/build/assert_third_party_readmes.py +2 -1
- package/scripts/build/ninja/devtools_entrypoint.gni +25 -17
- package/scripts/devtools_paths.py +4 -0
- package/scripts/protocol_typescript/protocol_dts_generator.ts +4 -9
- package/front_end/generated/protocol.d.ts +0 -16771
- package/front_end/models/issues_manager/WasmCrossOriginModuleSharingIssue.ts +0 -67
- package/front_end/models/issues_manager/descriptions/wasmCrossOriginModuleSharing.md +0 -5
- package/front_end/models/text_utils/CodeMirrorUtils.ts +0 -77
- package/front_end/panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts +0 -90
package/.eslintignore
CHANGED
@@ -5,13 +5,14 @@
|
|
5
5
|
// clang-format check also ignores that file
|
6
6
|
front_end/.eslintrc.js
|
7
7
|
front_end/diff/diff_match_patch.js
|
8
|
+
front_end/generated/protocol.ts
|
8
9
|
front_end/javascript_metadata/NativeFunctions.js
|
9
10
|
front_end/third_party/
|
11
|
+
node_modules
|
12
|
+
scripts/migration/**/*.js
|
13
|
+
scripts/protocol_typescript/*.js
|
14
|
+
test/**/fixtures/
|
10
15
|
test/e2e/**/*.js
|
11
16
|
test/shared/**/*.js
|
12
|
-
test/**/fixtures/
|
13
|
-
scripts/protocol_typescript/*.js
|
14
|
-
scripts/migration/**/*.js
|
15
|
-
node_modules
|
16
17
|
|
17
18
|
*.d.ts
|
package/AUTHORS
CHANGED
@@ -39,6 +39,7 @@ Luke Swiderski <luke.swiderski@gmail.com>
|
|
39
39
|
Marijn Haverbeke <marijnh@gmail.com>
|
40
40
|
Michael Brüning <michael.bruning@qt.io>
|
41
41
|
Michael Rienstra <mrienstra@gmail.com>
|
42
|
+
Paul Fisher <paul@pfish.zone>
|
42
43
|
Per-Olov Jernberg <possan@possan.se>
|
43
44
|
PhistucK <phistuck@gmail.com>
|
44
45
|
Pradhuman Singh Baid <pradhumansinghbaid@gmail.com>
|
@@ -308,7 +308,6 @@ grd_files_release_sources = [
|
|
308
308
|
"front_end/models/issues_manager/descriptions/heavyAd.md",
|
309
309
|
"front_end/models/issues_manager/descriptions/mixedContent.md",
|
310
310
|
"front_end/models/issues_manager/descriptions/sharedArrayBuffer.md",
|
311
|
-
"front_end/models/issues_manager/descriptions/wasmCrossOriginModuleSharing.md",
|
312
311
|
"front_end/models/issues_manager/issues_manager.js",
|
313
312
|
"front_end/models/javascript_metadata/javascript_metadata.js",
|
314
313
|
"front_end/models/logs/logs-meta.js",
|
@@ -660,6 +659,7 @@ grd_files_debug_sources = [
|
|
660
659
|
"front_end/generated/ARIAProperties.js",
|
661
660
|
"front_end/generated/InspectorBackendCommands.js",
|
662
661
|
"front_end/generated/SupportedCSSProperties.js",
|
662
|
+
"front_end/generated/protocol.js",
|
663
663
|
"front_end/legacy_test_runner/test_runner/TestRunner.js",
|
664
664
|
"front_end/models/bindings/BreakpointManager.js",
|
665
665
|
"front_end/models/bindings/CSSWorkspaceBinding.js",
|
@@ -718,7 +718,6 @@ grd_files_debug_sources = [
|
|
718
718
|
"front_end/models/issues_manager/SharedArrayBufferIssue.js",
|
719
719
|
"front_end/models/issues_manager/SourceFrameIssuesManager.js",
|
720
720
|
"front_end/models/issues_manager/TrustedWebActivityIssue.js",
|
721
|
-
"front_end/models/issues_manager/WasmCrossOriginModuleSharingIssue.js",
|
722
721
|
"front_end/models/javascript_metadata/JavaScriptMetadata.js",
|
723
722
|
"front_end/models/javascript_metadata/NativeFunctions.js",
|
724
723
|
"front_end/models/logs/LogManager.js",
|
@@ -737,7 +736,6 @@ grd_files_debug_sources = [
|
|
737
736
|
"front_end/models/persistence/WorkspaceSettingsTab.js",
|
738
737
|
"front_end/models/persistence/editFileSystemView.css.js",
|
739
738
|
"front_end/models/persistence/workspaceSettingsTab.css.js",
|
740
|
-
"front_end/models/text_utils/CodeMirrorUtils.js",
|
741
739
|
"front_end/models/text_utils/ContentProvider.js",
|
742
740
|
"front_end/models/text_utils/StaticContentProvider.js",
|
743
741
|
"front_end/models/text_utils/Text.js",
|
@@ -992,7 +990,6 @@ grd_files_debug_sources = [
|
|
992
990
|
"front_end/panels/issues/IssueRevealer.js",
|
993
991
|
"front_end/panels/issues/IssueView.js",
|
994
992
|
"front_end/panels/issues/IssuesPane.js",
|
995
|
-
"front_end/panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.js",
|
996
993
|
"front_end/panels/issues/components/HideIssuesMenu.js",
|
997
994
|
"front_end/panels/issues/components/hideIssuesMenu.css.js",
|
998
995
|
"front_end/panels/issues/cspViolationsListView.css.js",
|
@@ -168,16 +168,17 @@ export class ParsedURL {
|
|
168
168
|
}
|
169
169
|
|
170
170
|
static rawPathToUrlString(fileSystemPath: Platform.DevToolsPath.RawPathString): Platform.DevToolsPath.UrlString {
|
171
|
-
let
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
171
|
+
let preEncodedPath: string = ParsedURL.preEncodeSpecialCharactersInPath(
|
172
|
+
fileSystemPath.replace(/\\/g, '/') as Platform.DevToolsPath.RawPathString);
|
173
|
+
preEncodedPath = preEncodedPath.replace(/\\/g, '/');
|
174
|
+
if (!preEncodedPath.startsWith('file://')) {
|
175
|
+
if (preEncodedPath.startsWith('/')) {
|
176
|
+
preEncodedPath = 'file://' + preEncodedPath;
|
176
177
|
} else {
|
177
|
-
|
178
|
+
preEncodedPath = 'file:///' + preEncodedPath;
|
178
179
|
}
|
179
180
|
}
|
180
|
-
return
|
181
|
+
return new URL(preEncodedPath).toString() as Platform.DevToolsPath.UrlString;
|
181
182
|
}
|
182
183
|
|
183
184
|
static relativePathToUrlString(relativePath: string, baseURL: Platform.DevToolsPath.UrlString):
|
@@ -187,13 +188,14 @@ export class ParsedURL {
|
|
187
188
|
return new URL(preEncodedPath, baseURL).toString() as Platform.DevToolsPath.UrlString;
|
188
189
|
}
|
189
190
|
|
190
|
-
static
|
191
|
+
static urlToRawPathString(fileURL: Platform.DevToolsPath.UrlString, isWindows?: boolean):
|
191
192
|
Platform.DevToolsPath.RawPathString {
|
192
193
|
console.assert(fileURL.startsWith('file://'), 'This must be a file URL.');
|
194
|
+
const decodedFileURL = decodeURIComponent(fileURL);
|
193
195
|
if (isWindows) {
|
194
|
-
return
|
196
|
+
return decodedFileURL.substr('file:///'.length).replace(/\//g, '\\') as Platform.DevToolsPath.RawPathString;
|
195
197
|
}
|
196
|
-
return
|
198
|
+
return decodedFileURL.substr('file://'.length) as Platform.DevToolsPath.RawPathString;
|
197
199
|
}
|
198
200
|
|
199
201
|
static urlWithoutHash(url: string): string {
|
@@ -584,7 +584,8 @@ export enum DevtoolsExperiments {
|
|
584
584
|
'cssTypeComponentLength' = 52,
|
585
585
|
'preciseChanges' = 53,
|
586
586
|
'bfcacheDisplayTree' = 54,
|
587
|
-
'
|
587
|
+
'stylesPaneCSSChanges' = 55,
|
588
|
+
'MaxValue' = 56,
|
588
589
|
}
|
589
590
|
/* eslint-enable @typescript-eslint/naming-convention */
|
590
591
|
|
@@ -1394,9 +1394,6 @@
|
|
1394
1394
|
"models/issues_manager/TrustedWebActivityIssue.ts | changesToQualityCriteriaForPwas": {
|
1395
1395
|
"message": "Changes to quality criteria for PWAs using Trusted Web Activity"
|
1396
1396
|
},
|
1397
|
-
"models/issues_manager/WasmCrossOriginModuleSharingIssue.ts | linkTitle": {
|
1398
|
-
"message": "Restricting Wasm module sharing to same-origin"
|
1399
|
-
},
|
1400
1397
|
"models/logs/logs-meta.ts | clear": {
|
1401
1398
|
"message": "clear"
|
1402
1399
|
},
|
@@ -2897,6 +2894,9 @@
|
|
2897
2894
|
"panels/application/components/FrameDetailsView.ts | parentIsAdExplanation": {
|
2898
2895
|
"message": "This frame is considered an ad frame because its parent frame is an ad frame."
|
2899
2896
|
},
|
2897
|
+
"panels/application/components/FrameDetailsView.ts | refresh": {
|
2898
|
+
"message": "Refresh"
|
2899
|
+
},
|
2900
2900
|
"panels/application/components/FrameDetailsView.ts | reportingTo": {
|
2901
2901
|
"message": "reporting to"
|
2902
2902
|
},
|
@@ -2990,6 +2990,9 @@
|
|
2990
2990
|
"panels/application/components/PermissionsPolicySection.ts | clickToShowIframe": {
|
2991
2991
|
"message": "Click to reveal the top-most iframe which does not allow this feature in the elements panel."
|
2992
2992
|
},
|
2993
|
+
"panels/application/components/PermissionsPolicySection.ts | disabledByFencedFrame": {
|
2994
|
+
"message": "disabled inside a fencedframe"
|
2995
|
+
},
|
2993
2996
|
"panels/application/components/PermissionsPolicySection.ts | disabledByHeader": {
|
2994
2997
|
"message": "disabled by \"Permissions-Policy\" header"
|
2995
2998
|
},
|
@@ -5495,27 +5498,6 @@
|
|
5495
5498
|
"panels/issues/IssueView.ts | warned": {
|
5496
5499
|
"message": "Warned"
|
5497
5500
|
},
|
5498
|
-
"panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts | blocked": {
|
5499
|
-
"message": "blocked"
|
5500
|
-
},
|
5501
|
-
"panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts | nModuleTransfers": {
|
5502
|
-
"message": "{n, plural, =1 {# module} other {# modules}}"
|
5503
|
-
},
|
5504
|
-
"panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts | sourceOrigin": {
|
5505
|
-
"message": "Source Origin"
|
5506
|
-
},
|
5507
|
-
"panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts | status": {
|
5508
|
-
"message": "Status"
|
5509
|
-
},
|
5510
|
-
"panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts | targetOrigin": {
|
5511
|
-
"message": "Target Origin"
|
5512
|
-
},
|
5513
|
-
"panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts | warned": {
|
5514
|
-
"message": "warning"
|
5515
|
-
},
|
5516
|
-
"panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts | wasmModuleUrl": {
|
5517
|
-
"message": "Wasm Module URL"
|
5518
|
-
},
|
5519
5501
|
"panels/js_profiler/js_profiler-meta.ts | profiler": {
|
5520
5502
|
"message": "Profiler"
|
5521
5503
|
},
|
@@ -1394,9 +1394,6 @@
|
|
1394
1394
|
"models/issues_manager/TrustedWebActivityIssue.ts | changesToQualityCriteriaForPwas": {
|
1395
1395
|
"message": "Ĉh́âńĝéŝ t́ô q́ûál̂ít̂ý ĉŕît́êŕîá f̂ór̂ ṔŴÁŝ úŝín̂ǵ T̂ŕûśt̂éd̂ Ẃêb́ Âćt̂ív̂ít̂ý"
|
1396
1396
|
},
|
1397
|
-
"models/issues_manager/WasmCrossOriginModuleSharingIssue.ts | linkTitle": {
|
1398
|
-
"message": "R̂éŝt́r̂íĉt́îńĝ Ẃâśm̂ ḿôd́ûĺê śĥár̂ín̂ǵ t̂ó ŝám̂é-ôŕîǵîń"
|
1399
|
-
},
|
1400
1397
|
"models/logs/logs-meta.ts | clear": {
|
1401
1398
|
"message": "ĉĺêár̂"
|
1402
1399
|
},
|
@@ -2897,6 +2894,9 @@
|
|
2897
2894
|
"panels/application/components/FrameDetailsView.ts | parentIsAdExplanation": {
|
2898
2895
|
"message": "T̂h́îś f̂ŕâḿê íŝ ćôńŝíd̂ér̂éd̂ án̂ ád̂ f́r̂ám̂é b̂éĉáûśê ít̂ś p̂ár̂én̂t́ f̂ŕâḿê íŝ án̂ ád̂ f́r̂ám̂é."
|
2899
2896
|
},
|
2897
|
+
"panels/application/components/FrameDetailsView.ts | refresh": {
|
2898
|
+
"message": "R̂éf̂ŕêśĥ"
|
2899
|
+
},
|
2900
2900
|
"panels/application/components/FrameDetailsView.ts | reportingTo": {
|
2901
2901
|
"message": "r̂ép̂ór̂t́îńĝ t́ô"
|
2902
2902
|
},
|
@@ -2990,6 +2990,9 @@
|
|
2990
2990
|
"panels/application/components/PermissionsPolicySection.ts | clickToShowIframe": {
|
2991
2991
|
"message": "Ĉĺîćk̂ t́ô ŕêv́êál̂ t́ĥé t̂óp̂-ḿôśt̂ íf̂ŕâḿê ẃĥíĉh́ d̂óêś n̂ót̂ ál̂ĺôẃ t̂h́îś f̂éât́ûŕê ín̂ t́ĥé êĺêḿêńt̂ś p̂án̂él̂."
|
2992
2992
|
},
|
2993
|
+
"panels/application/components/PermissionsPolicySection.ts | disabledByFencedFrame": {
|
2994
|
+
"message": "d̂íŝáb̂ĺêd́ îńŝíd̂é â fencedframe"
|
2995
|
+
},
|
2993
2996
|
"panels/application/components/PermissionsPolicySection.ts | disabledByHeader": {
|
2994
2997
|
"message": "d̂íŝáb̂ĺêd́ b̂ý \"Permissions-Policy\" ĥéâd́êŕ"
|
2995
2998
|
},
|
@@ -5495,27 +5498,6 @@
|
|
5495
5498
|
"panels/issues/IssueView.ts | warned": {
|
5496
5499
|
"message": "Ŵár̂ńêd́"
|
5497
5500
|
},
|
5498
|
-
"panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts | blocked": {
|
5499
|
-
"message": "b̂ĺôćk̂éd̂"
|
5500
|
-
},
|
5501
|
-
"panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts | nModuleTransfers": {
|
5502
|
-
"message": "{n, plural, =1 {# m̂ód̂úl̂é} other {# m̂ód̂úl̂éŝ}}"
|
5503
|
-
},
|
5504
|
-
"panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts | sourceOrigin": {
|
5505
|
-
"message": "Ŝóûŕĉé Ôŕîǵîń"
|
5506
|
-
},
|
5507
|
-
"panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts | status": {
|
5508
|
-
"message": "Ŝt́ât́ûś"
|
5509
|
-
},
|
5510
|
-
"panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts | targetOrigin": {
|
5511
|
-
"message": "T̂ár̂ǵêt́ Ôŕîǵîń"
|
5512
|
-
},
|
5513
|
-
"panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts | warned": {
|
5514
|
-
"message": "ŵár̂ńîńĝ"
|
5515
|
-
},
|
5516
|
-
"panels/issues/WasmCrossOriginModuleSharingAffectedResourcesView.ts | wasmModuleUrl": {
|
5517
|
-
"message": "Ŵáŝḿ M̂ód̂úl̂é ÛŔL̂"
|
5518
|
-
},
|
5519
5501
|
"panels/js_profiler/js_profiler-meta.ts | profiler": {
|
5520
5502
|
"message": "P̂ŕôf́îĺêŕ"
|
5521
5503
|
},
|
@@ -30,7 +30,7 @@
|
|
30
30
|
|
31
31
|
import {NodeURL} from './NodeURL.js';
|
32
32
|
import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
|
33
|
-
import * as Protocol from '../../generated/protocol.js';
|
33
|
+
import type * as Protocol from '../../generated/protocol.js';
|
34
34
|
|
35
35
|
export const DevToolsStubErrorCode = -32015;
|
36
36
|
// TODO(dgozman): we are not reporting generic errors in tests, but we should
|
@@ -147,14 +147,14 @@ export class InspectorBackend {
|
|
147
147
|
|
148
148
|
registerEnum(type: QualifiedName, values: Object): void {
|
149
149
|
const [domain, name] = splitQualifiedName(type);
|
150
|
-
// @ts-ignore
|
151
|
-
if (!Protocol[domain]) {
|
152
|
-
// @ts-ignore
|
153
|
-
Protocol[domain] = {};
|
150
|
+
// @ts-ignore globalThis global namespace pollution
|
151
|
+
if (!globalThis.Protocol[domain]) {
|
152
|
+
// @ts-ignore globalThis global namespace pollution
|
153
|
+
globalThis.Protocol[domain] = {};
|
154
154
|
}
|
155
155
|
|
156
|
-
// @ts-ignore
|
157
|
-
Protocol[domain][name] = values;
|
156
|
+
// @ts-ignore globalThis global namespace pollution
|
157
|
+
globalThis.Protocol[domain][name] = values;
|
158
158
|
this.#initialized = true;
|
159
159
|
}
|
160
160
|
|
@@ -272,6 +272,8 @@ export enum ExperimentName {
|
|
272
272
|
WEBAUTHN_PANE = 'webauthnPane',
|
273
273
|
SYNC_SETTINGS = 'syncSettings',
|
274
274
|
FULL_ACCESSIBILITY_TREE = 'fullAccessibilityTree',
|
275
|
+
PRECISE_CHANGES = 'preciseChanges',
|
276
|
+
STYLES_PANE_CSS_CHANGES = 'stylesPaneCSSChanges',
|
275
277
|
}
|
276
278
|
|
277
279
|
// TODO(crbug.com/1167717): Make this a const enum again
|
@@ -3,13 +3,10 @@
|
|
3
3
|
// found in the LICENSE file.
|
4
4
|
|
5
5
|
import * as TextUtils from '../../models/text_utils/text_utils.js';
|
6
|
-
import * as Common from '../common/common.js';
|
6
|
+
import type * as Common from '../common/common.js';
|
7
7
|
import * as HostModule from '../host/host.js';
|
8
|
-
import * as Platform from '../platform/platform.js';
|
9
|
-
import * as Root from '../root/root.js';
|
10
8
|
import type * as Protocol from '../../generated/protocol.js';
|
11
9
|
|
12
|
-
import {cssMetadata, GridAreaRowRegex} from './CSSMetadata.js';
|
13
10
|
import type {Edit} from './CSSModel.js';
|
14
11
|
import type {CSSStyleDeclaration} from './CSSStyleDeclaration.js';
|
15
12
|
|
@@ -163,113 +160,17 @@ export class CSSProperty {
|
|
163
160
|
}
|
164
161
|
|
165
162
|
const range = this.range.relativeTo(this.ownerStyle.range.startLine, this.ownerStyle.range.startColumn);
|
166
|
-
const indentation = this.ownerStyle.cssText ?
|
167
|
-
this.detectIndentation(this.ownerStyle.cssText) :
|
168
|
-
Common.Settings.Settings.instance().moduleSetting('textEditorIndent').get();
|
169
|
-
const endIndentation = this.ownerStyle.cssText ? indentation.substring(0, this.ownerStyle.range.endColumn) : '';
|
170
163
|
const text = new TextUtils.Text.Text(this.ownerStyle.cssText || '');
|
171
|
-
const
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
styleText: string, indentation: string, endIndentation: string,
|
179
|
-
tokenizerFactory: TextUtils.TextUtils.TokenizerFactory): string {
|
180
|
-
const doubleIndent = indentation.substring(endIndentation.length) + indentation;
|
181
|
-
if (indentation) {
|
182
|
-
indentation = '\n' + indentation;
|
183
|
-
}
|
184
|
-
let result = '';
|
185
|
-
let propertyName = '';
|
186
|
-
let propertyText = '';
|
187
|
-
let insideProperty = false;
|
188
|
-
let needsSemi = false;
|
189
|
-
const tokenize = tokenizerFactory.createTokenizer('text/css');
|
190
|
-
|
191
|
-
tokenize('*{' + styleText + '}', processToken);
|
192
|
-
if (insideProperty) {
|
193
|
-
result += propertyText;
|
194
|
-
}
|
195
|
-
result = result.substring(2, result.length - 1).trimRight();
|
196
|
-
return result + (indentation ? '\n' + endIndentation : '');
|
197
|
-
|
198
|
-
function processToken(token: string, tokenType: string|null, _column: number, _newColumn: number): void {
|
199
|
-
if (!insideProperty) {
|
200
|
-
const disabledProperty = tokenType && tokenType.includes('comment') && isDisabledProperty(token);
|
201
|
-
const isPropertyStart = tokenType &&
|
202
|
-
(tokenType.includes('string') || tokenType.includes('meta') || tokenType.includes('property') ||
|
203
|
-
tokenType.includes('variable-2'));
|
204
|
-
if (disabledProperty) {
|
205
|
-
result = result.trimRight() + indentation + token;
|
206
|
-
} else if (isPropertyStart) {
|
207
|
-
insideProperty = true;
|
208
|
-
propertyText = token;
|
209
|
-
} else if (token !== ';' || needsSemi) {
|
210
|
-
result += token;
|
211
|
-
if (token.trim() && !(tokenType && tokenType.includes('comment'))) {
|
212
|
-
needsSemi = token !== ';';
|
213
|
-
}
|
214
|
-
}
|
215
|
-
if (token === '{' && !tokenType) {
|
216
|
-
needsSemi = false;
|
217
|
-
}
|
218
|
-
return;
|
219
|
-
}
|
220
|
-
|
221
|
-
if (token === '}' || token === ';') {
|
222
|
-
// While `propertyText` can generally be trimmed, doing so
|
223
|
-
// breaks valid CSS declarations such as `--foo: ;` which would
|
224
|
-
// then produce invalid CSS of the form `--foo:;`. This
|
225
|
-
// implementation takes special care to restore a single
|
226
|
-
// whitespace token in this edge case. https://crbug.com/1071296
|
227
|
-
const trimmedPropertyText = propertyText.trim();
|
228
|
-
result =
|
229
|
-
result.trimRight() + indentation + trimmedPropertyText + (trimmedPropertyText.endsWith(':') ? ' ' : '');
|
230
|
-
needsSemi = false;
|
231
|
-
insideProperty = false;
|
232
|
-
propertyName = '';
|
233
|
-
if (Root.Runtime.experiments.isEnabled('preciseChanges')) {
|
234
|
-
result += token;
|
235
|
-
return;
|
236
|
-
}
|
237
|
-
// We preserve the legacy behavior to always add semicolon to
|
238
|
-
// declarations regardless of its original text.
|
239
|
-
result += ';';
|
240
|
-
if (token === '}') {
|
241
|
-
result += '}';
|
242
|
-
}
|
243
|
-
} else {
|
244
|
-
if (cssMetadata().isGridAreaDefiningProperty(propertyName)) {
|
245
|
-
const rowResult = GridAreaRowRegex.exec(token);
|
246
|
-
if (rowResult && rowResult.index === 0 && !propertyText.trimRight().endsWith(']')) {
|
247
|
-
propertyText = propertyText.trimRight() + '\n' + doubleIndent;
|
248
|
-
}
|
249
|
-
}
|
250
|
-
if (!propertyName && token === ':') {
|
251
|
-
propertyName = propertyText;
|
252
|
-
}
|
253
|
-
propertyText += token;
|
254
|
-
}
|
164
|
+
const textBeforeInsertion =
|
165
|
+
text.extract(new TextUtils.TextRange.TextRange(0, 0, range.startLine, range.startColumn));
|
166
|
+
// If we are appending after the last property and that property doesn't have a semicolon at the end
|
167
|
+
// (which is only legal in the last position), then add the semicolon in front of the new text to avoid
|
168
|
+
// CSS parsing errors. However, we shouldn't prepend semicolons on the first line or after a comment.
|
169
|
+
if (textBeforeInsertion.trim().length && !/[;{\/]\s*$/.test(textBeforeInsertion)) {
|
170
|
+
propertyText = ';' + propertyText;
|
255
171
|
}
|
256
|
-
|
257
|
-
|
258
|
-
const colon = text.indexOf(':');
|
259
|
-
if (colon === -1) {
|
260
|
-
return false;
|
261
|
-
}
|
262
|
-
const propertyName = text.substring(2, colon).trim();
|
263
|
-
return cssMetadata().isCSSPropertyName(propertyName);
|
264
|
-
}
|
265
|
-
}
|
266
|
-
|
267
|
-
private detectIndentation(text: string): string {
|
268
|
-
const lines = text.split('\n');
|
269
|
-
if (lines.length < 2) {
|
270
|
-
return '';
|
271
|
-
}
|
272
|
-
return TextUtils.TextUtils.Utils.lineIndent(lines[1]);
|
172
|
+
const newStyleText = text.replaceRange(range, propertyText);
|
173
|
+
return this.ownerStyle.setText(newStyleText, majorChange);
|
273
174
|
}
|
274
175
|
|
275
176
|
setValue(newValue: string, majorChange: boolean, overwrite: boolean, userCallback?: ((arg0: boolean) => void)): void {
|
@@ -288,7 +189,18 @@ export class CSSProperty {
|
|
288
189
|
return Promise.resolve(true);
|
289
190
|
}
|
290
191
|
const propertyText = this.text.trim();
|
291
|
-
|
192
|
+
// Ensure that if we try to enable/disable a property that has no semicolon (which is only legal
|
193
|
+
// in the last position of a css rule), we add it. This ensures that if we then later try
|
194
|
+
// to re-enable/-disable the rule, we end up with legal syntax (if the user adds more properties
|
195
|
+
// after the disabled rule).
|
196
|
+
const appendSemicolonIfMissing = (propertyText: string): string =>
|
197
|
+
propertyText + (propertyText.endsWith(';') ? '' : ';');
|
198
|
+
let text: string;
|
199
|
+
if (disabled) {
|
200
|
+
text = '/* ' + appendSemicolonIfMissing(propertyText) + ' */';
|
201
|
+
} else {
|
202
|
+
text = appendSemicolonIfMissing(this.text.substring(2, propertyText.length - 2).trim());
|
203
|
+
}
|
292
204
|
return this.setText(text, true, true);
|
293
205
|
}
|
294
206
|
|
@@ -425,7 +425,7 @@ export class DebuggerModel extends SDKModel<EventTypes> {
|
|
425
425
|
if (this.target().type() === Type.Node && url.startsWith('file://')) {
|
426
426
|
// TODO(crbug.com/1253323): Cast to UrlString will be removed when migration to branded types is complete.
|
427
427
|
const platformPath =
|
428
|
-
Common.ParsedURL.ParsedURL.
|
428
|
+
Common.ParsedURL.ParsedURL.urlToRawPathString(url as Platform.DevToolsPath.UrlString, Host.Platform.isWin());
|
429
429
|
urlRegex =
|
430
430
|
`${Platform.StringUtilities.escapeForRegExp(platformPath)}|${Platform.StringUtilities.escapeForRegExp(url)}`;
|
431
431
|
}
|
@@ -365,13 +365,18 @@ export class MainImpl {
|
|
365
365
|
'https://developer.chrome.com/blog/new-in-devtools-96/#length');
|
366
366
|
|
367
367
|
// Display precise changes in the Changes tab.
|
368
|
-
Root.Runtime.experiments.register(
|
368
|
+
Root.Runtime.experiments.register(
|
369
|
+
Root.Runtime.ExperimentName.PRECISE_CHANGES, 'Display more precise changes in the Changes tab');
|
370
|
+
|
371
|
+
// Integrate CSS changes in the Styles pane.
|
372
|
+
Root.Runtime.experiments.register(
|
373
|
+
Root.Runtime.ExperimentName.STYLES_PANE_CSS_CHANGES, 'Sync CSS changes in the Styles pane');
|
369
374
|
|
370
375
|
Root.Runtime.experiments.enableExperimentsByDefault([
|
371
376
|
'sourceOrderViewer',
|
372
377
|
'hideIssuesFeature',
|
373
378
|
'cssTypeComponentLength',
|
374
|
-
|
379
|
+
Root.Runtime.ExperimentName.PRECISE_CHANGES,
|
375
380
|
'reportingApiDebugging',
|
376
381
|
Root.Runtime.ExperimentName.SYNC_SETTINGS,
|
377
382
|
]);
|