Package Torello.Browser
Class CSS
- java.lang.Object
-
- Torello.Browser.CSS
-
public class CSS extends java.lang.Object
Class created byAutomatic Code-Generator
.
This class was built using the Chrome Remote Dev-Tools A.P.I., which is specified by two JSON-RPC Files. These files were obtained from the Chrome Dev Tools Protocol Git Hub Page, which has a "Tip of Tree" (the latest) API-Specification Page Here: JSON-RPC Protocol Specification.
JSON-Viewable Google-API:
These files may be viewed here: browser_protocol.json and js_protocol.json.
These files were converted into this Java-Browser (CDT) Library; they are a Java-Alternative to the Node.js implementation.
HTML-Viewable API:
In addition to this Class-Library, these files were also converted to a simple HTML Page, which may be browsed here: Browser API Web-PageNode.js
RDP-API Implementation:
You may read about theNode.js Chrome Remote Interface
on the Node.js Package Manager Web-Site: NPM
This domain exposes CSS read/write operations. All CSS objects (stylesheets, rules, and styles) have an associatedid
used in subsequent operations on the related object. Each object type has a specificid
structure, 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
/styleSheetRemoved
events and subsequently load the required stylesheet contents using thegetStyleSheet[Text]()
methods.This class is intended to be used with a Headless Browser
These methods have been tested, to some degree, using Google Chrome. In order to use this class you must start a web-browser instance and make a connection to the browser using aRemote Debugging Port
. The initializations may be accomplished using classBRDPC
(Browser Remote Debug Protocol Connection).
Google-Chrome was used during the development process of the classes in this particular package. Note that, lately, it has been asserted Microsoft has switched to using the Chrome-Engine for its Microsoft Edge Browser Internal Code-Base. Therefore, there may limited support / functionality when running the methods in this class with Microsoft-Edge. There is the possibility these will work with Opera & Safari.
Check whether the your Web-Browser will allow itself to be driven by theWeb-Socket RDP-Port 9223
.
Foreign Function API:
Every one of the methods that reside in this class are designed to do nothing more than:- Accept Parameters from the User, and "Marshall Them" into a Valid JSON-Request
- Transmit the Marshalled Request-JSON to a Headless Web-Browser over a Web-Socket RDP Connection
- Receive BOTH that Method's Results AND any Browser Event-Firings from the Web-Socket
- Parse JSON Method-Results and Browser-Event Firings, and Subsequently Convert them to Standard Java-Types
- Report these Method-Results and Browser-Events to the User via an User-Registered Event-Listener or a Promise Object
Java-HTML Difference:
Unlike the bulk of the Java HTML JAR Library, there is very little native Java-Code, and very little testing that may be done on any of the classes & methods in this package. The code inside these classes does nothing more than marshall-and-unmarshall Java-Types into Json-Requests (and vice-versa). The Java-Script & Browser modules inside of a Google-Chrome instance are, theoretically, handling these requests, and returning their results (or events) over the Web-Socket Connection.
It has been asserted (by Google Chrome Developers) that some of these methods are only "partially working" or "experimental".
Hi-Lited Source-Code:- View Here: Torello/Browser/CSS.java
- Open New Browser-Tab: Torello/Browser/CSS.java
File Size: 171,770 Bytes Line Count: 4,195 '\n' Characters Found
Stateless Class:This class neither contains any program-state, nor can it be instantiated. The@StaticFunctional
Annotation may also be called 'The Spaghetti Report'.Static-Functional
classes are, essentially, C-Styled Files, without any constructors or non-static member fields. It is a concept very similar to the Java-Bean's@Stateless
Annotation.
- 1 Constructor(s), 1 declared private, zero-argument constructor
- 26 Method(s), 26 declared static
- 6 Field(s), 6 declared static, 5 declared final
- Fields excused from final modifier (with explanation):
Field 'counter' is not final. Reason: CONFIGURATION
-
-
Nested Class Summary
Type Classes: CSS Domain Types Modifier and Type Inner-Class static class
CSS.CSSComputedStyleProperty
[No Description Provided by Google]
static class
CSS.CSSContainerQuery
CSS container query rule descriptor.static class
CSS.CSSKeyframeRule
CSS keyframe rule representation.static class
CSS.CSSKeyframesRule
CSS keyframes rule representation.static class
CSS.CSSMedia
CSS media rule descriptor.static class
CSS.CSSProperty
CSS property declaration data.static class
CSS.CSSRule
CSS rule representation.static class
CSS.CSSStyle
CSS style representation.static class
CSS.CSSStyleSheetHeader
CSS stylesheet metainformation.static class
CSS.FontFace
Properties of a web font: https://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#font-descriptions and additional information such as platformFontFamily and fontVariationAxes.static class
CSS.FontVariationAxis
Information about font variation axes for variable fontsstatic class
CSS.InheritedStyleEntry
Inherited CSS rule collection from ancestor node.static class
CSS.MediaQuery
Media query descriptor.static class
CSS.MediaQueryExpression
Media query expression descriptor.static class
CSS.PlatformFontUsage
Information about amount of glyphs that were rendered with given font.static class
CSS.PseudoElementMatches
CSS rule collection for a single pseudo style.static class
CSS.RuleMatch
Match data for a CSS rule.static class
CSS.RuleUsage
CSS coverage information.static class
CSS.SelectorList
Selector list data.static class
CSS.ShorthandEntry
[No Description Provided by Google]
static class
CSS.SourceRange
Text range within a resource.static class
CSS.StyleDeclarationEdit
A descriptor of operation to mutate style declaration text.static class
CSS.Value
Data for a simple selector (these are delimited by commas in a selector list).Event Classes: CSS Domain Events Modifier and Type Inner-Class static class
CSS.fontsUpdated
Fires whenever a web font is updated.static class
CSS.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.static class
CSS.styleSheetAdded
Fired whenever an active document stylesheet is added.static class
CSS.styleSheetChanged
Fired whenever a stylesheet is changed as a result of the client operation.static class
CSS.styleSheetRemoved
Fired whenever an active document stylesheet is removed.
-
Field Summary
CSS Domain Enumerated String Types Modifier and Type Field static String[]
StyleSheetOrigin
Stylesheet type: "injected" for stylesheets injected via extension, "user-agent" for user-agent stylesheets, "inspector" for stylesheets created by the inspector (i.e.
-
Method Summary
CSS Domain Commands Script Returns Modifier and Type Method CSS.CSSRule
static Script<>
addRule(String styleSheetId, String ruleText, CSS.SourceRange location)
Inserts a new rule with the givenruleText
in a stylesheet with givenstyleSheetId
, at the position specified bylocation
.String[]
static Script<>
collectClassNames(String styleSheetId)
Returns all class names from specified stylesheet.String
static Script<>
createStyleSheet(String frameId)
Creates a new special "via-inspector" stylesheet in the frame with givenframeId
.NONE ( void
)static Script<>
disable()
Disables the CSS agent for the given page.NONE ( void
)static Script<>
enable()
Enables the CSS agent for the given page.NONE ( void
)static Script<>
forcePseudoState(int nodeId, String[] forcedPseudoClasses)
Ensures that the given node will have specified pseudo-classes whenever its style is computed by the browser.Ret3<String[],
String,
String>static Script<>
getBackgroundColors(int nodeId)
[No Description Provided by Google]
CSS.CSSComputedStyleProperty[]
static Script<>
getComputedStyleForNode(int nodeId)
Returns the computed style for a DOM node identified bynodeId
.Ret2<CSS.CSSStyle,
CSS.CSSStyle>static Script<>
getInlineStylesForNode(int nodeId)
Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM attributes) for a DOM node identified bynodeId
.Ret6<CSS.CSSStyle,
CSS.CSSStyle,
CSS.RuleMatch[],
CSS.PseudoElementMatches[],
CSS.InheritedStyleEntry[],
CSS.CSSKeyframesRule[]>static Script<>
getMatchedStylesForNode(int nodeId)
Returns requested styles for a DOM node identified bynodeId
.CSS.CSSMedia[]
static Script<>
getMediaQueries()
Returns all media queries parsed by the rendering engine.CSS.PlatformFontUsage[]
static Script<>
getPlatformFontsForNode(int nodeId)
Requests information about platform fonts which we used to render child TextNodes in the given node.String
static Script<>
getStyleSheetText(String styleSheetId)
Returns the current textual content for a stylesheet.CSS.CSSContainerQuery
static Script<>
setContainerQueryText(String styleSheetId, CSS.SourceRange range, String text)
Modifies the expression of a container query.NONE ( void
)static Script<>
setEffectivePropertyValueForNode(int nodeId, String propertyName, String value)
Find a rule with the given active property for the given node and set the new value for this propertyCSS.Value
static Script<>
setKeyframeKey(String styleSheetId, CSS.SourceRange range, String keyText)
Modifies the keyframe rule key text.NONE ( void
)static Script<>
setLocalFontsEnabled(boolean enabled)
Enables/disables rendering of local CSS fonts (enabled by default).CSS.CSSMedia
static Script<>
setMediaText(String styleSheetId, CSS.SourceRange range, String text)
Modifies the rule selector.CSS.SelectorList
static Script<>
setRuleSelector(String styleSheetId, CSS.SourceRange range, String selector)
Modifies the rule selector.String
static Script<>
setStyleSheetText(String styleSheetId, String text)
Sets the new stylesheet text.CSS.CSSStyle[]
static Script<>
setStyleTexts(CSS.StyleDeclarationEdit[] edits)
Applies specified style edits one after another in the given order.NONE ( void
)static Script<>
startRuleUsageTracking()
Enables the selector recording.CSS.RuleUsage[]
static Script<>
stopRuleUsageTracking()
Stop tracking rule usage and return the list of rules that were used since last call totakeCoverageDelta
(or since start of coverage instrumentation)int[]
static Script<>
takeComputedStyleUpdates()
Polls the next batch of computed style updates.Ret2<CSS.RuleUsage[],
Number>static Script<>
takeCoverageDelta()
Obtain list of rules that became used since last call to this method (or since start of coverage instrumentation)NONE ( void
)static Script<>
trackComputedStyleUpdates(CSS.CSSComputedStyleProperty[] propertiesToTrack)
Starts tracking the given computed styles for updates.
-
-
-
Field Detail
-
StyleSheetOrigin
public static final java.lang.String[] StyleSheetOrigin
Stylesheet type: "injected" for stylesheets injected via extension, "user-agent" for user-agent stylesheets, "inspector" for stylesheets created by the inspector (i.e. those holding the "via inspector" rules), "regular" for regular stylesheets.
-
-
Method Detail
-
addRule
public static Script<java.lang.String,JsonObject,CSS.CSSRule> addRule (java.lang.String styleSheetId, java.lang.String ruleText, CSS.SourceRange location)
Inserts a new rule with the givenruleText
in a stylesheet with givenstyleSheetId
, at the position specified bylocation
.- 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:
- An instance of
Script
<String,JsonObject
,CSS.CSSRule
>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.CSS.CSSRule
>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)CSS.CSSRule
(rule
The newly created rule.
-
collectClassNames
public static Script<java.lang.String,JsonObject,java.lang.String[]> collectClassNames (java.lang.String styleSheetId)
Returns all class names from specified stylesheet.- Parameters:
styleSheetId
- -- Returns:
- An instance of
Script
<String,JsonObject
, String[]>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, String[]>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsString[] (classNames
)
Class name list.
-
createStyleSheet
public static Script<java.lang.String,JsonObject,java.lang.String> createStyleSheet (java.lang.String frameId)
Creates a new special "via-inspector" stylesheet in the frame with givenframeId
.- Parameters:
frameId
- Identifier of the frame where "via-inspector" stylesheet should be created.- Returns:
- An instance of
Script
<String,JsonObject
, String>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, String>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsString (styleSheetId
)
Identifier of the created "via-inspector" stylesheet.
-
disable
public static Script<java.lang.String,JsonObject,Ret0> disable()
Disables the CSS agent for the given page.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
enable
public static Script<java.lang.String,JsonObject,Ret0> 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.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
forcePseudoState
public static Script<java.lang.String,JsonObject,Ret0> forcePseudoState (int nodeId, 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.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
getBackgroundColors
public static Script<java.lang.String,JsonObject,Ret3<java.lang.String[],java.lang.String,java.lang.String>> getBackgroundColors (int nodeId)
[No Description Provided by Google]
- Parameters:
nodeId
- Id of the node to get background colors for.- Returns:
- An instance of
Script
<String,JsonObject
,Ret3
>
ThisScript
may be executed (usingScript.exec()
), and aPromise
returned.
When thePromise
is awaited (usingPromise.await()
), theRet3
will subsequently be returned from that call.
The returned values are encapsulated in an instance ofRet3
Ret3.a: String[] (backgroundColors)
The range of background colors behind this element, if it contains any visible text. If no visible text is present, this will be undefined. In the case of a flat background color, this will consist of simply that color. In the case of a gradient, this will consist of each of the color stops. For anything more complicated, this will be an empty array. Images will be ignored (as if the image had failed to load).Ret3.b: String (computedFontSize)
The computed font size for this node, as a CSS computed value string (e.g. '12px').Ret3.c: String (computedFontWeight)
The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or '100').
-
getComputedStyleForNode
public static Script<java.lang.String,JsonObject,CSS.CSSComputedStyleProperty[]> getComputedStyleForNode (int nodeId)
Returns the computed style for a DOM node identified bynodeId
.- Parameters:
nodeId
- -- Returns:
- An instance of
Script
<String,JsonObject
,CSS.CSSComputedStyleProperty
[]>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.CSS.CSSComputedStyleProperty
[]>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)CSS.CSSComputedStyleProperty
[] (computedStyle
Computed style for the specified DOM node.
-
getInlineStylesForNode
public static Script<java.lang.String,JsonObject,Ret2<CSS.CSSStyle,CSS.CSSStyle>> getInlineStylesForNode (int nodeId)
Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM attributes) for a DOM node identified bynodeId
.- Parameters:
nodeId
- -- Returns:
- An instance of
Script
<String,JsonObject
,Ret2
>
ThisScript
may be executed (usingScript.exec()
), and aPromise
returned.
When thePromise
is awaited (usingPromise.await()
), theRet2
will subsequently be returned from that call.
The returned values are encapsulated in an instance ofRet2
Ret2.a:
CSS.CSSStyle
(inlineStyle)
Inline style for the specified DOM node.Ret2.b:
CSS.CSSStyle
(attributesStyle)
Attribute-defined element style (e.g. resulting from "width=20 height=100%").
-
getMatchedStylesForNode
public static Script<java.lang.String,JsonObject,Ret6<CSS.CSSStyle,CSS.CSSStyle,CSS.RuleMatch[],CSS.PseudoElementMatches[],CSS.InheritedStyleEntry[],CSS.CSSKeyframesRule[]>> getMatchedStylesForNode (int nodeId)
Returns requested styles for a DOM node identified bynodeId
.- Parameters:
nodeId
- -- Returns:
- An instance of
Script
<String,JsonObject
,Ret6
>
ThisScript
may be executed (usingScript.exec()
), and aPromise
returned.
When thePromise
is awaited (usingPromise.await()
), theRet6
will subsequently be returned from that call.
The returned values are encapsulated in an instance ofRet6
Ret6.a1:
CSS.CSSStyle
(inlineStyle)
Inline style for the specified DOM node.Ret6.b2:
CSS.CSSStyle
(attributesStyle)
Attribute-defined element style (e.g. resulting from "width=20 height=100%").Ret6.c3:
CSS.RuleMatch
[] (matchedCSSRules)
CSS rules matching this node, from all applicable stylesheets.Ret6.d4:
CSS.PseudoElementMatches
[] (pseudoElements)
Pseudo style matches for this node.Ret6.e5:
CSS.InheritedStyleEntry
[] (inherited)
A chain of inherited styles (from the immediate node parent up to the DOM tree root).Ret6.f6:
CSS.CSSKeyframesRule
[] (cssKeyframesRules)
A list of CSS keyframed animations matching this node.
-
getMediaQueries
public static Script<java.lang.String,JsonObject,CSS.CSSMedia[]> getMediaQueries ()
Returns all media queries parsed by the rendering engine.- Returns:
- An instance of
Script
<String,JsonObject
,CSS.CSSMedia
[]>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.CSS.CSSMedia
[]>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)CSS.CSSMedia
[] (medias
-
-
getPlatformFontsForNode
public static Script<java.lang.String,JsonObject,CSS.PlatformFontUsage[]> getPlatformFontsForNode (int nodeId)
Requests information about platform fonts which we used to render child TextNodes in the given node.- Parameters:
nodeId
- -- Returns:
- An instance of
Script
<String,JsonObject
,CSS.PlatformFontUsage
[]>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.CSS.PlatformFontUsage
[]>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)CSS.PlatformFontUsage
[] (fonts
Usage statistics for every employed platform font.
-
getStyleSheetText
public static Script<java.lang.String,JsonObject,java.lang.String> getStyleSheetText (java.lang.String styleSheetId)
Returns the current textual content for a stylesheet.- Parameters:
styleSheetId
- -- Returns:
- An instance of
Script
<String,JsonObject
, String>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, String>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsString (text
)
The stylesheet text.
-
trackComputedStyleUpdates
public static Script<java.lang.String,JsonObject,Ret0> trackComputedStyleUpdates (CSS.CSSComputedStyleProperty[] propertiesToTrack)
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.
EXPERIMENTAL- Parameters:
propertiesToTrack
- -- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
takeComputedStyleUpdates
public static Script<java.lang.String,JsonObject,int[]> takeComputedStyleUpdates ()
Polls the next batch of computed style updates.
EXPERIMENTAL- Returns:
- An instance of
Script
<String,JsonObject
, int[]>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, int[]>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsint[] (nodeIds
)
The list of node Ids that have their tracked computed styles updated
-
setEffectivePropertyValueForNode
public static Script<java.lang.String,JsonObject,Ret0> setEffectivePropertyValueForNode (int 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.propertyName
- -value
- -- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
setKeyframeKey
public static Script<java.lang.String,JsonObject,CSS.Value> setKeyframeKey (java.lang.String styleSheetId, CSS.SourceRange range, java.lang.String keyText)
Modifies the keyframe rule key text.- Parameters:
styleSheetId
- -range
- -keyText
- -- Returns:
- An instance of
Script
<String,JsonObject
,CSS.Value
>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.CSS.Value
>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)CSS.Value
(keyText
The resulting key text after modification.
-
setMediaText
public static Script<java.lang.String,JsonObject,CSS.CSSMedia> setMediaText (java.lang.String styleSheetId, CSS.SourceRange range, java.lang.String text)
Modifies the rule selector.- Parameters:
styleSheetId
- -range
- -text
- -- Returns:
- An instance of
Script
<String,JsonObject
,CSS.CSSMedia
>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.CSS.CSSMedia
>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)CSS.CSSMedia
(media
The resulting CSS media rule after modification.
-
setContainerQueryText
public static Script<java.lang.String,JsonObject,CSS.CSSContainerQuery> setContainerQueryText (java.lang.String styleSheetId, CSS.SourceRange range, java.lang.String text)
Modifies the expression of a container query.
EXPERIMENTAL- Parameters:
styleSheetId
- -range
- -text
- -- Returns:
- An instance of
Script
<String,JsonObject
,CSS.CSSContainerQuery
>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.CSS.CSSContainerQuery
>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)CSS.CSSContainerQuery
(containerQuery
The resulting CSS container query rule after modification.
-
setRuleSelector
public static Script<java.lang.String,JsonObject,CSS.SelectorList> setRuleSelector (java.lang.String styleSheetId, CSS.SourceRange range, java.lang.String selector)
Modifies the rule selector.- Parameters:
styleSheetId
- -range
- -selector
- -- Returns:
- An instance of
Script
<String,JsonObject
,CSS.SelectorList
>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.CSS.SelectorList
>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)CSS.SelectorList
(selectorList
The resulting selector list after modification.
-
setStyleSheetText
public static Script<java.lang.String,JsonObject,java.lang.String> setStyleSheetText (java.lang.String styleSheetId, java.lang.String text)
Sets the new stylesheet text.- Parameters:
styleSheetId
- -text
- -- Returns:
- An instance of
Script
<String,JsonObject
, String>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject, String>
will be returned.
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returnsString (sourceMapURL
)
URL of source map associated with script (if any).
-
setStyleTexts
public static Script<java.lang.String,JsonObject,CSS.CSSStyle[]> setStyleTexts (CSS.StyleDeclarationEdit[] edits)
Applies specified style edits one after another in the given order.- Parameters:
edits
- -- Returns:
- An instance of
Script
<String,JsonObject
,CSS.CSSStyle
[]>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.CSS.CSSStyle
[]>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)CSS.CSSStyle
[] (styles
The resulting styles after modification.
-
startRuleUsageTracking
public static Script<java.lang.String,JsonObject,Ret0> startRuleUsageTracking ()
Enables the selector recording.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
stopRuleUsageTracking
public static Script<java.lang.String,JsonObject,CSS.RuleUsage[]> stopRuleUsageTracking ()
Stop tracking rule usage and return the list of rules that were used since last call totakeCoverageDelta
(or since start of coverage instrumentation)- Returns:
- An instance of
Script
<String,JsonObject
,CSS.RuleUsage
[]>
This script may be executed, usingScript.exec()
, and afterwards, aPromise
<JsonObject,
will be returned.CSS.RuleUsage
[]>
Finally, thePromise
may be awaited, usingPromise.await()
, and the returned result of this Browser Function may may be retrieved.
This Browser Function returns
)CSS.RuleUsage
[] (ruleUsage
-
-
takeCoverageDelta
public static Script<java.lang.String,JsonObject,Ret2<CSS.RuleUsage[],java.lang.Number>> takeCoverageDelta ()
Obtain list of rules that became used since last call to this method (or since start of coverage instrumentation)- Returns:
- An instance of
Script
<String,JsonObject
,Ret2
>
ThisScript
may be executed (usingScript.exec()
), and aPromise
returned.
When thePromise
is awaited (usingPromise.await()
), theRet2
will subsequently be returned from that call.
The returned values are encapsulated in an instance ofRet2
Ret2.a:
CSS.RuleUsage
[] (coverage)
-Ret2.b: Number (timestamp)
Monotonically increasing time, in seconds.
-
setLocalFontsEnabled
public static Script<java.lang.String,JsonObject,Ret0> setLocalFontsEnabled (boolean enabled)
Enables/disables rendering of local CSS fonts (enabled by default).
EXPERIMENTAL- Parameters:
enabled
- Whether rendering of local fonts is enabled.- Returns:
- An instance of
Script
<String,JsonObject
,Ret0
>
ThisScript
instance must be executed before the browser receives the invocation-request.
This Browser-Function does not have a return-value. You may choose to await thePromise
<JsonObject,
Ret0
>
to ensure the Browser Function has run to completion.
-
-