Class CSSImpl

java.lang.Object
io.webfolder.cdp.command.CSSImpl
All Implemented Interfaces:
CSS

public class CSSImpl
extends java.lang.Object
implements CSS
  • Constructor Summary

    Constructors 
    Constructor Description
    CSSImpl​(SessionInvocationHandler handler)  
  • 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)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • addRule

      public CSSRule addRule​(java.lang.String styleSheetId, java.lang.String ruleText, SourceRange location)
      Description copied from interface: CSS
      Inserts a new rule with the given `ruleText` in a stylesheet with given `styleSheetId`, at the position specified by `location`.
      Specified by:
      addRule in interface CSS
      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

      public java.util.List<java.lang.String> collectClassNames​(java.lang.String styleSheetId)
      Description copied from interface: CSS
      Returns all class names from specified stylesheet.
      Specified by:
      collectClassNames in interface CSS
      Returns:
      Class name list.
    • createStyleSheet

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

      public void disable()
      Description copied from interface: CSS
      Disables the CSS agent for the given page.
      Specified by:
      disable in interface CSS
    • enable

      public void enable()
      Description copied from interface: CSS
      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.
      Specified by:
      enable in interface CSS
    • forcePseudoState

      public void forcePseudoState​(java.lang.Integer nodeId, java.util.List<java.lang.String> forcedPseudoClasses)
      Description copied from interface: CSS
      Ensures that the given node will have specified pseudo-classes whenever its style is computed by the browser.
      Specified by:
      forcePseudoState in interface CSS
      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

      public GetBackgroundColorsResult getBackgroundColors​(java.lang.Integer nodeId)
      Specified by:
      getBackgroundColors in interface CSS
      Returns:
      GetBackgroundColorsResult
    • getComputedStyleForNode

      public java.util.List<CSSComputedStyleProperty> getComputedStyleForNode​(java.lang.Integer nodeId)
      Description copied from interface: CSS
      Returns the computed style for a DOM node identified by `nodeId`.
      Specified by:
      getComputedStyleForNode in interface CSS
      Returns:
      Computed style for the specified DOM node.
    • getInlineStylesForNode

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

      public GetMatchedStylesForNodeResult getMatchedStylesForNode​(java.lang.Integer nodeId)
      Description copied from interface: CSS
      Returns requested styles for a DOM node identified by `nodeId`.
      Specified by:
      getMatchedStylesForNode in interface CSS
      Returns:
      GetMatchedStylesForNodeResult
    • getMediaQueries

      public java.util.List<CSSMedia> getMediaQueries()
      Description copied from interface: CSS
      Returns all media queries parsed by the rendering engine.
      Specified by:
      getMediaQueries in interface CSS
    • getPlatformFontsForNode

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

      public java.lang.String getStyleSheetText​(java.lang.String styleSheetId)
      Description copied from interface: CSS
      Returns the current textual content for a stylesheet.
      Specified by:
      getStyleSheetText in interface CSS
      Returns:
      The stylesheet text.
    • setEffectivePropertyValueForNode

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

      public Value setKeyframeKey​(java.lang.String styleSheetId, SourceRange range, java.lang.String keyText)
      Description copied from interface: CSS
      Modifies the keyframe rule key text.
      Specified by:
      setKeyframeKey in interface CSS
      Returns:
      The resulting key text after modification.
    • setMediaText

      public CSSMedia setMediaText​(java.lang.String styleSheetId, SourceRange range, java.lang.String text)
      Description copied from interface: CSS
      Modifies the rule selector.
      Specified by:
      setMediaText in interface CSS
      Returns:
      The resulting CSS media rule after modification.
    • setRuleSelector

      public SelectorList setRuleSelector​(java.lang.String styleSheetId, SourceRange range, java.lang.String selector)
      Description copied from interface: CSS
      Modifies the rule selector.
      Specified by:
      setRuleSelector in interface CSS
      Returns:
      The resulting selector list after modification.
    • setStyleSheetText

      public java.lang.String setStyleSheetText​(java.lang.String styleSheetId, java.lang.String text)
      Description copied from interface: CSS
      Sets the new stylesheet text.
      Specified by:
      setStyleSheetText in interface CSS
      Returns:
      URL of source map associated with script (if any).
    • setStyleTexts

      public java.util.List<CSSStyle> setStyleTexts​(java.util.List<StyleDeclarationEdit> edits)
      Description copied from interface: CSS
      Applies specified style edits one after another in the given order.
      Specified by:
      setStyleTexts in interface CSS
      Returns:
      The resulting styles after modification.
    • startRuleUsageTracking

      public void startRuleUsageTracking()
      Description copied from interface: CSS
      Enables the selector recording.
      Specified by:
      startRuleUsageTracking in interface CSS
    • stopRuleUsageTracking

      public java.util.List<RuleUsage> stopRuleUsageTracking()
      Description copied from interface: CSS
      Stop tracking rule usage and return the list of rules that were used since last call to `takeCoverageDelta` (or since start of coverage instrumentation)
      Specified by:
      stopRuleUsageTracking in interface CSS
    • takeCoverageDelta

      public java.util.List<RuleUsage> takeCoverageDelta()
      Description copied from interface: CSS
      Obtain list of rules that became used since last call to this method (or since start of coverage instrumentation)
      Specified by:
      takeCoverageDelta in interface CSS