2017-01-24 15:09:23 +00:00
// Package css provides the Chrome Debugging Protocol
2017-02-12 04:59:33 +00:00
// commands, types, and events for the CSS domain.
2017-01-24 15:09:23 +00:00
//
// 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
2017-06-30 23:55:30 +00:00
// a DOM node id). A client can also keep track of stylesheets via the
// styleSheetAdded/styleSheetRemoved events and subsequently load the required
2017-01-24 15:09:23 +00:00
// stylesheet contents using the getStyleSheet[Text]() methods.
//
// Generated by the chromedp-gen command.
package css
2017-07-09 02:05:19 +00:00
// Code generated by chromedp-gen. DO NOT EDIT.
2017-01-24 15:09:23 +00:00
import (
"context"
2017-01-26 07:28:34 +00:00
cdp "github.com/knq/chromedp/cdp"
2017-01-24 15:09:23 +00:00
)
// EnableParams 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.
type EnableParams struct { }
// 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.
func Enable ( ) * EnableParams {
return & EnableParams { }
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.enable against the provided context and
// target handler.
func ( p * EnableParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandCSSEnable , nil , nil )
2017-01-24 15:09:23 +00:00
}
// DisableParams disables the CSS agent for the given page.
type DisableParams struct { }
// Disable disables the CSS agent for the given page.
func Disable ( ) * DisableParams {
return & DisableParams { }
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.disable against the provided context and
// target handler.
func ( p * DisableParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandCSSDisable , nil , nil )
2017-01-24 15:09:23 +00:00
}
// GetMatchedStylesForNodeParams returns requested styles for a DOM node
// identified by nodeId.
type GetMatchedStylesForNodeParams struct {
2017-01-26 07:28:34 +00:00
NodeID cdp . NodeID ` json:"nodeId" `
2017-01-24 15:09:23 +00:00
}
// GetMatchedStylesForNode returns requested styles for a DOM node identified
// by nodeId.
//
// parameters:
2017-01-26 07:28:34 +00:00
// nodeID
func GetMatchedStylesForNode ( nodeID cdp . NodeID ) * GetMatchedStylesForNodeParams {
2017-01-24 15:09:23 +00:00
return & GetMatchedStylesForNodeParams {
2017-01-26 07:28:34 +00:00
NodeID : nodeID ,
2017-01-24 15:09:23 +00:00
}
}
// GetMatchedStylesForNodeReturns return values.
type GetMatchedStylesForNodeReturns struct {
InlineStyle * Style ` json:"inlineStyle,omitempty" ` // Inline style for the specified DOM node.
AttributesStyle * Style ` json:"attributesStyle,omitempty" ` // Attribute-defined element style (e.g. resulting from "width=20 height=100%").
MatchedCSSRules [ ] * RuleMatch ` json:"matchedCSSRules,omitempty" ` // CSS rules matching this node, from all applicable stylesheets.
PseudoElements [ ] * PseudoElementMatches ` json:"pseudoElements,omitempty" ` // Pseudo style matches for this node.
Inherited [ ] * InheritedStyleEntry ` json:"inherited,omitempty" ` // A chain of inherited styles (from the immediate node parent up to the DOM tree root).
CSSKeyframesRules [ ] * KeyframesRule ` json:"cssKeyframesRules,omitempty" ` // A list of CSS keyframed animations matching this node.
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.getMatchedStylesForNode against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// inlineStyle - Inline style for the specified DOM node.
// attributesStyle - Attribute-defined element style (e.g. resulting from "width=20 height=100%").
// matchedCSSRules - CSS rules matching this node, from all applicable stylesheets.
// pseudoElements - Pseudo style matches for this node.
// inherited - A chain of inherited styles (from the immediate node parent up to the DOM tree root).
// cssKeyframesRules - A list of CSS keyframed animations matching this node.
2017-02-12 04:59:33 +00:00
func ( p * GetMatchedStylesForNodeParams ) Do ( ctxt context . Context , h cdp . Handler ) ( inlineStyle * Style , attributesStyle * Style , matchedCSSRules [ ] * RuleMatch , pseudoElements [ ] * PseudoElementMatches , inherited [ ] * InheritedStyleEntry , cssKeyframesRules [ ] * KeyframesRule , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res GetMatchedStylesForNodeReturns
err = h . Execute ( ctxt , cdp . CommandCSSGetMatchedStylesForNode , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return nil , nil , nil , nil , nil , nil , err
}
2017-02-14 08:41:23 +00:00
return res . InlineStyle , res . AttributesStyle , res . MatchedCSSRules , res . PseudoElements , res . Inherited , res . CSSKeyframesRules , nil
2017-01-24 15:09:23 +00:00
}
// GetInlineStylesForNodeParams returns the styles defined inline (explicitly
// in the "style" attribute and implicitly, using DOM attributes) for a DOM node
// identified by nodeId.
type GetInlineStylesForNodeParams struct {
2017-01-26 07:28:34 +00:00
NodeID cdp . NodeID ` json:"nodeId" `
2017-01-24 15:09:23 +00:00
}
// GetInlineStylesForNode returns the styles defined inline (explicitly in
// the "style" attribute and implicitly, using DOM attributes) for a DOM node
// identified by nodeId.
//
// parameters:
2017-01-26 07:28:34 +00:00
// nodeID
func GetInlineStylesForNode ( nodeID cdp . NodeID ) * GetInlineStylesForNodeParams {
2017-01-24 15:09:23 +00:00
return & GetInlineStylesForNodeParams {
2017-01-26 07:28:34 +00:00
NodeID : nodeID ,
2017-01-24 15:09:23 +00:00
}
}
// GetInlineStylesForNodeReturns return values.
type GetInlineStylesForNodeReturns struct {
InlineStyle * Style ` json:"inlineStyle,omitempty" ` // Inline style for the specified DOM node.
AttributesStyle * Style ` json:"attributesStyle,omitempty" ` // Attribute-defined element style (e.g. resulting from "width=20 height=100%").
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.getInlineStylesForNode against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// inlineStyle - Inline style for the specified DOM node.
// attributesStyle - Attribute-defined element style (e.g. resulting from "width=20 height=100%").
2017-02-12 04:59:33 +00:00
func ( p * GetInlineStylesForNodeParams ) Do ( ctxt context . Context , h cdp . Handler ) ( inlineStyle * Style , attributesStyle * Style , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res GetInlineStylesForNodeReturns
err = h . Execute ( ctxt , cdp . CommandCSSGetInlineStylesForNode , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return nil , nil , err
}
2017-02-14 08:41:23 +00:00
return res . InlineStyle , res . AttributesStyle , nil
2017-01-24 15:09:23 +00:00
}
// GetComputedStyleForNodeParams returns the computed style for a DOM node
// identified by nodeId.
type GetComputedStyleForNodeParams struct {
2017-01-26 07:28:34 +00:00
NodeID cdp . NodeID ` json:"nodeId" `
2017-01-24 15:09:23 +00:00
}
// GetComputedStyleForNode returns the computed style for a DOM node
// identified by nodeId.
//
// parameters:
2017-01-26 07:28:34 +00:00
// nodeID
func GetComputedStyleForNode ( nodeID cdp . NodeID ) * GetComputedStyleForNodeParams {
2017-01-24 15:09:23 +00:00
return & GetComputedStyleForNodeParams {
2017-01-26 07:28:34 +00:00
NodeID : nodeID ,
2017-01-24 15:09:23 +00:00
}
}
// GetComputedStyleForNodeReturns return values.
type GetComputedStyleForNodeReturns struct {
ComputedStyle [ ] * ComputedProperty ` json:"computedStyle,omitempty" ` // Computed style for the specified DOM node.
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.getComputedStyleForNode against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// computedStyle - Computed style for the specified DOM node.
2017-02-12 04:59:33 +00:00
func ( p * GetComputedStyleForNodeParams ) Do ( ctxt context . Context , h cdp . Handler ) ( computedStyle [ ] * ComputedProperty , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res GetComputedStyleForNodeReturns
err = h . Execute ( ctxt , cdp . CommandCSSGetComputedStyleForNode , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return nil , err
}
2017-02-14 08:41:23 +00:00
return res . ComputedStyle , nil
2017-01-24 15:09:23 +00:00
}
// GetPlatformFontsForNodeParams requests information about platform fonts
// which we used to render child TextNodes in the given node.
type GetPlatformFontsForNodeParams struct {
2017-01-26 07:28:34 +00:00
NodeID cdp . NodeID ` json:"nodeId" `
2017-01-24 15:09:23 +00:00
}
// GetPlatformFontsForNode requests information about platform fonts which we
// used to render child TextNodes in the given node.
//
// parameters:
2017-01-26 07:28:34 +00:00
// nodeID
func GetPlatformFontsForNode ( nodeID cdp . NodeID ) * GetPlatformFontsForNodeParams {
2017-01-24 15:09:23 +00:00
return & GetPlatformFontsForNodeParams {
2017-01-26 07:28:34 +00:00
NodeID : nodeID ,
2017-01-24 15:09:23 +00:00
}
}
// GetPlatformFontsForNodeReturns return values.
type GetPlatformFontsForNodeReturns struct {
Fonts [ ] * PlatformFontUsage ` json:"fonts,omitempty" ` // Usage statistics for every employed platform font.
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.getPlatformFontsForNode against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// fonts - Usage statistics for every employed platform font.
2017-02-12 04:59:33 +00:00
func ( p * GetPlatformFontsForNodeParams ) Do ( ctxt context . Context , h cdp . Handler ) ( fonts [ ] * PlatformFontUsage , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res GetPlatformFontsForNodeReturns
err = h . Execute ( ctxt , cdp . CommandCSSGetPlatformFontsForNode , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return nil , err
}
2017-02-14 08:41:23 +00:00
return res . Fonts , nil
2017-01-24 15:09:23 +00:00
}
// GetStyleSheetTextParams returns the current textual content and the URL
// for a stylesheet.
type GetStyleSheetTextParams struct {
StyleSheetID StyleSheetID ` json:"styleSheetId" `
}
// GetStyleSheetText returns the current textual content and the URL for a
// stylesheet.
//
// parameters:
2017-01-26 07:28:34 +00:00
// styleSheetID
func GetStyleSheetText ( styleSheetID StyleSheetID ) * GetStyleSheetTextParams {
2017-01-24 15:09:23 +00:00
return & GetStyleSheetTextParams {
2017-01-26 07:28:34 +00:00
StyleSheetID : styleSheetID ,
2017-01-24 15:09:23 +00:00
}
}
// GetStyleSheetTextReturns return values.
type GetStyleSheetTextReturns struct {
Text string ` json:"text,omitempty" ` // The stylesheet text.
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.getStyleSheetText against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// text - The stylesheet text.
2017-02-12 04:59:33 +00:00
func ( p * GetStyleSheetTextParams ) Do ( ctxt context . Context , h cdp . Handler ) ( text string , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res GetStyleSheetTextReturns
err = h . Execute ( ctxt , cdp . CommandCSSGetStyleSheetText , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return "" , err
}
2017-02-14 08:41:23 +00:00
return res . Text , nil
2017-01-24 15:09:23 +00:00
}
// CollectClassNamesParams returns all class names from specified stylesheet.
type CollectClassNamesParams struct {
StyleSheetID StyleSheetID ` json:"styleSheetId" `
}
// CollectClassNames returns all class names from specified stylesheet.
//
// parameters:
2017-01-26 07:28:34 +00:00
// styleSheetID
func CollectClassNames ( styleSheetID StyleSheetID ) * CollectClassNamesParams {
2017-01-24 15:09:23 +00:00
return & CollectClassNamesParams {
2017-01-26 07:28:34 +00:00
StyleSheetID : styleSheetID ,
2017-01-24 15:09:23 +00:00
}
}
// CollectClassNamesReturns return values.
type CollectClassNamesReturns struct {
ClassNames [ ] string ` json:"classNames,omitempty" ` // Class name list.
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.collectClassNames against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// classNames - Class name list.
2017-02-12 04:59:33 +00:00
func ( p * CollectClassNamesParams ) Do ( ctxt context . Context , h cdp . Handler ) ( classNames [ ] string , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res CollectClassNamesReturns
err = h . Execute ( ctxt , cdp . CommandCSSCollectClassNames , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return nil , err
}
2017-02-14 08:41:23 +00:00
return res . ClassNames , nil
2017-01-24 15:09:23 +00:00
}
// SetStyleSheetTextParams sets the new stylesheet text.
type SetStyleSheetTextParams struct {
StyleSheetID StyleSheetID ` json:"styleSheetId" `
Text string ` json:"text" `
}
// SetStyleSheetText sets the new stylesheet text.
//
// parameters:
2017-01-26 07:28:34 +00:00
// styleSheetID
2017-01-24 15:09:23 +00:00
// text
2017-01-26 07:28:34 +00:00
func SetStyleSheetText ( styleSheetID StyleSheetID , text string ) * SetStyleSheetTextParams {
2017-01-24 15:09:23 +00:00
return & SetStyleSheetTextParams {
2017-01-26 07:28:34 +00:00
StyleSheetID : styleSheetID ,
2017-01-24 15:09:23 +00:00
Text : text ,
}
}
// SetStyleSheetTextReturns return values.
type SetStyleSheetTextReturns struct {
SourceMapURL string ` json:"sourceMapURL,omitempty" ` // URL of source map associated with script (if any).
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.setStyleSheetText against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// sourceMapURL - URL of source map associated with script (if any).
2017-02-12 04:59:33 +00:00
func ( p * SetStyleSheetTextParams ) Do ( ctxt context . Context , h cdp . Handler ) ( sourceMapURL string , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res SetStyleSheetTextReturns
err = h . Execute ( ctxt , cdp . CommandCSSSetStyleSheetText , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return "" , err
}
2017-02-14 08:41:23 +00:00
return res . SourceMapURL , nil
2017-01-24 15:09:23 +00:00
}
// SetRuleSelectorParams modifies the rule selector.
type SetRuleSelectorParams struct {
StyleSheetID StyleSheetID ` json:"styleSheetId" `
Range * SourceRange ` json:"range" `
Selector string ` json:"selector" `
}
// SetRuleSelector modifies the rule selector.
//
// parameters:
2017-01-26 07:28:34 +00:00
// styleSheetID
2017-01-24 15:09:23 +00:00
// range
// selector
2017-01-26 07:28:34 +00:00
func SetRuleSelector ( styleSheetID StyleSheetID , rangeVal * SourceRange , selector string ) * SetRuleSelectorParams {
2017-01-24 15:09:23 +00:00
return & SetRuleSelectorParams {
2017-01-26 07:28:34 +00:00
StyleSheetID : styleSheetID ,
Range : rangeVal ,
2017-01-24 15:09:23 +00:00
Selector : selector ,
}
}
// SetRuleSelectorReturns return values.
type SetRuleSelectorReturns struct {
SelectorList * SelectorList ` json:"selectorList,omitempty" ` // The resulting selector list after modification.
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.setRuleSelector against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// selectorList - The resulting selector list after modification.
2017-02-12 04:59:33 +00:00
func ( p * SetRuleSelectorParams ) Do ( ctxt context . Context , h cdp . Handler ) ( selectorList * SelectorList , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res SetRuleSelectorReturns
err = h . Execute ( ctxt , cdp . CommandCSSSetRuleSelector , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return nil , err
}
2017-02-14 08:41:23 +00:00
return res . SelectorList , nil
2017-01-24 15:09:23 +00:00
}
// SetKeyframeKeyParams modifies the keyframe rule key text.
type SetKeyframeKeyParams struct {
StyleSheetID StyleSheetID ` json:"styleSheetId" `
Range * SourceRange ` json:"range" `
KeyText string ` json:"keyText" `
}
// SetKeyframeKey modifies the keyframe rule key text.
//
// parameters:
2017-01-26 07:28:34 +00:00
// styleSheetID
2017-01-24 15:09:23 +00:00
// range
// keyText
2017-01-26 07:28:34 +00:00
func SetKeyframeKey ( styleSheetID StyleSheetID , rangeVal * SourceRange , keyText string ) * SetKeyframeKeyParams {
2017-01-24 15:09:23 +00:00
return & SetKeyframeKeyParams {
2017-01-26 07:28:34 +00:00
StyleSheetID : styleSheetID ,
Range : rangeVal ,
2017-01-24 15:09:23 +00:00
KeyText : keyText ,
}
}
// SetKeyframeKeyReturns return values.
type SetKeyframeKeyReturns struct {
KeyText * Value ` json:"keyText,omitempty" ` // The resulting key text after modification.
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.setKeyframeKey against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// keyText - The resulting key text after modification.
2017-02-12 04:59:33 +00:00
func ( p * SetKeyframeKeyParams ) Do ( ctxt context . Context , h cdp . Handler ) ( keyText * Value , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res SetKeyframeKeyReturns
err = h . Execute ( ctxt , cdp . CommandCSSSetKeyframeKey , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return nil , err
}
2017-02-14 08:41:23 +00:00
return res . KeyText , nil
2017-01-24 15:09:23 +00:00
}
// SetStyleTextsParams applies specified style edits one after another in the
// given order.
type SetStyleTextsParams struct {
Edits [ ] * StyleDeclarationEdit ` json:"edits" `
}
// SetStyleTexts applies specified style edits one after another in the given
// order.
//
// parameters:
// edits
func SetStyleTexts ( edits [ ] * StyleDeclarationEdit ) * SetStyleTextsParams {
return & SetStyleTextsParams {
Edits : edits ,
}
}
// SetStyleTextsReturns return values.
type SetStyleTextsReturns struct {
Styles [ ] * Style ` json:"styles,omitempty" ` // The resulting styles after modification.
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.setStyleTexts against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// styles - The resulting styles after modification.
2017-02-12 04:59:33 +00:00
func ( p * SetStyleTextsParams ) Do ( ctxt context . Context , h cdp . Handler ) ( styles [ ] * Style , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res SetStyleTextsReturns
err = h . Execute ( ctxt , cdp . CommandCSSSetStyleTexts , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return nil , err
}
2017-02-14 08:41:23 +00:00
return res . Styles , nil
2017-01-24 15:09:23 +00:00
}
// SetMediaTextParams modifies the rule selector.
type SetMediaTextParams struct {
StyleSheetID StyleSheetID ` json:"styleSheetId" `
Range * SourceRange ` json:"range" `
Text string ` json:"text" `
}
// SetMediaText modifies the rule selector.
//
// parameters:
2017-01-26 07:28:34 +00:00
// styleSheetID
2017-01-24 15:09:23 +00:00
// range
// text
2017-01-26 07:28:34 +00:00
func SetMediaText ( styleSheetID StyleSheetID , rangeVal * SourceRange , text string ) * SetMediaTextParams {
2017-01-24 15:09:23 +00:00
return & SetMediaTextParams {
2017-01-26 07:28:34 +00:00
StyleSheetID : styleSheetID ,
Range : rangeVal ,
2017-01-24 15:09:23 +00:00
Text : text ,
}
}
// SetMediaTextReturns return values.
type SetMediaTextReturns struct {
Media * Media ` json:"media,omitempty" ` // The resulting CSS media rule after modification.
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.setMediaText against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// media - The resulting CSS media rule after modification.
2017-02-12 04:59:33 +00:00
func ( p * SetMediaTextParams ) Do ( ctxt context . Context , h cdp . Handler ) ( media * Media , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res SetMediaTextReturns
err = h . Execute ( ctxt , cdp . CommandCSSSetMediaText , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return nil , err
}
2017-02-14 08:41:23 +00:00
return res . Media , nil
2017-01-24 15:09:23 +00:00
}
// CreateStyleSheetParams creates a new special "via-inspector" stylesheet in
// the frame with given frameId.
type CreateStyleSheetParams struct {
2017-01-26 07:28:34 +00:00
FrameID cdp . FrameID ` json:"frameId" ` // Identifier of the frame where "via-inspector" stylesheet should be created.
2017-01-24 15:09:23 +00:00
}
// CreateStyleSheet creates a new special "via-inspector" stylesheet in the
// frame with given frameId.
//
// parameters:
2017-01-26 07:28:34 +00:00
// frameID - Identifier of the frame where "via-inspector" stylesheet should be created.
func CreateStyleSheet ( frameID cdp . FrameID ) * CreateStyleSheetParams {
2017-01-24 15:09:23 +00:00
return & CreateStyleSheetParams {
2017-01-26 07:28:34 +00:00
FrameID : frameID ,
2017-01-24 15:09:23 +00:00
}
}
// CreateStyleSheetReturns return values.
type CreateStyleSheetReturns struct {
StyleSheetID StyleSheetID ` json:"styleSheetId,omitempty" ` // Identifier of the created "via-inspector" stylesheet.
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.createStyleSheet against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
2017-01-26 07:28:34 +00:00
// styleSheetID - Identifier of the created "via-inspector" stylesheet.
2017-02-12 04:59:33 +00:00
func ( p * CreateStyleSheetParams ) Do ( ctxt context . Context , h cdp . Handler ) ( styleSheetID StyleSheetID , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res CreateStyleSheetReturns
err = h . Execute ( ctxt , cdp . CommandCSSCreateStyleSheet , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return "" , err
}
2017-02-14 08:41:23 +00:00
return res . StyleSheetID , nil
2017-01-24 15:09:23 +00:00
}
// AddRuleParams inserts a new rule with the given ruleText in a stylesheet
// with given styleSheetId, at the position specified by location.
type AddRuleParams struct {
StyleSheetID StyleSheetID ` json:"styleSheetId" ` // The css style sheet identifier where a new rule should be inserted.
RuleText string ` json:"ruleText" ` // The text of a new rule.
Location * SourceRange ` json:"location" ` // Text position of a new rule in the target style sheet.
}
// AddRule inserts a new rule with the given ruleText in a stylesheet with
// given styleSheetId, at the position specified by location.
//
// parameters:
2017-01-26 07:28:34 +00:00
// styleSheetID - The css style sheet identifier where a new rule should be inserted.
2017-01-24 15:09:23 +00:00
// ruleText - The text of a new rule.
// location - Text position of a new rule in the target style sheet.
2017-01-26 07:28:34 +00:00
func AddRule ( styleSheetID StyleSheetID , ruleText string , location * SourceRange ) * AddRuleParams {
2017-01-24 15:09:23 +00:00
return & AddRuleParams {
2017-01-26 07:28:34 +00:00
StyleSheetID : styleSheetID ,
2017-01-24 15:09:23 +00:00
RuleText : ruleText ,
Location : location ,
}
}
// AddRuleReturns return values.
type AddRuleReturns struct {
Rule * Rule ` json:"rule,omitempty" ` // The newly created rule.
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.addRule against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// rule - The newly created rule.
2017-02-12 04:59:33 +00:00
func ( p * AddRuleParams ) Do ( ctxt context . Context , h cdp . Handler ) ( rule * Rule , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res AddRuleReturns
err = h . Execute ( ctxt , cdp . CommandCSSAddRule , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
return nil , err
}
2017-02-14 08:41:23 +00:00
return res . Rule , nil
2017-01-24 15:09:23 +00:00
}
// ForcePseudoStateParams ensures that the given node will have specified
// pseudo-classes whenever its style is computed by the browser.
type ForcePseudoStateParams struct {
2017-01-26 07:28:34 +00:00
NodeID cdp . NodeID ` json:"nodeId" ` // The element id for which to force the pseudo state.
2017-01-24 15:09:23 +00:00
ForcedPseudoClasses [ ] PseudoClass ` json:"forcedPseudoClasses" ` // Element pseudo classes to force when computing the element's style.
}
// ForcePseudoState ensures that the given node will have specified
// pseudo-classes whenever its style is computed by the browser.
//
// parameters:
2017-01-26 07:28:34 +00:00
// nodeID - The element id for which to force the pseudo state.
2017-01-24 15:09:23 +00:00
// forcedPseudoClasses - Element pseudo classes to force when computing the element's style.
2017-01-26 07:28:34 +00:00
func ForcePseudoState ( nodeID cdp . NodeID , forcedPseudoClasses [ ] PseudoClass ) * ForcePseudoStateParams {
2017-01-24 15:09:23 +00:00
return & ForcePseudoStateParams {
2017-01-26 07:28:34 +00:00
NodeID : nodeID ,
2017-01-24 15:09:23 +00:00
ForcedPseudoClasses : forcedPseudoClasses ,
}
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.forcePseudoState against the provided context and
// target handler.
func ( p * ForcePseudoStateParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandCSSForcePseudoState , p , nil )
2017-01-24 15:09:23 +00:00
}
// GetMediaQueriesParams returns all media queries parsed by the rendering
// engine.
type GetMediaQueriesParams struct { }
// GetMediaQueries returns all media queries parsed by the rendering engine.
func GetMediaQueries ( ) * GetMediaQueriesParams {
return & GetMediaQueriesParams { }
}
// GetMediaQueriesReturns return values.
type GetMediaQueriesReturns struct {
Medias [ ] * Media ` json:"medias,omitempty" `
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.getMediaQueries against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// medias
2017-02-12 04:59:33 +00:00
func ( p * GetMediaQueriesParams ) Do ( ctxt context . Context , h cdp . Handler ) ( medias [ ] * Media , err error ) {
2017-01-24 15:09:23 +00:00
// execute
2017-02-14 08:41:23 +00:00
var res GetMediaQueriesReturns
err = h . Execute ( ctxt , cdp . CommandCSSGetMediaQueries , nil , & res )
if err != nil {
return nil , err
2017-01-24 15:09:23 +00:00
}
2017-02-14 08:41:23 +00:00
return res . Medias , nil
2017-01-24 15:09:23 +00:00
}
// SetEffectivePropertyValueForNodeParams find a rule with the given active
// property for the given node and set the new value for this property.
type SetEffectivePropertyValueForNodeParams struct {
2017-01-26 07:28:34 +00:00
NodeID cdp . NodeID ` json:"nodeId" ` // The element id for which to set property.
PropertyName string ` json:"propertyName" `
Value string ` json:"value" `
2017-01-24 15:09:23 +00:00
}
// SetEffectivePropertyValueForNode find a rule with the given active
// property for the given node and set the new value for this property.
//
// parameters:
2017-01-26 07:28:34 +00:00
// nodeID - The element id for which to set property.
2017-01-24 15:09:23 +00:00
// propertyName
// value
2017-01-26 07:28:34 +00:00
func SetEffectivePropertyValueForNode ( nodeID cdp . NodeID , propertyName string , value string ) * SetEffectivePropertyValueForNodeParams {
2017-01-24 15:09:23 +00:00
return & SetEffectivePropertyValueForNodeParams {
2017-01-26 07:28:34 +00:00
NodeID : nodeID ,
2017-01-24 15:09:23 +00:00
PropertyName : propertyName ,
Value : value ,
}
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.setEffectivePropertyValueForNode against the provided context and
// target handler.
func ( p * SetEffectivePropertyValueForNodeParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandCSSSetEffectivePropertyValueForNode , p , nil )
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
// GetBackgroundColorsParams [no description].
2017-01-24 15:09:23 +00:00
type GetBackgroundColorsParams struct {
2017-01-26 07:28:34 +00:00
NodeID cdp . NodeID ` json:"nodeId" ` // Id of the node to get background colors for.
2017-01-24 15:09:23 +00:00
}
2017-01-26 07:28:34 +00:00
// GetBackgroundColors [no description].
//
2017-01-24 15:09:23 +00:00
// parameters:
2017-01-26 07:28:34 +00:00
// nodeID - Id of the node to get background colors for.
func GetBackgroundColors ( nodeID cdp . NodeID ) * GetBackgroundColorsParams {
2017-01-24 15:09:23 +00:00
return & GetBackgroundColorsParams {
2017-01-26 07:28:34 +00:00
NodeID : nodeID ,
2017-01-24 15:09:23 +00:00
}
}
// GetBackgroundColorsReturns return values.
type GetBackgroundColorsReturns struct {
2017-08-11 02:28:38 +00:00
BackgroundColors [ ] string ` json:"backgroundColors,omitempty" ` // 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).
ComputedFontSize string ` json:"computedFontSize,omitempty" ` // The computed font size for this node, as a CSS computed value string (e.g. '12px').
ComputedFontWeight string ` json:"computedFontWeight,omitempty" ` // The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or '100').
ComputedBodyFontSize string ` json:"computedBodyFontSize,omitempty" ` // The computed font size for the document body, as a computed CSS value string (e.g. '16px').
2017-01-24 15:09:23 +00:00
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.getBackgroundColors against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// 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).
2017-08-11 02:28:38 +00:00
// computedFontSize - The computed font size for this node, as a CSS computed value string (e.g. '12px').
// computedFontWeight - The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or '100').
// computedBodyFontSize - The computed font size for the document body, as a computed CSS value string (e.g. '16px').
func ( p * GetBackgroundColorsParams ) Do ( ctxt context . Context , h cdp . Handler ) ( backgroundColors [ ] string , computedFontSize string , computedFontWeight string , computedBodyFontSize string , err error ) {
2017-02-14 08:41:23 +00:00
// execute
var res GetBackgroundColorsReturns
err = h . Execute ( ctxt , cdp . CommandCSSGetBackgroundColors , p , & res )
2017-01-24 15:09:23 +00:00
if err != nil {
2017-08-11 02:28:38 +00:00
return nil , "" , "" , "" , err
2017-01-24 15:09:23 +00:00
}
2017-08-11 02:28:38 +00:00
return res . BackgroundColors , res . ComputedFontSize , res . ComputedFontWeight , res . ComputedBodyFontSize , nil
2017-01-24 15:09:23 +00:00
}
// StartRuleUsageTrackingParams enables the selector recording.
type StartRuleUsageTrackingParams struct { }
// StartRuleUsageTracking enables the selector recording.
func StartRuleUsageTracking ( ) * StartRuleUsageTrackingParams {
return & StartRuleUsageTrackingParams { }
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.startRuleUsageTracking against the provided context and
// target handler.
func ( p * StartRuleUsageTrackingParams ) Do ( ctxt context . Context , h cdp . Handler ) ( err error ) {
2017-02-14 08:41:23 +00:00
return h . Execute ( ctxt , cdp . CommandCSSStartRuleUsageTracking , nil , nil )
2017-01-24 15:09:23 +00:00
}
2017-03-24 22:51:18 +00:00
// TakeCoverageDeltaParams obtain list of rules that became used since last
// call to this method (or since start of coverage instrumentation).
type TakeCoverageDeltaParams struct { }
// TakeCoverageDelta obtain list of rules that became used since last call to
// this method (or since start of coverage instrumentation).
func TakeCoverageDelta ( ) * TakeCoverageDeltaParams {
return & TakeCoverageDeltaParams { }
}
// TakeCoverageDeltaReturns return values.
type TakeCoverageDeltaReturns struct {
Coverage [ ] * RuleUsage ` json:"coverage,omitempty" `
}
// Do executes CSS.takeCoverageDelta against the provided context and
// target handler.
//
// returns:
// coverage
func ( p * TakeCoverageDeltaParams ) Do ( ctxt context . Context , h cdp . Handler ) ( coverage [ ] * RuleUsage , err error ) {
// execute
var res TakeCoverageDeltaReturns
err = h . Execute ( ctxt , cdp . CommandCSSTakeCoverageDelta , nil , & res )
if err != nil {
return nil , err
}
return res . Coverage , nil
}
2017-01-24 15:09:23 +00:00
// StopRuleUsageTrackingParams the list of rules with an indication of
// whether these were used.
type StopRuleUsageTrackingParams struct { }
// StopRuleUsageTracking the list of rules with an indication of whether
// these were used.
func StopRuleUsageTracking ( ) * StopRuleUsageTrackingParams {
return & StopRuleUsageTrackingParams { }
}
// StopRuleUsageTrackingReturns return values.
type StopRuleUsageTrackingReturns struct {
RuleUsage [ ] * RuleUsage ` json:"ruleUsage,omitempty" `
}
2017-02-12 04:59:33 +00:00
// Do executes CSS.stopRuleUsageTracking against the provided context and
// target handler.
2017-01-24 15:09:23 +00:00
//
// returns:
// ruleUsage
2017-02-12 04:59:33 +00:00
func ( p * StopRuleUsageTrackingParams ) Do ( ctxt context . Context , h cdp . Handler ) ( ruleUsage [ ] * RuleUsage , err error ) {
2017-01-24 15:09:23 +00:00
// execute
2017-02-14 08:41:23 +00:00
var res StopRuleUsageTrackingReturns
err = h . Execute ( ctxt , cdp . CommandCSSStopRuleUsageTracking , nil , & res )
if err != nil {
return nil , err
2017-01-24 15:09:23 +00:00
}
2017-02-14 08:41:23 +00:00
return res . RuleUsage , nil
2017-01-24 15:09:23 +00:00
}