Interface CSS

All Known Implementing Classes:
CSSImpl

public interface CSS
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
  • Method Summary

    Modifier and Type Method Description
    CSSRule addRule​(java.lang.String styleSheetId, java.lang.String ruleText, SourceRange location)
    Inserts a new rule with the given `ruleText` in a stylesheet with given `styleSheetId`, at the position specified by `location`.
    java.util.List<java.lang.String> collectClassNames​(java.lang.String styleSheetId)
    Returns all class names from specified stylesheet.
    java.lang.String createStyleSheet​(java.lang.String frameId)
    Creates a new special "via-inspector" stylesheet in the frame with given `frameId`.
    void disable()
    Disables the CSS agent for the given page.
    void enable()
    Enables the CSS agent for the given page.
    void forcePseudoState​(java.lang.Integer nodeId, java.util.List<java.lang.String> forcedPseudoClasses)
    Ensures that the given node will have specified pseudo-classes whenever its style is computed by the browser.
    GetBackgroundColorsResult getBackgroundColors​(java.lang.Integer nodeId)  
    java.util.List<CSSComputedStyleProperty> getComputedStyleForNode​(java.lang.Integer nodeId)
    Returns the computed style for a DOM node identified by `nodeId`.
    GetInlineStylesForNodeResult getInlineStylesForNode​(java.lang.Integer nodeId)
    Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM attributes) for a DOM node identified by `nodeId`.
    GetMatchedStylesForNodeResult getMatchedStylesForNode​(java.lang.Integer nodeId)
    Returns requested styles for a DOM node identified by `nodeId`.
    java.util.List<CSSMedia> getMediaQueries()
    Returns all media queries parsed by the rendering engine.
    java.util.List<PlatformFontUsage> getPlatformFontsForNode​(java.lang.Integer nodeId)
    Requests information about platform fonts which we used to render child TextNodes in the given node.
    java.lang.String getStyleSheetText​(java.lang.String styleSheetId)
    Returns the current textual content for a stylesheet.
    void setEffectivePropertyValueForNode​(java.lang.Integer nodeId, java.lang.String propertyName, java.lang.String value)
    Find a rule with the given active property for the given node and set the new value for this property
    Value setKeyframeKey​(java.lang.String styleSheetId, SourceRange range, java.lang.String keyText)
    Modifies the keyframe rule key text.
    CSSMedia setMediaText​(java.lang.String styleSheetId, SourceRange range, java.lang.String text)
    Modifies the rule selector.
    SelectorList setRuleSelector​(java.lang.String styleSheetId, SourceRange range, java.lang.String selector)
    Modifies the rule selector.
    java.lang.String setStyleSheetText​(java.lang.String styleSheetId, java.lang.String text)
    Sets the new stylesheet text.
    java.util.List<CSSStyle> setStyleTexts​(java.util.List<StyleDeclarationEdit> edits)
    Applies specified style edits one after another in the given order.
    void startRuleUsageTracking()
    Enables the selector recording.
    java.util.List<RuleUsage> 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)
    java.util.List<RuleUsage> takeCoverageDelta()
    Obtain list of rules that became used since last call to this method (or since start of coverage instrumentation)
  • Method Details

    • addRule

      CSSRule addRule​(java.lang.String styleSheetId, java.lang.String ruleText, SourceRange location)
      Inserts a new rule with the given `ruleText` in a stylesheet with given `styleSheetId`, at the position specified by `location`.
      Parameters:
      styleSheetId - The css style sheet identifier where a new rule should be inserted.
      ruleText - The text of a new rule.
      location - Text position of a new rule in the target style sheet.
      Returns:
      The newly created rule.
    • collectClassNames

      java.util.List<java.lang.String> collectClassNames​(java.lang.String styleSheetId)
      Returns all class names from specified stylesheet.
      Returns:
      Class name list.
    • createStyleSheet

      java.lang.String createStyleSheet​(java.lang.String frameId)
      Creates a new special "via-inspector" stylesheet in the frame with given `frameId`.
      Parameters:
      frameId - Identifier of the frame where "via-inspector" stylesheet should be created.
      Returns:
      Identifier of the created "via-inspector" stylesheet.
    • disable

      void disable()
      Disables the CSS agent for the given page.
    • enable

      void 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

      void forcePseudoState​(java.lang.Integer nodeId, java.util.List<java.lang.String> forcedPseudoClasses)
      Ensures that the given node will have specified pseudo-classes whenever its style is computed by the browser.
      Parameters:
      nodeId - The element id for which to force the pseudo state.
      forcedPseudoClasses - Element pseudo classes to force when computing the element's style.
    • getBackgroundColors

      GetBackgroundColorsResult getBackgroundColors​(java.lang.Integer nodeId)
      Returns:
      GetBackgroundColorsResult
    • getComputedStyleForNode

      java.util.List<CSSComputedStyleProperty> getComputedStyleForNode​(java.lang.Integer nodeId)
      Returns the computed style for a DOM node identified by `nodeId`.
      Returns:
      Computed style for the specified DOM node.
    • getInlineStylesForNode

      GetInlineStylesForNodeResult getInlineStylesForNode​(java.lang.Integer nodeId)
      Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM attributes) for a DOM node identified by `nodeId`.
      Returns:
      GetInlineStylesForNodeResult
    • getMatchedStylesForNode

      GetMatchedStylesForNodeResult getMatchedStylesForNode​(java.lang.Integer nodeId)
      Returns requested styles for a DOM node identified by `nodeId`.
      Returns:
      GetMatchedStylesForNodeResult
    • getMediaQueries

      java.util.List<CSSMedia> getMediaQueries()
      Returns all media queries parsed by the rendering engine.
    • getPlatformFontsForNode

      java.util.List<PlatformFontUsage> getPlatformFontsForNode​(java.lang.Integer nodeId)
      Requests information about platform fonts which we used to render child TextNodes in the given node.
      Returns:
      Usage statistics for every employed platform font.
    • getStyleSheetText

      java.lang.String getStyleSheetText​(java.lang.String styleSheetId)
      Returns the current textual content for a stylesheet.
      Returns:
      The stylesheet text.
    • setEffectivePropertyValueForNode

      void setEffectivePropertyValueForNode​(java.lang.Integer nodeId, java.lang.String propertyName, java.lang.String value)
      Find a rule with the given active property for the given node and set the new value for this property
      Parameters:
      nodeId - The element id for which to set property.
    • setKeyframeKey

      Value setKeyframeKey​(java.lang.String styleSheetId, SourceRange range, java.lang.String keyText)
      Modifies the keyframe rule key text.
      Returns:
      The resulting key text after modification.
    • setMediaText

      CSSMedia setMediaText​(java.lang.String styleSheetId, SourceRange range, java.lang.String text)
      Modifies the rule selector.
      Returns:
      The resulting CSS media rule after modification.
    • setRuleSelector

      SelectorList setRuleSelector​(java.lang.String styleSheetId, SourceRange range, java.lang.String selector)
      Modifies the rule selector.
      Returns:
      The resulting selector list after modification.
    • setStyleSheetText

      java.lang.String setStyleSheetText​(java.lang.String styleSheetId, java.lang.String text)
      Sets the new stylesheet text.
      Returns:
      URL of source map associated with script (if any).
    • setStyleTexts

      java.util.List<CSSStyle> setStyleTexts​(java.util.List<StyleDeclarationEdit> edits)
      Applies specified style edits one after another in the given order.
      Returns:
      The resulting styles after modification.
    • startRuleUsageTracking

      void startRuleUsageTracking()
      Enables the selector recording.
    • stopRuleUsageTracking

      java.util.List<RuleUsage> 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

      java.util.List<RuleUsage> takeCoverageDelta()
      Obtain list of rules that became used since last call to this method (or since start of coverage instrumentation)