chrome-devtools-kotlin / org.hildan.chrome.devtools.domains.css / CSSDomain

CSSDomain

class CSSDomain

This domain exposes CSS read/write operations. All CSS objects (stylesheets, rules, and styles) have an associated id used in subsequent operations on the related object. Each object type has a specific id structure, and those are not interchangeable between objects of different kinds. CSS objects can be loaded using the get*ForNode() calls (which accept a DOM node id). A client can also keep track of stylesheets via the styleSheetAdded/styleSheetRemoved events and subsequently load the required stylesheet contents using the getStyleSheet[Text]() methods.

Functions

addRule

Inserts a new rule with the given ruleText in a stylesheet with given styleSheetId, at the position specified by location.

suspend fun addRule(input: AddRuleRequest): AddRuleResponse

collectClassNames

Returns all class names from specified stylesheet.

suspend fun collectClassNames(input: CollectClassNamesRequest): CollectClassNamesResponse

createStyleSheet

Creates a new special "via-inspector" stylesheet in the frame with given frameId.

suspend fun createStyleSheet(input: CreateStyleSheetRequest): CreateStyleSheetResponse

disable

Disables the CSS agent for the given page.

suspend fun disable(): 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.

suspend fun enable(): Unit

events

Subscribes to all events related to this domain.

fun events(): Flow<CSSEvent>

fontsUpdated

Fires whenever a web font is updated. A non-empty font parameter indicates a successfully loaded web font

fun fontsUpdated(): Flow<FontsUpdatedEvent>

forcePseudoState

Ensures that the given node will have specified pseudo-classes whenever its style is computed by the browser.

suspend fun forcePseudoState(input: ForcePseudoStateRequest): Unit

getBackgroundColors

suspend fun getBackgroundColors(input: GetBackgroundColorsRequest): GetBackgroundColorsResponse

getComputedStyleForNode

Returns the computed style for a DOM node identified by nodeId.

suspend fun getComputedStyleForNode(input: GetComputedStyleForNodeRequest): GetComputedStyleForNodeResponse

getInlineStylesForNode

Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM attributes) for a DOM node identified by nodeId.

suspend fun getInlineStylesForNode(input: GetInlineStylesForNodeRequest): GetInlineStylesForNodeResponse

getMatchedStylesForNode

Returns requested styles for a DOM node identified by nodeId.

suspend fun getMatchedStylesForNode(input: GetMatchedStylesForNodeRequest): GetMatchedStylesForNodeResponse

getMediaQueries

Returns all media queries parsed by the rendering engine.

suspend fun getMediaQueries(): GetMediaQueriesResponse

getPlatformFontsForNode

Requests information about platform fonts which we used to render child TextNodes in the given node.

suspend fun getPlatformFontsForNode(input: GetPlatformFontsForNodeRequest): GetPlatformFontsForNodeResponse

getStyleSheetText

Returns the current textual content for a stylesheet.

suspend fun getStyleSheetText(input: GetStyleSheetTextRequest): GetStyleSheetTextResponse

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.

fun mediaQueryResultChanged(): Flow<MediaQueryResultChangedEvent>

setEffectivePropertyValueForNode

Find a rule with the given active property for the given node and set the new value for this property

suspend fun setEffectivePropertyValueForNode(input: SetEffectivePropertyValueForNodeRequest): Unit

setKeyframeKey

Modifies the keyframe rule key text.

suspend fun setKeyframeKey(input: SetKeyframeKeyRequest): SetKeyframeKeyResponse

setLocalFontsEnabled

Enables/disables rendering of local CSS fonts (enabled by default).

suspend fun setLocalFontsEnabled(input: SetLocalFontsEnabledRequest): Unit

setMediaText

Modifies the rule selector.

suspend fun setMediaText(input: SetMediaTextRequest): SetMediaTextResponse

setRuleSelector

Modifies the rule selector.

suspend fun setRuleSelector(input: SetRuleSelectorRequest): SetRuleSelectorResponse

setStyleSheetText

Sets the new stylesheet text.

suspend fun setStyleSheetText(input: SetStyleSheetTextRequest): SetStyleSheetTextResponse

setStyleTexts

Applies specified style edits one after another in the given order.

suspend fun setStyleTexts(input: SetStyleTextsRequest): SetStyleTextsResponse

startRuleUsageTracking

Enables the selector recording.

suspend fun startRuleUsageTracking(): Unit

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)

suspend fun stopRuleUsageTracking(): StopRuleUsageTrackingResponse

styleSheetAdded

Fired whenever an active document stylesheet is added.

fun styleSheetAdded(): Flow<StyleSheetAddedEvent>

styleSheetChanged

Fired whenever a stylesheet is changed as a result of the client operation.

fun styleSheetChanged(): Flow<StyleSheetChangedEvent>

styleSheetRemoved

Fired whenever an active document stylesheet is removed.

fun styleSheetRemoved(): Flow<StyleSheetRemovedEvent>

takeComputedStyleUpdates

Polls the next batch of computed style updates.

suspend fun takeComputedStyleUpdates(): TakeComputedStyleUpdatesResponse

takeCoverageDelta

Obtain list of rules that became used since last call to this method (or since start of coverage instrumentation)

suspend fun takeCoverageDelta(): TakeCoverageDeltaResponse

trackComputedStyleUpdates

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.

suspend fun trackComputedStyleUpdates(input: TrackComputedStyleUpdatesRequest): Unit