chrome-devtools-frontend 1.0.1512349 → 1.0.1513662
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/cookbook/release_management.md +15 -13
- package/docs/get_the_code.md +114 -35
- package/front_end/core/common/Color.ts +40 -44
- package/front_end/core/common/Console.ts +4 -4
- package/front_end/core/common/ParsedURL.ts +14 -14
- package/front_end/core/common/ResourceType.ts +20 -20
- package/front_end/core/common/SegmentedRange.ts +13 -14
- package/front_end/core/common/Settings.ts +4 -4
- package/front_end/core/common/StringOutputStream.ts +4 -4
- package/front_end/core/host/GdpClient.ts +38 -0
- package/front_end/core/host/InspectorFrontendHost.ts +4 -1
- package/front_end/core/host/InspectorFrontendHostAPI.ts +2 -0
- package/front_end/core/host/ResourceLoader.ts +2 -2
- package/front_end/core/host/UserMetrics.ts +0 -2
- package/front_end/core/protocol_client/InspectorBackend.ts +9 -9
- package/front_end/core/root/Runtime.ts +5 -2
- package/front_end/core/sdk/AccessibilityModel.ts +48 -48
- package/front_end/core/sdk/AnimationModel.ts +78 -79
- package/front_end/core/sdk/CPUProfilerModel.ts +5 -5
- package/front_end/core/sdk/CPUThrottlingManager.ts +17 -17
- package/front_end/core/sdk/CSSMatchedStyles.ts +44 -44
- package/front_end/core/sdk/CSSMedia.ts +22 -22
- package/front_end/core/sdk/CSSModel.ts +4 -4
- package/front_end/core/sdk/CSSProperty.ts +9 -9
- package/front_end/core/sdk/CSSPropertyParser.ts +1 -2
- package/front_end/core/sdk/CSSRule.ts +3 -3
- package/front_end/core/sdk/CSSStyleDeclaration.ts +27 -28
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +13 -13
- package/front_end/core/sdk/CategorizedBreakpoint.ts +4 -4
- package/front_end/core/sdk/ChildTargetManager.ts +6 -6
- package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +4 -4
- package/front_end/core/sdk/ConsoleModel.ts +24 -24
- package/front_end/core/sdk/Cookie.ts +16 -16
- package/front_end/core/sdk/CookieParser.ts +6 -6
- package/front_end/core/sdk/DOMDebuggerModel.ts +88 -89
- package/front_end/core/sdk/DOMModel.ts +113 -113
- package/front_end/core/sdk/DebuggerModel.ts +102 -103
- package/front_end/core/sdk/EmulationModel.ts +6 -6
- package/front_end/core/sdk/EventBreakpointsModel.ts +5 -5
- package/front_end/core/sdk/HeapProfilerModel.ts +5 -5
- package/front_end/core/sdk/IsolateManager.ts +26 -26
- package/front_end/core/sdk/LayerTreeBase.ts +29 -30
- package/front_end/core/sdk/OverlayModel.ts +6 -6
- package/front_end/core/sdk/Resource.ts +43 -43
- package/front_end/core/sdk/ResourceTreeModel.ts +58 -61
- package/front_end/core/sdk/RuntimeModel.ts +12 -13
- package/front_end/core/sdk/SDKModel.ts +3 -3
- package/front_end/core/sdk/Script.ts +17 -17
- package/front_end/core/sdk/SecurityOriginManager.ts +14 -14
- package/front_end/core/sdk/ServerTiming.ts +2 -2
- package/front_end/core/sdk/ServiceWorkerCacheModel.ts +15 -15
- package/front_end/core/sdk/ServiceWorkerManager.ts +19 -24
- package/front_end/core/sdk/SourceMap.ts +10 -10
- package/front_end/core/sdk/StorageKeyManager.ts +12 -12
- package/front_end/core/sdk/Target.ts +33 -34
- package/front_end/core/sdk/TargetManager.ts +20 -20
- package/front_end/entrypoints/formatter_worker/AcornTokenizer.ts +8 -8
- package/front_end/entrypoints/formatter_worker/HTMLFormatter.ts +7 -7
- package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +7 -7
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +24 -24
- package/front_end/entrypoints/main/GlobalAiButton.ts +3 -3
- package/front_end/entrypoints/main/MainImpl.ts +16 -14
- package/front_end/entrypoints/main/main-meta.ts +1 -2
- package/front_end/generated/InspectorBackendCommands.js +3 -2
- package/front_end/generated/SupportedCSSProperties.js +20 -0
- package/front_end/generated/protocol-mapping.d.ts +4 -0
- package/front_end/generated/protocol-proxy-api.d.ts +5 -0
- package/front_end/generated/protocol.ts +20 -0
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +15 -16
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +127 -0
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +149 -26
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +6 -0
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +9 -10
- package/front_end/models/badges/AiExplorerBadge.ts +21 -0
- package/front_end/models/badges/Badge.ts +3 -5
- package/front_end/models/badges/CodeWhispererBadge.ts +21 -0
- package/front_end/models/badges/DOMDetectiveBadge.ts +4 -3
- package/front_end/models/badges/SpeedsterBadge.ts +6 -4
- package/front_end/models/badges/StarterBadge.ts +4 -3
- package/front_end/models/badges/UserBadges.ts +29 -3
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +6 -6
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +18 -18
- package/front_end/models/bindings/FileUtils.ts +15 -15
- package/front_end/models/bindings/ResourceScriptMapping.ts +14 -14
- package/front_end/models/elements/ElementUpdateRecord.ts +11 -11
- package/front_end/models/emulation/DeviceModeModel.ts +123 -131
- package/front_end/models/emulation/EmulatedDevices.ts +22 -22
- package/front_end/models/extensions/ExtensionPanel.ts +24 -24
- package/front_end/models/extensions/ExtensionServer.ts +4 -4
- package/front_end/models/javascript_metadata/NativeFunctions.js +14 -2
- package/front_end/models/persistence/IsolatedFileSystem.ts +18 -19
- package/front_end/models/persistence/IsolatedFileSystemManager.ts +13 -13
- package/front_end/models/trace/EventsSerializer.ts +5 -5
- package/front_end/models/trace/LanternComputationData.ts +10 -10
- package/front_end/models/trace/ModelImpl.ts +32 -41
- package/front_end/models/trace/Processor.ts +28 -30
- package/front_end/models/trace/extras/FilmStrip.ts +6 -6
- package/front_end/models/trace/extras/StackTraceForEvent.ts +22 -25
- package/front_end/models/trace/extras/ThirdParties.ts +16 -17
- package/front_end/models/trace/extras/TraceFilter.ts +1 -1
- package/front_end/models/trace/handlers/Threads.ts +10 -10
- package/front_end/models/trace/handlers/helpers.ts +9 -9
- package/front_end/models/trace/handlers/types.ts +3 -3
- package/front_end/models/trace/insights/CLSCulprits.ts +12 -14
- package/front_end/models/trace/insights/Cache.ts +8 -4
- package/front_end/models/trace/insights/DOMSize.ts +8 -5
- package/front_end/models/trace/insights/DocumentLatency.ts +2 -2
- package/front_end/models/trace/insights/DuplicatedJavaScript.ts +3 -3
- package/front_end/models/trace/insights/FontDisplay.ts +3 -4
- package/front_end/models/trace/insights/ForcedReflow.ts +3 -3
- package/front_end/models/trace/insights/INPBreakdown.ts +2 -2
- package/front_end/models/trace/insights/ImageDelivery.ts +11 -11
- package/front_end/models/trace/insights/LCPBreakdown.ts +4 -4
- package/front_end/models/trace/insights/LCPDiscovery.ts +4 -4
- package/front_end/models/trace/insights/LegacyJavaScript.ts +2 -2
- package/front_end/models/trace/insights/ModernHTTP.ts +4 -5
- package/front_end/models/trace/insights/NetworkDependencyTree.ts +12 -12
- package/front_end/models/trace/insights/RenderBlocking.ts +9 -10
- package/front_end/models/trace/insights/SlowCSSSelector.ts +2 -2
- package/front_end/models/trace/insights/ThirdParties.ts +4 -5
- package/front_end/models/trace/insights/Viewport.ts +8 -5
- package/front_end/models/trace/insights/types.ts +1 -0
- package/front_end/models/trace/lantern/testing/MetricTestUtils.ts +10 -10
- package/front_end/panels/accessibility/AXBreadcrumbsPane.ts +52 -52
- package/front_end/panels/accessibility/AccessibilitySidebarView.ts +8 -8
- package/front_end/panels/animation/AnimationTimeline.ts +5 -5
- package/front_end/panels/animation/AnimationUI.ts +22 -23
- package/front_end/panels/application/ApplicationPanelSidebar.ts +12 -12
- package/front_end/panels/application/DOMStorageModel.ts +23 -23
- package/front_end/panels/application/ExtensionStorageModel.ts +31 -31
- package/front_end/panels/application/IndexedDBModel.ts +1 -0
- package/front_end/panels/application/PreloadingTreeElement.ts +8 -8
- package/front_end/panels/application/ServiceWorkersView.ts +0 -53
- package/front_end/panels/application/preloading/components/PreloadingDisabledInfobar.ts +2 -2
- package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +2 -2
- package/front_end/panels/common/BadgeNotification.ts +24 -4
- package/front_end/panels/common/GdpSignUpDialog.ts +5 -0
- package/front_end/panels/common/badgeNotification.css +26 -9
- package/front_end/panels/console/ConsoleContextSelector.ts +9 -9
- package/front_end/panels/console/ConsolePrompt.ts +8 -5
- package/front_end/panels/console/ConsoleView.ts +13 -13
- package/front_end/panels/console/ConsoleViewport.ts +29 -29
- package/front_end/panels/coverage/CoverageModel.ts +22 -22
- package/front_end/panels/elements/ClassesPaneWidget.ts +1 -1
- package/front_end/panels/elements/ComputedStyleModel.ts +17 -18
- package/front_end/panels/elements/DOMPath.ts +2 -2
- package/front_end/panels/elements/ElementsPanel.ts +13 -13
- package/front_end/panels/elements/ElementsTreeElement.ts +18 -18
- package/front_end/panels/elements/ElementsTreeOutline.ts +41 -48
- package/front_end/panels/elements/ShortcutTreeElement.ts +4 -4
- package/front_end/panels/elements/StylePropertiesSection.ts +4 -4
- package/front_end/panels/elements/StylePropertyTreeElement.ts +49 -50
- package/front_end/panels/elements/StylesSidebarPane.ts +19 -19
- package/front_end/panels/emulation/DeviceModeToolbar.ts +7 -7
- package/front_end/panels/emulation/DeviceModeView.ts +6 -6
- package/front_end/panels/emulation/MediaQueryInspector.ts +18 -18
- package/front_end/panels/event_listeners/EventListenersView.ts +13 -14
- package/front_end/panels/layer_viewer/LayerTreeOutline.ts +3 -3
- package/front_end/panels/layer_viewer/LayerViewHost.ts +13 -13
- package/front_end/panels/layer_viewer/PaintProfilerView.ts +9 -10
- package/front_end/panels/layer_viewer/TransformController.ts +34 -36
- package/front_end/panels/layers/LayerTreeModel.ts +41 -40
- package/front_end/panels/lighthouse/LighthouseReportSelector.ts +13 -13
- package/front_end/panels/lighthouse/LighthouseStartView.ts +7 -7
- package/front_end/panels/media/PlayerMessagesView.ts +5 -5
- package/front_end/panels/media/TickingFlameChart.ts +24 -24
- package/front_end/panels/media/TickingFlameChartHelpers.ts +32 -32
- package/front_end/panels/network/NetworkItemView.ts +4 -4
- package/front_end/panels/network/NetworkLogViewColumns.ts +29 -29
- package/front_end/panels/network/NetworkPanel.ts +8 -5
- package/front_end/panels/network/ResourceWebSocketFrameView.ts +10 -10
- package/front_end/panels/profiler/HeapDetachedElementsView.ts +3 -3
- package/front_end/panels/profiler/HeapProfileView.ts +1 -1
- package/front_end/panels/profiler/ProfileFlameChartDataProvider.ts +3 -4
- package/front_end/panels/profiler/ProfileHeader.ts +25 -25
- package/front_end/panels/profiler/ProfileLauncherView.ts +5 -6
- package/front_end/panels/recorder/components/ReplaySection.ts +3 -1
- package/front_end/panels/security/OriginTreeElement.ts +8 -8
- package/front_end/panels/security/SecurityPanel.ts +5 -5
- package/front_end/panels/settings/SettingsScreen.ts +18 -12
- package/front_end/panels/settings/components/SyncSection.ts +20 -6
- package/front_end/panels/sources/AiCodeCompletionPlugin.ts +3 -0
- package/front_end/panels/sources/DebuggerPausedMessage.ts +8 -9
- package/front_end/panels/sources/NavigatorView.ts +43 -46
- package/front_end/panels/sources/SourcesPanel.ts +35 -35
- package/front_end/panels/sources/SourcesView.ts +13 -13
- package/front_end/panels/sources/TabbedEditorContainer.ts +19 -22
- package/front_end/panels/sources/UISourceCodeFrame.ts +4 -4
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +34 -36
- package/front_end/panels/timeline/AnimationsTrackAppender.ts +3 -3
- package/front_end/panels/timeline/CompatibilityTracksAppender.ts +8 -8
- package/front_end/panels/timeline/CountersGraph.ts +16 -16
- package/front_end/panels/timeline/EntriesFilter.ts +4 -3
- package/front_end/panels/timeline/EventsTimelineTreeView.ts +3 -3
- package/front_end/panels/timeline/GPUTrackAppender.ts +3 -3
- package/front_end/panels/timeline/Initiators.ts +10 -10
- package/front_end/panels/timeline/InteractionsTrackAppender.ts +5 -5
- package/front_end/panels/timeline/LayoutShiftsTrackAppender.ts +7 -7
- package/front_end/panels/timeline/ModificationsManager.ts +8 -15
- package/front_end/panels/timeline/TargetForEvent.ts +2 -2
- package/front_end/panels/timeline/ThirdPartyTreeView.ts +1 -1
- package/front_end/panels/timeline/ThreadAppender.ts +13 -13
- package/front_end/panels/timeline/TimelineDetailsView.ts +6 -14
- package/front_end/panels/timeline/TimelineEventOverview.ts +27 -26
- package/front_end/panels/timeline/TimelineFilters.ts +5 -5
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +54 -53
- package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +34 -34
- package/front_end/panels/timeline/TimelineFlameChartView.ts +18 -31
- package/front_end/panels/timeline/TimelineHistoryManager.ts +17 -18
- package/front_end/panels/timeline/TimelineMiniMap.ts +6 -6
- package/front_end/panels/timeline/TimelinePaintProfilerView.ts +6 -6
- package/front_end/panels/timeline/TimelinePanel.ts +52 -59
- package/front_end/panels/timeline/TimelineSelectorStatsView.ts +7 -5
- package/front_end/panels/timeline/TimelineTreeView.ts +10 -10
- package/front_end/panels/timeline/TimelineUIUtils.ts +43 -43
- package/front_end/panels/timeline/TimingsTrackAppender.ts +12 -12
- package/front_end/panels/timeline/TracingLayerTree.ts +43 -43
- package/front_end/panels/timeline/TrackConfigBanner.ts +6 -6
- package/front_end/panels/timeline/TrackConfiguration.ts +1 -1
- package/front_end/panels/timeline/components/DetailsView.ts +4 -4
- package/front_end/panels/timeline/components/LayoutShiftDetails.ts +12 -21
- package/front_end/panels/timeline/components/LiveMetricsView.ts +2 -1
- package/front_end/panels/timeline/components/NetworkRequestDetails.ts +5 -5
- package/front_end/panels/timeline/components/Sidebar.ts +4 -14
- package/front_end/panels/timeline/components/SidebarInsightsTab.ts +13 -36
- package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +21 -19
- package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +1 -1
- package/front_end/panels/timeline/components/insights/Cache.ts +4 -0
- package/front_end/panels/timeline/components/insights/DOMSize.ts +5 -1
- package/front_end/panels/timeline/components/insights/Helpers.ts +19 -0
- package/front_end/panels/timeline/components/insights/NetworkDependencyTree.ts +1 -1
- package/front_end/panels/timeline/components/insights/Viewport.ts +4 -0
- package/front_end/panels/timeline/overlays/OverlaysImpl.ts +1 -1
- package/front_end/panels/timeline/utils/AICallTree.ts +11 -11
- package/front_end/panels/timeline/utils/AIContext.ts +17 -19
- package/front_end/panels/timeline/utils/EntityMapper.ts +6 -5
- package/front_end/panels/timeline/utils/EntryName.ts +2 -2
- package/front_end/panels/timeline/utils/EntryNodes.ts +5 -5
- package/front_end/panels/timeline/utils/EntryStyles.ts +4 -4
- package/front_end/panels/timeline/utils/FreshRecording.ts +3 -3
- package/front_end/panels/timeline/utils/Helpers.ts +0 -18
- package/front_end/panels/timeline/utils/InsightAIContext.ts +6 -6
- package/front_end/panels/timeline/utils/SourceMapsResolver.ts +7 -7
- package/front_end/panels/webauthn/WebauthnPane.ts +1 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/codemirror.next/chunk/angular.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/angular.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/cpp.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/cpp.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/java.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/java.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/legacy.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/legacy.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/less.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/less.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/markdown.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/markdown.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/php.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/php.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/python.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/python.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/sass.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/sass.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/svelte.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/svelte.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/vue.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/vue.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/wast.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/wast.js.map +1 -1
- package/front_end/third_party/codemirror.next/chunk/xml.js +1 -1
- package/front_end/third_party/codemirror.next/chunk/xml.js.map +1 -1
- package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +1 -1
- package/front_end/third_party/codemirror.next/rebuild.sh +1 -1
- package/front_end/third_party/json5/rebuild.sh +1 -1
- package/front_end/third_party/legacy-javascript/{update.sh → rebuild.sh} +1 -1
- package/front_end/third_party/lit/lib/decorators.d.ts +26 -9
- package/front_end/third_party/lit/lib/decorators.js +5 -5
- package/front_end/third_party/lit/lib/decorators.js.map +1 -1
- package/front_end/third_party/lit/lib/directive.js.map +1 -1
- package/front_end/third_party/lit/lib/directives.js +8 -13
- package/front_end/third_party/lit/lib/directives.js.map +1 -1
- package/front_end/third_party/lit/lib/lit.d.ts +26 -9
- package/front_end/third_party/lit/lib/lit.js +5 -5
- package/front_end/third_party/lit/lib/lit.js.map +1 -1
- package/front_end/third_party/lit/lib/static-html.js +2 -2
- package/front_end/third_party/lit/lib/static-html.js.map +1 -1
- package/front_end/third_party/lit/rebuild.sh +1 -1
- package/front_end/third_party/third-party-web/rebuild.sh +1 -1
- package/front_end/ui/components/dialogs/Dialog.ts +6 -7
- package/front_end/ui/legacy/ActionRegistration.ts +9 -9
- package/front_end/ui/legacy/DockController.ts +18 -18
- package/front_end/ui/legacy/FilterBar.ts +7 -7
- package/front_end/ui/legacy/Fragment.ts +4 -4
- package/front_end/ui/legacy/GlassPane.ts +12 -12
- package/front_end/ui/legacy/InspectorView.ts +5 -15
- package/front_end/ui/legacy/ListControl.ts +27 -27
- package/front_end/ui/legacy/ListWidget.ts +4 -4
- package/front_end/ui/legacy/PopoverHelper.ts +4 -4
- package/front_end/ui/legacy/ShortcutRegistry.ts +17 -17
- package/front_end/ui/legacy/TabbedPane.ts +74 -75
- package/front_end/ui/legacy/TextPrompt.ts +31 -31
- package/front_end/ui/legacy/Toolbar.ts +13 -14
- package/front_end/ui/legacy/ViewManager.ts +30 -31
- package/front_end/ui/legacy/Widget.ts +6 -6
- package/front_end/ui/legacy/XLink.ts +9 -9
- package/front_end/ui/legacy/ZoomManager.ts +9 -9
- package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +27 -27
- package/front_end/ui/legacy/components/color_picker/ContrastInfo.ts +30 -32
- package/front_end/ui/legacy/components/color_picker/Spectrum.ts +15 -15
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +64 -64
- package/front_end/ui/legacy/components/data_grid/ShowMoreDataGridNode.ts +2 -2
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +10 -11
- package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +12 -12
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +3 -3
- package/front_end/ui/legacy/components/perf_ui/TimelineGrid.ts +14 -14
- package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +8 -8
- package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +5 -5
- package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +4 -4
- package/front_end/ui/legacy/theme_support/ThemeSupport.ts +4 -4
- package/front_end/ui/visual_logging/KnownContextValues.ts +2 -2
- package/package.json +1 -1
@@ -287,14 +287,14 @@ export class CSSRegisteredProperty {
|
|
287
287
|
}
|
288
288
|
|
289
289
|
export class CSSMatchedStyles {
|
290
|
-
#
|
291
|
-
#
|
290
|
+
#cssModel: CSSModel;
|
291
|
+
#node: DOMNode;
|
292
292
|
#addedStyles = new Map<CSSStyleDeclaration, DOMNode>();
|
293
293
|
#matchingSelectors = new Map<number, Map<string, boolean>>();
|
294
|
-
#
|
294
|
+
#keyframes: CSSKeyframesRule[] = [];
|
295
295
|
#registeredProperties: CSSRegisteredProperty[];
|
296
296
|
#registeredPropertyMap = new Map<string, CSSRegisteredProperty>();
|
297
|
-
#
|
297
|
+
#nodeForStyle = new Map<CSSStyleDeclaration, DOMNode|null>();
|
298
298
|
#inheritedStyles = new Set<CSSStyleDeclaration>();
|
299
299
|
#styleToDOMCascade = new Map<CSSStyleDeclaration, DOMInheritanceCascade>();
|
300
300
|
#parentLayoutNodeId: Protocol.DOM.NodeId|undefined;
|
@@ -326,14 +326,14 @@ export class CSSMatchedStyles {
|
|
326
326
|
activePositionFallbackIndex,
|
327
327
|
functionRules,
|
328
328
|
}: CSSMatchedStylesPayload) {
|
329
|
-
this.#
|
330
|
-
this.#
|
329
|
+
this.#cssModel = cssModel;
|
330
|
+
this.#node = node;
|
331
331
|
this.#registeredProperties = [
|
332
332
|
...propertyRules.map(rule => new CSSPropertyRule(cssModel, rule)),
|
333
333
|
...cssPropertyRegistrations,
|
334
334
|
].map(r => new CSSRegisteredProperty(cssModel, r));
|
335
335
|
if (animationsPayload) {
|
336
|
-
this.#
|
336
|
+
this.#keyframes = animationsPayload.map(rule => new CSSKeyframesRule(cssModel, rule));
|
337
337
|
}
|
338
338
|
this.#positionTryRules = positionTryRules.map(rule => new CSSPositionTryRule(cssModel, rule));
|
339
339
|
this.#parentLayoutNodeId = parentLayoutNodeId;
|
@@ -402,45 +402,45 @@ export class CSSMatchedStyles {
|
|
402
402
|
if (!attributesPayload) {
|
403
403
|
return;
|
404
404
|
}
|
405
|
-
const style = new CSSStyleDeclaration(this.#
|
406
|
-
this.#
|
405
|
+
const style = new CSSStyleDeclaration(this.#cssModel, null, attributesPayload, Type.Attributes);
|
406
|
+
this.#nodeForStyle.set(style, this.#node);
|
407
407
|
nodeStyles.push(style);
|
408
408
|
}
|
409
409
|
|
410
410
|
// Transition styles take precedence over animation styles & inline styles.
|
411
411
|
if (transitionsStylePayload) {
|
412
|
-
const style = new CSSStyleDeclaration(this.#
|
413
|
-
this.#
|
412
|
+
const style = new CSSStyleDeclaration(this.#cssModel, null, transitionsStylePayload, Type.Transition);
|
413
|
+
this.#nodeForStyle.set(style, this.#node);
|
414
414
|
nodeStyles.push(style);
|
415
415
|
}
|
416
416
|
|
417
417
|
// Animation styles take precedence over inline styles.
|
418
418
|
for (const animationsStyle of animationStylesPayload) {
|
419
|
-
const style =
|
420
|
-
this.#
|
421
|
-
this.#
|
419
|
+
const style =
|
420
|
+
new CSSStyleDeclaration(this.#cssModel, null, animationsStyle.style, Type.Animation, animationsStyle.name);
|
421
|
+
this.#nodeForStyle.set(style, this.#node);
|
422
422
|
nodeStyles.push(style);
|
423
423
|
}
|
424
424
|
|
425
425
|
// Inline style takes precedence over regular and inherited rules.
|
426
|
-
if (inlinePayload && this.#
|
427
|
-
const style = new CSSStyleDeclaration(this.#
|
428
|
-
this.#
|
426
|
+
if (inlinePayload && this.#node.nodeType() === Node.ELEMENT_NODE) {
|
427
|
+
const style = new CSSStyleDeclaration(this.#cssModel, null, inlinePayload, Type.Inline);
|
428
|
+
this.#nodeForStyle.set(style, this.#node);
|
429
429
|
nodeStyles.push(style);
|
430
430
|
}
|
431
431
|
|
432
432
|
// Add rules in reverse order to match the cascade order.
|
433
433
|
let addedAttributesStyle;
|
434
434
|
for (let i = matchedPayload.length - 1; i >= 0; --i) {
|
435
|
-
const rule = new CSSStyleRule(this.#
|
435
|
+
const rule = new CSSStyleRule(this.#cssModel, matchedPayload[i].rule);
|
436
436
|
if ((rule.isInjected() || rule.isUserAgent()) && !addedAttributesStyle) {
|
437
437
|
// Show element's Style Attributes after all author rules.
|
438
438
|
addedAttributesStyle = true;
|
439
439
|
addAttributesStyle.call(this);
|
440
440
|
}
|
441
|
-
this.#
|
441
|
+
this.#nodeForStyle.set(rule.style, this.#node);
|
442
442
|
nodeStyles.push(rule.style);
|
443
|
-
this.addMatchingSelectors(this.#
|
443
|
+
this.addMatchingSelectors(this.#node, rule, matchedPayload[i].matchingSelectors);
|
444
444
|
}
|
445
445
|
|
446
446
|
if (!addedAttributesStyle) {
|
@@ -449,7 +449,7 @@ export class CSSMatchedStyles {
|
|
449
449
|
nodeCascades.push(new NodeCascade(this, nodeStyles, false /* #isInherited */));
|
450
450
|
|
451
451
|
// Walk the node structure and identify styles with inherited properties.
|
452
|
-
let parentNode: (DOMNode|null) = this.#
|
452
|
+
let parentNode: (DOMNode|null) = this.#node.parentNode;
|
453
453
|
const traverseParentInFlatTree = async(node: DOMNode): Promise<DOMNode|null> => {
|
454
454
|
if (node.hasAssignedSlot()) {
|
455
455
|
return await node.assignedSlot?.deferredNode.resolvePromise() ?? null;
|
@@ -463,19 +463,19 @@ export class CSSMatchedStyles {
|
|
463
463
|
const entryPayload = inheritedPayload[i];
|
464
464
|
const inheritedAnimatedEntryPayload = inheritedAnimatedPayload[i];
|
465
465
|
const inheritedInlineStyle = entryPayload.inlineStyle ?
|
466
|
-
new CSSStyleDeclaration(this.#
|
466
|
+
new CSSStyleDeclaration(this.#cssModel, null, entryPayload.inlineStyle, Type.Inline) :
|
467
467
|
null;
|
468
468
|
const inheritedTransitionsStyle = inheritedAnimatedEntryPayload?.transitionsStyle ?
|
469
469
|
new CSSStyleDeclaration(
|
470
|
-
this.#
|
470
|
+
this.#cssModel, null, inheritedAnimatedEntryPayload?.transitionsStyle, Type.Transition) :
|
471
471
|
null;
|
472
472
|
const inheritedAnimationStyles =
|
473
473
|
inheritedAnimatedEntryPayload?.animationStyles?.map(
|
474
474
|
animationStyle => new CSSStyleDeclaration(
|
475
|
-
this.#
|
475
|
+
this.#cssModel, null, animationStyle.style, Type.Animation, animationStyle.name)) ??
|
476
476
|
[];
|
477
477
|
if (inheritedTransitionsStyle && containsInherited(inheritedTransitionsStyle)) {
|
478
|
-
this.#
|
478
|
+
this.#nodeForStyle.set(inheritedTransitionsStyle, parentNode);
|
479
479
|
inheritedStyles.push(inheritedTransitionsStyle);
|
480
480
|
this.#inheritedStyles.add(inheritedTransitionsStyle);
|
481
481
|
}
|
@@ -485,20 +485,20 @@ export class CSSMatchedStyles {
|
|
485
485
|
continue;
|
486
486
|
}
|
487
487
|
|
488
|
-
this.#
|
488
|
+
this.#nodeForStyle.set(inheritedAnimationsStyle, parentNode);
|
489
489
|
inheritedStyles.push(inheritedAnimationsStyle);
|
490
490
|
this.#inheritedStyles.add(inheritedAnimationsStyle);
|
491
491
|
}
|
492
492
|
|
493
493
|
if (inheritedInlineStyle && containsInherited(inheritedInlineStyle)) {
|
494
|
-
this.#
|
494
|
+
this.#nodeForStyle.set(inheritedInlineStyle, parentNode);
|
495
495
|
inheritedStyles.push(inheritedInlineStyle);
|
496
496
|
this.#inheritedStyles.add(inheritedInlineStyle);
|
497
497
|
}
|
498
498
|
|
499
499
|
const inheritedMatchedCSSRules = entryPayload.matchedCSSRules || [];
|
500
500
|
for (let j = inheritedMatchedCSSRules.length - 1; j >= 0; --j) {
|
501
|
-
const inheritedRule = new CSSStyleRule(this.#
|
501
|
+
const inheritedRule = new CSSStyleRule(this.#cssModel, inheritedMatchedCSSRules[j].rule);
|
502
502
|
this.addMatchingSelectors(parentNode, inheritedRule, inheritedMatchedCSSRules[j].matchingSelectors);
|
503
503
|
if (!containsInherited(inheritedRule.style)) {
|
504
504
|
continue;
|
@@ -509,7 +509,7 @@ export class CSSMatchedStyles {
|
|
509
509
|
continue;
|
510
510
|
}
|
511
511
|
}
|
512
|
-
this.#
|
512
|
+
this.#nodeForStyle.set(inheritedRule.style, parentNode);
|
513
513
|
inheritedStyles.push(inheritedRule.style);
|
514
514
|
this.#inheritedStyles.add(inheritedRule.style);
|
515
515
|
}
|
@@ -538,8 +538,8 @@ export class CSSMatchedStyles {
|
|
538
538
|
const highlightNamesToMatchingSelectorIndices = customHighlightNamesToMatchingSelectorIndices(rules[j]);
|
539
539
|
|
540
540
|
for (const [highlightName, matchingSelectors] of highlightNamesToMatchingSelectorIndices) {
|
541
|
-
const pseudoRule = new CSSStyleRule(this.#
|
542
|
-
this.#
|
541
|
+
const pseudoRule = new CSSStyleRule(this.#cssModel, rules[j].rule);
|
542
|
+
this.#nodeForStyle.set(pseudoRule.style, node);
|
543
543
|
if (isInherited) {
|
544
544
|
this.#inheritedStyles.add(pseudoRule.style);
|
545
545
|
}
|
@@ -580,20 +580,20 @@ export class CSSMatchedStyles {
|
|
580
580
|
for (let i = 0; i < pseudoPayload.length; ++i) {
|
581
581
|
const entryPayload = pseudoPayload[i];
|
582
582
|
// PseudoElement nodes are not created unless "content" css property is set.
|
583
|
-
const pseudoElement = this.#
|
583
|
+
const pseudoElement = this.#node.pseudoElements().get(entryPayload.pseudoType)?.at(-1) || null;
|
584
584
|
const pseudoStyles = [];
|
585
585
|
const rules = entryPayload.matches || [];
|
586
586
|
|
587
587
|
if (entryPayload.pseudoType === Protocol.DOM.PseudoType.Highlight) {
|
588
588
|
this.buildSplitCustomHighlightCascades(
|
589
|
-
rules, this.#
|
589
|
+
rules, this.#node, false /* #isInherited */, customHighlightPseudoCascades);
|
590
590
|
} else {
|
591
591
|
for (let j = rules.length - 1; j >= 0; --j) {
|
592
|
-
const pseudoRule = new CSSStyleRule(this.#
|
592
|
+
const pseudoRule = new CSSStyleRule(this.#cssModel, rules[j].rule);
|
593
593
|
pseudoStyles.push(pseudoRule.style);
|
594
594
|
const nodeForStyle =
|
595
|
-
cssMetadata().isHighlightPseudoType(entryPayload.pseudoType) ? this.#
|
596
|
-
this.#
|
595
|
+
cssMetadata().isHighlightPseudoType(entryPayload.pseudoType) ? this.#node : pseudoElement;
|
596
|
+
this.#nodeForStyle.set(pseudoRule.style, nodeForStyle);
|
597
597
|
if (nodeForStyle) {
|
598
598
|
this.addMatchingSelectors(nodeForStyle, pseudoRule, rules[j].matchingSelectors);
|
599
599
|
}
|
@@ -606,7 +606,7 @@ export class CSSMatchedStyles {
|
|
606
606
|
}
|
607
607
|
|
608
608
|
if (inheritedPseudoPayload) {
|
609
|
-
let parentNode: (DOMNode|null) = this.#
|
609
|
+
let parentNode: (DOMNode|null) = this.#node.parentNode;
|
610
610
|
for (let i = 0; parentNode && i < inheritedPseudoPayload.length; ++i) {
|
611
611
|
const inheritedPseudoMatches = inheritedPseudoPayload[i].pseudoElements;
|
612
612
|
for (let j = 0; j < inheritedPseudoMatches.length; ++j) {
|
@@ -619,9 +619,9 @@ export class CSSMatchedStyles {
|
|
619
619
|
} else {
|
620
620
|
const pseudoStyles = [];
|
621
621
|
for (let k = rules.length - 1; k >= 0; --k) {
|
622
|
-
const pseudoRule = new CSSStyleRule(this.#
|
622
|
+
const pseudoRule = new CSSStyleRule(this.#cssModel, rules[k].rule);
|
623
623
|
pseudoStyles.push(pseudoRule.style);
|
624
|
-
this.#
|
624
|
+
this.#nodeForStyle.set(pseudoRule.style, parentNode);
|
625
625
|
this.#inheritedStyles.add(pseudoRule.style);
|
626
626
|
this.addMatchingSelectors(parentNode, pseudoRule, rules[k].matchingSelectors);
|
627
627
|
}
|
@@ -668,11 +668,11 @@ export class CSSMatchedStyles {
|
|
668
668
|
}
|
669
669
|
|
670
670
|
node(): DOMNode {
|
671
|
-
return this.#
|
671
|
+
return this.#node;
|
672
672
|
}
|
673
673
|
|
674
674
|
cssModel(): CSSModel {
|
675
|
-
return this.#
|
675
|
+
return this.#cssModel;
|
676
676
|
}
|
677
677
|
|
678
678
|
hasMatchingSelectors(rule: CSSStyleRule): boolean {
|
@@ -729,7 +729,7 @@ export class CSSMatchedStyles {
|
|
729
729
|
if (typeof ownerDocument.id !== 'number') {
|
730
730
|
return;
|
731
731
|
}
|
732
|
-
const matchingNodeIds = await this.#
|
732
|
+
const matchingNodeIds = await this.#node.domModel().querySelectorAll(ownerDocument.id, selectorText);
|
733
733
|
|
734
734
|
if (matchingNodeIds) {
|
735
735
|
if (typeof node.id === 'number') {
|
@@ -799,7 +799,7 @@ export class CSSMatchedStyles {
|
|
799
799
|
}
|
800
800
|
|
801
801
|
keyframes(): CSSKeyframesRule[] {
|
802
|
-
return this.#
|
802
|
+
return this.#keyframes;
|
803
803
|
}
|
804
804
|
|
805
805
|
positionTryRules(): CSSPositionTryRule[] {
|
@@ -833,7 +833,7 @@ export class CSSMatchedStyles {
|
|
833
833
|
}
|
834
834
|
|
835
835
|
nodeForStyle(style: CSSStyleDeclaration): DOMNode|null {
|
836
|
-
return this.#addedStyles.get(style) || this.#
|
836
|
+
return this.#addedStyles.get(style) || this.#nodeForStyle.get(style) || null;
|
837
837
|
}
|
838
838
|
|
839
839
|
availableCSSVariables(style: CSSStyleDeclaration): string[] {
|
@@ -9,13 +9,13 @@ import type {CSSModel} from './CSSModel.js';
|
|
9
9
|
import {CSSQuery} from './CSSQuery.js';
|
10
10
|
|
11
11
|
export class CSSMediaQuery {
|
12
|
-
readonly #
|
13
|
-
readonly #
|
12
|
+
readonly #active: boolean;
|
13
|
+
readonly #expressions: CSSMediaQueryExpression[]|null;
|
14
14
|
constructor(payload: Protocol.CSS.MediaQuery) {
|
15
|
-
this.#
|
16
|
-
this.#
|
15
|
+
this.#active = payload.active;
|
16
|
+
this.#expressions = [];
|
17
17
|
for (let j = 0; j < payload.expressions.length; ++j) {
|
18
|
-
this.#
|
18
|
+
this.#expressions.push(CSSMediaQueryExpression.parsePayload(payload.expressions[j]));
|
19
19
|
}
|
20
20
|
}
|
21
21
|
|
@@ -24,26 +24,26 @@ export class CSSMediaQuery {
|
|
24
24
|
}
|
25
25
|
|
26
26
|
active(): boolean {
|
27
|
-
return this.#
|
27
|
+
return this.#active;
|
28
28
|
}
|
29
29
|
|
30
30
|
expressions(): CSSMediaQueryExpression[]|null {
|
31
|
-
return this.#
|
31
|
+
return this.#expressions;
|
32
32
|
}
|
33
33
|
}
|
34
34
|
|
35
35
|
export class CSSMediaQueryExpression {
|
36
|
-
readonly #
|
37
|
-
readonly #
|
38
|
-
readonly #
|
39
|
-
readonly #
|
40
|
-
readonly #
|
36
|
+
readonly #value: number;
|
37
|
+
readonly #unit: string;
|
38
|
+
readonly #feature: string;
|
39
|
+
readonly #valueRange: TextUtils.TextRange.TextRange|null;
|
40
|
+
readonly #computedLength: number|null;
|
41
41
|
constructor(payload: Protocol.CSS.MediaQueryExpression) {
|
42
|
-
this.#
|
43
|
-
this.#
|
44
|
-
this.#
|
45
|
-
this.#
|
46
|
-
this.#
|
42
|
+
this.#value = payload.value;
|
43
|
+
this.#unit = payload.unit;
|
44
|
+
this.#feature = payload.feature;
|
45
|
+
this.#valueRange = payload.valueRange ? TextUtils.TextRange.TextRange.fromObject(payload.valueRange) : null;
|
46
|
+
this.#computedLength = payload.computedLength || null;
|
47
47
|
}
|
48
48
|
|
49
49
|
static parsePayload(payload: Protocol.CSS.MediaQueryExpression): CSSMediaQueryExpression {
|
@@ -51,23 +51,23 @@ export class CSSMediaQueryExpression {
|
|
51
51
|
}
|
52
52
|
|
53
53
|
value(): number {
|
54
|
-
return this.#
|
54
|
+
return this.#value;
|
55
55
|
}
|
56
56
|
|
57
57
|
unit(): string {
|
58
|
-
return this.#
|
58
|
+
return this.#unit;
|
59
59
|
}
|
60
60
|
|
61
61
|
feature(): string {
|
62
|
-
return this.#
|
62
|
+
return this.#feature;
|
63
63
|
}
|
64
64
|
|
65
65
|
valueRange(): TextUtils.TextRange.TextRange|null {
|
66
|
-
return this.#
|
66
|
+
return this.#valueRange;
|
67
67
|
}
|
68
68
|
|
69
69
|
computedLength(): number|null {
|
70
|
-
return this.#
|
70
|
+
return this.#computedLength;
|
71
71
|
}
|
72
72
|
}
|
73
73
|
|
@@ -1020,13 +1020,13 @@ export class Edit {
|
|
1020
1020
|
}
|
1021
1021
|
|
1022
1022
|
export class CSSLocation {
|
1023
|
-
readonly #
|
1023
|
+
readonly #cssModel: CSSModel;
|
1024
1024
|
styleSheetId: Protocol.CSS.StyleSheetId;
|
1025
1025
|
url: Platform.DevToolsPath.UrlString;
|
1026
1026
|
lineNumber: number;
|
1027
1027
|
columnNumber: number;
|
1028
1028
|
constructor(header: CSSStyleSheetHeader, lineNumber: number, columnNumber?: number) {
|
1029
|
-
this.#
|
1029
|
+
this.#cssModel = header.cssModel();
|
1030
1030
|
this.styleSheetId = header.id;
|
1031
1031
|
this.url = header.resourceURL();
|
1032
1032
|
this.lineNumber = lineNumber;
|
@@ -1034,11 +1034,11 @@ export class CSSLocation {
|
|
1034
1034
|
}
|
1035
1035
|
|
1036
1036
|
cssModel(): CSSModel {
|
1037
|
-
return this.#
|
1037
|
+
return this.#cssModel;
|
1038
1038
|
}
|
1039
1039
|
|
1040
1040
|
header(): CSSStyleSheetHeader|null {
|
1041
|
-
return this.#
|
1041
|
+
return this.#cssModel.styleSheetHeaderForId(this.styleSheetId);
|
1042
1042
|
}
|
1043
1043
|
}
|
1044
1044
|
|
@@ -42,8 +42,8 @@ export class CSSProperty extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
42
42
|
text: string|null|undefined;
|
43
43
|
range: TextUtils.TextRange.TextRange|null;
|
44
44
|
#active: boolean;
|
45
|
-
#
|
46
|
-
#
|
45
|
+
#nameRange: TextUtils.TextRange.TextRange|null;
|
46
|
+
#valueRange: TextUtils.TextRange.TextRange|null;
|
47
47
|
#invalidString?: Common.UIString.LocalizedString;
|
48
48
|
#longhandProperties: CSSProperty[] = [];
|
49
49
|
|
@@ -63,8 +63,8 @@ export class CSSProperty extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
63
63
|
this.text = text;
|
64
64
|
this.range = range ? TextUtils.TextRange.TextRange.fromObject(range) : null;
|
65
65
|
this.#active = true;
|
66
|
-
this.#
|
67
|
-
this.#
|
66
|
+
this.#nameRange = null;
|
67
|
+
this.#valueRange = null;
|
68
68
|
|
69
69
|
if (longhandProperties && longhandProperties.length > 0) {
|
70
70
|
for (const property of longhandProperties) {
|
@@ -125,7 +125,7 @@ export class CSSProperty extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
125
125
|
}
|
126
126
|
|
127
127
|
private ensureRanges(): void {
|
128
|
-
if (this.#
|
128
|
+
if (this.#nameRange && this.#valueRange) {
|
129
129
|
return;
|
130
130
|
}
|
131
131
|
const range = this.range;
|
@@ -143,8 +143,8 @@ export class CSSProperty extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
143
143
|
const nameSourceRange = new TextUtils.TextRange.SourceRange(nameIndex, this.name.length);
|
144
144
|
const valueSourceRange = new TextUtils.TextRange.SourceRange(valueIndex, this.value.length);
|
145
145
|
|
146
|
-
this.#
|
147
|
-
this.#
|
146
|
+
this.#nameRange = rebase(text.toTextRange(nameSourceRange), range.startLine, range.startColumn);
|
147
|
+
this.#valueRange = rebase(text.toTextRange(valueSourceRange), range.startLine, range.startColumn);
|
148
148
|
|
149
149
|
function rebase(oneLineRange: TextUtils.TextRange.TextRange, lineOffset: number, columnOffset: number):
|
150
150
|
TextUtils.TextRange.TextRange {
|
@@ -160,12 +160,12 @@ export class CSSProperty extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
|
|
160
160
|
|
161
161
|
nameRange(): TextUtils.TextRange.TextRange|null {
|
162
162
|
this.ensureRanges();
|
163
|
-
return this.#
|
163
|
+
return this.#nameRange;
|
164
164
|
}
|
165
165
|
|
166
166
|
valueRange(): TextUtils.TextRange.TextRange|null {
|
167
167
|
this.ensureRanges();
|
168
|
-
return this.#
|
168
|
+
return this.#valueRange;
|
169
169
|
}
|
170
170
|
|
171
171
|
rebase(edit: Edit): void {
|
@@ -74,8 +74,6 @@ export function stripComments(value: string): string {
|
|
74
74
|
return value.replaceAll(/(\/\*(?:.|\s)*?\*\/)/g, '');
|
75
75
|
}
|
76
76
|
|
77
|
-
const cssParser = CodeMirror.css.cssLanguage.parser;
|
78
|
-
|
79
77
|
function nodeText(node: CodeMirror.SyntaxNode, text: string): string {
|
80
78
|
return nodeTextRange(node, node, text);
|
81
79
|
}
|
@@ -577,6 +575,7 @@ export namespace ASTUtils {
|
|
577
575
|
}
|
578
576
|
|
579
577
|
function declaration(rule: string): CodeMirror.SyntaxNode|null {
|
578
|
+
const cssParser = CodeMirror.css.cssLanguage.parser;
|
580
579
|
return cssParser.parse(rule).topNode.getChild('RuleSet')?.getChild('Block')?.getChild('Declaration') ?? null;
|
581
580
|
}
|
582
581
|
|
@@ -265,10 +265,10 @@ export class CSSFontPaletteValuesRule extends CSSRule {
|
|
265
265
|
|
266
266
|
export class CSSKeyframesRule {
|
267
267
|
readonly #animationName: CSSValue;
|
268
|
-
readonly #
|
268
|
+
readonly #keyframes: CSSKeyframeRule[];
|
269
269
|
constructor(cssModel: CSSModel, payload: Protocol.CSS.CSSKeyframesRule) {
|
270
270
|
this.#animationName = new CSSValue(payload.animationName);
|
271
|
-
this.#
|
271
|
+
this.#keyframes =
|
272
272
|
payload.keyframes.map(keyframeRule => new CSSKeyframeRule(cssModel, keyframeRule, this.#animationName.text));
|
273
273
|
}
|
274
274
|
|
@@ -277,7 +277,7 @@ export class CSSKeyframesRule {
|
|
277
277
|
}
|
278
278
|
|
279
279
|
keyframes(): CSSKeyframeRule[] {
|
280
|
-
return this.#
|
280
|
+
return this.#keyframes;
|
281
281
|
}
|
282
282
|
}
|
283
283
|
|
@@ -12,16 +12,16 @@ import type {CSSRule} from './CSSRule.js';
|
|
12
12
|
import type {Target} from './Target.js';
|
13
13
|
|
14
14
|
export class CSSStyleDeclaration {
|
15
|
-
readonly #
|
15
|
+
readonly #cssModel: CSSModel;
|
16
16
|
parentRule: CSSRule|null;
|
17
|
-
#
|
17
|
+
#allProperties!: CSSProperty[];
|
18
18
|
styleSheetId?: Protocol.CSS.StyleSheetId;
|
19
19
|
range!: TextUtils.TextRange.TextRange|null;
|
20
20
|
cssText?: string;
|
21
21
|
#shorthandValues = new Map<string, string>();
|
22
22
|
#shorthandIsImportant = new Set<string>();
|
23
23
|
#activePropertyMap = new Map<string, CSSProperty>();
|
24
|
-
#
|
24
|
+
#leadingProperties!: CSSProperty[]|null;
|
25
25
|
type: Type;
|
26
26
|
// For CSSStyles coming from animations,
|
27
27
|
// This holds the name of the animation.
|
@@ -29,7 +29,7 @@ export class CSSStyleDeclaration {
|
|
29
29
|
constructor(
|
30
30
|
cssModel: CSSModel, parentRule: CSSRule|null, payload: Protocol.CSS.CSSStyle, type: Type,
|
31
31
|
animationName?: string) {
|
32
|
-
this.#
|
32
|
+
this.#cssModel = cssModel;
|
33
33
|
this.parentRule = parentRule;
|
34
34
|
this.#reinitialize(payload);
|
35
35
|
this.type = type;
|
@@ -44,8 +44,8 @@ export class CSSStyleDeclaration {
|
|
44
44
|
this.#reinitialize((edit.payload as Protocol.CSS.CSSStyle));
|
45
45
|
} else {
|
46
46
|
this.range = this.range.rebaseAfterTextEdit(edit.oldRange, edit.newRange);
|
47
|
-
for (let i = 0; i < this.#
|
48
|
-
this.#
|
47
|
+
for (let i = 0; i < this.#allProperties.length; ++i) {
|
48
|
+
this.#allProperties[i].rebase(edit);
|
49
49
|
}
|
50
50
|
}
|
51
51
|
}
|
@@ -68,7 +68,7 @@ export class CSSStyleDeclaration {
|
|
68
68
|
}
|
69
69
|
}
|
70
70
|
|
71
|
-
this.#
|
71
|
+
this.#allProperties = [];
|
72
72
|
|
73
73
|
if (payload.cssText && this.range) {
|
74
74
|
const longhands = [];
|
@@ -77,20 +77,19 @@ export class CSSStyleDeclaration {
|
|
77
77
|
if (!range) {
|
78
78
|
continue;
|
79
79
|
}
|
80
|
-
const parsedProperty = CSSProperty.parsePayload(this, this.#
|
81
|
-
this.#
|
80
|
+
const parsedProperty = CSSProperty.parsePayload(this, this.#allProperties.length, cssProperty);
|
81
|
+
this.#allProperties.push(parsedProperty);
|
82
82
|
for (const longhand of parsedProperty.getLonghandProperties()) {
|
83
83
|
longhands.push(longhand);
|
84
84
|
}
|
85
85
|
}
|
86
86
|
for (const longhand of longhands) {
|
87
|
-
longhand.index = this.#
|
88
|
-
this.#
|
87
|
+
longhand.index = this.#allProperties.length;
|
88
|
+
this.#allProperties.push(longhand);
|
89
89
|
}
|
90
90
|
} else {
|
91
91
|
for (const cssProperty of payload.cssProperties) {
|
92
|
-
this.#
|
93
|
-
CSSProperty.parsePayload(this, this.#allPropertiesInternal.length, cssProperty));
|
92
|
+
this.#allProperties.push(CSSProperty.parsePayload(this, this.#allProperties.length, cssProperty));
|
94
93
|
}
|
95
94
|
}
|
96
95
|
|
@@ -100,7 +99,7 @@ export class CSSStyleDeclaration {
|
|
100
99
|
// TODO(changhaohan): verify if this #activePropertyMap is still necessary, or if it is
|
101
100
|
// providing different information against the activeness in allPropertiesInternal.
|
102
101
|
this.#activePropertyMap = new Map();
|
103
|
-
for (const property of this.#
|
102
|
+
for (const property of this.#allProperties) {
|
104
103
|
if (!property.activeInStyle()) {
|
105
104
|
continue;
|
106
105
|
}
|
@@ -108,7 +107,7 @@ export class CSSStyleDeclaration {
|
|
108
107
|
}
|
109
108
|
|
110
109
|
this.cssText = payload.cssText;
|
111
|
-
this.#
|
110
|
+
this.#leadingProperties = null;
|
112
111
|
}
|
113
112
|
|
114
113
|
#generateSyntheticPropertiesIfNeeded(): void {
|
@@ -121,13 +120,13 @@ export class CSSStyleDeclaration {
|
|
121
120
|
}
|
122
121
|
|
123
122
|
const propertiesSet = new Set<string>();
|
124
|
-
for (const property of this.#
|
123
|
+
for (const property of this.#allProperties) {
|
125
124
|
propertiesSet.add(property.name);
|
126
125
|
}
|
127
126
|
|
128
127
|
const generatedProperties = [];
|
129
128
|
// For style-based properties, generate #shorthands with values when possible.
|
130
|
-
for (const property of this.#
|
129
|
+
for (const property of this.#allProperties) {
|
131
130
|
// For style-based properties, try generating #shorthands.
|
132
131
|
const shorthands = cssMetadata().getShorthands(property.name) || [];
|
133
132
|
for (const shorthand of shorthands) {
|
@@ -147,7 +146,7 @@ export class CSSStyleDeclaration {
|
|
147
146
|
propertiesSet.add(shorthand);
|
148
147
|
}
|
149
148
|
}
|
150
|
-
this.#
|
149
|
+
this.#allProperties = this.#allProperties.concat(generatedProperties);
|
151
150
|
}
|
152
151
|
|
153
152
|
#computeLeadingProperties(): CSSProperty[] {
|
@@ -156,11 +155,11 @@ export class CSSStyleDeclaration {
|
|
156
155
|
}
|
157
156
|
|
158
157
|
if (this.range) {
|
159
|
-
return this.#
|
158
|
+
return this.#allProperties.filter(propertyHasRange);
|
160
159
|
}
|
161
160
|
|
162
161
|
const leadingProperties = [];
|
163
|
-
for (const property of this.#
|
162
|
+
for (const property of this.#allProperties) {
|
164
163
|
const shorthands = cssMetadata().getShorthands(property.name) || [];
|
165
164
|
let belongToAnyShorthand = false;
|
166
165
|
for (const shorthand of shorthands) {
|
@@ -178,18 +177,18 @@ export class CSSStyleDeclaration {
|
|
178
177
|
}
|
179
178
|
|
180
179
|
leadingProperties(): CSSProperty[] {
|
181
|
-
if (!this.#
|
182
|
-
this.#
|
180
|
+
if (!this.#leadingProperties) {
|
181
|
+
this.#leadingProperties = this.#computeLeadingProperties();
|
183
182
|
}
|
184
|
-
return this.#
|
183
|
+
return this.#leadingProperties;
|
185
184
|
}
|
186
185
|
|
187
186
|
target(): Target {
|
188
|
-
return this.#
|
187
|
+
return this.#cssModel.target();
|
189
188
|
}
|
190
189
|
|
191
190
|
cssModel(): CSSModel {
|
192
|
-
return this.#
|
191
|
+
return this.#cssModel;
|
193
192
|
}
|
194
193
|
|
195
194
|
#computeInactiveProperties(): void {
|
@@ -198,7 +197,7 @@ export class CSSStyleDeclaration {
|
|
198
197
|
// 1. regular property, including shorthands
|
199
198
|
// 2. longhand components from shorthands, in the order of their shorthands.
|
200
199
|
const processedLonghands = new Set();
|
201
|
-
for (const property of this.#
|
200
|
+
for (const property of this.#allProperties) {
|
202
201
|
const metadata = cssMetadata();
|
203
202
|
const canonicalName = metadata.canonicalPropertyName(property.name);
|
204
203
|
if (property.disabled || !property.parsedOk) {
|
@@ -239,7 +238,7 @@ export class CSSStyleDeclaration {
|
|
239
238
|
}
|
240
239
|
|
241
240
|
allProperties(): CSSProperty[] {
|
242
|
-
return this.#
|
241
|
+
return this.#allProperties;
|
243
242
|
}
|
244
243
|
|
245
244
|
hasActiveProperty(name: string): boolean {
|
@@ -290,7 +289,7 @@ export class CSSStyleDeclaration {
|
|
290
289
|
if (!this.range || !this.styleSheetId) {
|
291
290
|
return Promise.resolve(false);
|
292
291
|
}
|
293
|
-
return this.#
|
292
|
+
return this.#cssModel.setStyleText(this.styleSheetId, this.range, text, majorChange);
|
294
293
|
}
|
295
294
|
|
296
295
|
insertPropertyAt(index: number, name: string, value: string, userCallback?: ((arg0: boolean) => void)): void {
|