chrome-devtools-frontend 1.0.1548980 → 1.0.1549484
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/docs/contributing/settings-experiments-features.md +35 -0
- package/docs/styleguide/ux/patterns.md +27 -0
- package/eslint.config.mjs +1 -0
- package/front_end/Tests.js +2 -0
- package/front_end/core/host/InspectorFrontendHost.ts +26 -558
- package/front_end/core/host/InspectorFrontendHostAPI.ts +6 -3
- package/front_end/core/host/InspectorFrontendHostStub.ts +558 -0
- package/front_end/core/host/ResourceLoader.ts +9 -23
- package/front_end/core/host/UserMetrics.ts +4 -4
- package/front_end/core/root/DevToolsContext.ts +4 -0
- package/front_end/core/root/Runtime.ts +10 -0
- package/front_end/core/sdk/CSSMatchedStyles.ts +2 -2
- package/front_end/core/sdk/CSSModel.ts +24 -24
- package/front_end/core/sdk/CSSPropertyParserMatchers.ts +11 -11
- package/front_end/core/sdk/CSSQuery.ts +1 -1
- package/front_end/core/sdk/CSSRule.ts +2 -2
- package/front_end/core/sdk/CSSStyleDeclaration.ts +1 -1
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +1 -1
- package/front_end/core/sdk/DOMModel.ts +3 -0
- package/front_end/core/sdk/NetworkManager.ts +29 -31
- package/front_end/core/sdk/NetworkRequest.ts +4 -0
- package/front_end/core/sdk/OverlayModel.ts +2 -2
- package/front_end/core/sdk/PageResourceLoader.ts +63 -37
- package/front_end/core/sdk/SourceMap.ts +6 -0
- package/front_end/core/sdk/SourceMapCache.ts +21 -0
- package/front_end/core/sdk/SourceMapManager.ts +7 -6
- package/front_end/core/sdk/SourceMapScopesInfo.ts +6 -2
- package/front_end/core/sdk/TargetManager.ts +14 -2
- package/front_end/core/sdk/sdk-meta.ts +13 -0
- package/front_end/entrypoints/formatter_worker/FormatterActions.ts +1 -0
- package/front_end/entrypoints/formatter_worker/ScopeParser.ts +1 -1
- package/front_end/entrypoints/main/MainImpl.ts +13 -3
- package/front_end/foundation/Universe.ts +1 -1
- package/front_end/generated/Deprecation.ts +18 -4
- package/front_end/generated/InspectorBackendCommands.ts +33 -31
- package/front_end/generated/SupportedCSSProperties.js +41 -41
- package/front_end/generated/protocol-mapping.d.ts +12 -0
- package/front_end/generated/protocol-proxy-api.d.ts +11 -0
- package/front_end/generated/protocol.ts +70 -35
- package/front_end/models/ai_assistance/AiConversation.ts +5 -4
- package/front_end/models/ai_assistance/ChangeManager.ts +4 -4
- package/front_end/models/ai_assistance/ConversationHandler.ts +0 -15
- package/front_end/models/ai_assistance/agents/AiAgent.ts +9 -6
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +135 -3
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +24 -0
- package/front_end/models/bindings/CompilerScriptMapping.ts +43 -0
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +19 -0
- package/front_end/models/bindings/ResourceMapping.ts +73 -0
- package/front_end/models/bindings/ResourceScriptMapping.ts +50 -0
- package/front_end/models/issues_manager/GenericIssue.ts +17 -0
- package/front_end/models/issues_manager/descriptions/genericNavigationEntryMarkedSkippable.md +7 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +7 -3
- package/front_end/models/source_map_scopes/FunctionCodeResolver.snapshot.txt +98 -0
- package/front_end/models/source_map_scopes/FunctionCodeResolver.ts +270 -0
- package/front_end/models/source_map_scopes/source_map_scopes.ts +2 -0
- package/front_end/models/workspace/UISourceCode.ts +51 -44
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +76 -34
- package/front_end/panels/ai_assistance/aiAssistancePanel.css +1 -0
- package/front_end/panels/ai_assistance/components/ChatView.ts +23 -11
- package/front_end/panels/application/AppManifestView.ts +3 -2
- package/front_end/panels/application/FrameDetailsView.ts +5 -6
- package/front_end/panels/application/ServiceWorkersView.ts +2 -2
- package/front_end/panels/application/TrustTokensTreeElement.ts +2 -6
- package/front_end/panels/application/components/PermissionsPolicySection.ts +201 -157
- package/front_end/panels/application/components/ProtocolHandlersView.ts +117 -80
- package/front_end/panels/application/components/ServiceWorkerRouterView.ts +47 -41
- package/front_end/panels/application/components/StorageMetadataView.ts +31 -34
- package/front_end/panels/application/components/TrustTokensView.ts +76 -68
- package/front_end/panels/console/ConsoleView.ts +3 -2
- package/front_end/panels/console/ConsoleViewMessage.ts +6 -4
- package/front_end/panels/console/console-meta.ts +0 -13
- package/front_end/panels/developer_resources/DeveloperResourcesView.ts +3 -1
- package/front_end/panels/elements/CSSRuleValidator.ts +7 -7
- package/front_end/panels/elements/CSSRuleValidatorHelper.ts +2 -2
- package/front_end/panels/elements/ElementsTreeElement.ts +16 -13
- package/front_end/panels/elements/ElementsTreeOutline.ts +2 -1
- package/front_end/panels/elements/LayoutPane.ts +12 -10
- package/front_end/panels/elements/StylePropertyTreeElement.ts +12 -12
- package/front_end/panels/elements/components/AdornerManager.ts +3 -3
- package/front_end/panels/elements/components/StylePropertyEditor.ts +6 -6
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.ts +27 -49
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +15 -11
- package/front_end/panels/media/PlayerListView.ts +100 -73
- package/front_end/panels/media/playerListView.css +5 -0
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +3 -3
- package/front_end/panels/network/RequestConditionsDrawer.ts +5 -5
- package/front_end/panels/network/components/DirectSocketConnectionView.ts +17 -0
- package/front_end/panels/network/resourceChunkView.css +4 -0
- package/front_end/panels/security/CookieControlsView.ts +1 -1
- package/front_end/panels/sensors/LocationsSettingsTab.ts +1 -1
- package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +1 -1
- package/front_end/panels/settings/KeybindsSettingsTab.ts +1 -1
- package/front_end/panels/settings/SettingsScreen.ts +6 -6
- package/front_end/panels/settings/WorkspaceSettingsTab.ts +1 -1
- package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +1 -1
- package/front_end/panels/snippets/SnippetsQuickOpen.ts +4 -2
- package/front_end/panels/sources/CSSPlugin.ts +1 -1
- package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +13 -5
- package/front_end/panels/sources/GoToLineQuickOpen.ts +4 -2
- package/front_end/panels/sources/NavigatorView.ts +2 -2
- package/front_end/panels/sources/OpenFileQuickOpen.ts +7 -8
- package/front_end/panels/sources/OutlineQuickOpen.ts +6 -3
- package/front_end/panels/sources/ProfilePlugin.ts +21 -12
- package/front_end/panels/sources/UISourceCodeFrame.ts +0 -1
- package/front_end/panels/sources/filteredUISourceCodeListProvider.css +41 -0
- package/front_end/panels/timeline/TimelinePanel.ts +17 -18
- package/front_end/panels/timeline/TimelineSelectorStatsView.ts +3 -3
- package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +2 -2
- package/front_end/panels/timeline/docs/flame_chart_migration.md +11 -16
- package/front_end/panels/utils/utils.ts +17 -3
- package/front_end/panels/whats_new/ReleaseNoteText.ts +10 -20
- package/front_end/panels/whats_new/resources/WNDT.md +8 -8
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/puppeteer/third_party/mitt/README.chromium +1 -0
- package/front_end/third_party/puppeteer/third_party/parsel/README.chromium +1 -0
- package/front_end/third_party/puppeteer/third_party/rxjs/README.chromium +1 -0
- package/front_end/ui/components/adorners/Adorner.ts +1 -1
- package/front_end/ui/components/annotations/AnnotationRepository.ts +98 -0
- package/front_end/ui/components/annotations/AnnotationType.ts +10 -0
- package/front_end/ui/components/annotations/annotations.ts +6 -0
- package/front_end/ui/components/buttons/Button.ts +1 -1
- package/front_end/ui/components/buttons/FloatingButton.ts +1 -1
- package/front_end/ui/components/chrome_link/ChromeLink.ts +1 -1
- package/front_end/ui/components/dialogs/ButtonDialog.ts +1 -1
- package/front_end/ui/components/dialogs/Dialog.ts +1 -1
- package/front_end/ui/components/dialogs/ShortcutDialog.ts +1 -0
- package/front_end/ui/components/diff_view/DiffView.ts +1 -1
- package/front_end/ui/components/expandable_list/ExpandableList.ts +1 -1
- package/front_end/ui/components/highlighting/HighlightElement.ts +1 -0
- package/front_end/ui/components/highlighting/MarkupHighlight.ts +162 -0
- package/front_end/ui/components/highlighting/highlighting.ts +7 -0
- package/front_end/ui/components/icon_button/FileSourceIcon.ts +1 -1
- package/front_end/ui/components/icon_button/Icon.ts +4 -2
- package/front_end/ui/components/icon_button/IconButton.ts +1 -1
- package/front_end/ui/components/issue_counter/IssueCounter.ts +1 -1
- package/front_end/ui/components/issue_counter/IssueLinkIcon.ts +1 -1
- package/front_end/ui/components/legacy_wrapper/LegacyWrapper.ts +1 -1
- package/front_end/ui/components/linkifier/LinkifierImpl.ts +1 -1
- package/front_end/ui/components/list/List.ts +184 -0
- package/front_end/ui/components/list/list.css +90 -0
- package/front_end/ui/components/{cards/cards.ts → list/lists.ts} +3 -3
- package/front_end/ui/components/markdown_view/CodeBlock.ts +1 -1
- package/front_end/ui/components/markdown_view/MarkdownImage.ts +1 -1
- package/front_end/ui/components/markdown_view/MarkdownLink.ts +1 -1
- package/front_end/ui/components/markdown_view/MarkdownView.ts +1 -1
- package/front_end/ui/components/menus/Menu.ts +1 -1
- package/front_end/ui/components/menus/SelectMenu.ts +1 -1
- package/front_end/ui/components/node_text/NodeText.ts +1 -1
- package/front_end/ui/components/panel_feedback/FeedbackButton.ts +1 -1
- package/front_end/ui/components/panel_feedback/PanelFeedback.ts +1 -1
- package/front_end/ui/components/panel_feedback/PreviewToggle.ts +1 -1
- package/front_end/ui/components/panel_introduction_steps/PanelIntroductionSteps.ts +1 -1
- package/front_end/ui/components/report_view/ReportView.ts +1 -1
- package/front_end/ui/components/request_link_icon/RequestLinkIcon.ts +1 -1
- package/front_end/ui/components/settings/SettingCheckbox.ts +1 -1
- package/front_end/ui/components/settings/SettingDeprecationWarning.ts +1 -1
- package/front_end/ui/components/snackbars/Snackbar.ts +1 -1
- package/front_end/ui/components/spinners/Spinner.ts +1 -1
- package/front_end/ui/components/srgb_overlay/SrgbOverlay.ts +1 -1
- package/front_end/ui/components/suggestion_input/SuggestionInput.ts +1 -0
- package/front_end/ui/components/survey_link/SurveyLink.ts +1 -1
- package/front_end/ui/components/switch/SwitchImpl.ts +1 -1
- package/front_end/ui/components/text_editor/TextEditor.ts +1 -0
- package/front_end/ui/components/text_prompt/TextPrompt.ts +1 -1
- package/front_end/ui/components/tooltips/Tooltip.ts +1 -1
- package/front_end/ui/components/tree_outline/TreeOutline.ts +1 -1
- package/front_end/ui/kit/kit.ts +5 -0
- package/front_end/ui/legacy/TabbedPane.ts +98 -0
- package/front_end/ui/legacy/UIUtils.ts +0 -184
- package/front_end/ui/legacy/ViewManager.ts +23 -8
- package/front_end/ui/legacy/ViewRegistration.ts +21 -22
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +5 -4
- package/front_end/ui/legacy/components/perf_ui/LineLevelProfile.ts +73 -35
- package/front_end/ui/legacy/components/perf_ui/LiveHeapProfile.ts +11 -2
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +12 -13
- package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +7 -16
- package/front_end/ui/legacy/components/quick_open/HelpQuickOpen.ts +5 -6
- package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +18 -65
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +2 -1
- package/front_end/ui/legacy/tabbedPane.css +10 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
- package/inspector_overlay/README.md +3 -3
- package/mcp/HostBindings.ts +310 -0
- package/mcp/mcp.ts +17 -0
- package/mcp/tsconfig.json +6 -1
- package/package.json +26 -24
- /package/front_end/ui/{components → kit}/cards/Card.ts +0 -0
- /package/front_end/ui/{components → kit}/cards/card.css +0 -0
|
@@ -40,32 +40,22 @@ export function getReleaseNote(): ReleaseNote {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
let releaseNote: ReleaseNote = {
|
|
43
|
-
version:
|
|
44
|
-
header: 'What\'s new in DevTools
|
|
43
|
+
version: 143,
|
|
44
|
+
header: 'What\'s new in DevTools 143',
|
|
45
45
|
markdownLinks: [
|
|
46
46
|
{
|
|
47
|
-
key: '
|
|
48
|
-
link: 'https://developer.chrome.com/blog/new-in-devtools-
|
|
47
|
+
key: 'mcp-server',
|
|
48
|
+
link: 'https://developer.chrome.com/blog/new-in-devtools-143/#mcp-server',
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
|
-
key: '
|
|
52
|
-
link: 'https://developer.chrome.com/blog/new-in-devtools-
|
|
51
|
+
key: 'trace-sharing',
|
|
52
|
+
link: 'https://developer.chrome.com/blog/new-in-devtools-143/#trace-sharing',
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
|
-
key: '
|
|
56
|
-
link: 'https://developer.chrome.com/blog/new-in-devtools-
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
key: 'ai-main-button',
|
|
60
|
-
link: 'https://developer.chrome.com/blog/new-in-devtools-142/#ai-main-button',
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
videoLinks: [
|
|
64
|
-
{
|
|
65
|
-
description: 'See past highlights from Chrome 141',
|
|
66
|
-
link: 'https://developer.chrome.com/blog/new-in-devtools-141' as Platform.DevToolsPath.UrlString,
|
|
67
|
-
type: VideoType.WHATS_NEW,
|
|
55
|
+
key: 'starting-style',
|
|
56
|
+
link: 'https://developer.chrome.com/blog/new-in-devtools-143/#starting-style',
|
|
68
57
|
},
|
|
69
58
|
],
|
|
70
|
-
|
|
59
|
+
videoLinks: [],
|
|
60
|
+
link: 'https://developer.chrome.com/blog/new-in-devtools-143/',
|
|
71
61
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
### [
|
|
2
|
-
The Performance panel now integrates a more capable AI agent that has full access to the stack trace.
|
|
1
|
+
### [MCP server](mcp-server)
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
Code completion powered by AI is now available in the Sources panel and the Console.
|
|
3
|
+
Let your favourite coding agent debug your pages at runtime, using the Chrome DevTools MCP server.
|
|
6
4
|
|
|
7
|
-
### [
|
|
8
|
-
The Google Developer Program, a ready-made subscription and community platform, is now in DevTools, offering a more personalized experience, a badge system, and easier discovery of new features.
|
|
5
|
+
### [Improved trace sharing](trace-sharing)
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
Optionally include resource content and script source maps in exported performance traces.
|
|
8
|
+
|
|
9
|
+
### [Support for @starting-style](starting-style)
|
|
10
|
+
|
|
11
|
+
Debug and identify CSS entry animations using the new adorner in the Elements panel.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Name: Dependencies sourced from the upstream `chromium` repository
|
|
2
2
|
URL: https://chromium.googlesource.com/chromium/src
|
|
3
3
|
Version: N/A
|
|
4
|
-
Revision:
|
|
4
|
+
Revision: 3e09060fabbdeb607bc7ed4db07e88ef0112f839
|
|
5
5
|
Update Mechanism: Manual (https://crbug.com/428069060)
|
|
6
6
|
License: BSD-3-Clause
|
|
7
7
|
License File: LICENSE
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2020 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
4
|
+
/* eslint-disable @devtools/no-lit-render-outside-of-view, @devtools/enforce-custom-element-definitions-location */
|
|
5
5
|
|
|
6
6
|
import type * as Platform from '../../../core/platform/platform.js';
|
|
7
7
|
import {html, render} from '../../../ui/lit/lit.js';
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// Copyright 2025 The Chromium Authors
|
|
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 Common from '../../../core/common/common.js';
|
|
6
|
+
import * as Root from '../../../core/root/root.js';
|
|
7
|
+
import type * as SDK from '../../../core/sdk/sdk.js';
|
|
8
|
+
|
|
9
|
+
import {AnnotationType} from './AnnotationType.js';
|
|
10
|
+
|
|
11
|
+
interface BaseAnnotationData {
|
|
12
|
+
id: number;
|
|
13
|
+
type: AnnotationType;
|
|
14
|
+
message: string;
|
|
15
|
+
// Sometimes the anchor for an annotation is not known, but is provided using a
|
|
16
|
+
// string id instead (which can be converted to an `anchor` later).
|
|
17
|
+
lookupId: string;
|
|
18
|
+
// Sometimes we want annotations to anchor to a particular string on the page.
|
|
19
|
+
anchorToString?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface ElementsAnnotationData extends BaseAnnotationData {
|
|
23
|
+
type: AnnotationType.ELEMENT_NODE;
|
|
24
|
+
anchor?: SDK.DOMModel.DOMNode;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const enum Events {
|
|
28
|
+
ANNOTATION_ADDED = 'AnnotationAdded',
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface EventTypes {
|
|
32
|
+
[Events.ANNOTATION_ADDED]: BaseAnnotationData;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export class AnnotationRepository {
|
|
36
|
+
static #instance: AnnotationRepository|null = null;
|
|
37
|
+
#events = new Common.ObjectWrapper.ObjectWrapper<EventTypes>();
|
|
38
|
+
#annotations: BaseAnnotationData[] = [];
|
|
39
|
+
#nextId = 0;
|
|
40
|
+
|
|
41
|
+
static instance(): AnnotationRepository {
|
|
42
|
+
if (!AnnotationRepository.#instance) {
|
|
43
|
+
AnnotationRepository.#instance = new AnnotationRepository();
|
|
44
|
+
}
|
|
45
|
+
return AnnotationRepository.#instance;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
static annotationsEnabled(): boolean {
|
|
49
|
+
return Boolean(Root.Runtime.hostConfig.devToolsGreenDevUi?.enabled);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
addEventListener<T extends keyof EventTypes>(
|
|
53
|
+
eventType: T, listener: (arg0: Common.EventTarget.EventTargetEvent<EventTypes[T]>) => void,
|
|
54
|
+
thisObject?: Object): Common.EventTarget.EventDescriptor<EventTypes, T> {
|
|
55
|
+
if (!AnnotationRepository.annotationsEnabled()) {
|
|
56
|
+
console.warn('Received request to add event listener with annotations disabled');
|
|
57
|
+
}
|
|
58
|
+
return this.#events.addEventListener(eventType, listener, thisObject);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
getAnnotationsByType(type: AnnotationType): BaseAnnotationData[] {
|
|
62
|
+
if (!AnnotationRepository.annotationsEnabled()) {
|
|
63
|
+
console.warn('Received query for annotation types with annotations disabled');
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const annotations = this.#annotations.filter(annotation => annotation.type === type);
|
|
68
|
+
return annotations;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
addElementsAnnotation(
|
|
72
|
+
label: string,
|
|
73
|
+
lookupId?: string,
|
|
74
|
+
anchor?: SDK.DOMModel.DOMNode,
|
|
75
|
+
anchorToString?: string,
|
|
76
|
+
): void {
|
|
77
|
+
if (!AnnotationRepository.annotationsEnabled()) {
|
|
78
|
+
console.warn('Received annotation registration with annotations disabled');
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const annotationData: ElementsAnnotationData = {
|
|
83
|
+
id: this.#nextId++,
|
|
84
|
+
type: AnnotationType.ELEMENT_NODE,
|
|
85
|
+
message: label,
|
|
86
|
+
lookupId: lookupId || '',
|
|
87
|
+
anchor,
|
|
88
|
+
anchorToString
|
|
89
|
+
};
|
|
90
|
+
this.#annotations.push(annotationData);
|
|
91
|
+
// eslint-disable-next-line no-console
|
|
92
|
+
console.log('[AnnotationRepository] Added annotation:', label, {
|
|
93
|
+
annotationData,
|
|
94
|
+
annotations: this.#annotations.length,
|
|
95
|
+
});
|
|
96
|
+
this.#events.dispatchEventToListeners(Events.ANNOTATION_ADDED, annotationData);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Copyright 2025 The Chromium Authors
|
|
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 enum AnnotationType {
|
|
6
|
+
ELEMENT_NODE = 0,
|
|
7
|
+
STYLE_RULE = 1,
|
|
8
|
+
NETWORK_REQUEST = 2,
|
|
9
|
+
NETWORK_REQUEST_SUBPANEL_HEADERS = 3,
|
|
10
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2021 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
4
|
+
/* eslint-disable @devtools/no-lit-render-outside-of-view, @devtools/enforce-custom-element-definitions-location */
|
|
5
5
|
|
|
6
6
|
import '../icon_button/icon_button.js';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2024 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
4
|
+
/* eslint-disable @devtools/no-lit-render-outside-of-view, @devtools/enforce-custom-element-definitions-location */
|
|
5
5
|
import '../icon_button/icon_button.js';
|
|
6
6
|
|
|
7
7
|
import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2022 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
4
|
+
/* eslint-disable @devtools/no-lit-render-outside-of-view, @devtools/enforce-custom-element-definitions-location */
|
|
5
5
|
|
|
6
6
|
import * as Common from '../../../core/common/common.js';
|
|
7
7
|
import * as Host from '../../../core/host/host.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2024 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
4
|
+
/* eslint-disable @devtools/no-lit-render-outside-of-view, @devtools/enforce-custom-element-definitions-location */
|
|
5
5
|
|
|
6
6
|
import type * as Buttons from '../../../ui/components/buttons/buttons.js';
|
|
7
7
|
import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2023 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
4
|
+
/* eslint-disable @devtools/no-lit-render-outside-of-view, @devtools/enforce-custom-element-definitions-location */
|
|
5
5
|
|
|
6
6
|
import * as i18n from '../../../core/i18n/i18n.js';
|
|
7
7
|
import * as Platform from '../../../core/platform/platform.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright 2023 The Chromium Authors
|
|
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
|
+
/* eslint-disable @devtools/enforce-custom-element-definitions-location */
|
|
4
5
|
import './ButtonDialog.js';
|
|
5
6
|
|
|
6
7
|
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2019 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
4
|
+
/* eslint-disable @devtools/no-lit-render-outside-of-view, @devtools/enforce-custom-element-definitions-location */
|
|
5
5
|
|
|
6
6
|
import * as i18n from '../../../core/i18n/i18n.js';
|
|
7
7
|
import * as Diff from '../../../third_party/diff/diff.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2021 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
4
|
+
/* eslint-disable @devtools/no-lit-render-outside-of-view, @devtools/enforce-custom-element-definitions-location */
|
|
5
5
|
|
|
6
6
|
import * as Lit from '../../lit/lit.js';
|
|
7
7
|
import * as VisualLogging from '../../visual_logging/visual_logging.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright 2025 The Chromium Authors
|
|
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
|
+
/* eslint-disable @devtools/enforce-custom-element-definitions-location */
|
|
4
5
|
|
|
5
6
|
import * as TextUtils from '../../../models/text_utils/text_utils.js';
|
|
6
7
|
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
// Copyright 2025 The Chromium Authors
|
|
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 TextUtils from '../../../models/text_utils/text_utils.js';
|
|
6
|
+
|
|
7
|
+
export const highlightedSearchResultClassName = 'highlighted-search-result';
|
|
8
|
+
export const highlightedCurrentSearchResultClassName = 'current-search-result';
|
|
9
|
+
|
|
10
|
+
export interface HighlightChange {
|
|
11
|
+
node: Element|Text;
|
|
12
|
+
type: string;
|
|
13
|
+
oldText?: string;
|
|
14
|
+
newText?: string;
|
|
15
|
+
nextSibling?: Node;
|
|
16
|
+
parent?: Node;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function highlightRangesWithStyleClass(
|
|
20
|
+
element: Element, resultRanges: TextUtils.TextRange.SourceRange[], styleClass: string,
|
|
21
|
+
changes?: HighlightChange[]): Element[] {
|
|
22
|
+
changes = changes || [];
|
|
23
|
+
const highlightNodes: Element[] = [];
|
|
24
|
+
const textNodes = element.childTextNodes();
|
|
25
|
+
const lineText = textNodes
|
|
26
|
+
.map(function(node) {
|
|
27
|
+
return node.textContent;
|
|
28
|
+
})
|
|
29
|
+
.join('');
|
|
30
|
+
const ownerDocument = element.ownerDocument;
|
|
31
|
+
|
|
32
|
+
if (textNodes.length === 0) {
|
|
33
|
+
return highlightNodes;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const nodeRanges: TextUtils.TextRange.SourceRange[] = [];
|
|
37
|
+
let rangeEndOffset = 0;
|
|
38
|
+
for (const textNode of textNodes) {
|
|
39
|
+
const range =
|
|
40
|
+
new TextUtils.TextRange.SourceRange(rangeEndOffset, textNode.textContent ? textNode.textContent.length : 0);
|
|
41
|
+
rangeEndOffset = range.offset + range.length;
|
|
42
|
+
nodeRanges.push(range);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
let startIndex = 0;
|
|
46
|
+
for (let i = 0; i < resultRanges.length; ++i) {
|
|
47
|
+
const startOffset = resultRanges[i].offset;
|
|
48
|
+
const endOffset = startOffset + resultRanges[i].length;
|
|
49
|
+
|
|
50
|
+
while (startIndex < textNodes.length &&
|
|
51
|
+
nodeRanges[startIndex].offset + nodeRanges[startIndex].length <= startOffset) {
|
|
52
|
+
startIndex++;
|
|
53
|
+
}
|
|
54
|
+
let endIndex = startIndex;
|
|
55
|
+
while (endIndex < textNodes.length && nodeRanges[endIndex].offset + nodeRanges[endIndex].length < endOffset) {
|
|
56
|
+
endIndex++;
|
|
57
|
+
}
|
|
58
|
+
if (endIndex === textNodes.length) {
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const highlightNode = ownerDocument.createElement('span');
|
|
63
|
+
highlightNode.className = styleClass;
|
|
64
|
+
highlightNode.textContent = lineText.substring(startOffset, endOffset);
|
|
65
|
+
|
|
66
|
+
const lastTextNode = textNodes[endIndex];
|
|
67
|
+
const lastText = lastTextNode.textContent || '';
|
|
68
|
+
lastTextNode.textContent = lastText.substring(endOffset - nodeRanges[endIndex].offset);
|
|
69
|
+
changes.push({
|
|
70
|
+
node: (lastTextNode as Element),
|
|
71
|
+
type: 'changed',
|
|
72
|
+
oldText: lastText,
|
|
73
|
+
newText: lastTextNode.textContent,
|
|
74
|
+
nextSibling: undefined,
|
|
75
|
+
parent: undefined,
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
if (startIndex === endIndex && lastTextNode.parentElement) {
|
|
79
|
+
lastTextNode.parentElement.insertBefore(highlightNode, lastTextNode);
|
|
80
|
+
changes.push({
|
|
81
|
+
node: highlightNode,
|
|
82
|
+
type: 'added',
|
|
83
|
+
nextSibling: lastTextNode,
|
|
84
|
+
parent: lastTextNode.parentElement,
|
|
85
|
+
oldText: undefined,
|
|
86
|
+
newText: undefined,
|
|
87
|
+
});
|
|
88
|
+
highlightNodes.push(highlightNode);
|
|
89
|
+
|
|
90
|
+
const prefixNode =
|
|
91
|
+
ownerDocument.createTextNode(lastText.substring(0, startOffset - nodeRanges[startIndex].offset));
|
|
92
|
+
lastTextNode.parentElement.insertBefore(prefixNode, highlightNode);
|
|
93
|
+
changes.push({
|
|
94
|
+
node: prefixNode,
|
|
95
|
+
type: 'added',
|
|
96
|
+
nextSibling: highlightNode,
|
|
97
|
+
parent: lastTextNode.parentElement,
|
|
98
|
+
oldText: undefined,
|
|
99
|
+
newText: undefined,
|
|
100
|
+
});
|
|
101
|
+
} else {
|
|
102
|
+
const firstTextNode = textNodes[startIndex];
|
|
103
|
+
const firstText = firstTextNode.textContent || '';
|
|
104
|
+
const anchorElement = firstTextNode.nextSibling;
|
|
105
|
+
|
|
106
|
+
if (firstTextNode.parentElement) {
|
|
107
|
+
firstTextNode.parentElement.insertBefore(highlightNode, anchorElement);
|
|
108
|
+
changes.push({
|
|
109
|
+
node: highlightNode,
|
|
110
|
+
type: 'added',
|
|
111
|
+
nextSibling: anchorElement || undefined,
|
|
112
|
+
parent: firstTextNode.parentElement,
|
|
113
|
+
oldText: undefined,
|
|
114
|
+
newText: undefined,
|
|
115
|
+
});
|
|
116
|
+
highlightNodes.push(highlightNode);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
firstTextNode.textContent = firstText.substring(0, startOffset - nodeRanges[startIndex].offset);
|
|
120
|
+
changes.push({
|
|
121
|
+
node: (firstTextNode as Element),
|
|
122
|
+
type: 'changed',
|
|
123
|
+
oldText: firstText,
|
|
124
|
+
newText: firstTextNode.textContent,
|
|
125
|
+
nextSibling: undefined,
|
|
126
|
+
parent: undefined,
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
for (let j = startIndex + 1; j < endIndex; j++) {
|
|
130
|
+
const textNode = textNodes[j];
|
|
131
|
+
const text = textNode.textContent;
|
|
132
|
+
textNode.textContent = '';
|
|
133
|
+
changes.push({
|
|
134
|
+
node: (textNode as Element),
|
|
135
|
+
type: 'changed',
|
|
136
|
+
oldText: text || undefined,
|
|
137
|
+
newText: textNode.textContent,
|
|
138
|
+
nextSibling: undefined,
|
|
139
|
+
parent: undefined,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
startIndex = endIndex;
|
|
144
|
+
nodeRanges[startIndex].offset = endOffset;
|
|
145
|
+
nodeRanges[startIndex].length = lastTextNode.textContent.length;
|
|
146
|
+
}
|
|
147
|
+
return highlightNodes;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export function revertDomChanges(domChanges: HighlightChange[]): void {
|
|
151
|
+
for (let i = domChanges.length - 1; i >= 0; --i) {
|
|
152
|
+
const entry = domChanges[i];
|
|
153
|
+
switch (entry.type) {
|
|
154
|
+
case 'added':
|
|
155
|
+
entry.node.remove();
|
|
156
|
+
break;
|
|
157
|
+
case 'changed':
|
|
158
|
+
entry.node.textContent = entry.oldText ?? null;
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -6,4 +6,11 @@ import './HighlightElement.js';
|
|
|
6
6
|
|
|
7
7
|
import * as HighlightManager from './HighlightManager.js';
|
|
8
8
|
|
|
9
|
+
export {
|
|
10
|
+
type HighlightChange,
|
|
11
|
+
highlightedCurrentSearchResultClassName,
|
|
12
|
+
highlightedSearchResultClassName,
|
|
13
|
+
highlightRangesWithStyleClass,
|
|
14
|
+
revertDomChanges
|
|
15
|
+
} from './MarkupHighlight.js';
|
|
9
16
|
export {HighlightManager};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2024 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
4
|
+
/* eslint-disable @devtools/no-lit-render-outside-of-view, @devtools/enforce-custom-element-definitions-location */
|
|
5
5
|
|
|
6
6
|
import './IconButton.js';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2020 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-imperative-dom-api */
|
|
4
|
+
/* eslint-disable @devtools/no-imperative-dom-api, @devtools/enforce-custom-element-definitions-location */
|
|
5
5
|
|
|
6
6
|
import '../../../Images/Images.js';
|
|
7
7
|
|
|
@@ -74,7 +74,9 @@ export class Icon extends HTMLElement {
|
|
|
74
74
|
|
|
75
75
|
constructor() {
|
|
76
76
|
super();
|
|
77
|
-
this.role
|
|
77
|
+
if (!this.role) {
|
|
78
|
+
this.role = 'presentation';
|
|
79
|
+
}
|
|
78
80
|
const style = document.createElement('style');
|
|
79
81
|
style.textContent = iconStyles;
|
|
80
82
|
this.#icon = document.createElement('span');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2021 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
4
|
+
/* eslint-disable @devtools/no-lit-render-outside-of-view, @devtools/enforce-custom-element-definitions-location */
|
|
5
5
|
|
|
6
6
|
import './Icon.js';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2021 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
4
|
+
/* eslint-disable @devtools/no-lit-render-outside-of-view, @devtools/enforce-custom-element-definitions-location */
|
|
5
5
|
|
|
6
6
|
import '../icon_button/icon_button.js';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2021 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
4
|
+
/* eslint-disable @devtools/no-lit-render-outside-of-view, @devtools/enforce-custom-element-definitions-location */
|
|
5
5
|
|
|
6
6
|
import '../../../ui/components/icon_button/icon_button.js';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2023 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-imperative-dom-api */
|
|
4
|
+
/* eslint-disable @devtools/no-imperative-dom-api, @devtools/enforce-custom-element-definitions-location*/
|
|
5
5
|
|
|
6
6
|
import type * as Platform from '../../../core/platform/platform.js';
|
|
7
7
|
import type * as UI from '../../legacy/legacy.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright 2020 The Chromium Authors
|
|
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
|
-
/* eslint-disable @devtools/no-lit-render-outside-of-view */
|
|
4
|
+
/* eslint-disable @devtools/no-lit-render-outside-of-view, @devtools/enforce-custom-element-definitions-location */
|
|
5
5
|
|
|
6
6
|
import * as Platform from '../../../core/platform/platform.js';
|
|
7
7
|
import * as Lit from '../../lit/lit.js';
|