-
public final class CSSDomainThis domain exposes CSS read/write operations. All CSS objects (stylesheets, rules, and styles) have an associated
idused in subsequent operations on the related object. Each object type has a specificidstructure, and those are not interchangeable between objects of different kinds. CSS objects can be loaded using theget*ForNode()calls (which accept a DOM node id). A client can also keep track of stylesheets via thestyleSheetAdded/styleSheetRemovedevents and subsequently load the required stylesheet contents using thegetStyleSheet[Text]()methods.
-
-
Method Summary
Modifier and Type Method Description final Flow<CSSEvent>events()Subscribes to all events related to this domain. final Flow<CSSEvent.FontsUpdatedEvent>fontsUpdated()Fires whenever a web font is updated. final Flow<CSSEvent.MediaQueryResultChangedEvent>mediaQueryResultChanged()Fires whenever a MediaQuery result changes (for example, after a browser window has been resized.) The current implementation considers only viewport-dependent media features. final Flow<CSSEvent.StyleSheetAddedEvent>styleSheetAdded()Fired whenever an active document stylesheet is added. final Flow<CSSEvent.StyleSheetChangedEvent>styleSheetChanged()Fired whenever a stylesheet is changed as a result of the client operation. final Flow<CSSEvent.StyleSheetRemovedEvent>styleSheetRemoved()Fired whenever an active document stylesheet is removed. final AddRuleResponseaddRule(AddRuleRequest input)Inserts a new rule with the given ruleTextin a stylesheet with givenstyleSheetId, at the position specified bylocation.final CollectClassNamesResponsecollectClassNames(CollectClassNamesRequest input)Returns all class names from specified stylesheet. final CreateStyleSheetResponsecreateStyleSheet(CreateStyleSheetRequest input)Creates a new special "via-inspector" stylesheet in the frame with given frameId.final Unitdisable()Disables the CSS agent for the given page. final Unitenable()Enables the CSS agent for the given page. final UnitforcePseudoState(ForcePseudoStateRequest input)Ensures that the given node will have specified pseudo-classes whenever its style is computed by the browser. final GetBackgroundColorsResponsegetBackgroundColors(GetBackgroundColorsRequest input)Official doc final GetComputedStyleForNodeResponsegetComputedStyleForNode(GetComputedStyleForNodeRequest input)Returns the computed style for a DOM node identified by nodeId.final GetInlineStylesForNodeResponsegetInlineStylesForNode(GetInlineStylesForNodeRequest input)Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM attributes) for a DOM node identified by nodeId.final GetMatchedStylesForNodeResponsegetMatchedStylesForNode(GetMatchedStylesForNodeRequest input)Returns requested styles for a DOM node identified by nodeId.final GetMediaQueriesResponsegetMediaQueries()Returns all media queries parsed by the rendering engine. final GetPlatformFontsForNodeResponsegetPlatformFontsForNode(GetPlatformFontsForNodeRequest input)Requests information about platform fonts which we used to render child TextNodes in the given node. final GetStyleSheetTextResponsegetStyleSheetText(GetStyleSheetTextRequest input)Returns the current textual content for a stylesheet. final UnittrackComputedStyleUpdates(TrackComputedStyleUpdatesRequest input)Starts tracking the given computed styles for updates. final TakeComputedStyleUpdatesResponsetakeComputedStyleUpdates()Polls the next batch of computed style updates. final UnitsetEffectivePropertyValueForNode(SetEffectivePropertyValueForNodeRequest input)Find a rule with the given active property for the given node and set the new value for this propertyOfficial doc final SetKeyframeKeyResponsesetKeyframeKey(SetKeyframeKeyRequest input)Modifies the keyframe rule key text. final SetMediaTextResponsesetMediaText(SetMediaTextRequest input)Modifies the rule selector. final SetRuleSelectorResponsesetRuleSelector(SetRuleSelectorRequest input)Modifies the rule selector. final SetStyleSheetTextResponsesetStyleSheetText(SetStyleSheetTextRequest input)Sets the new stylesheet text. final SetStyleTextsResponsesetStyleTexts(SetStyleTextsRequest input)Applies specified style edits one after another in the given order. final UnitstartRuleUsageTracking()Enables the selector recording. final StopRuleUsageTrackingResponsestopRuleUsageTracking()Stop tracking rule usage and return the list of rules that were used since last call to takeCoverageDelta(or since start of coverage instrumentation)Official docfinal TakeCoverageDeltaResponsetakeCoverageDelta()Obtain list of rules that became used since last call to this method (or since start of coverage instrumentation)Official doc final UnitsetLocalFontsEnabled(SetLocalFontsEnabledRequest input)Enables/disables rendering of local CSS fonts (enabled by default). -
-
Method Detail
-
fontsUpdated
final Flow<CSSEvent.FontsUpdatedEvent> fontsUpdated()
Fires whenever a web font is updated. A non-empty font parameter indicates a successfully loaded web font
-
mediaQueryResultChanged
final Flow<CSSEvent.MediaQueryResultChangedEvent> mediaQueryResultChanged()
Fires whenever a MediaQuery result changes (for example, after a browser window has been resized.) The current implementation considers only viewport-dependent media features.
-
styleSheetAdded
final Flow<CSSEvent.StyleSheetAddedEvent> styleSheetAdded()
Fired whenever an active document stylesheet is added.
-
styleSheetChanged
final Flow<CSSEvent.StyleSheetChangedEvent> styleSheetChanged()
Fired whenever a stylesheet is changed as a result of the client operation.
-
styleSheetRemoved
final Flow<CSSEvent.StyleSheetRemovedEvent> styleSheetRemoved()
Fired whenever an active document stylesheet is removed.
-
addRule
final AddRuleResponse addRule(AddRuleRequest input)
Inserts a new rule with the given
ruleTextin a stylesheet with givenstyleSheetId, at the position specified bylocation.
-
collectClassNames
final CollectClassNamesResponse collectClassNames(CollectClassNamesRequest input)
Returns all class names from specified stylesheet.
-
createStyleSheet
final CreateStyleSheetResponse createStyleSheet(CreateStyleSheetRequest input)
Creates a new special "via-inspector" stylesheet in the frame with given
frameId.
-
enable
final Unit enable()
Enables the CSS agent for the given page. Clients should not assume that the CSS agent has been enabled until the result of this command is received.
-
forcePseudoState
final Unit forcePseudoState(ForcePseudoStateRequest input)
Ensures that the given node will have specified pseudo-classes whenever its style is computed by the browser.
-
getBackgroundColors
final GetBackgroundColorsResponse getBackgroundColors(GetBackgroundColorsRequest input)
-
getComputedStyleForNode
final GetComputedStyleForNodeResponse getComputedStyleForNode(GetComputedStyleForNodeRequest input)
Returns the computed style for a DOM node identified by
nodeId.
-
getInlineStylesForNode
final GetInlineStylesForNodeResponse getInlineStylesForNode(GetInlineStylesForNodeRequest input)
Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM attributes) for a DOM node identified by
nodeId.
-
getMatchedStylesForNode
final GetMatchedStylesForNodeResponse getMatchedStylesForNode(GetMatchedStylesForNodeRequest input)
Returns requested styles for a DOM node identified by
nodeId.
-
getMediaQueries
final GetMediaQueriesResponse getMediaQueries()
Returns all media queries parsed by the rendering engine.
-
getPlatformFontsForNode
final GetPlatformFontsForNodeResponse getPlatformFontsForNode(GetPlatformFontsForNodeRequest input)
Requests information about platform fonts which we used to render child TextNodes in the given node.
-
getStyleSheetText
final GetStyleSheetTextResponse getStyleSheetText(GetStyleSheetTextRequest input)
Returns the current textual content for a stylesheet.
-
trackComputedStyleUpdates
final Unit trackComputedStyleUpdates(TrackComputedStyleUpdatesRequest input)
Starts tracking the given computed styles for updates. The specified array of properties replaces the one previously specified. Pass empty array to disable tracking. Use takeComputedStyleUpdates to retrieve the list of nodes that had properties modified. The changes to computed style properties are only tracked for nodes pushed to the front-end by the DOM agent. If no changes to the tracked properties occur after the node has been pushed to the front-end, no updates will be issued for the node.
-
takeComputedStyleUpdates
final TakeComputedStyleUpdatesResponse takeComputedStyleUpdates()
Polls the next batch of computed style updates.
-
setEffectivePropertyValueForNode
final Unit setEffectivePropertyValueForNode(SetEffectivePropertyValueForNodeRequest input)
Find a rule with the given active property for the given node and set the new value for this property
-
setKeyframeKey
final SetKeyframeKeyResponse setKeyframeKey(SetKeyframeKeyRequest input)
Modifies the keyframe rule key text.
-
setMediaText
final SetMediaTextResponse setMediaText(SetMediaTextRequest input)
Modifies the rule selector.
-
setRuleSelector
final SetRuleSelectorResponse setRuleSelector(SetRuleSelectorRequest input)
Modifies the rule selector.
-
setStyleSheetText
final SetStyleSheetTextResponse setStyleSheetText(SetStyleSheetTextRequest input)
Sets the new stylesheet text.
-
setStyleTexts
final SetStyleTextsResponse setStyleTexts(SetStyleTextsRequest input)
Applies specified style edits one after another in the given order.
-
startRuleUsageTracking
final Unit startRuleUsageTracking()
Enables the selector recording.
-
stopRuleUsageTracking
final StopRuleUsageTrackingResponse stopRuleUsageTracking()
Stop tracking rule usage and return the list of rules that were used since last call to
takeCoverageDelta(or since start of coverage instrumentation)
-
takeCoverageDelta
final TakeCoverageDeltaResponse takeCoverageDelta()
Obtain list of rules that became used since last call to this method (or since start of coverage instrumentation)
-
setLocalFontsEnabled
final Unit setLocalFontsEnabled(SetLocalFontsEnabledRequest input)
Enables/disables rendering of local CSS fonts (enabled by default).
-
-
-
-