1package layertree 2 3// Code generated by cdproto-gen. DO NOT EDIT. 4 5import ( 6 "errors" 7 8 "github.com/chromedp/cdproto/cdp" 9 "github.com/chromedp/cdproto/dom" 10 "github.com/mailru/easyjson" 11 "github.com/mailru/easyjson/jlexer" 12 "github.com/mailru/easyjson/jwriter" 13) 14 15// LayerID unique Layer identifier. 16// 17// See: https://chromedevtools.github.io/devtools-protocol/tot/LayerTree#type-LayerId 18type LayerID string 19 20// String returns the LayerID as string value. 21func (t LayerID) String() string { 22 return string(t) 23} 24 25// SnapshotID unique snapshot identifier. 26// 27// See: https://chromedevtools.github.io/devtools-protocol/tot/LayerTree#type-SnapshotId 28type SnapshotID string 29 30// String returns the SnapshotID as string value. 31func (t SnapshotID) String() string { 32 return string(t) 33} 34 35// ScrollRect rectangle where scrolling happens on the main thread. 36// 37// See: https://chromedevtools.github.io/devtools-protocol/tot/LayerTree#type-ScrollRect 38type ScrollRect struct { 39 Rect *dom.Rect `json:"rect"` // Rectangle itself. 40 Type ScrollRectType `json:"type"` // Reason for rectangle to force scrolling on the main thread 41} 42 43// StickyPositionConstraint sticky position constraints. 44// 45// See: https://chromedevtools.github.io/devtools-protocol/tot/LayerTree#type-StickyPositionConstraint 46type StickyPositionConstraint struct { 47 StickyBoxRect *dom.Rect `json:"stickyBoxRect"` // Layout rectangle of the sticky element before being shifted 48 ContainingBlockRect *dom.Rect `json:"containingBlockRect"` // Layout rectangle of the containing block of the sticky element 49 NearestLayerShiftingStickyBox LayerID `json:"nearestLayerShiftingStickyBox,omitempty"` // The nearest sticky layer that shifts the sticky box 50 NearestLayerShiftingContainingBlock LayerID `json:"nearestLayerShiftingContainingBlock,omitempty"` // The nearest sticky layer that shifts the containing block 51} 52 53// PictureTile serialized fragment of layer picture along with its offset 54// within the layer. 55// 56// See: https://chromedevtools.github.io/devtools-protocol/tot/LayerTree#type-PictureTile 57type PictureTile struct { 58 X float64 `json:"x"` // Offset from owning layer left boundary 59 Y float64 `json:"y"` // Offset from owning layer top boundary 60 Picture string `json:"picture"` // Base64-encoded snapshot data. 61} 62 63// Layer information about a compositing layer. 64// 65// See: https://chromedevtools.github.io/devtools-protocol/tot/LayerTree#type-Layer 66type Layer struct { 67 LayerID LayerID `json:"layerId"` // The unique id for this layer. 68 ParentLayerID LayerID `json:"parentLayerId,omitempty"` // The id of parent (not present for root). 69 BackendNodeID cdp.BackendNodeID `json:"backendNodeId,omitempty"` // The backend id for the node associated with this layer. 70 OffsetX float64 `json:"offsetX"` // Offset from parent layer, X coordinate. 71 OffsetY float64 `json:"offsetY"` // Offset from parent layer, Y coordinate. 72 Width float64 `json:"width"` // Layer width. 73 Height float64 `json:"height"` // Layer height. 74 Transform []float64 `json:"transform,omitempty"` // Transformation matrix for layer, default is identity matrix 75 AnchorX float64 `json:"anchorX,omitempty"` // Transform anchor point X, absent if no transform specified 76 AnchorY float64 `json:"anchorY,omitempty"` // Transform anchor point Y, absent if no transform specified 77 AnchorZ float64 `json:"anchorZ,omitempty"` // Transform anchor point Z, absent if no transform specified 78 PaintCount int64 `json:"paintCount"` // Indicates how many time this layer has painted. 79 DrawsContent bool `json:"drawsContent"` // Indicates whether this layer hosts any content, rather than being used for transform/scrolling purposes only. 80 Invisible bool `json:"invisible,omitempty"` // Set if layer is not visible. 81 ScrollRects []*ScrollRect `json:"scrollRects,omitempty"` // Rectangles scrolling on main thread only. 82 StickyPositionConstraint *StickyPositionConstraint `json:"stickyPositionConstraint,omitempty"` // Sticky position constraint information 83} 84 85// PaintProfile array of timings, one per paint step. 86// 87// See: https://chromedevtools.github.io/devtools-protocol/tot/LayerTree#type-PaintProfile 88type PaintProfile []float64 89 90// ScrollRectType reason for rectangle to force scrolling on the main thread. 91// 92// See: https://chromedevtools.github.io/devtools-protocol/tot/LayerTree#type-ScrollRect 93type ScrollRectType string 94 95// String returns the ScrollRectType as string value. 96func (t ScrollRectType) String() string { 97 return string(t) 98} 99 100// ScrollRectType values. 101const ( 102 ScrollRectTypeRepaintsOnScroll ScrollRectType = "RepaintsOnScroll" 103 ScrollRectTypeTouchEventHandler ScrollRectType = "TouchEventHandler" 104 ScrollRectTypeWheelEventHandler ScrollRectType = "WheelEventHandler" 105) 106 107// MarshalEasyJSON satisfies easyjson.Marshaler. 108func (t ScrollRectType) MarshalEasyJSON(out *jwriter.Writer) { 109 out.String(string(t)) 110} 111 112// MarshalJSON satisfies json.Marshaler. 113func (t ScrollRectType) MarshalJSON() ([]byte, error) { 114 return easyjson.Marshal(t) 115} 116 117// UnmarshalEasyJSON satisfies easyjson.Unmarshaler. 118func (t *ScrollRectType) UnmarshalEasyJSON(in *jlexer.Lexer) { 119 switch ScrollRectType(in.String()) { 120 case ScrollRectTypeRepaintsOnScroll: 121 *t = ScrollRectTypeRepaintsOnScroll 122 case ScrollRectTypeTouchEventHandler: 123 *t = ScrollRectTypeTouchEventHandler 124 case ScrollRectTypeWheelEventHandler: 125 *t = ScrollRectTypeWheelEventHandler 126 127 default: 128 in.AddError(errors.New("unknown ScrollRectType value")) 129 } 130} 131 132// UnmarshalJSON satisfies json.Unmarshaler. 133func (t *ScrollRectType) UnmarshalJSON(buf []byte) error { 134 return easyjson.Unmarshal(buf, t) 135} 136