package overlay
import (
"context"
"github.com/chromedp/cdproto/cdp"
"github.com/chromedp/cdproto/dom"
"github.com/chromedp/cdproto/runtime"
"github.com/mailru/easyjson"
)
type DisableParams struct {}
func Disable () *DisableParams {
return &DisableParams {}
}
func (p *DisableParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandDisable , nil , nil )
}
type EnableParams struct {}
func Enable () *EnableParams {
return &EnableParams {}
}
func (p *EnableParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandEnable , nil , nil )
}
type GetHighlightObjectForTestParams struct {
NodeID cdp .NodeID `json:"nodeId"`
IncludeDistance bool `json:"includeDistance,omitempty"`
IncludeStyle bool `json:"includeStyle,omitempty"`
ColorFormat ColorFormat `json:"colorFormat,omitempty"`
ShowAccessibilityInfo bool `json:"showAccessibilityInfo,omitempty"`
}
func GetHighlightObjectForTest (nodeID cdp .NodeID ) *GetHighlightObjectForTestParams {
return &GetHighlightObjectForTestParams {
NodeID : nodeID ,
}
}
func (p GetHighlightObjectForTestParams ) WithIncludeDistance (includeDistance bool ) *GetHighlightObjectForTestParams {
p .IncludeDistance = includeDistance
return &p
}
func (p GetHighlightObjectForTestParams ) WithIncludeStyle (includeStyle bool ) *GetHighlightObjectForTestParams {
p .IncludeStyle = includeStyle
return &p
}
func (p GetHighlightObjectForTestParams ) WithColorFormat (colorFormat ColorFormat ) *GetHighlightObjectForTestParams {
p .ColorFormat = colorFormat
return &p
}
func (p GetHighlightObjectForTestParams ) WithShowAccessibilityInfo (showAccessibilityInfo bool ) *GetHighlightObjectForTestParams {
p .ShowAccessibilityInfo = showAccessibilityInfo
return &p
}
type GetHighlightObjectForTestReturns struct {
Highlight easyjson .RawMessage `json:"highlight,omitempty"`
}
func (p *GetHighlightObjectForTestParams ) Do (ctx context .Context ) (highlight easyjson .RawMessage , err error ) {
var res GetHighlightObjectForTestReturns
err = cdp .Execute (ctx , CommandGetHighlightObjectForTest , p , &res )
if err != nil {
return nil , err
}
return res .Highlight , nil
}
type GetGridHighlightObjectsForTestParams struct {
NodeIDs []cdp .NodeID `json:"nodeIds"`
}
func GetGridHighlightObjectsForTest (nodeIDs []cdp .NodeID ) *GetGridHighlightObjectsForTestParams {
return &GetGridHighlightObjectsForTestParams {
NodeIDs : nodeIDs ,
}
}
type GetGridHighlightObjectsForTestReturns struct {
Highlights easyjson .RawMessage `json:"highlights,omitempty"`
}
func (p *GetGridHighlightObjectsForTestParams ) Do (ctx context .Context ) (highlights easyjson .RawMessage , err error ) {
var res GetGridHighlightObjectsForTestReturns
err = cdp .Execute (ctx , CommandGetGridHighlightObjectsForTest , p , &res )
if err != nil {
return nil , err
}
return res .Highlights , nil
}
type GetSourceOrderHighlightObjectForTestParams struct {
NodeID cdp .NodeID `json:"nodeId"`
}
func GetSourceOrderHighlightObjectForTest (nodeID cdp .NodeID ) *GetSourceOrderHighlightObjectForTestParams {
return &GetSourceOrderHighlightObjectForTestParams {
NodeID : nodeID ,
}
}
type GetSourceOrderHighlightObjectForTestReturns struct {
Highlight easyjson .RawMessage `json:"highlight,omitempty"`
}
func (p *GetSourceOrderHighlightObjectForTestParams ) Do (ctx context .Context ) (highlight easyjson .RawMessage , err error ) {
var res GetSourceOrderHighlightObjectForTestReturns
err = cdp .Execute (ctx , CommandGetSourceOrderHighlightObjectForTest , p , &res )
if err != nil {
return nil , err
}
return res .Highlight , nil
}
type HideHighlightParams struct {}
func HideHighlight () *HideHighlightParams {
return &HideHighlightParams {}
}
func (p *HideHighlightParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandHideHighlight , nil , nil )
}
type HighlightNodeParams struct {
HighlightConfig *HighlightConfig `json:"highlightConfig"`
NodeID cdp .NodeID `json:"nodeId,omitempty"`
BackendNodeID cdp .BackendNodeID `json:"backendNodeId,omitempty"`
ObjectID runtime .RemoteObjectID `json:"objectId,omitempty"`
Selector string `json:"selector,omitempty"`
}
func HighlightNode (highlightConfig *HighlightConfig ) *HighlightNodeParams {
return &HighlightNodeParams {
HighlightConfig : highlightConfig ,
}
}
func (p HighlightNodeParams ) WithNodeID (nodeID cdp .NodeID ) *HighlightNodeParams {
p .NodeID = nodeID
return &p
}
func (p HighlightNodeParams ) WithBackendNodeID (backendNodeID cdp .BackendNodeID ) *HighlightNodeParams {
p .BackendNodeID = backendNodeID
return &p
}
func (p HighlightNodeParams ) WithObjectID (objectID runtime .RemoteObjectID ) *HighlightNodeParams {
p .ObjectID = objectID
return &p
}
func (p HighlightNodeParams ) WithSelector (selector string ) *HighlightNodeParams {
p .Selector = selector
return &p
}
func (p *HighlightNodeParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandHighlightNode , p , nil )
}
type HighlightQuadParams struct {
Quad dom .Quad `json:"quad"`
Color *cdp .RGBA `json:"color,omitempty"`
OutlineColor *cdp .RGBA `json:"outlineColor,omitempty"`
}
func HighlightQuad (quad dom .Quad ) *HighlightQuadParams {
return &HighlightQuadParams {
Quad : quad ,
}
}
func (p HighlightQuadParams ) WithColor (color *cdp .RGBA ) *HighlightQuadParams {
p .Color = color
return &p
}
func (p HighlightQuadParams ) WithOutlineColor (outlineColor *cdp .RGBA ) *HighlightQuadParams {
p .OutlineColor = outlineColor
return &p
}
func (p *HighlightQuadParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandHighlightQuad , p , nil )
}
type HighlightRectParams struct {
X int64 `json:"x"`
Y int64 `json:"y"`
Width int64 `json:"width"`
Height int64 `json:"height"`
Color *cdp .RGBA `json:"color,omitempty"`
OutlineColor *cdp .RGBA `json:"outlineColor,omitempty"`
}
func HighlightRect (x int64 , y int64 , width int64 , height int64 ) *HighlightRectParams {
return &HighlightRectParams {
X : x ,
Y : y ,
Width : width ,
Height : height ,
}
}
func (p HighlightRectParams ) WithColor (color *cdp .RGBA ) *HighlightRectParams {
p .Color = color
return &p
}
func (p HighlightRectParams ) WithOutlineColor (outlineColor *cdp .RGBA ) *HighlightRectParams {
p .OutlineColor = outlineColor
return &p
}
func (p *HighlightRectParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandHighlightRect , p , nil )
}
type HighlightSourceOrderParams struct {
SourceOrderConfig *SourceOrderConfig `json:"sourceOrderConfig"`
NodeID cdp .NodeID `json:"nodeId,omitempty"`
BackendNodeID cdp .BackendNodeID `json:"backendNodeId,omitempty"`
ObjectID runtime .RemoteObjectID `json:"objectId,omitempty"`
}
func HighlightSourceOrder (sourceOrderConfig *SourceOrderConfig ) *HighlightSourceOrderParams {
return &HighlightSourceOrderParams {
SourceOrderConfig : sourceOrderConfig ,
}
}
func (p HighlightSourceOrderParams ) WithNodeID (nodeID cdp .NodeID ) *HighlightSourceOrderParams {
p .NodeID = nodeID
return &p
}
func (p HighlightSourceOrderParams ) WithBackendNodeID (backendNodeID cdp .BackendNodeID ) *HighlightSourceOrderParams {
p .BackendNodeID = backendNodeID
return &p
}
func (p HighlightSourceOrderParams ) WithObjectID (objectID runtime .RemoteObjectID ) *HighlightSourceOrderParams {
p .ObjectID = objectID
return &p
}
func (p *HighlightSourceOrderParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandHighlightSourceOrder , p , nil )
}
type SetInspectModeParams struct {
Mode InspectMode `json:"mode"`
HighlightConfig *HighlightConfig `json:"highlightConfig,omitempty"`
}
func SetInspectMode (mode InspectMode ) *SetInspectModeParams {
return &SetInspectModeParams {
Mode : mode ,
}
}
func (p SetInspectModeParams ) WithHighlightConfig (highlightConfig *HighlightConfig ) *SetInspectModeParams {
p .HighlightConfig = highlightConfig
return &p
}
func (p *SetInspectModeParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetInspectMode , p , nil )
}
type SetShowAdHighlightsParams struct {
Show bool `json:"show"`
}
func SetShowAdHighlights (show bool ) *SetShowAdHighlightsParams {
return &SetShowAdHighlightsParams {
Show : show ,
}
}
func (p *SetShowAdHighlightsParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetShowAdHighlights , p , nil )
}
type SetPausedInDebuggerMessageParams struct {
Message string `json:"message,omitempty"`
}
func SetPausedInDebuggerMessage () *SetPausedInDebuggerMessageParams {
return &SetPausedInDebuggerMessageParams {}
}
func (p SetPausedInDebuggerMessageParams ) WithMessage (message string ) *SetPausedInDebuggerMessageParams {
p .Message = message
return &p
}
func (p *SetPausedInDebuggerMessageParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetPausedInDebuggerMessage , p , nil )
}
type SetShowDebugBordersParams struct {
Show bool `json:"show"`
}
func SetShowDebugBorders (show bool ) *SetShowDebugBordersParams {
return &SetShowDebugBordersParams {
Show : show ,
}
}
func (p *SetShowDebugBordersParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetShowDebugBorders , p , nil )
}
type SetShowFPSCounterParams struct {
Show bool `json:"show"`
}
func SetShowFPSCounter (show bool ) *SetShowFPSCounterParams {
return &SetShowFPSCounterParams {
Show : show ,
}
}
func (p *SetShowFPSCounterParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetShowFPSCounter , p , nil )
}
type SetShowGridOverlaysParams struct {
GridNodeHighlightConfigs []*GridNodeHighlightConfig `json:"gridNodeHighlightConfigs"`
}
func SetShowGridOverlays (gridNodeHighlightConfigs []*GridNodeHighlightConfig ) *SetShowGridOverlaysParams {
return &SetShowGridOverlaysParams {
GridNodeHighlightConfigs : gridNodeHighlightConfigs ,
}
}
func (p *SetShowGridOverlaysParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetShowGridOverlays , p , nil )
}
type SetShowFlexOverlaysParams struct {
FlexNodeHighlightConfigs []*FlexNodeHighlightConfig `json:"flexNodeHighlightConfigs"`
}
func SetShowFlexOverlays (flexNodeHighlightConfigs []*FlexNodeHighlightConfig ) *SetShowFlexOverlaysParams {
return &SetShowFlexOverlaysParams {
FlexNodeHighlightConfigs : flexNodeHighlightConfigs ,
}
}
func (p *SetShowFlexOverlaysParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetShowFlexOverlays , p , nil )
}
type SetShowScrollSnapOverlaysParams struct {
ScrollSnapHighlightConfigs []*ScrollSnapHighlightConfig `json:"scrollSnapHighlightConfigs"`
}
func SetShowScrollSnapOverlays (scrollSnapHighlightConfigs []*ScrollSnapHighlightConfig ) *SetShowScrollSnapOverlaysParams {
return &SetShowScrollSnapOverlaysParams {
ScrollSnapHighlightConfigs : scrollSnapHighlightConfigs ,
}
}
func (p *SetShowScrollSnapOverlaysParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetShowScrollSnapOverlays , p , nil )
}
type SetShowContainerQueryOverlaysParams struct {
ContainerQueryHighlightConfigs []*ContainerQueryHighlightConfig `json:"containerQueryHighlightConfigs"`
}
func SetShowContainerQueryOverlays (containerQueryHighlightConfigs []*ContainerQueryHighlightConfig ) *SetShowContainerQueryOverlaysParams {
return &SetShowContainerQueryOverlaysParams {
ContainerQueryHighlightConfigs : containerQueryHighlightConfigs ,
}
}
func (p *SetShowContainerQueryOverlaysParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetShowContainerQueryOverlays , p , nil )
}
type SetShowPaintRectsParams struct {
Result bool `json:"result"`
}
func SetShowPaintRects (result bool ) *SetShowPaintRectsParams {
return &SetShowPaintRectsParams {
Result : result ,
}
}
func (p *SetShowPaintRectsParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetShowPaintRects , p , nil )
}
type SetShowLayoutShiftRegionsParams struct {
Result bool `json:"result"`
}
func SetShowLayoutShiftRegions (result bool ) *SetShowLayoutShiftRegionsParams {
return &SetShowLayoutShiftRegionsParams {
Result : result ,
}
}
func (p *SetShowLayoutShiftRegionsParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetShowLayoutShiftRegions , p , nil )
}
type SetShowScrollBottleneckRectsParams struct {
Show bool `json:"show"`
}
func SetShowScrollBottleneckRects (show bool ) *SetShowScrollBottleneckRectsParams {
return &SetShowScrollBottleneckRectsParams {
Show : show ,
}
}
func (p *SetShowScrollBottleneckRectsParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetShowScrollBottleneckRects , p , nil )
}
type SetShowWebVitalsParams struct {
Show bool `json:"show"`
}
func SetShowWebVitals (show bool ) *SetShowWebVitalsParams {
return &SetShowWebVitalsParams {
Show : show ,
}
}
func (p *SetShowWebVitalsParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetShowWebVitals , p , nil )
}
type SetShowViewportSizeOnResizeParams struct {
Show bool `json:"show"`
}
func SetShowViewportSizeOnResize (show bool ) *SetShowViewportSizeOnResizeParams {
return &SetShowViewportSizeOnResizeParams {
Show : show ,
}
}
func (p *SetShowViewportSizeOnResizeParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetShowViewportSizeOnResize , p , nil )
}
type SetShowHingeParams struct {
HingeConfig *HingeConfig `json:"hingeConfig,omitempty"`
}
func SetShowHinge () *SetShowHingeParams {
return &SetShowHingeParams {}
}
func (p SetShowHingeParams ) WithHingeConfig (hingeConfig *HingeConfig ) *SetShowHingeParams {
p .HingeConfig = hingeConfig
return &p
}
func (p *SetShowHingeParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetShowHinge , p , nil )
}
type SetShowIsolatedElementsParams struct {
IsolatedElementHighlightConfigs []*IsolatedElementHighlightConfig `json:"isolatedElementHighlightConfigs"`
}
func SetShowIsolatedElements (isolatedElementHighlightConfigs []*IsolatedElementHighlightConfig ) *SetShowIsolatedElementsParams {
return &SetShowIsolatedElementsParams {
IsolatedElementHighlightConfigs : isolatedElementHighlightConfigs ,
}
}
func (p *SetShowIsolatedElementsParams ) Do (ctx context .Context ) (err error ) {
return cdp .Execute (ctx , CommandSetShowIsolatedElements , p , nil )
}
const (
CommandDisable = "Overlay.disable"
CommandEnable = "Overlay.enable"
CommandGetHighlightObjectForTest = "Overlay.getHighlightObjectForTest"
CommandGetGridHighlightObjectsForTest = "Overlay.getGridHighlightObjectsForTest"
CommandGetSourceOrderHighlightObjectForTest = "Overlay.getSourceOrderHighlightObjectForTest"
CommandHideHighlight = "Overlay.hideHighlight"
CommandHighlightNode = "Overlay.highlightNode"
CommandHighlightQuad = "Overlay.highlightQuad"
CommandHighlightRect = "Overlay.highlightRect"
CommandHighlightSourceOrder = "Overlay.highlightSourceOrder"
CommandSetInspectMode = "Overlay.setInspectMode"
CommandSetShowAdHighlights = "Overlay.setShowAdHighlights"
CommandSetPausedInDebuggerMessage = "Overlay.setPausedInDebuggerMessage"
CommandSetShowDebugBorders = "Overlay.setShowDebugBorders"
CommandSetShowFPSCounter = "Overlay.setShowFPSCounter"
CommandSetShowGridOverlays = "Overlay.setShowGridOverlays"
CommandSetShowFlexOverlays = "Overlay.setShowFlexOverlays"
CommandSetShowScrollSnapOverlays = "Overlay.setShowScrollSnapOverlays"
CommandSetShowContainerQueryOverlays = "Overlay.setShowContainerQueryOverlays"
CommandSetShowPaintRects = "Overlay.setShowPaintRects"
CommandSetShowLayoutShiftRegions = "Overlay.setShowLayoutShiftRegions"
CommandSetShowScrollBottleneckRects = "Overlay.setShowScrollBottleneckRects"
CommandSetShowWebVitals = "Overlay.setShowWebVitals"
CommandSetShowViewportSizeOnResize = "Overlay.setShowViewportSizeOnResize"
CommandSetShowHinge = "Overlay.setShowHinge"
CommandSetShowIsolatedElements = "Overlay.setShowIsolatedElements"
)
The pages are generated with Golds v0.8.2 . (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu .
PR and bug reports are welcome and can be submitted to the issue list .
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds .