chrome-devtools-frontend 1.0.925655 → 1.0.927419
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/.stylelintignore +1 -0
- package/AUTHORS +1 -0
- package/config/gni/devtools_grd_files.gni +10 -3
- package/front_end/core/common/Color.ts +6 -0
- package/front_end/core/common/SettingRegistration.ts +8 -0
- package/front_end/core/host/InspectorFrontendHost.ts +3 -0
- package/front_end/core/host/InspectorFrontendHostAPI.ts +3 -0
- package/front_end/core/host/UserMetrics.ts +7 -3
- package/front_end/core/i18n/locales/en-US.json +71 -14
- package/front_end/core/i18n/locales/en-XL.json +71 -14
- package/front_end/core/platform/keyboard-utilities.ts +1 -0
- package/front_end/core/root/Runtime.ts +1 -0
- package/front_end/core/sdk/ConsoleModel.ts +3 -0
- package/front_end/core/sdk/DebuggerModel.ts +2 -0
- package/front_end/core/sdk/NetworkManager.ts +12 -2
- package/front_end/core/sdk/NetworkRequest.ts +20 -5
- package/front_end/core/sdk/OverlayModel.ts +21 -0
- package/front_end/core/sdk/OverlayPersistentHighlighter.ts +55 -3
- package/front_end/devtools_compatibility.js +11 -1
- package/front_end/entrypoints/main/MainImpl.ts +4 -2
- package/front_end/entrypoints/main/main-meta.ts +16 -0
- package/front_end/generated/InspectorBackendCommands.js +8 -7
- package/front_end/generated/SupportedCSSProperties.js +7 -1
- package/front_end/generated/protocol-mapping.d.ts +5 -24
- package/front_end/generated/protocol-proxy-api.d.ts +6 -29
- package/front_end/generated/protocol.d.ts +51 -46
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -6
- package/front_end/models/issues_manager/CorsIssue.ts +4 -0
- package/front_end/models/logs/LogManager.ts +1 -0
- package/front_end/models/persistence/WorkspaceSettingsTab.ts +6 -4
- package/front_end/models/persistence/workspaceSettingsTab.css +18 -18
- package/front_end/models/timeline_model/TimelineFrameModel.ts +107 -28
- package/front_end/panels/application/ReportingApiReportsView.ts +89 -0
- package/front_end/panels/application/ReportingApiTreeElement.ts +3 -3
- package/front_end/panels/application/ReportingApiView.ts +27 -0
- package/front_end/panels/application/application.ts +2 -0
- package/front_end/panels/application/components/EndpointsGrid.ts +55 -0
- package/front_end/panels/application/components/ReportsGrid.ts +144 -0
- package/front_end/panels/application/components/components.ts +4 -2
- package/front_end/panels/application/components/reportingApiGrid.css +35 -0
- package/front_end/panels/application/reportingApiReportsView.css +13 -0
- package/front_end/panels/console/ConsoleView.ts +17 -0
- package/front_end/panels/console/console-meta.ts +26 -0
- package/front_end/panels/elements/ElementsTreeElement.ts +19 -0
- package/front_end/panels/elements/PropertiesWidget.ts +1 -2
- package/front_end/panels/elements/StylePropertyTreeElement.ts +28 -0
- package/front_end/panels/elements/StylePropertyUtils.ts +13 -0
- package/front_end/panels/elements/components/nodeText.css +4 -4
- package/front_end/panels/elements/elements.ts +2 -0
- package/front_end/panels/elements/layoutPane.css +1 -1
- package/front_end/panels/issues/CorsIssueDetailsView.ts +4 -2
- package/front_end/panels/network/RequestCookiesView.ts +13 -4
- package/front_end/panels/screencast/screencastView.css +2 -6
- package/front_end/panels/search/SearchResultsPane.ts +1 -1
- package/front_end/panels/settings/SettingsScreen.ts +3 -0
- package/front_end/panels/snippets/SnippetsQuickOpen.ts +8 -3
- package/front_end/panels/sources/CallStackSidebarPane.ts +1 -10
- package/front_end/panels/sources/GoToLineQuickOpen.ts +50 -10
- package/front_end/panels/sources/UISourceCodeFrame.ts +0 -13
- package/front_end/panels/sources/sources-legacy.ts +0 -11
- package/front_end/panels/sources/sources-meta.ts +22 -20
- package/front_end/panels/sources/sources.ts +0 -2
- package/front_end/third_party/codemirror.next/LICENSE +21 -0
- package/front_end/third_party/codemirror.next/README.chromium +18 -0
- package/front_end/third_party/codemirror.next/bundle-tsconfig.json +21 -0
- package/front_end/third_party/codemirror.next/bundle.ts +87 -0
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -0
- package/front_end/third_party/codemirror.next/chunk/cpp.js +2 -0
- package/front_end/third_party/codemirror.next/chunk/css.js +2 -0
- package/front_end/third_party/codemirror.next/chunk/html.js +4 -0
- package/front_end/third_party/codemirror.next/chunk/java.js +2 -0
- package/front_end/third_party/codemirror.next/chunk/javascript.js +2 -0
- package/front_end/third_party/codemirror.next/chunk/json.js +2 -0
- package/front_end/third_party/codemirror.next/chunk/legacy.js +1 -0
- package/front_end/third_party/codemirror.next/chunk/markdown.js +6 -0
- package/front_end/third_party/codemirror.next/chunk/php.js +6 -0
- package/front_end/third_party/codemirror.next/chunk/python.js +2 -0
- package/front_end/third_party/codemirror.next/chunk/wast.js +2 -0
- package/front_end/third_party/codemirror.next/chunk/xml.js +2 -0
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +5467 -0
- package/front_end/third_party/codemirror.next/codemirror.next.js +2 -0
- package/front_end/third_party/codemirror.next/package.json +39 -0
- package/front_end/third_party/codemirror.next/rebuild.sh +6 -0
- package/front_end/third_party/codemirror.next/rollup.config.js +45 -0
- package/front_end/ui/components/buttons/Button.ts +33 -5
- package/front_end/ui/components/buttons/button.css +32 -2
- 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/button/basic.html +1 -0
- package/front_end/ui/components/docs/button/basic.ts +47 -4
- 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/render_coordinator/RenderCoordinator.ts +17 -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/ui/components/text_editor/text_editor.ts +6 -0
- 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/UIUtils.ts +9 -1
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +8 -3
- package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +39 -39
- package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +10 -4
- package/front_end/ui/legacy/components/quick_open/QuickOpen.ts +31 -14
- package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +7 -8
- package/front_end/ui/legacy/components/source_frame/source_frame-legacy.ts +0 -6
- package/front_end/ui/legacy/components/source_frame/source_frame.ts +0 -2
- package/front_end/ui/legacy/components/utils/JSPresentationUtils.ts +11 -9
- package/front_end/ui/legacy/filter.css +1 -0
- package/front_end/ui/legacy/inspectorSyntaxHighlight.css +3 -8
- package/front_end/ui/legacy/inspectorSyntaxHighlightDark.css +11 -16
- package/front_end/ui/legacy/themeColors.css +60 -0
- package/inspector_overlay/debug/tool_persistent_isolated_element.html +75 -0
- package/inspector_overlay/drag_resize_handler.ts +142 -0
- package/inspector_overlay/highlight_isolated_element.ts +62 -0
- package/inspector_overlay/main.ts +4 -1
- package/inspector_overlay/tool_highlight.ts +6 -0
- package/inspector_overlay/tool_paused.ts +2 -0
- package/inspector_overlay/tool_persistent.ts +110 -0
- package/inspector_overlay/tool_screenshot.ts +8 -1
- package/package.json +1 -1
- package/front_end/panels/application/components/ReportingApiView.ts +0 -24
- package/front_end/panels/sources/GutterDiffPlugin.ts +0 -282
- package/front_end/ui/legacy/components/source_frame/SourceCodeDiff.ts +0 -140
|
@@ -129,6 +129,37 @@
|
|
|
129
129
|
--color-ic-file-stylesheet: rgb(174 82 255);
|
|
130
130
|
--color-ic-file-webbundle: rgb(128 134 139);
|
|
131
131
|
--color-ic-file-default: rgb(128 134 139);
|
|
132
|
+
|
|
133
|
+
/* Code highlighting colors */
|
|
134
|
+
--color-token-variable: inherit;
|
|
135
|
+
--color-token-property: inherit;
|
|
136
|
+
--color-token-type: rgb(0 136 119);
|
|
137
|
+
--color-token-definition: var(--color-token-attribute-value);
|
|
138
|
+
--color-token-variable-special: rgb(0 85 170);
|
|
139
|
+
--color-token-builtin: rgb(50 0 170);
|
|
140
|
+
--color-token-keyword: rgb(171 13 144);
|
|
141
|
+
--color-token-number: rgb(50 0 255);
|
|
142
|
+
--color-token-string: rgb(170 17 17);
|
|
143
|
+
--color-token-string-special: rgb(200 0 0);
|
|
144
|
+
--color-token-atom: rgb(34 17 153);
|
|
145
|
+
--color-token-tag: rgb(136 18 128);
|
|
146
|
+
--color-token-attribute: rgb(153 69 0);
|
|
147
|
+
--color-token-attribute-value: rgb(26 26 168);
|
|
148
|
+
--color-token-comment: rgb(0 117 0);
|
|
149
|
+
--color-token-meta: rgb(85 85 85);
|
|
150
|
+
--color-token-deleted: rgb(221 68 68);
|
|
151
|
+
--color-token-inserted: rgb(34 153 34);
|
|
152
|
+
|
|
153
|
+
/* Colors used by the code editor */
|
|
154
|
+
--color-secondary-cursor: #c0c0c0;
|
|
155
|
+
--color-line-number: hsl(0deg 0% 46%);
|
|
156
|
+
--color-matching-bracket-underline: rgb(0 0 0 / 50%);
|
|
157
|
+
--color-matching-bracket-background: rgb(0 0 0 / 7%);
|
|
158
|
+
--color-nonmatching-bracket-underline: rgb(255 0 0 / 50%);
|
|
159
|
+
--color-nonmatching-bracket-background: rgb(255 0 0 / 7%);
|
|
160
|
+
--color-editor-selection: #cfe8fc;
|
|
161
|
+
--color-editor-selection-blurred: #e0e0e0;
|
|
162
|
+
--color-highlighted-line: rgb(255 255 0 / 50%);
|
|
132
163
|
}
|
|
133
164
|
|
|
134
165
|
.-theme-with-dark-background {
|
|
@@ -215,4 +246,33 @@
|
|
|
215
246
|
--color-ic-file-stylesheet: rgb(161 66 244);
|
|
216
247
|
--color-ic-file-webbundle: rgb(128 134 139);
|
|
217
248
|
--color-ic-file-default: rgb(128 134 139);
|
|
249
|
+
|
|
250
|
+
/* Code highlighting colors */
|
|
251
|
+
--color-token-variable: rgb(217 217 217);
|
|
252
|
+
--color-token-property: rgb(210 192 87);
|
|
253
|
+
--color-token-type: var(--color-token-tag);
|
|
254
|
+
--color-token-definition: var(--color-token-tag);
|
|
255
|
+
--color-token-builtin: rgb(159 180 214);
|
|
256
|
+
--color-token-variable-special: rgb(0 85 170);
|
|
257
|
+
--color-token-keyword: rgb(154 127 213);
|
|
258
|
+
--color-token-number: var(--color-token-number);
|
|
259
|
+
--color-token-string: rgb(242 139 84);
|
|
260
|
+
--color-token-string-special: var(--color-token-string);
|
|
261
|
+
--color-token-atom: rgb(161 247 181);
|
|
262
|
+
--color-token-comment: rgb(137 137 137);
|
|
263
|
+
--color-token-tag: rgb(93 176 215);
|
|
264
|
+
--color-token-attribute: rgb(155 187 220);
|
|
265
|
+
--color-token-attribute-value: rgb(1 200 1);
|
|
266
|
+
--color-token-meta: rgb(221 251 85);
|
|
267
|
+
|
|
268
|
+
/* Colors used by the code editor */
|
|
269
|
+
--color-secondary-cursor: rgb(63 63 63);
|
|
270
|
+
--color-line-number: rgb(138 138 138);
|
|
271
|
+
--color-matching-bracket-underline: rgb(217 217 217);
|
|
272
|
+
--color-matching-bracket-background: initial;
|
|
273
|
+
--color-nonmatching-bracket-underline: rgb(255 26 26);
|
|
274
|
+
--color-nonmatching-bracket-background: initial;
|
|
275
|
+
--color-editor-selection: hsl(207deg 88% 22%);
|
|
276
|
+
--color-editor-selection-blurred: #454545;
|
|
277
|
+
--color-highlighted-line: hsl(133deg 100% 30% / 50%);
|
|
218
278
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Copyright 2021 The Chromium Authors. All rights reserved.
|
|
3
|
+
Use of this source code is governed by a BSD-style license that can be
|
|
4
|
+
found in the LICENSE file.
|
|
5
|
+
-->
|
|
6
|
+
<!DOCTYPE html>
|
|
7
|
+
<html lang="en">
|
|
8
|
+
<head>
|
|
9
|
+
<meta charset="utf-8">
|
|
10
|
+
<title>Debug</title>
|
|
11
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
12
|
+
<script type="module" src="/out/Default/resources/inspector_overlay/main.js"></script>
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<script type="module">
|
|
16
|
+
const viewportWidth = document.documentElement.clientWidth;
|
|
17
|
+
const viewportHeight = document.documentElement.clientHeight;
|
|
18
|
+
dispatch(["setPlatform", "other"]);
|
|
19
|
+
dispatch(["setOverlay", "persistent"]);
|
|
20
|
+
dispatch(["reset", {
|
|
21
|
+
viewportSize: {
|
|
22
|
+
width: viewportWidth,
|
|
23
|
+
height: viewportHeight,
|
|
24
|
+
},
|
|
25
|
+
deviceScaleFactor: 1,
|
|
26
|
+
pageScaleFactor: 1,
|
|
27
|
+
pageZoomFactor: 1,
|
|
28
|
+
emulationScaleFactor: 1,
|
|
29
|
+
scrollX: 0,
|
|
30
|
+
scrollY: 0,
|
|
31
|
+
}]);
|
|
32
|
+
dispatch(["drawIsolatedElementHighlight", {
|
|
33
|
+
"draggableWidthBorder": [
|
|
34
|
+
"M",
|
|
35
|
+
300,
|
|
36
|
+
100,
|
|
37
|
+
"L",
|
|
38
|
+
350,
|
|
39
|
+
100,
|
|
40
|
+
"L",
|
|
41
|
+
350,
|
|
42
|
+
300,
|
|
43
|
+
"L",
|
|
44
|
+
300,
|
|
45
|
+
300,
|
|
46
|
+
"Z"
|
|
47
|
+
],
|
|
48
|
+
"draggableHeightBorder": [
|
|
49
|
+
"M",
|
|
50
|
+
100,
|
|
51
|
+
300,
|
|
52
|
+
"L",
|
|
53
|
+
300,
|
|
54
|
+
300,
|
|
55
|
+
"L",
|
|
56
|
+
300,
|
|
57
|
+
350,
|
|
58
|
+
"L",
|
|
59
|
+
100,
|
|
60
|
+
350,
|
|
61
|
+
"Z"
|
|
62
|
+
],
|
|
63
|
+
"currentWidth": 200,
|
|
64
|
+
"currentHeight": 200,
|
|
65
|
+
"currentX": 100,
|
|
66
|
+
"currentY": 100,
|
|
67
|
+
"highlightIndex": 1,
|
|
68
|
+
}]);
|
|
69
|
+
</script>
|
|
70
|
+
</body>
|
|
71
|
+
</html>
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
// Copyright 2021 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 const enum ResizerType {
|
|
6
|
+
WIDTH = 'width',
|
|
7
|
+
HEIGHT = 'height',
|
|
8
|
+
BIDIRECTION = 'bidirection',
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface Draggable {
|
|
12
|
+
type: ResizerType;
|
|
13
|
+
initialWidth?: number;
|
|
14
|
+
initialHeight?: number;
|
|
15
|
+
update({width, height}: {width?: number, height?: number}): void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface Delegate {
|
|
19
|
+
getDraggable(x: number, y: number): Draggable|undefined;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const cursorByResizerType = new Map([
|
|
23
|
+
[ResizerType.WIDTH, 'ew-resize'],
|
|
24
|
+
[ResizerType.HEIGHT, 'ns-resize'],
|
|
25
|
+
[ResizerType.BIDIRECTION, 'nwse-resize'],
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
type OriginInfo = {
|
|
29
|
+
coord: number,
|
|
30
|
+
value: number,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export class DragResizeHandler {
|
|
34
|
+
private document: Document;
|
|
35
|
+
private delegate: Delegate;
|
|
36
|
+
private originX?: OriginInfo;
|
|
37
|
+
private originY?: OriginInfo;
|
|
38
|
+
private boundMousemove: (event: MouseEvent) => void;
|
|
39
|
+
private boundMousedown: (event: MouseEvent) => void;
|
|
40
|
+
|
|
41
|
+
constructor(document: Document, delegate: Delegate) {
|
|
42
|
+
this.document = document;
|
|
43
|
+
this.delegate = delegate;
|
|
44
|
+
this.boundMousemove = this.onMousemove.bind(this);
|
|
45
|
+
this.boundMousedown = this.onMousedown.bind(this);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
install() {
|
|
49
|
+
this.document.body.addEventListener('mousemove', this.boundMousemove);
|
|
50
|
+
this.document.body.addEventListener('mousedown', this.boundMousedown);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
uninstall() {
|
|
54
|
+
this.document.body.removeEventListener('mousemove', this.boundMousemove);
|
|
55
|
+
this.document.body.removeEventListener('mousedown', this.boundMousedown);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Updates the cursor style of the mouse is hovered over a resizeable area.
|
|
60
|
+
*/
|
|
61
|
+
private onMousemove(event: MouseEvent) {
|
|
62
|
+
const match = this.delegate.getDraggable(event.clientX, event.clientY);
|
|
63
|
+
if (!match) {
|
|
64
|
+
this.document.body.style.cursor = 'default';
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
this.document.body.style.cursor = cursorByResizerType.get(match.type) || 'default';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Starts dragging
|
|
72
|
+
*/
|
|
73
|
+
private onMousedown(event: MouseEvent) {
|
|
74
|
+
const match = this.delegate.getDraggable(event.clientX, event.clientY);
|
|
75
|
+
if (!match) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const boundOnDrag = this.onDrag.bind(this, match);
|
|
80
|
+
|
|
81
|
+
event.stopPropagation();
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
|
|
84
|
+
if (match.initialWidth !== undefined &&
|
|
85
|
+
(match.type === ResizerType.WIDTH || match.type === ResizerType.BIDIRECTION)) {
|
|
86
|
+
this.originX = {
|
|
87
|
+
coord: Math.round(event.clientX),
|
|
88
|
+
value: match.initialWidth,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (match.initialHeight !== undefined &&
|
|
93
|
+
(match.type === ResizerType.HEIGHT || match.type === ResizerType.BIDIRECTION)) {
|
|
94
|
+
this.originY = {
|
|
95
|
+
coord: Math.round(event.clientY),
|
|
96
|
+
value: match.initialHeight,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
this.document.body.removeEventListener('mousemove', this.boundMousemove);
|
|
101
|
+
this.document.body.style.cursor = cursorByResizerType.get(match.type) || 'default';
|
|
102
|
+
|
|
103
|
+
const endDrag = (event: Event) => {
|
|
104
|
+
event.stopPropagation();
|
|
105
|
+
event.preventDefault();
|
|
106
|
+
this.originX = undefined;
|
|
107
|
+
this.originY = undefined;
|
|
108
|
+
|
|
109
|
+
this.document.body.style.cursor = 'default';
|
|
110
|
+
this.document.body.removeEventListener('mousemove', boundOnDrag);
|
|
111
|
+
this.document.body.addEventListener('mousemove', this.boundMousemove);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
this.document.body.addEventListener('mouseup', endDrag, {once: true});
|
|
115
|
+
window.addEventListener('mouseout', endDrag, {once: true});
|
|
116
|
+
|
|
117
|
+
this.document.body.addEventListener('mousemove', boundOnDrag);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Computes the new value while the cursor is being dragged and calls InspectorOverlayHost with the new value.
|
|
122
|
+
*/
|
|
123
|
+
private onDrag(match: Draggable, e: MouseEvent) {
|
|
124
|
+
if (!this.originX && !this.originY) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
let width: number|undefined;
|
|
129
|
+
let height: number|undefined;
|
|
130
|
+
if (this.originX) {
|
|
131
|
+
const delta = this.originX.coord - e.clientX;
|
|
132
|
+
width = Math.round(this.originX.value - delta);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (this.originY) {
|
|
136
|
+
const delta = this.originY.coord - e.clientY;
|
|
137
|
+
height = Math.round(this.originY.value - delta);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
match.update({width, height});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Copyright 2021 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
|
+
import type {PathCommands} from './common.js';
|
|
6
|
+
import {buildPath, emptyBounds, fillPathWithBoxStyle} from './highlight_common.js';
|
|
7
|
+
|
|
8
|
+
export interface IsolatedElementHighlight {
|
|
9
|
+
widthResizerBorder: PathCommands;
|
|
10
|
+
heightResizerBorder: PathCommands;
|
|
11
|
+
bidirectionResizerBorder: PathCommands;
|
|
12
|
+
currentX: number;
|
|
13
|
+
currentY: number;
|
|
14
|
+
currentWidth: number;
|
|
15
|
+
currentHeight: number;
|
|
16
|
+
highlightIndex: number;
|
|
17
|
+
isolationModeHighlightConfig: {
|
|
18
|
+
resizerColor: string,
|
|
19
|
+
resizerHandleColor: string,
|
|
20
|
+
maskColor: string,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function drawIsolatedElementHighlight(
|
|
25
|
+
highlight: IsolatedElementHighlight, context: CanvasRenderingContext2D, canvasWidth: number, canvasHeight: number,
|
|
26
|
+
emulationScaleFactor: number) {
|
|
27
|
+
const {currentX, currentY, currentWidth, currentHeight, highlightIndex} = highlight;
|
|
28
|
+
// Draw a mask covering other area of the canvas.
|
|
29
|
+
context.save();
|
|
30
|
+
context.fillStyle = highlight.isolationModeHighlightConfig.maskColor;
|
|
31
|
+
context.fillRect(0, 0, canvasWidth, canvasHeight);
|
|
32
|
+
context.clearRect(currentX, currentY, currentWidth, currentHeight);
|
|
33
|
+
context.restore();
|
|
34
|
+
|
|
35
|
+
// Draw the width resizer with handle bars.
|
|
36
|
+
const bounds = emptyBounds();
|
|
37
|
+
const widthPath = buildPath(highlight.widthResizerBorder, bounds, emulationScaleFactor);
|
|
38
|
+
fillPathWithBoxStyle(context, widthPath, bounds, 0 /* angle */, {
|
|
39
|
+
fillColor: highlight.isolationModeHighlightConfig.resizerColor,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Draw the height resizer with handle bars.
|
|
43
|
+
const heightPath = buildPath(highlight.heightResizerBorder, bounds, emulationScaleFactor);
|
|
44
|
+
fillPathWithBoxStyle(context, heightPath, bounds, 0 /* angle */, {
|
|
45
|
+
fillColor: highlight.isolationModeHighlightConfig.resizerColor,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Draw the bidirection resizer with handle bars.
|
|
49
|
+
const bidirectionPath = buildPath(highlight.bidirectionResizerBorder, bounds, emulationScaleFactor);
|
|
50
|
+
fillPathWithBoxStyle(context, bidirectionPath, bounds, 0 /* angle */, {
|
|
51
|
+
fillColor: highlight.isolationModeHighlightConfig.resizerColor,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
widthPath,
|
|
56
|
+
heightPath,
|
|
57
|
+
bidirectionPath,
|
|
58
|
+
currentWidth,
|
|
59
|
+
currentHeight,
|
|
60
|
+
highlightIndex,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -14,11 +14,14 @@ import highlightStyle from './tool_highlight.css'; // eslint-disable-line rulesd
|
|
|
14
14
|
import {HighlightOverlay} from './tool_highlight.js';
|
|
15
15
|
// @ts-ignore Importing CSS is handled in Rollup.
|
|
16
16
|
import pausedStyle from './tool_paused.css'; // eslint-disable-line rulesdir/es_modules_import
|
|
17
|
+
import type {PausedToolMessage} from './tool_paused.js';
|
|
17
18
|
import {PausedOverlay} from './tool_paused.js';
|
|
19
|
+
import type {PersistentToolMessage} from './tool_persistent.js';
|
|
18
20
|
import {PersistentOverlay} from './tool_persistent.js';
|
|
19
21
|
// @ts-ignore Importing CSS is handled in Rollup.
|
|
20
22
|
import screenshotStyle from './tool_screenshot.css'; // eslint-disable-line rulesdir/es_modules_import
|
|
21
23
|
import {ScreenshotOverlay} from './tool_screenshot.js';
|
|
24
|
+
import type {ScreenshotToolMessage} from './tool_screenshot.js';
|
|
22
25
|
// @ts-ignore Importing CSS is handled in Rollup.
|
|
23
26
|
import sourceOrderStyle from './tool_source_order.css'; // eslint-disable-line rulesdir/es_modules_import
|
|
24
27
|
import {SourceOrderOverlay} from './tool_source_order.js';
|
|
@@ -28,7 +31,7 @@ declare global {
|
|
|
28
31
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
29
32
|
interface Window {
|
|
30
33
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
31
|
-
InspectorOverlayHost: {send(data: string): void};
|
|
34
|
+
InspectorOverlayHost: {send(data: PausedToolMessage|PersistentToolMessage|ScreenshotToolMessage|string): void};
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
37
|
|
|
@@ -41,6 +41,7 @@ import {drawLayoutGridHighlight} from './highlight_grid_common.js';
|
|
|
41
41
|
import type {ScrollSnapHighlight} from './highlight_scroll_snap.js';
|
|
42
42
|
import type {ContainerQueryHighlight} from './highlight_container_query.js';
|
|
43
43
|
import {drawContainerQueryHighlight} from './highlight_container_query.js';
|
|
44
|
+
import type {IsolatedElementHighlight} from './highlight_isolated_element.js';
|
|
44
45
|
import {PersistentOverlay} from './tool_persistent.js';
|
|
45
46
|
|
|
46
47
|
interface Path {
|
|
@@ -85,6 +86,7 @@ interface Highlight {
|
|
|
85
86
|
flexInfo: FlexContainerHighlight[];
|
|
86
87
|
flexItemInfo: FlexItemHighlight[];
|
|
87
88
|
containerQueryInfo: ContainerQueryHighlight[];
|
|
89
|
+
isolatedElementInfo: IsolatedElementHighlight[];
|
|
88
90
|
}
|
|
89
91
|
|
|
90
92
|
export class HighlightOverlay extends Overlay {
|
|
@@ -245,6 +247,10 @@ export class HighlightOverlay extends Overlay {
|
|
|
245
247
|
this.persistentOverlay?.drawContainerQueryHighlight(highlight);
|
|
246
248
|
}
|
|
247
249
|
|
|
250
|
+
drawIsolatedElementHighlight(highlight: IsolatedElementHighlight) {
|
|
251
|
+
this.persistentOverlay?.drawIsolatedElementHighlight(highlight);
|
|
252
|
+
}
|
|
253
|
+
|
|
248
254
|
private drawAxis(context: CanvasRenderingContext2D, rulerAtRight: boolean, rulerAtBottom: boolean) {
|
|
249
255
|
context.save();
|
|
250
256
|
|
|
@@ -30,19 +30,74 @@
|
|
|
30
30
|
|
|
31
31
|
import type {ResetData} from './common.js';
|
|
32
32
|
import {Overlay} from './common.js';
|
|
33
|
+
import type {Delegate} from './drag_resize_handler.js';
|
|
34
|
+
import {DragResizeHandler, ResizerType} from './drag_resize_handler.js';
|
|
33
35
|
import type {ContainerQueryHighlight} from './highlight_container_query.js';
|
|
34
36
|
import {drawContainerQueryHighlight} from './highlight_container_query.js';
|
|
35
37
|
import type {FlexContainerHighlight} from './highlight_flex_common.js';
|
|
36
38
|
import {drawLayoutFlexContainerHighlight} from './highlight_flex_common.js';
|
|
37
39
|
import type {GridHighlight} from './highlight_grid_common.js';
|
|
38
40
|
import {drawLayoutGridHighlight} from './highlight_grid_common.js';
|
|
41
|
+
import type {IsolatedElementHighlight} from './highlight_isolated_element.js';
|
|
42
|
+
import {drawIsolatedElementHighlight} from './highlight_isolated_element.js';
|
|
39
43
|
import type {ScrollSnapHighlight} from './highlight_scroll_snap.js';
|
|
40
44
|
import {drawScrollSnapHighlight} from './highlight_scroll_snap.js';
|
|
41
45
|
|
|
46
|
+
export type PersistentToolMessage = {
|
|
47
|
+
highlightType: string,
|
|
48
|
+
highlightIndex: number,
|
|
49
|
+
newWidth: string,
|
|
50
|
+
newHeight: string,
|
|
51
|
+
resizerType: ResizerType,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
interface DraggableMetadata {
|
|
55
|
+
type: ResizerType;
|
|
56
|
+
highlightIndex: number;
|
|
57
|
+
initialWidth?: number;
|
|
58
|
+
initialHeight?: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function makeDraggableDelegate(overlay: PersistentOverlay): Delegate {
|
|
62
|
+
return {
|
|
63
|
+
getDraggable: (x, y) => {
|
|
64
|
+
const result = overlay.isPointInDraggablePath(x, y);
|
|
65
|
+
if (!result) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
type: result.type,
|
|
71
|
+
initialWidth: result.initialWidth,
|
|
72
|
+
initialHeight: result.initialHeight,
|
|
73
|
+
id: result.highlightIndex,
|
|
74
|
+
update: ({width, height}: {width?: number, height?: number}) => {
|
|
75
|
+
window.InspectorOverlayHost.send({
|
|
76
|
+
highlightType: 'isolatedElement',
|
|
77
|
+
highlightIndex: result.highlightIndex,
|
|
78
|
+
newWidth: `${width}px`,
|
|
79
|
+
newHeight: `${height}px`,
|
|
80
|
+
resizerType: result.type,
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
42
88
|
export class PersistentOverlay extends Overlay {
|
|
43
89
|
private gridLabelState = {gridLayerCounter: 0};
|
|
44
90
|
|
|
45
91
|
private gridLabels!: HTMLElement;
|
|
92
|
+
private draggableBorders: Map<number, {
|
|
93
|
+
widthPath: Path2D,
|
|
94
|
+
heightPath: Path2D,
|
|
95
|
+
bidirectionPath: Path2D,
|
|
96
|
+
highlightIndex: number,
|
|
97
|
+
initialWidth: number,
|
|
98
|
+
initialHeight: number,
|
|
99
|
+
}> = new Map();
|
|
100
|
+
private dragHandler?: DragResizeHandler;
|
|
46
101
|
|
|
47
102
|
reset(data: ResetData) {
|
|
48
103
|
super.reset(data);
|
|
@@ -70,12 +125,15 @@ export class PersistentOverlay extends Overlay {
|
|
|
70
125
|
this.setCanvas(canvas);
|
|
71
126
|
|
|
72
127
|
super.install();
|
|
128
|
+
this.dragHandler?.install();
|
|
73
129
|
}
|
|
74
130
|
|
|
75
131
|
uninstall() {
|
|
76
132
|
this.document.body.classList.remove('fill');
|
|
77
133
|
this.document.body.innerHTML = '';
|
|
134
|
+
this.draggableBorders = new Map();
|
|
78
135
|
super.uninstall();
|
|
136
|
+
this.dragHandler?.uninstall();
|
|
79
137
|
}
|
|
80
138
|
|
|
81
139
|
drawGridHighlight(highlight: GridHighlight) {
|
|
@@ -105,4 +163,56 @@ export class PersistentOverlay extends Overlay {
|
|
|
105
163
|
drawContainerQueryHighlight(highlight, this.context, this.emulationScaleFactor);
|
|
106
164
|
this.context.restore();
|
|
107
165
|
}
|
|
166
|
+
|
|
167
|
+
drawIsolatedElementHighlight(highlight: IsolatedElementHighlight) {
|
|
168
|
+
if (!this.dragHandler) {
|
|
169
|
+
this.dragHandler = new DragResizeHandler(this.document, makeDraggableDelegate(this));
|
|
170
|
+
this.dragHandler.install();
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
this.context.save();
|
|
174
|
+
const {widthPath, heightPath, bidirectionPath, currentWidth, currentHeight, highlightIndex} =
|
|
175
|
+
drawIsolatedElementHighlight(
|
|
176
|
+
highlight, this.context, this.canvasWidth, this.canvasHeight, this.emulationScaleFactor);
|
|
177
|
+
|
|
178
|
+
this.draggableBorders.set(highlightIndex, {
|
|
179
|
+
widthPath,
|
|
180
|
+
heightPath,
|
|
181
|
+
bidirectionPath,
|
|
182
|
+
highlightIndex,
|
|
183
|
+
initialWidth: currentWidth,
|
|
184
|
+
initialHeight: currentHeight,
|
|
185
|
+
});
|
|
186
|
+
this.context.restore();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
isPointInDraggablePath(x: number, y: number): DraggableMetadata|undefined {
|
|
190
|
+
for (const {widthPath, heightPath, bidirectionPath, highlightIndex, initialWidth, initialHeight} of this
|
|
191
|
+
.draggableBorders.values()) {
|
|
192
|
+
if (this.context.isPointInPath(widthPath, x, y)) {
|
|
193
|
+
return {
|
|
194
|
+
type: ResizerType.WIDTH,
|
|
195
|
+
highlightIndex,
|
|
196
|
+
initialWidth,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
if (this.context.isPointInPath(heightPath, x, y)) {
|
|
200
|
+
return {
|
|
201
|
+
type: ResizerType.HEIGHT,
|
|
202
|
+
highlightIndex,
|
|
203
|
+
initialHeight,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
if (this.context.isPointInPath(bidirectionPath, x, y)) {
|
|
207
|
+
return {
|
|
208
|
+
type: ResizerType.BIDIRECTION,
|
|
209
|
+
highlightIndex,
|
|
210
|
+
initialWidth,
|
|
211
|
+
initialHeight,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
108
218
|
}
|
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
import {Overlay} from './common.js';
|
|
6
6
|
|
|
7
|
+
export type ScreenshotToolMessage = {
|
|
8
|
+
x: number,
|
|
9
|
+
y: number,
|
|
10
|
+
width: number,
|
|
11
|
+
height: number,
|
|
12
|
+
};
|
|
13
|
+
|
|
7
14
|
let anchor: {x: number, y: number}|null = null;
|
|
8
15
|
let position: {x: number, y: number}|null = null;
|
|
9
16
|
|
|
@@ -56,7 +63,7 @@ export class ScreenshotOverlay extends Overlay {
|
|
|
56
63
|
if (anchor && position) {
|
|
57
64
|
const rect = currentRect();
|
|
58
65
|
if (rect.width >= 5 && rect.height >= 5) {
|
|
59
|
-
this.window.InspectorOverlayHost.send(
|
|
66
|
+
this.window.InspectorOverlayHost.send(rect);
|
|
60
67
|
}
|
|
61
68
|
}
|
|
62
69
|
cancel();
|
package/package.json
CHANGED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// Copyright 2021 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
|
-
import * as i18n from '../../../core/i18n/i18n.js';
|
|
6
|
-
import * as UI from '../../../ui/legacy/legacy.js';
|
|
7
|
-
|
|
8
|
-
const UIStrings = {
|
|
9
|
-
/**
|
|
10
|
-
*@description Placeholder text when there are no Reporting API reports.
|
|
11
|
-
*(https://developers.google.com/web/updates/2018/09/reportingapi#sending)
|
|
12
|
-
*/
|
|
13
|
-
noReportsToDisplay: 'No reports to display',
|
|
14
|
-
};
|
|
15
|
-
const str_ = i18n.i18n.registerUIStrings('panels/application/components/ReportingApiView.ts', UIStrings);
|
|
16
|
-
export const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
17
|
-
|
|
18
|
-
export class ReportingApiView extends UI.Widget.VBox {
|
|
19
|
-
constructor() {
|
|
20
|
-
super();
|
|
21
|
-
const emptyView = new UI.EmptyWidget.EmptyWidget(i18nString(UIStrings.noReportsToDisplay));
|
|
22
|
-
emptyView.show(this.contentElement);
|
|
23
|
-
}
|
|
24
|
-
}
|