chrome-devtools-mcp-for-extension 0.19.2 → 0.20.0
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/build/node_modules/chrome-devtools-frontend/front_end/core/common/Color.js +13 -9
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/ColorConverter.js +9 -7
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Console.js +1 -8
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Debouncer.js +2 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Gzip.js +9 -7
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/MapWithDefault.js +5 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/ParsedURL.js +10 -20
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/ResourceType.js +0 -11
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/ReturnToPanel.js +6 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Revealer.js +5 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/SegmentedRange.js +1 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Settings.js +110 -99
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/StringOutputStream.js +1 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/Throttler.js +2 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/common/common.js +1 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/AidaClient.js +21 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/DispatchHttpRequestClient.js +66 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/GdpClient.js +102 -86
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/InspectorFrontendHost.js +32 -450
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/InspectorFrontendHostAPI.js +32 -29
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/InspectorFrontendHostStub.js +430 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/Platform.js +5 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/ResourceLoader.js +10 -22
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/UserMetrics.js +26 -15
- package/build/node_modules/chrome-devtools-frontend/front_end/core/host/host.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/ArrayUtilities.js +2 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/HostRuntime.js +19 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/StringUtilities.js +34 -32
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/api/HostRuntime.js +4 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/api/api.js +5 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/browser/HostRuntime.js +63 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/browser/browser.js +5 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/node/HostRuntime.js +72 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/node/node.js +5 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/platform/platform.js +2 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/protocol_client/CDPConnection.js +17 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/protocol_client/ConnectionTransport.js +12 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/protocol_client/DevToolsCDPConnection.js +138 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/protocol_client/InspectorBackend.js +49 -312
- package/build/node_modules/chrome-devtools-frontend/front_end/core/protocol_client/protocol_client.js +4 -9
- package/build/node_modules/chrome-devtools-frontend/front_end/core/root/DevToolsContext.js +54 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/root/root.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/AnimationModel.js +2 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CPUThrottlingManager.js +0 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSMatchedStyles.js +51 -17
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSMetadata.js +21 -7
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSModel.js +11 -5
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSProperty.js +4 -7
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSPropertyParser.js +11 -9
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSPropertyParserMatchers.js +34 -24
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSRule.js +52 -10
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSStartingStyle.js +21 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSStyleDeclaration.js +4 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ChildTargetManager.js +39 -35
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/Connections.js +10 -47
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ConsoleModel.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/Cookie.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/DOMModel.js +29 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/DebuggerModel.js +5 -20
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/EnhancedTracesParser.js +17 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/EventBreakpointsModel.js +4 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/HttpReasonPhraseStrings.js +4 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/IOModel.js +1 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/NetworkManager.js +428 -121
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/NetworkRequest.js +8 -22
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/PageResourceLoader.js +44 -34
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/PreloadingModel.js +64 -19
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/RehydratingConnection.js +139 -12
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/RemoteObject.js +5 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ResourceTreeModel.js +3 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ScopeTreeCache.js +36 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ScreenCaptureModel.js +20 -18
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/Script.js +26 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/ServerSentEventsProtocol.js +3 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SourceMap.js +54 -14
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SourceMapCache.js +16 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SourceMapManager.js +19 -7
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/SourceMapScopesInfo.js +240 -8
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/Target.js +12 -17
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/TargetManager.js +38 -29
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/TraceObject.js +11 -8
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/sdk-meta.js +80 -31
- package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/sdk.js +4 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/generated/ARIAProperties.js +1301 -174
- package/build/node_modules/chrome-devtools-frontend/front_end/generated/Deprecation.js +67 -22
- package/build/node_modules/chrome-devtools-frontend/front_end/generated/InspectorBackendCommands.js +62 -91
- package/build/node_modules/chrome-devtools-frontend/front_end/generated/SupportedCSSProperties.js +188 -100
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.js +30 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.js +50 -34
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.js +152 -101
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/performance/AICallTree.js +11 -6
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/performance/AIContext.js +25 -26
- package/build/node_modules/chrome-devtools-frontend/front_end/models/ai_assistance/performance/AIQueries.js +46 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/CSSWorkspaceBinding.js +10 -8
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/CompilerScriptMapping.js +82 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/DebuggerWorkspaceBinding.js +33 -15
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/ResourceMapping.js +105 -14
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/ResourceScriptMapping.js +38 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/bindings/SASSSourceMapping.js +5 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/cpu_profile/CPUProfileDataModel.js +9 -7
- package/build/node_modules/chrome-devtools-frontend/front_end/models/cpu_profile/ProfileTreeModel.js +6 -7
- package/build/node_modules/chrome-devtools-frontend/front_end/models/crux-manager/CrUXManager.js +6 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/formatter/FormatterWorkerPool.js +16 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/network_time_calculator/RequestTimeRanges.js +6 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/source_map_scopes/FunctionCodeResolver.js +192 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/source_map_scopes/NamesResolver.js +12 -16
- package/build/node_modules/chrome-devtools-frontend/front_end/models/source_map_scopes/source_map_scopes.js +2 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/stack_trace/StackTraceModel.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/stack_trace/Trie.js +8 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/LanternComputationData.js +1 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/ModelImpl.js +6 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/Processor.js +4 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/Styles.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/extras/TraceTree.js +11 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/FramesHandler.js +7 -5
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/LayoutShiftsHandler.js +8 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/MetaHandler.js +4 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/NetworkRequestsHandler.js +29 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/SamplesHandler.js +59 -6
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/ScriptsHandler.js +26 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/UserTimingsHandler.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/handlers/helpers.js +1 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/helpers/Timing.js +4 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/helpers/Trace.js +18 -4
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/CLSCulprits.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/Cache.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/DOMSize.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/DocumentLatency.js +12 -11
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/DuplicatedJavaScript.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/FontDisplay.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/ForcedReflow.js +3 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/INPBreakdown.js +14 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/ImageDelivery.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/LCPBreakdown.js +13 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/LCPDiscovery.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/LegacyJavaScript.js +4 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/ModernHTTP.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/NetworkDependencyTree.js +4 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/RenderBlocking.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/SlowCSSSelector.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/ThirdParties.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/insights/Viewport.js +2 -1
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace/types/TraceEvents.js +9 -3
- package/build/node_modules/chrome-devtools-frontend/front_end/models/trace_source_maps_resolver/SourceMapsResolver.js +25 -2
- package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/IgnoreListManager.js +41 -48
- package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/UISourceCode.js +38 -0
- package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/WorkspaceImpl.js +5 -8
- package/build/node_modules/chrome-devtools-frontend/front_end/models/workspace/workspace-meta.js +34 -0
- package/build/src/McpContext.js +8 -1
- package/build/src/tools/bookmarks.js +0 -1
- package/build/src/tools/gemini-web.js +17 -25
- package/build/src/tools/snapshot.js +9 -2
- package/package.json +3 -3
|
@@ -5,8 +5,8 @@ import * as Platform from '../platform/platform.js';
|
|
|
5
5
|
import { CSSMetadata, cssMetadata } from './CSSMetadata.js';
|
|
6
6
|
import { CSSProperty } from './CSSProperty.js';
|
|
7
7
|
import * as PropertyParser from './CSSPropertyParser.js';
|
|
8
|
-
import { AnchorFunctionMatcher, AngleMatcher, AttributeMatcher, AutoBaseMatcher, BaseVariableMatcher, BezierMatcher, BinOpMatcher, ColorMatcher, ColorMixMatcher, CustomFunctionMatcher, defaultValueForCSSType, EnvFunctionMatcher,
|
|
9
|
-
import {
|
|
8
|
+
import { AnchorFunctionMatcher, AngleMatcher, AttributeMatcher, AutoBaseMatcher, BaseVariableMatcher, BezierMatcher, BinOpMatcher, ColorMatcher, ColorMixMatcher, CustomFunctionMatcher, defaultValueForCSSType, EnvFunctionMatcher, FlexGridGridLanesMatcher, GridTemplateMatcher, LengthMatcher, LightDarkColorMatcher, LinearGradientMatcher, LinkableNameMatcher, localEvalCSS, MathFunctionMatcher, PositionAnchorMatcher, PositionTryMatcher, RelativeColorChannelMatcher, ShadowMatcher, StringMatcher, URLMatcher, VariableMatcher } from './CSSPropertyParserMatchers.js';
|
|
9
|
+
import { CSSAtRule, CSSFunctionRule, CSSKeyframeRule, CSSKeyframesRule, CSSPositionTryRule, CSSPropertyRule, CSSStyleRule, } from './CSSRule.js';
|
|
10
10
|
import { CSSStyleDeclaration, Type } from './CSSStyleDeclaration.js';
|
|
11
11
|
function containsStyle(styles, query) {
|
|
12
12
|
if (!query.styleSheetId || !query.range) {
|
|
@@ -212,15 +212,15 @@ export class CSSMatchedStyles {
|
|
|
212
212
|
#pseudoDOMCascades;
|
|
213
213
|
#customHighlightPseudoDOMCascades;
|
|
214
214
|
#functionRules;
|
|
215
|
+
#atRules;
|
|
215
216
|
#functionRuleMap = new Map();
|
|
216
|
-
#fontPaletteValuesRule;
|
|
217
217
|
#environmentVariables = {};
|
|
218
218
|
static async create(payload) {
|
|
219
219
|
const cssMatchedStyles = new CSSMatchedStyles(payload);
|
|
220
220
|
await cssMatchedStyles.init(payload);
|
|
221
221
|
return cssMatchedStyles;
|
|
222
222
|
}
|
|
223
|
-
constructor({ cssModel, node, animationsPayload, parentLayoutNodeId, positionTryRules, propertyRules, cssPropertyRegistrations,
|
|
223
|
+
constructor({ cssModel, node, animationsPayload, parentLayoutNodeId, positionTryRules, propertyRules, cssPropertyRegistrations, activePositionFallbackIndex, functionRules, atRules, }) {
|
|
224
224
|
this.#cssModel = cssModel;
|
|
225
225
|
this.#node = node;
|
|
226
226
|
this.#registeredProperties = [
|
|
@@ -232,17 +232,16 @@ export class CSSMatchedStyles {
|
|
|
232
232
|
}
|
|
233
233
|
this.#positionTryRules = positionTryRules.map(rule => new CSSPositionTryRule(cssModel, rule));
|
|
234
234
|
this.#parentLayoutNodeId = parentLayoutNodeId;
|
|
235
|
-
this.#fontPaletteValuesRule =
|
|
236
|
-
fontPaletteValuesRule ? new CSSFontPaletteValuesRule(cssModel, fontPaletteValuesRule) : undefined;
|
|
237
235
|
this.#activePositionFallbackIndex = activePositionFallbackIndex;
|
|
238
236
|
this.#functionRules = functionRules.map(rule => new CSSFunctionRule(cssModel, rule));
|
|
237
|
+
this.#atRules = atRules.map(rule => new CSSAtRule(cssModel, rule));
|
|
239
238
|
}
|
|
240
239
|
async init({ matchedPayload, inheritedPayload, inlinePayload, attributesPayload, pseudoPayload, inheritedPseudoPayload, animationStylesPayload, transitionsStylePayload, inheritedAnimatedPayload, }) {
|
|
241
240
|
matchedPayload = cleanUserAgentPayload(matchedPayload);
|
|
242
241
|
for (const inheritedResult of inheritedPayload) {
|
|
243
242
|
inheritedResult.matchedCSSRules = cleanUserAgentPayload(inheritedResult.matchedCSSRules);
|
|
244
243
|
}
|
|
245
|
-
this.#environmentVariables = await this.cssModel().
|
|
244
|
+
this.#environmentVariables = await this.cssModel().getEnvironmentVariables();
|
|
246
245
|
this.#mainDOMCascade = await this.buildMainCascade(inlinePayload, attributesPayload, matchedPayload, inheritedPayload, animationStylesPayload, transitionsStylePayload, inheritedAnimatedPayload);
|
|
247
246
|
[this.#pseudoDOMCascades, this.#customHighlightPseudoDOMCascades] =
|
|
248
247
|
this.buildPseudoCascades(pseudoPayload, inheritedPseudoPayload);
|
|
@@ -305,7 +304,7 @@ export class CSSMatchedStyles {
|
|
|
305
304
|
if (!addedAttributesStyle) {
|
|
306
305
|
addAttributesStyle.call(this);
|
|
307
306
|
}
|
|
308
|
-
nodeCascades.push(new NodeCascade(this, nodeStyles, false /* #isInherited */));
|
|
307
|
+
nodeCascades.push(new NodeCascade(this, nodeStyles, this.#node, false /* #isInherited */));
|
|
309
308
|
// Walk the node structure and identify styles with inherited properties.
|
|
310
309
|
let parentNode = this.#node.parentNode;
|
|
311
310
|
const traverseParentInFlatTree = async (node) => {
|
|
@@ -361,8 +360,9 @@ export class CSSMatchedStyles {
|
|
|
361
360
|
inheritedStyles.push(inheritedRule.style);
|
|
362
361
|
this.#inheritedStyles.add(inheritedRule.style);
|
|
363
362
|
}
|
|
363
|
+
const node = parentNode;
|
|
364
364
|
parentNode = await traverseParentInFlatTree(parentNode);
|
|
365
|
-
nodeCascades.push(new NodeCascade(this, inheritedStyles, true /* #isInherited */));
|
|
365
|
+
nodeCascades.push(new NodeCascade(this, inheritedStyles, node, true /* #isInherited */));
|
|
366
366
|
}
|
|
367
367
|
return new DOMInheritanceCascade(this, nodeCascades, this.#registeredProperties);
|
|
368
368
|
}
|
|
@@ -396,7 +396,7 @@ export class CSSMatchedStyles {
|
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
398
|
for (const [highlightName, highlightStyles] of splitHighlightRules) {
|
|
399
|
-
const nodeCascade = new NodeCascade(this, highlightStyles, isInherited, true /* #isHighlightPseudoCascade*/);
|
|
399
|
+
const nodeCascade = new NodeCascade(this, highlightStyles, node, isInherited, true /* #isHighlightPseudoCascade*/);
|
|
400
400
|
const cascadeListForHighlightName = pseudoCascades.get(highlightName);
|
|
401
401
|
if (cascadeListForHighlightName) {
|
|
402
402
|
cascadeListForHighlightName.push(nodeCascade);
|
|
@@ -434,7 +434,7 @@ export class CSSMatchedStyles {
|
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
436
|
const isHighlightPseudoCascade = cssMetadata().isHighlightPseudoType(entryPayload.pseudoType);
|
|
437
|
-
const nodeCascade = new NodeCascade(this, pseudoStyles, false /* #isInherited */, isHighlightPseudoCascade /* #isHighlightPseudoCascade*/);
|
|
437
|
+
const nodeCascade = new NodeCascade(this, pseudoStyles, this.#node, false /* #isInherited */, isHighlightPseudoCascade /* #isHighlightPseudoCascade*/);
|
|
438
438
|
pseudoCascades.set(entryPayload.pseudoType, [nodeCascade]);
|
|
439
439
|
}
|
|
440
440
|
}
|
|
@@ -458,7 +458,7 @@ export class CSSMatchedStyles {
|
|
|
458
458
|
this.addMatchingSelectors(parentNode, pseudoRule, rules[k].matchingSelectors);
|
|
459
459
|
}
|
|
460
460
|
const isHighlightPseudoCascade = cssMetadata().isHighlightPseudoType(inheritedEntryPayload.pseudoType);
|
|
461
|
-
const nodeCascade = new NodeCascade(this, pseudoStyles, true /* #isInherited */, isHighlightPseudoCascade /* #isHighlightPseudoCascade*/);
|
|
461
|
+
const nodeCascade = new NodeCascade(this, pseudoStyles, parentNode, true /* #isInherited */, isHighlightPseudoCascade /* #isHighlightPseudoCascade*/);
|
|
462
462
|
const cascadeListForPseudoType = pseudoCascades.get(inheritedEntryPayload.pseudoType);
|
|
463
463
|
if (cascadeListForPseudoType) {
|
|
464
464
|
cascadeListForPseudoType.push(nodeCascade);
|
|
@@ -598,8 +598,8 @@ export class CSSMatchedStyles {
|
|
|
598
598
|
functionRules() {
|
|
599
599
|
return this.#functionRules;
|
|
600
600
|
}
|
|
601
|
-
|
|
602
|
-
return this.#
|
|
601
|
+
atRules() {
|
|
602
|
+
return this.#atRules;
|
|
603
603
|
}
|
|
604
604
|
keyframes() {
|
|
605
605
|
return this.#keyframes;
|
|
@@ -713,7 +713,7 @@ export class CSSMatchedStyles {
|
|
|
713
713
|
new LinearGradientMatcher(),
|
|
714
714
|
new AnchorFunctionMatcher(),
|
|
715
715
|
new PositionAnchorMatcher(),
|
|
716
|
-
new
|
|
716
|
+
new FlexGridGridLanesMatcher(),
|
|
717
717
|
new PositionTryMatcher(),
|
|
718
718
|
new LengthMatcher(),
|
|
719
719
|
new MathFunctionMatcher(),
|
|
@@ -736,11 +736,13 @@ class NodeCascade {
|
|
|
736
736
|
#isHighlightPseudoCascade;
|
|
737
737
|
propertiesState = new Map();
|
|
738
738
|
activeProperties = new Map();
|
|
739
|
-
|
|
739
|
+
#node;
|
|
740
|
+
constructor(matchedStyles, styles, node, isInherited, isHighlightPseudoCascade = false) {
|
|
740
741
|
this.#matchedStyles = matchedStyles;
|
|
741
742
|
this.styles = styles;
|
|
742
743
|
this.#isInherited = isInherited;
|
|
743
744
|
this.#isHighlightPseudoCascade = isHighlightPseudoCascade;
|
|
745
|
+
this.#node = node;
|
|
744
746
|
}
|
|
745
747
|
computeActiveProperties() {
|
|
746
748
|
this.propertiesState.clear();
|
|
@@ -791,9 +793,41 @@ class NodeCascade {
|
|
|
791
793
|
}
|
|
792
794
|
}
|
|
793
795
|
}
|
|
796
|
+
#treeScopeDistance(property) {
|
|
797
|
+
if (!property.ownerStyle.parentRule && property.ownerStyle.type !== Type.Inline) {
|
|
798
|
+
return -1;
|
|
799
|
+
}
|
|
800
|
+
const root = this.#node.getTreeRoot();
|
|
801
|
+
const nodeId = property.ownerStyle.parentRule?.treeScope ?? root?.backendNodeId();
|
|
802
|
+
if (nodeId === undefined) {
|
|
803
|
+
return -1;
|
|
804
|
+
}
|
|
805
|
+
let distance = 0;
|
|
806
|
+
for (let ancestor = this.#node; ancestor; ancestor = ancestor.parentNode) {
|
|
807
|
+
if (ancestor.backendNodeId() === nodeId) {
|
|
808
|
+
return distance;
|
|
809
|
+
}
|
|
810
|
+
distance++;
|
|
811
|
+
}
|
|
812
|
+
return -1;
|
|
813
|
+
}
|
|
814
|
+
#needsCascadeContextStep() {
|
|
815
|
+
if (!this.#node.isInShadowTree()) {
|
|
816
|
+
return false;
|
|
817
|
+
}
|
|
818
|
+
if (this.#node.ancestorShadowRoot()?.shadowRootType() === 'user-agent') {
|
|
819
|
+
// In UA shadow dom, only standards-track pseudo elements override style attributes. -webkit-* and -internal-*
|
|
820
|
+
// pseudos are still exempt from that to retain legacy behavior.
|
|
821
|
+
const pseudoElement = this.#node.getAttribute('pseudo');
|
|
822
|
+
return !pseudoElement?.startsWith('-webkit-') && !pseudoElement?.startsWith('-internal-');
|
|
823
|
+
}
|
|
824
|
+
return true;
|
|
825
|
+
}
|
|
794
826
|
updatePropertyState(propertyWithHigherSpecificity, canonicalName) {
|
|
795
827
|
const activeProperty = this.activeProperties.get(canonicalName);
|
|
796
|
-
if (activeProperty?.important && !propertyWithHigherSpecificity.important
|
|
828
|
+
if (activeProperty?.important && !propertyWithHigherSpecificity.important ||
|
|
829
|
+
activeProperty && this.#needsCascadeContextStep() &&
|
|
830
|
+
this.#treeScopeDistance(activeProperty) > this.#treeScopeDistance(propertyWithHigherSpecificity)) {
|
|
797
831
|
this.propertiesState.set(propertyWithHigherSpecificity, "Overloaded" /* PropertyState.OVERLOADED */);
|
|
798
832
|
return;
|
|
799
833
|
}
|
|
@@ -279,8 +279,10 @@ export const CubicBezierKeywordValues = new Map([
|
|
|
279
279
|
['ease-in-out', 'cubic-bezier(0.42, 0, 0.58, 1)'],
|
|
280
280
|
['ease-out', 'cubic-bezier(0, 0, 0.58, 1)'],
|
|
281
281
|
]);
|
|
282
|
-
|
|
283
|
-
|
|
282
|
+
/**
|
|
283
|
+
* Spec: https://drafts.csswg.org/css-cascade/#defaulting-keywords
|
|
284
|
+
* https://drafts.csswg.org/css-cascade-5/#revert-layer
|
|
285
|
+
**/
|
|
284
286
|
export const CSSWideKeywords = [
|
|
285
287
|
"inherit" /* CSSWideKeyword.INHERIT */,
|
|
286
288
|
"initial" /* CSSWideKeyword.INITIAL */,
|
|
@@ -344,11 +346,8 @@ const cornerShapeValuePresetMap = new Map([
|
|
|
344
346
|
['superellipse(infinity)', 'superellipse(|infinity|)'],
|
|
345
347
|
]);
|
|
346
348
|
const valuePresets = new Map([
|
|
347
|
-
['filter', filterValuePresetMap],
|
|
348
|
-
['
|
|
349
|
-
['background', imageValuePresetMap],
|
|
350
|
-
['background-image', imageValuePresetMap],
|
|
351
|
-
['-webkit-mask-image', imageValuePresetMap],
|
|
349
|
+
['filter', filterValuePresetMap], ['backdrop-filter', filterValuePresetMap], ['background', imageValuePresetMap],
|
|
350
|
+
['background-image', imageValuePresetMap], ['-webkit-mask-image', imageValuePresetMap],
|
|
352
351
|
[
|
|
353
352
|
'transform',
|
|
354
353
|
new Map([
|
|
@@ -375,6 +374,17 @@ const valuePresets = new Map([
|
|
|
375
374
|
]),
|
|
376
375
|
],
|
|
377
376
|
['corner-shape', cornerShapeValuePresetMap],
|
|
377
|
+
[
|
|
378
|
+
'font-variant-alternates',
|
|
379
|
+
new Map([
|
|
380
|
+
['stylistic', 'stylistic(||)'],
|
|
381
|
+
['styleset', 'styleset(||)'],
|
|
382
|
+
['character-variant', 'character-variant(||)'],
|
|
383
|
+
['swash', 'swash(||)'],
|
|
384
|
+
['ornaments', 'ornaments(||)'],
|
|
385
|
+
['annotation', 'annotation(||)'],
|
|
386
|
+
]),
|
|
387
|
+
]
|
|
378
388
|
]);
|
|
379
389
|
const distanceProperties = new Set([
|
|
380
390
|
'background-position',
|
|
@@ -646,6 +656,10 @@ const extraPropertyValues = new Map([
|
|
|
646
656
|
'ruby',
|
|
647
657
|
]),
|
|
648
658
|
],
|
|
659
|
+
[
|
|
660
|
+
'font-variant-alternates',
|
|
661
|
+
new Set(['historical-forms', 'stylistic', 'styleset', 'character-variant', 'swash', 'ornaments', 'annotation'])
|
|
662
|
+
],
|
|
649
663
|
['vertical-align', new Set(['top', 'bottom', '-webkit-baseline-middle'])],
|
|
650
664
|
['page-break-after', new Set(['left', 'right', 'always', 'avoid'])],
|
|
651
665
|
['text-emphasis-style', textEmphasisStyle],
|
|
@@ -138,7 +138,7 @@ export class CSSModel extends SDKModel {
|
|
|
138
138
|
try {
|
|
139
139
|
await this.ensureOriginalStyleSheetText(styleSheetId);
|
|
140
140
|
const { styles } = await this.agent.invoke_setStyleTexts({ edits: [{ styleSheetId, range: range.serializeToObject(), text }] });
|
|
141
|
-
if (
|
|
141
|
+
if (styles?.length !== 1) {
|
|
142
142
|
return false;
|
|
143
143
|
}
|
|
144
144
|
this.#domModel.markUndoableState(!majorChange);
|
|
@@ -278,7 +278,7 @@ export class CSSModel extends SDKModel {
|
|
|
278
278
|
propertyRules: matchedStylesResponse.cssPropertyRules ?? [],
|
|
279
279
|
functionRules: matchedStylesResponse.cssFunctionRules ?? [],
|
|
280
280
|
cssPropertyRegistrations: matchedStylesResponse.cssPropertyRegistrations ?? [],
|
|
281
|
-
|
|
281
|
+
atRules: matchedStylesResponse.cssAtRules ?? [],
|
|
282
282
|
activePositionFallbackIndex: matchedStylesResponse.activePositionFallbackIndex ?? -1,
|
|
283
283
|
animationStylesPayload: animatedStylesResponse?.animationStyles || [],
|
|
284
284
|
inheritedAnimatedPayload: animatedStylesResponse?.inherited || [],
|
|
@@ -308,7 +308,7 @@ export class CSSModel extends SDKModel {
|
|
|
308
308
|
(styles.get('grid-template-columns')?.startsWith('subgrid') ||
|
|
309
309
|
styles.get('grid-template-rows')?.startsWith('subgrid'))) ??
|
|
310
310
|
false;
|
|
311
|
-
const
|
|
311
|
+
const isGridLanes = display === 'grid-lanes' || display === 'inline-grid-lanes';
|
|
312
312
|
const containerType = styles.get('container-type');
|
|
313
313
|
const isContainer = Boolean(containerType) && containerType !== '' && containerType !== 'normal';
|
|
314
314
|
const hasScroll = Boolean(styles.get('scroll-snap-type')) && styles.get('scroll-snap-type') !== 'none';
|
|
@@ -316,12 +316,12 @@ export class CSSModel extends SDKModel {
|
|
|
316
316
|
isFlex,
|
|
317
317
|
isGrid,
|
|
318
318
|
isSubgrid,
|
|
319
|
-
|
|
319
|
+
isGridLanes,
|
|
320
320
|
isContainer,
|
|
321
321
|
hasScroll,
|
|
322
322
|
};
|
|
323
323
|
}
|
|
324
|
-
async
|
|
324
|
+
async getEnvironmentVariables() {
|
|
325
325
|
const response = await this.agent.invoke_getEnvironmentVariables();
|
|
326
326
|
if (response.getError()) {
|
|
327
327
|
return {};
|
|
@@ -368,6 +368,11 @@ export class CSSModel extends SDKModel {
|
|
|
368
368
|
null;
|
|
369
369
|
return new InlineStyleResult(inlineStyle, attributesStyle);
|
|
370
370
|
}
|
|
371
|
+
forceStartingStyle(node, forced) {
|
|
372
|
+
void this.agent.invoke_forceStartingStyle({ nodeId: node.id, forced });
|
|
373
|
+
this.dispatchEventToListeners(Events.StartingStylesStateForced, node);
|
|
374
|
+
return true;
|
|
375
|
+
}
|
|
371
376
|
forcePseudoState(node, pseudoClass, enable) {
|
|
372
377
|
const forcedPseudoClasses = node.marker(PseudoStateMarker) || [];
|
|
373
378
|
const hasPseudoClass = forcedPseudoClasses.includes(pseudoClass);
|
|
@@ -781,6 +786,7 @@ export var Events;
|
|
|
781
786
|
Events["ModelWasEnabled"] = "ModelWasEnabled";
|
|
782
787
|
Events["ModelDisposed"] = "ModelDisposed";
|
|
783
788
|
Events["PseudoStateForced"] = "PseudoStateForced";
|
|
789
|
+
Events["StartingStylesStateForced"] = "StartingStylesStateForced";
|
|
784
790
|
Events["StyleSheetAdded"] = "StyleSheetAdded";
|
|
785
791
|
Events["StyleSheetChanged"] = "StyleSheetChanged";
|
|
786
792
|
Events["StyleSheetRemoved"] = "StyleSheetRemoved";
|
|
@@ -20,9 +20,9 @@ export class CSSProperty extends Common.ObjectWrapper.ObjectWrapper {
|
|
|
20
20
|
implicit;
|
|
21
21
|
text;
|
|
22
22
|
range;
|
|
23
|
-
#active;
|
|
24
|
-
#nameRange;
|
|
25
|
-
#valueRange;
|
|
23
|
+
#active = true;
|
|
24
|
+
#nameRange = null;
|
|
25
|
+
#valueRange = null;
|
|
26
26
|
#invalidString;
|
|
27
27
|
#longhandProperties = [];
|
|
28
28
|
constructor(ownerStyle, index, name, value, important, disabled, parsedOk, implicit, text, range, longhandProperties) {
|
|
@@ -37,9 +37,6 @@ export class CSSProperty extends Common.ObjectWrapper.ObjectWrapper {
|
|
|
37
37
|
this.implicit = implicit; // A longhand, implicitly set by missing values of shorthand.
|
|
38
38
|
this.text = text;
|
|
39
39
|
this.range = range ? TextUtils.TextRange.TextRange.fromObject(range) : null;
|
|
40
|
-
this.#active = true;
|
|
41
|
-
this.#nameRange = null;
|
|
42
|
-
this.#valueRange = null;
|
|
43
40
|
if (longhandProperties && longhandProperties.length > 0) {
|
|
44
41
|
for (const property of longhandProperties) {
|
|
45
42
|
this.#longhandProperties.push(new CSSProperty(ownerStyle, ++index, property.name, property.value, important, disabled, parsedOk, true));
|
|
@@ -234,7 +231,7 @@ export class CSSProperty extends Common.ObjectWrapper.ObjectWrapper {
|
|
|
234
231
|
}
|
|
235
232
|
if (cssMetadata().isGridAreaDefiningProperty(propertyName)) {
|
|
236
233
|
const rowResult = GridAreaRowRegex.exec(token);
|
|
237
|
-
if (rowResult
|
|
234
|
+
if (rowResult?.index === 0 && !propertyText.trimEnd().endsWith(']')) {
|
|
238
235
|
propertyText = propertyText.trimEnd() + '\n' + doubleIndent;
|
|
239
236
|
}
|
|
240
237
|
}
|
|
@@ -246,11 +246,11 @@ class ComputedTextChunk {
|
|
|
246
246
|
}
|
|
247
247
|
return this.#cachedComputedText;
|
|
248
248
|
}
|
|
249
|
-
// If the match is top-level, i.e. is an outermost
|
|
250
|
-
//
|
|
249
|
+
// If the match is top-level, i.e. is an outermost sub-expression in the property value, count the number of outermost
|
|
250
|
+
// sub-expressions after applying any potential substitutions.
|
|
251
251
|
get topLevelValueCount() {
|
|
252
252
|
if (this.match.node.parent?.name !== 'Declaration') {
|
|
253
|
-
// Not a top-level
|
|
253
|
+
// Not a top-level match.
|
|
254
254
|
return 0;
|
|
255
255
|
}
|
|
256
256
|
const computedText = this.computedText;
|
|
@@ -268,12 +268,14 @@ class ComputedTextChunk {
|
|
|
268
268
|
return this.#topLevelValueCount;
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
271
|
+
/**
|
|
272
|
+
* This class constructs the "computed" text from the input property text, i.e., it will strip comments and substitute
|
|
273
|
+
* var() functions if possible. It's intended for use during the bottom-up tree matching process. The original text is
|
|
274
|
+
* not modified. Instead, computed text slices are produced on the fly. During bottom-up matching, the sequence of
|
|
275
|
+
* top-level comments and var() matches will be recorded. This produces an ordered sequence of text pieces that need to
|
|
276
|
+
* be substituted into the original text. When a computed text slice is requested, it is generated by piecing together
|
|
277
|
+
* original and computed slices as required.
|
|
278
|
+
**/
|
|
277
279
|
export class ComputedText {
|
|
278
280
|
#chunks = [];
|
|
279
281
|
text;
|
package/build/node_modules/chrome-devtools-frontend/front_end/core/sdk/CSSPropertyParserMatchers.js
CHANGED
|
@@ -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
|
|
4
|
+
/* eslint-disable @devtools/no-imperative-dom-api */
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
|
6
6
|
import { CSSMetadata, cssMetadata, CubicBezierKeywordValues, } from './CSSMetadata.js';
|
|
7
7
|
import { ASTUtils, matchDeclaration, matcherBase, tokenizeDeclaration } from './CSSPropertyParser.js';
|
|
@@ -141,22 +141,26 @@ function getCssEvaluationElement() {
|
|
|
141
141
|
}
|
|
142
142
|
return cssEvaluationElement;
|
|
143
143
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
144
|
+
/**
|
|
145
|
+
* These functions use an element in the frontend to evaluate CSS. The advantage
|
|
146
|
+
* of this is that it is synchronous and doesn't require a CDP method. The
|
|
147
|
+
* disadvantage is it lacks context that would allow substitutions such as
|
|
148
|
+
* `var()` and `calc()` to be resolved correctly, and if the user is doing
|
|
149
|
+
* remote debugging there is a possibility that the CSS behavior is different
|
|
150
|
+
* between the two browser versions. We use it for type checking after
|
|
151
|
+
* substitutions (but not for actual evaluation) and for applying units.
|
|
152
|
+
**/
|
|
151
153
|
export function localEvalCSS(value, type) {
|
|
152
154
|
const element = getCssEvaluationElement();
|
|
153
155
|
element.setAttribute('data-value', value);
|
|
154
156
|
element.setAttribute('data-custom-expr', `attr(data-value ${type})`);
|
|
155
157
|
return element.computedStyleMap().get('--evaluation')?.toString() ?? null;
|
|
156
158
|
}
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
159
|
+
/**
|
|
160
|
+
* It is important to establish whether a type is valid, because if it is not,
|
|
161
|
+
* the current behavior of blink is to ignore the fallback and parse as a
|
|
162
|
+
* raw string, returning '' if the attribute is not set.
|
|
163
|
+
**/
|
|
160
164
|
export function isValidCSSType(type) {
|
|
161
165
|
const element = getCssEvaluationElement();
|
|
162
166
|
element.setAttribute('data-custom-expr', `attr(data-nonexistent ${type}, "good")`);
|
|
@@ -989,21 +993,22 @@ export class CustomFunctionMatcher extends matcherBase(CustomFunctionMatch) {
|
|
|
989
993
|
return new CustomFunctionMatch(text, node, callee, args);
|
|
990
994
|
}
|
|
991
995
|
}
|
|
992
|
-
export class
|
|
996
|
+
export class FlexGridGridLanesMatch {
|
|
993
997
|
text;
|
|
994
998
|
node;
|
|
995
|
-
|
|
996
|
-
constructor(text, node,
|
|
999
|
+
layoutType;
|
|
1000
|
+
constructor(text, node, layoutType) {
|
|
997
1001
|
this.text = text;
|
|
998
1002
|
this.node = node;
|
|
999
|
-
this.
|
|
1003
|
+
this.layoutType = layoutType;
|
|
1000
1004
|
}
|
|
1001
1005
|
}
|
|
1002
1006
|
// clang-format off
|
|
1003
|
-
export class
|
|
1007
|
+
export class FlexGridGridLanesMatcher extends matcherBase(FlexGridGridLanesMatch) {
|
|
1004
1008
|
// clang-format on
|
|
1005
1009
|
static FLEX = ['flex', 'inline-flex', 'block flex', 'inline flex'];
|
|
1006
1010
|
static GRID = ['grid', 'inline-grid', 'block grid', 'inline grid'];
|
|
1011
|
+
static GRID_LANES = ['grid-lanes', 'inline-grid-lanes', 'block grid-lanes', 'inline grid-lanes'];
|
|
1007
1012
|
accepts(propertyName) {
|
|
1008
1013
|
return propertyName === 'display';
|
|
1009
1014
|
}
|
|
@@ -1019,11 +1024,14 @@ export class FlexGridMatcher extends matcherBase(FlexGridMatch) {
|
|
|
1019
1024
|
.map(node => matching.getComputedText(node).trim())
|
|
1020
1025
|
.filter(value => value);
|
|
1021
1026
|
const text = values.join(' ');
|
|
1022
|
-
if (
|
|
1023
|
-
return new
|
|
1027
|
+
if (FlexGridGridLanesMatcher.FLEX.includes(text)) {
|
|
1028
|
+
return new FlexGridGridLanesMatch(matching.ast.text(node), node, "flex" /* LayoutType.FLEX */);
|
|
1024
1029
|
}
|
|
1025
|
-
if (
|
|
1026
|
-
return new
|
|
1030
|
+
if (FlexGridGridLanesMatcher.GRID.includes(text)) {
|
|
1031
|
+
return new FlexGridGridLanesMatch(matching.ast.text(node), node, "grid" /* LayoutType.GRID */);
|
|
1032
|
+
}
|
|
1033
|
+
if (FlexGridGridLanesMatcher.GRID_LANES.includes(text)) {
|
|
1034
|
+
return new FlexGridGridLanesMatch(matching.ast.text(node), node, "grid-lanes" /* LayoutType.GRID_LANES */);
|
|
1027
1035
|
}
|
|
1028
1036
|
return null;
|
|
1029
1037
|
}
|
|
@@ -1061,8 +1069,10 @@ export class GridTemplateMatcher extends matcherBase(GridTemplateMatch) {
|
|
|
1061
1069
|
// `needClosingLineNames` tracks if the current row can still consume an optional LineNames,
|
|
1062
1070
|
// which will decide if we should start a new line or not when a LineNames is encountered.
|
|
1063
1071
|
let needClosingLineNames = false;
|
|
1064
|
-
|
|
1065
|
-
|
|
1072
|
+
/**
|
|
1073
|
+
* Gather row definitions of [<line-names>? <string> <track-size>? <line-names>?], which
|
|
1074
|
+
* be rendered into separate lines.
|
|
1075
|
+
**/
|
|
1066
1076
|
function parseNodes(nodes, varParsingMode = false) {
|
|
1067
1077
|
for (const curNode of nodes) {
|
|
1068
1078
|
if (matching.getMatch(curNode) instanceof BaseVariableMatch) {
|
|
@@ -1159,7 +1169,7 @@ export class AnchorFunctionMatcher extends matcherBase(AnchorFunctionMatch) {
|
|
|
1159
1169
|
if (node.name === 'VariableName') {
|
|
1160
1170
|
// Double-dashed anchor reference to be rendered with a link to its matching anchor.
|
|
1161
1171
|
let parent = node.parent;
|
|
1162
|
-
if (
|
|
1172
|
+
if (parent?.name !== 'ArgList') {
|
|
1163
1173
|
return null;
|
|
1164
1174
|
}
|
|
1165
1175
|
parent = parent.parent;
|
|
@@ -1184,7 +1194,7 @@ export class AnchorFunctionMatcher extends matcherBase(AnchorFunctionMatch) {
|
|
|
1184
1194
|
return new AnchorFunctionMatch(matching.ast.text(node), node, calleeText);
|
|
1185
1195
|
}
|
|
1186
1196
|
}
|
|
1187
|
-
|
|
1197
|
+
/** For linking `position-anchor: --anchor-name`. **/
|
|
1188
1198
|
export class PositionAnchorMatch {
|
|
1189
1199
|
text;
|
|
1190
1200
|
matching;
|
|
@@ -7,6 +7,7 @@ import { CSSContainerQuery } from './CSSContainerQuery.js';
|
|
|
7
7
|
import { CSSLayer } from './CSSLayer.js';
|
|
8
8
|
import { CSSMedia } from './CSSMedia.js';
|
|
9
9
|
import { CSSScope } from './CSSScope.js';
|
|
10
|
+
import { CSSStartingStyle } from './CSSStartingStyle.js';
|
|
10
11
|
import { CSSStyleDeclaration, Type } from './CSSStyleDeclaration.js';
|
|
11
12
|
import { CSSSupports } from './CSSSupports.js';
|
|
12
13
|
function styleSheetHeaderForRule(cssModel, { styleSheetId }) {
|
|
@@ -17,10 +18,12 @@ export class CSSRule {
|
|
|
17
18
|
origin;
|
|
18
19
|
style;
|
|
19
20
|
header;
|
|
21
|
+
treeScope;
|
|
20
22
|
constructor(cssModel, payload) {
|
|
21
23
|
this.header = payload.header;
|
|
22
24
|
this.cssModelInternal = cssModel;
|
|
23
25
|
this.origin = payload.origin;
|
|
26
|
+
this.treeScope = payload.originTreeScopeNodeId;
|
|
24
27
|
this.style = new CSSStyleDeclaration(this.cssModelInternal, this, payload.style, Type.Regular);
|
|
25
28
|
}
|
|
26
29
|
get sourceURL() {
|
|
@@ -83,9 +86,15 @@ export class CSSStyleRule extends CSSRule {
|
|
|
83
86
|
scopes;
|
|
84
87
|
layers;
|
|
85
88
|
ruleTypes;
|
|
89
|
+
startingStyles;
|
|
86
90
|
wasUsed;
|
|
87
91
|
constructor(cssModel, payload, wasUsed) {
|
|
88
|
-
super(cssModel, {
|
|
92
|
+
super(cssModel, {
|
|
93
|
+
origin: payload.origin,
|
|
94
|
+
style: payload.style,
|
|
95
|
+
header: styleSheetHeaderForRule(cssModel, payload),
|
|
96
|
+
originTreeScopeNodeId: payload.originTreeScopeNodeId
|
|
97
|
+
});
|
|
89
98
|
this.reinitializeSelectors(payload.selectorList);
|
|
90
99
|
this.nestingSelectors = payload.nestingSelectors;
|
|
91
100
|
this.media = payload.media ? CSSMedia.parseMediaArrayPayload(cssModel, payload.media) : [];
|
|
@@ -95,6 +104,8 @@ export class CSSStyleRule extends CSSRule {
|
|
|
95
104
|
this.scopes = payload.scopes ? CSSScope.parseScopesPayload(cssModel, payload.scopes) : [];
|
|
96
105
|
this.supports = payload.supports ? CSSSupports.parseSupportsPayload(cssModel, payload.supports) : [];
|
|
97
106
|
this.layers = payload.layers ? CSSLayer.parseLayerPayload(cssModel, payload.layers) : [];
|
|
107
|
+
this.startingStyles =
|
|
108
|
+
payload.startingStyles ? CSSStartingStyle.parseStartingStylePayload(cssModel, payload.startingStyles) : [];
|
|
98
109
|
this.ruleTypes = payload.ruleTypes || [];
|
|
99
110
|
this.wasUsed = wasUsed || false;
|
|
100
111
|
}
|
|
@@ -184,7 +195,12 @@ export class CSSStyleRule extends CSSRule {
|
|
|
184
195
|
export class CSSPropertyRule extends CSSRule {
|
|
185
196
|
#name;
|
|
186
197
|
constructor(cssModel, payload) {
|
|
187
|
-
super(cssModel, {
|
|
198
|
+
super(cssModel, {
|
|
199
|
+
origin: payload.origin,
|
|
200
|
+
style: payload.style,
|
|
201
|
+
header: styleSheetHeaderForRule(cssModel, payload),
|
|
202
|
+
originTreeScopeNodeId: undefined,
|
|
203
|
+
});
|
|
188
204
|
this.#name = new CSSValue(payload.propertyName);
|
|
189
205
|
}
|
|
190
206
|
propertyName() {
|
|
@@ -211,14 +227,29 @@ export class CSSPropertyRule extends CSSRule {
|
|
|
211
227
|
return this.cssModelInternal.setPropertyRulePropertyName(styleSheetId, range, newPropertyName);
|
|
212
228
|
}
|
|
213
229
|
}
|
|
214
|
-
export class
|
|
215
|
-
#
|
|
230
|
+
export class CSSAtRule extends CSSRule {
|
|
231
|
+
#name;
|
|
232
|
+
#type;
|
|
233
|
+
#subsection;
|
|
216
234
|
constructor(cssModel, payload) {
|
|
217
|
-
super(cssModel, {
|
|
218
|
-
|
|
235
|
+
super(cssModel, {
|
|
236
|
+
origin: payload.origin,
|
|
237
|
+
style: payload.style,
|
|
238
|
+
header: styleSheetHeaderForRule(cssModel, payload),
|
|
239
|
+
originTreeScopeNodeId: undefined
|
|
240
|
+
});
|
|
241
|
+
this.#name = payload.name ? new CSSValue(payload.name) : null;
|
|
242
|
+
this.#type = payload.type;
|
|
243
|
+
this.#subsection = payload.subsection ?? null;
|
|
219
244
|
}
|
|
220
245
|
name() {
|
|
221
|
-
return this.#
|
|
246
|
+
return this.#name;
|
|
247
|
+
}
|
|
248
|
+
type() {
|
|
249
|
+
return this.#type;
|
|
250
|
+
}
|
|
251
|
+
subsection() {
|
|
252
|
+
return this.#subsection;
|
|
222
253
|
}
|
|
223
254
|
}
|
|
224
255
|
export class CSSKeyframesRule {
|
|
@@ -240,7 +271,12 @@ export class CSSKeyframeRule extends CSSRule {
|
|
|
240
271
|
#keyText;
|
|
241
272
|
#parentRuleName;
|
|
242
273
|
constructor(cssModel, payload, parentRuleName) {
|
|
243
|
-
super(cssModel, {
|
|
274
|
+
super(cssModel, {
|
|
275
|
+
origin: payload.origin,
|
|
276
|
+
style: payload.style,
|
|
277
|
+
header: styleSheetHeaderForRule(cssModel, payload),
|
|
278
|
+
originTreeScopeNodeId: undefined
|
|
279
|
+
});
|
|
244
280
|
this.reinitializeKey(payload.keyText);
|
|
245
281
|
this.#parentRuleName = parentRuleName;
|
|
246
282
|
}
|
|
@@ -284,7 +320,12 @@ export class CSSPositionTryRule extends CSSRule {
|
|
|
284
320
|
#name;
|
|
285
321
|
#active;
|
|
286
322
|
constructor(cssModel, payload) {
|
|
287
|
-
super(cssModel, {
|
|
323
|
+
super(cssModel, {
|
|
324
|
+
origin: payload.origin,
|
|
325
|
+
style: payload.style,
|
|
326
|
+
header: styleSheetHeaderForRule(cssModel, payload),
|
|
327
|
+
originTreeScopeNodeId: undefined
|
|
328
|
+
});
|
|
288
329
|
this.#name = new CSSValue(payload.name);
|
|
289
330
|
this.#active = payload.active;
|
|
290
331
|
}
|
|
@@ -303,7 +344,8 @@ export class CSSFunctionRule extends CSSRule {
|
|
|
303
344
|
super(cssModel, {
|
|
304
345
|
origin: payload.origin,
|
|
305
346
|
style: { cssProperties: [], shorthandEntries: [] },
|
|
306
|
-
header: styleSheetHeaderForRule(cssModel, payload)
|
|
347
|
+
header: styleSheetHeaderForRule(cssModel, payload),
|
|
348
|
+
originTreeScopeNodeId: undefined
|
|
307
349
|
});
|
|
308
350
|
this.#name = new CSSValue(payload.name);
|
|
309
351
|
this.#parameters = payload.parameters.map(({ name }) => name);
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
import * as TextUtils from '../../models/text_utils/text_utils.js';
|
|
5
|
+
import { CSSQuery } from './CSSQuery.js';
|
|
6
|
+
export class CSSStartingStyle extends CSSQuery {
|
|
7
|
+
static parseStartingStylePayload(cssModel, payload) {
|
|
8
|
+
return payload.map(p => new CSSStartingStyle(cssModel, p));
|
|
9
|
+
}
|
|
10
|
+
constructor(cssModel, payload) {
|
|
11
|
+
super(cssModel);
|
|
12
|
+
this.reinitialize(payload);
|
|
13
|
+
}
|
|
14
|
+
reinitialize(payload) {
|
|
15
|
+
this.range = payload.range ? TextUtils.TextRange.TextRange.fromObject(payload.range) : null;
|
|
16
|
+
this.styleSheetId = payload.styleSheetId;
|
|
17
|
+
}
|
|
18
|
+
active() {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
}
|