forked from chromedp/chromedp
/
types.go
103 lines (87 loc) · 4.25 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package dom
// AUTOGENERATED. DO NOT EDIT.
import (
"errors"
cdp "github.com/knq/chromedp/cdp"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// Quad an array of quad vertices, x immediately followed by y for each
// point, points clock-wise.
type Quad []float64
// BoxModel box model.
type BoxModel struct {
Content Quad `json:"content,omitempty"` // Content box
Padding Quad `json:"padding,omitempty"` // Padding box
Border Quad `json:"border,omitempty"` // Border box
Margin Quad `json:"margin,omitempty"` // Margin box
Width int64 `json:"width,omitempty"` // Node width
Height int64 `json:"height,omitempty"` // Node height
ShapeOutside *ShapeOutsideInfo `json:"shapeOutside,omitempty"` // Shape outside coordinates
}
// ShapeOutsideInfo cSS Shape Outside details.
type ShapeOutsideInfo struct {
Bounds Quad `json:"bounds,omitempty"` // Shape bounds
Shape []easyjson.RawMessage `json:"shape,omitempty"` // Shape coordinate details
MarginShape []easyjson.RawMessage `json:"marginShape,omitempty"` // Margin shape bounds
}
// Rect rectangle.
type Rect struct {
X float64 `json:"x,omitempty"` // X coordinate
Y float64 `json:"y,omitempty"` // Y coordinate
Width float64 `json:"width,omitempty"` // Rectangle width
Height float64 `json:"height,omitempty"` // Rectangle height
}
// HighlightConfig configuration data for the highlighting of page elements.
type HighlightConfig struct {
ShowInfo bool `json:"showInfo,omitempty"` // Whether the node info tooltip should be shown (default: false).
ShowRulers bool `json:"showRulers,omitempty"` // Whether the rulers should be shown (default: false).
ShowExtensionLines bool `json:"showExtensionLines,omitempty"` // Whether the extension lines from node to the rulers should be shown (default: false).
DisplayAsMaterial bool `json:"displayAsMaterial,omitempty"`
ContentColor *cdp.RGBA `json:"contentColor,omitempty"` // The content box highlight fill color (default: transparent).
PaddingColor *cdp.RGBA `json:"paddingColor,omitempty"` // The padding highlight fill color (default: transparent).
BorderColor *cdp.RGBA `json:"borderColor,omitempty"` // The border highlight fill color (default: transparent).
MarginColor *cdp.RGBA `json:"marginColor,omitempty"` // The margin highlight fill color (default: transparent).
EventTargetColor *cdp.RGBA `json:"eventTargetColor,omitempty"` // The event target element highlight fill color (default: transparent).
ShapeColor *cdp.RGBA `json:"shapeColor,omitempty"` // The shape outside fill color (default: transparent).
ShapeMarginColor *cdp.RGBA `json:"shapeMarginColor,omitempty"` // The shape margin fill color (default: transparent).
SelectorList string `json:"selectorList,omitempty"` // Selectors to highlight relevant nodes.
}
// InspectMode [no description].
type InspectMode string
// String returns the InspectMode as string value.
func (t InspectMode) String() string {
return string(t)
}
// InspectMode values.
const (
InspectModeSearchForNode InspectMode = "searchForNode"
InspectModeSearchForUAShadowDOM InspectMode = "searchForUAShadowDOM"
InspectModeNone InspectMode = "none"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t InspectMode) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t InspectMode) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *InspectMode) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch InspectMode(in.String()) {
case InspectModeSearchForNode:
*t = InspectModeSearchForNode
case InspectModeSearchForUAShadowDOM:
*t = InspectModeSearchForUAShadowDOM
case InspectModeNone:
*t = InspectModeNone
default:
in.AddError(errors.New("unknown InspectMode value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *InspectMode) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}