forked from go-rod/rod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
css.go
1325 lines (961 loc) · 42 KB
/
css.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// This file is generated by "./lib/proto/generate"
package proto
/*
CSS
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 a DOM node id). A client
can also keep track of stylesheets via the `styleSheetAdded`/`styleSheetRemoved` events and
subsequently load the required stylesheet contents using the `getStyleSheet[Text]()` methods.
*/
// CSSStyleSheetID ...
type CSSStyleSheetID string
// CSSStyleSheetOrigin 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.
type CSSStyleSheetOrigin string
const (
// CSSStyleSheetOriginInjected enum const
CSSStyleSheetOriginInjected CSSStyleSheetOrigin = "injected"
// CSSStyleSheetOriginUserAgent enum const
CSSStyleSheetOriginUserAgent CSSStyleSheetOrigin = "user-agent"
// CSSStyleSheetOriginInspector enum const
CSSStyleSheetOriginInspector CSSStyleSheetOrigin = "inspector"
// CSSStyleSheetOriginRegular enum const
CSSStyleSheetOriginRegular CSSStyleSheetOrigin = "regular"
)
// CSSPseudoElementMatches CSS rule collection for a single pseudo style.
type CSSPseudoElementMatches struct {
// PseudoType Pseudo element type.
PseudoType DOMPseudoType `json:"pseudoType"`
// PseudoIdentifier (optional) Pseudo element custom ident.
PseudoIdentifier string `json:"pseudoIdentifier,omitempty"`
// Matches Matches of CSS rules applicable to the pseudo style.
Matches []*CSSRuleMatch `json:"matches"`
}
// CSSInheritedStyleEntry Inherited CSS rule collection from ancestor node.
type CSSInheritedStyleEntry struct {
// InlineStyle (optional) The ancestor node's inline style, if any, in the style inheritance chain.
InlineStyle *CSSCSSStyle `json:"inlineStyle,omitempty"`
// MatchedCSSRules Matches of CSS rules matching the ancestor node in the style inheritance chain.
MatchedCSSRules []*CSSRuleMatch `json:"matchedCSSRules"`
}
// CSSInheritedPseudoElementMatches Inherited pseudo element matches from pseudos of an ancestor node.
type CSSInheritedPseudoElementMatches struct {
// PseudoElements Matches of pseudo styles from the pseudos of an ancestor node.
PseudoElements []*CSSPseudoElementMatches `json:"pseudoElements"`
}
// CSSRuleMatch Match data for a CSS rule.
type CSSRuleMatch struct {
// Rule CSS rule in the match.
Rule *CSSCSSRule `json:"rule"`
// MatchingSelectors Matching selector indices in the rule's selectorList selectors (0-based).
MatchingSelectors []int `json:"matchingSelectors"`
}
// CSSValue Data for a simple selector (these are delimited by commas in a selector list).
type CSSValue struct {
// Text Value text.
Text string `json:"text"`
// Range (optional) Value range in the underlying resource (if available).
Range *CSSSourceRange `json:"range,omitempty"`
}
// CSSSelectorList Selector list data.
type CSSSelectorList struct {
// Selectors Selectors in the list.
Selectors []*CSSValue `json:"selectors"`
// Text Rule selector text.
Text string `json:"text"`
}
// CSSCSSStyleSheetHeader CSS stylesheet metainformation.
type CSSCSSStyleSheetHeader struct {
// StyleSheetID The stylesheet identifier.
StyleSheetID CSSStyleSheetID `json:"styleSheetId"`
// FrameID Owner frame identifier.
FrameID PageFrameID `json:"frameId"`
// SourceURL Stylesheet resource URL. Empty if this is a constructed stylesheet created using
// new CSSStyleSheet() (but non-empty if this is a constructed sylesheet imported
// as a CSS module script).
SourceURL string `json:"sourceURL"`
// SourceMapURL (optional) URL of source map associated with the stylesheet (if any).
SourceMapURL string `json:"sourceMapURL,omitempty"`
// Origin Stylesheet origin.
Origin CSSStyleSheetOrigin `json:"origin"`
// Title Stylesheet title.
Title string `json:"title"`
// OwnerNode (optional) The backend id for the owner node of the stylesheet.
OwnerNode DOMBackendNodeID `json:"ownerNode,omitempty"`
// Disabled Denotes whether the stylesheet is disabled.
Disabled bool `json:"disabled"`
// HasSourceURL (optional) Whether the sourceURL field value comes from the sourceURL comment.
HasSourceURL bool `json:"hasSourceURL,omitempty"`
// IsInline Whether this stylesheet is created for STYLE tag by parser. This flag is not set for
// document.written STYLE tags.
IsInline bool `json:"isInline"`
// IsMutable Whether this stylesheet is mutable. Inline stylesheets become mutable
// after they have been modified via CSSOM API.
// <link> element's stylesheets become mutable only if DevTools modifies them.
// Constructed stylesheets (new CSSStyleSheet()) are mutable immediately after creation.
IsMutable bool `json:"isMutable"`
// IsConstructed True if this stylesheet is created through new CSSStyleSheet() or imported as a
// CSS module script.
IsConstructed bool `json:"isConstructed"`
// StartLine Line offset of the stylesheet within the resource (zero based).
StartLine float64 `json:"startLine"`
// StartColumn Column offset of the stylesheet within the resource (zero based).
StartColumn float64 `json:"startColumn"`
// Length Size of the content (in characters).
Length float64 `json:"length"`
// EndLine Line offset of the end of the stylesheet within the resource (zero based).
EndLine float64 `json:"endLine"`
// EndColumn Column offset of the end of the stylesheet within the resource (zero based).
EndColumn float64 `json:"endColumn"`
}
// CSSCSSRule CSS rule representation.
type CSSCSSRule struct {
// StyleSheetID (optional) The css style sheet identifier (absent for user agent stylesheet and user-specified
// stylesheet rules) this rule came from.
StyleSheetID CSSStyleSheetID `json:"styleSheetId,omitempty"`
// SelectorList Rule selector data.
SelectorList *CSSSelectorList `json:"selectorList"`
// Origin Parent stylesheet's origin.
Origin CSSStyleSheetOrigin `json:"origin"`
// Style Associated style declaration.
Style *CSSCSSStyle `json:"style"`
// Media (optional) Media list array (for rules involving media queries). The array enumerates media queries
// starting with the innermost one, going outwards.
Media []*CSSCSSMedia `json:"media,omitempty"`
// ContainerQueries (experimental) (optional) Container query list array (for rules involving container queries).
// The array enumerates container queries starting with the innermost one, going outwards.
ContainerQueries []*CSSCSSContainerQuery `json:"containerQueries,omitempty"`
// Supports (experimental) (optional) @supports CSS at-rule array.
// The array enumerates @supports at-rules starting with the innermost one, going outwards.
Supports []*CSSCSSSupports `json:"supports,omitempty"`
// Layers (experimental) (optional) Cascade layer array. Contains the layer hierarchy that this rule belongs to starting
// with the innermost layer and going outwards.
Layers []*CSSCSSLayer `json:"layers,omitempty"`
// Scopes (experimental) (optional) @scope CSS at-rule array.
// The array enumerates @scope at-rules starting with the innermost one, going outwards.
Scopes []*CSSCSSScope `json:"scopes,omitempty"`
}
// CSSRuleUsage CSS coverage information.
type CSSRuleUsage struct {
// StyleSheetID The css style sheet identifier (absent for user agent stylesheet and user-specified
// stylesheet rules) this rule came from.
StyleSheetID CSSStyleSheetID `json:"styleSheetId"`
// StartOffset Offset of the start of the rule (including selector) from the beginning of the stylesheet.
StartOffset float64 `json:"startOffset"`
// EndOffset Offset of the end of the rule body from the beginning of the stylesheet.
EndOffset float64 `json:"endOffset"`
// Used Indicates whether the rule was actually used by some element in the page.
Used bool `json:"used"`
}
// CSSSourceRange Text range within a resource. All numbers are zero-based.
type CSSSourceRange struct {
// StartLine Start line of range.
StartLine int `json:"startLine"`
// StartColumn Start column of range (inclusive).
StartColumn int `json:"startColumn"`
// EndLine End line of range
EndLine int `json:"endLine"`
// EndColumn End column of range (exclusive).
EndColumn int `json:"endColumn"`
}
// CSSShorthandEntry ...
type CSSShorthandEntry struct {
// Name Shorthand name.
Name string `json:"name"`
// Value Shorthand value.
Value string `json:"value"`
// Important (optional) Whether the property has "!important" annotation (implies `false` if absent).
Important bool `json:"important,omitempty"`
}
// CSSCSSComputedStyleProperty ...
type CSSCSSComputedStyleProperty struct {
// Name Computed style property name.
Name string `json:"name"`
// Value Computed style property value.
Value string `json:"value"`
}
// CSSCSSStyle CSS style representation.
type CSSCSSStyle struct {
// StyleSheetID (optional) The css style sheet identifier (absent for user agent stylesheet and user-specified
// stylesheet rules) this rule came from.
StyleSheetID CSSStyleSheetID `json:"styleSheetId,omitempty"`
// CSSProperties CSS properties in the style.
CSSProperties []*CSSCSSProperty `json:"cssProperties"`
// ShorthandEntries Computed values for all shorthands found in the style.
ShorthandEntries []*CSSShorthandEntry `json:"shorthandEntries"`
// CSSText (optional) Style declaration text (if available).
CSSText string `json:"cssText,omitempty"`
// Range (optional) Style declaration range in the enclosing stylesheet (if available).
Range *CSSSourceRange `json:"range,omitempty"`
}
// CSSCSSProperty CSS property declaration data.
type CSSCSSProperty struct {
// Name The property name.
Name string `json:"name"`
// Value The property value.
Value string `json:"value"`
// Important (optional) Whether the property has "!important" annotation (implies `false` if absent).
Important bool `json:"important,omitempty"`
// Implicit (optional) Whether the property is implicit (implies `false` if absent).
Implicit bool `json:"implicit,omitempty"`
// Text (optional) The full property text as specified in the style.
Text string `json:"text,omitempty"`
// ParsedOk (optional) Whether the property is understood by the browser (implies `true` if absent).
ParsedOk bool `json:"parsedOk,omitempty"`
// Disabled (optional) Whether the property is disabled by the user (present for source-based properties only).
Disabled bool `json:"disabled,omitempty"`
// Range (optional) The entire property range in the enclosing style declaration (if available).
Range *CSSSourceRange `json:"range,omitempty"`
// LonghandProperties (experimental) (optional) Parsed longhand components of this property if it is a shorthand.
// This field will be empty if the given property is not a shorthand.
LonghandProperties []*CSSCSSProperty `json:"longhandProperties,omitempty"`
}
// CSSCSSMediaSource enum
type CSSCSSMediaSource string
const (
// CSSCSSMediaSourceMediaRule enum const
CSSCSSMediaSourceMediaRule CSSCSSMediaSource = "mediaRule"
// CSSCSSMediaSourceImportRule enum const
CSSCSSMediaSourceImportRule CSSCSSMediaSource = "importRule"
// CSSCSSMediaSourceLinkedSheet enum const
CSSCSSMediaSourceLinkedSheet CSSCSSMediaSource = "linkedSheet"
// CSSCSSMediaSourceInlineSheet enum const
CSSCSSMediaSourceInlineSheet CSSCSSMediaSource = "inlineSheet"
)
// CSSCSSMedia CSS media rule descriptor.
type CSSCSSMedia struct {
// Text Media query text.
Text string `json:"text"`
// Source Source of the media query: "mediaRule" if specified by a @media rule, "importRule" if
// specified by an @import rule, "linkedSheet" if specified by a "media" attribute in a linked
// stylesheet's LINK tag, "inlineSheet" if specified by a "media" attribute in an inline
// stylesheet's STYLE tag.
Source CSSCSSMediaSource `json:"source"`
// SourceURL (optional) URL of the document containing the media query description.
SourceURL string `json:"sourceURL,omitempty"`
// Range (optional) The associated rule (@media or @import) header range in the enclosing stylesheet (if
// available).
Range *CSSSourceRange `json:"range,omitempty"`
// StyleSheetID (optional) Identifier of the stylesheet containing this object (if exists).
StyleSheetID CSSStyleSheetID `json:"styleSheetId,omitempty"`
// MediaList (optional) Array of media queries.
MediaList []*CSSMediaQuery `json:"mediaList,omitempty"`
}
// CSSMediaQuery Media query descriptor.
type CSSMediaQuery struct {
// Expressions Array of media query expressions.
Expressions []*CSSMediaQueryExpression `json:"expressions"`
// Active Whether the media query condition is satisfied.
Active bool `json:"active"`
}
// CSSMediaQueryExpression Media query expression descriptor.
type CSSMediaQueryExpression struct {
// Value Media query expression value.
Value float64 `json:"value"`
// Unit Media query expression units.
Unit string `json:"unit"`
// Feature Media query expression feature.
Feature string `json:"feature"`
// ValueRange (optional) The associated range of the value text in the enclosing stylesheet (if available).
ValueRange *CSSSourceRange `json:"valueRange,omitempty"`
// ComputedLength (optional) Computed length of media query expression (if applicable).
ComputedLength *float64 `json:"computedLength,omitempty"`
}
// CSSCSSContainerQuery (experimental) CSS container query rule descriptor.
type CSSCSSContainerQuery struct {
// Text Container query text.
Text string `json:"text"`
// Range (optional) The associated rule header range in the enclosing stylesheet (if
// available).
Range *CSSSourceRange `json:"range,omitempty"`
// StyleSheetID (optional) Identifier of the stylesheet containing this object (if exists).
StyleSheetID CSSStyleSheetID `json:"styleSheetId,omitempty"`
// Name (optional) Optional name for the container.
Name string `json:"name,omitempty"`
// PhysicalAxes (optional) Optional physical axes queried for the container.
PhysicalAxes DOMPhysicalAxes `json:"physicalAxes,omitempty"`
// LogicalAxes (optional) Optional logical axes queried for the container.
LogicalAxes DOMLogicalAxes `json:"logicalAxes,omitempty"`
}
// CSSCSSSupports (experimental) CSS Supports at-rule descriptor.
type CSSCSSSupports struct {
// Text Supports rule text.
Text string `json:"text"`
// Active Whether the supports condition is satisfied.
Active bool `json:"active"`
// Range (optional) The associated rule header range in the enclosing stylesheet (if
// available).
Range *CSSSourceRange `json:"range,omitempty"`
// StyleSheetID (optional) Identifier of the stylesheet containing this object (if exists).
StyleSheetID CSSStyleSheetID `json:"styleSheetId,omitempty"`
}
// CSSCSSScope (experimental) CSS Scope at-rule descriptor.
type CSSCSSScope struct {
// Text Scope rule text.
Text string `json:"text"`
// Range (optional) The associated rule header range in the enclosing stylesheet (if
// available).
Range *CSSSourceRange `json:"range,omitempty"`
// StyleSheetID (optional) Identifier of the stylesheet containing this object (if exists).
StyleSheetID CSSStyleSheetID `json:"styleSheetId,omitempty"`
}
// CSSCSSLayer (experimental) CSS Layer at-rule descriptor.
type CSSCSSLayer struct {
// Text Layer name.
Text string `json:"text"`
// Range (optional) The associated rule header range in the enclosing stylesheet (if
// available).
Range *CSSSourceRange `json:"range,omitempty"`
// StyleSheetID (optional) Identifier of the stylesheet containing this object (if exists).
StyleSheetID CSSStyleSheetID `json:"styleSheetId,omitempty"`
}
// CSSCSSLayerData (experimental) CSS Layer data.
type CSSCSSLayerData struct {
// Name Layer name.
Name string `json:"name"`
// SubLayers (optional) Direct sub-layers
SubLayers []*CSSCSSLayerData `json:"subLayers,omitempty"`
// Order Layer order. The order determines the order of the layer in the cascade order.
// A higher number has higher priority in the cascade order.
Order float64 `json:"order"`
}
// CSSPlatformFontUsage Information about amount of glyphs that were rendered with given font.
type CSSPlatformFontUsage struct {
// FamilyName Font's family name reported by platform.
FamilyName string `json:"familyName"`
// IsCustomFont Indicates if the font was downloaded or resolved locally.
IsCustomFont bool `json:"isCustomFont"`
// GlyphCount Amount of glyphs that were rendered with this font.
GlyphCount float64 `json:"glyphCount"`
}
// CSSFontVariationAxis Information about font variation axes for variable fonts
type CSSFontVariationAxis struct {
// Tag The font-variation-setting tag (a.k.a. "axis tag").
Tag string `json:"tag"`
// Name Human-readable variation name in the default language (normally, "en").
Name string `json:"name"`
// MinValue The minimum value (inclusive) the font supports for this tag.
MinValue float64 `json:"minValue"`
// MaxValue The maximum value (inclusive) the font supports for this tag.
MaxValue float64 `json:"maxValue"`
// DefaultValue The default value.
DefaultValue float64 `json:"defaultValue"`
}
// CSSFontFace 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.
type CSSFontFace struct {
// FontFamily The font-family.
FontFamily string `json:"fontFamily"`
// FontStyle The font-style.
FontStyle string `json:"fontStyle"`
// FontVariant The font-variant.
FontVariant string `json:"fontVariant"`
// FontWeight The font-weight.
FontWeight string `json:"fontWeight"`
// FontStretch The font-stretch.
FontStretch string `json:"fontStretch"`
// FontDisplay The font-display.
FontDisplay string `json:"fontDisplay"`
// UnicodeRange The unicode-range.
UnicodeRange string `json:"unicodeRange"`
// Src The src.
Src string `json:"src"`
// PlatformFontFamily The resolved platform font family
PlatformFontFamily string `json:"platformFontFamily"`
// FontVariationAxes (optional) Available variation settings (a.k.a. "axes").
FontVariationAxes []*CSSFontVariationAxis `json:"fontVariationAxes,omitempty"`
}
// CSSCSSKeyframesRule CSS keyframes rule representation.
type CSSCSSKeyframesRule struct {
// AnimationName Animation name.
AnimationName *CSSValue `json:"animationName"`
// Keyframes List of keyframes.
Keyframes []*CSSCSSKeyframeRule `json:"keyframes"`
}
// CSSCSSKeyframeRule CSS keyframe rule representation.
type CSSCSSKeyframeRule struct {
// StyleSheetID (optional) The css style sheet identifier (absent for user agent stylesheet and user-specified
// stylesheet rules) this rule came from.
StyleSheetID CSSStyleSheetID `json:"styleSheetId,omitempty"`
// Origin Parent stylesheet's origin.
Origin CSSStyleSheetOrigin `json:"origin"`
// KeyText Associated key text.
KeyText *CSSValue `json:"keyText"`
// Style Associated style declaration.
Style *CSSCSSStyle `json:"style"`
}
// CSSStyleDeclarationEdit A descriptor of operation to mutate style declaration text.
type CSSStyleDeclarationEdit struct {
// StyleSheetID The css style sheet identifier.
StyleSheetID CSSStyleSheetID `json:"styleSheetId"`
// Range The range of the style text in the enclosing stylesheet.
Range *CSSSourceRange `json:"range"`
// Text New style text.
Text string `json:"text"`
}
// CSSAddRule Inserts a new rule with the given `ruleText` in a stylesheet with given `styleSheetId`, at the
// position specified by `location`.
type CSSAddRule struct {
// StyleSheetID The css style sheet identifier where a new rule should be inserted.
StyleSheetID CSSStyleSheetID `json:"styleSheetId"`
// RuleText The text of a new rule.
RuleText string `json:"ruleText"`
// Location Text position of a new rule in the target style sheet.
Location *CSSSourceRange `json:"location"`
}
// ProtoReq name
func (m CSSAddRule) ProtoReq() string { return "CSS.addRule" }
// Call the request
func (m CSSAddRule) Call(c Client) (*CSSAddRuleResult, error) {
var res CSSAddRuleResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// CSSAddRuleResult ...
type CSSAddRuleResult struct {
// Rule The newly created rule.
Rule *CSSCSSRule `json:"rule"`
}
// CSSCollectClassNames Returns all class names from specified stylesheet.
type CSSCollectClassNames struct {
// StyleSheetID ...
StyleSheetID CSSStyleSheetID `json:"styleSheetId"`
}
// ProtoReq name
func (m CSSCollectClassNames) ProtoReq() string { return "CSS.collectClassNames" }
// Call the request
func (m CSSCollectClassNames) Call(c Client) (*CSSCollectClassNamesResult, error) {
var res CSSCollectClassNamesResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// CSSCollectClassNamesResult ...
type CSSCollectClassNamesResult struct {
// ClassNames Class name list.
ClassNames []string `json:"classNames"`
}
// CSSCreateStyleSheet Creates a new special "via-inspector" stylesheet in the frame with given `frameId`.
type CSSCreateStyleSheet struct {
// FrameID Identifier of the frame where "via-inspector" stylesheet should be created.
FrameID PageFrameID `json:"frameId"`
}
// ProtoReq name
func (m CSSCreateStyleSheet) ProtoReq() string { return "CSS.createStyleSheet" }
// Call the request
func (m CSSCreateStyleSheet) Call(c Client) (*CSSCreateStyleSheetResult, error) {
var res CSSCreateStyleSheetResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// CSSCreateStyleSheetResult ...
type CSSCreateStyleSheetResult struct {
// StyleSheetID Identifier of the created "via-inspector" stylesheet.
StyleSheetID CSSStyleSheetID `json:"styleSheetId"`
}
// CSSDisable Disables the CSS agent for the given page.
type CSSDisable struct {
}
// ProtoReq name
func (m CSSDisable) ProtoReq() string { return "CSS.disable" }
// Call sends the request
func (m CSSDisable) Call(c Client) error {
return call(m.ProtoReq(), m, nil, c)
}
// CSSEnable 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 CSSEnable struct {
}
// ProtoReq name
func (m CSSEnable) ProtoReq() string { return "CSS.enable" }
// Call sends the request
func (m CSSEnable) Call(c Client) error {
return call(m.ProtoReq(), m, nil, c)
}
// CSSForcePseudoState Ensures that the given node will have specified pseudo-classes whenever its style is computed by
// the browser.
type CSSForcePseudoState struct {
// NodeID The element id for which to force the pseudo state.
NodeID DOMNodeID `json:"nodeId"`
// ForcedPseudoClasses Element pseudo classes to force when computing the element's style.
ForcedPseudoClasses []string `json:"forcedPseudoClasses"`
}
// ProtoReq name
func (m CSSForcePseudoState) ProtoReq() string { return "CSS.forcePseudoState" }
// Call sends the request
func (m CSSForcePseudoState) Call(c Client) error {
return call(m.ProtoReq(), m, nil, c)
}
// CSSGetBackgroundColors ...
type CSSGetBackgroundColors struct {
// NodeID Id of the node to get background colors for.
NodeID DOMNodeID `json:"nodeId"`
}
// ProtoReq name
func (m CSSGetBackgroundColors) ProtoReq() string { return "CSS.getBackgroundColors" }
// Call the request
func (m CSSGetBackgroundColors) Call(c Client) (*CSSGetBackgroundColorsResult, error) {
var res CSSGetBackgroundColorsResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// CSSGetBackgroundColorsResult ...
type CSSGetBackgroundColorsResult struct {
// BackgroundColors (optional) 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).
BackgroundColors []string `json:"backgroundColors,omitempty"`
// ComputedFontSize (optional) The computed font size for this node, as a CSS computed value string (e.g. '12px').
ComputedFontSize string `json:"computedFontSize,omitempty"`
// ComputedFontWeight (optional) The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or
// '100').
ComputedFontWeight string `json:"computedFontWeight,omitempty"`
}
// CSSGetComputedStyleForNode Returns the computed style for a DOM node identified by `nodeId`.
type CSSGetComputedStyleForNode struct {
// NodeID ...
NodeID DOMNodeID `json:"nodeId"`
}
// ProtoReq name
func (m CSSGetComputedStyleForNode) ProtoReq() string { return "CSS.getComputedStyleForNode" }
// Call the request
func (m CSSGetComputedStyleForNode) Call(c Client) (*CSSGetComputedStyleForNodeResult, error) {
var res CSSGetComputedStyleForNodeResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// CSSGetComputedStyleForNodeResult ...
type CSSGetComputedStyleForNodeResult struct {
// ComputedStyle Computed style for the specified DOM node.
ComputedStyle []*CSSCSSComputedStyleProperty `json:"computedStyle"`
}
// CSSGetInlineStylesForNode Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM
// attributes) for a DOM node identified by `nodeId`.
type CSSGetInlineStylesForNode struct {
// NodeID ...
NodeID DOMNodeID `json:"nodeId"`
}
// ProtoReq name
func (m CSSGetInlineStylesForNode) ProtoReq() string { return "CSS.getInlineStylesForNode" }
// Call the request
func (m CSSGetInlineStylesForNode) Call(c Client) (*CSSGetInlineStylesForNodeResult, error) {
var res CSSGetInlineStylesForNodeResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// CSSGetInlineStylesForNodeResult ...
type CSSGetInlineStylesForNodeResult struct {
// InlineStyle (optional) Inline style for the specified DOM node.
InlineStyle *CSSCSSStyle `json:"inlineStyle,omitempty"`
// AttributesStyle (optional) Attribute-defined element style (e.g. resulting from "width=20 height=100%").
AttributesStyle *CSSCSSStyle `json:"attributesStyle,omitempty"`
}
// CSSGetMatchedStylesForNode Returns requested styles for a DOM node identified by `nodeId`.
type CSSGetMatchedStylesForNode struct {
// NodeID ...
NodeID DOMNodeID `json:"nodeId"`
}
// ProtoReq name
func (m CSSGetMatchedStylesForNode) ProtoReq() string { return "CSS.getMatchedStylesForNode" }
// Call the request
func (m CSSGetMatchedStylesForNode) Call(c Client) (*CSSGetMatchedStylesForNodeResult, error) {
var res CSSGetMatchedStylesForNodeResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// CSSGetMatchedStylesForNodeResult ...
type CSSGetMatchedStylesForNodeResult struct {
// InlineStyle (optional) Inline style for the specified DOM node.
InlineStyle *CSSCSSStyle `json:"inlineStyle,omitempty"`
// AttributesStyle (optional) Attribute-defined element style (e.g. resulting from "width=20 height=100%").
AttributesStyle *CSSCSSStyle `json:"attributesStyle,omitempty"`
// MatchedCSSRules (optional) CSS rules matching this node, from all applicable stylesheets.
MatchedCSSRules []*CSSRuleMatch `json:"matchedCSSRules,omitempty"`
// PseudoElements (optional) Pseudo style matches for this node.
PseudoElements []*CSSPseudoElementMatches `json:"pseudoElements,omitempty"`
// Inherited (optional) A chain of inherited styles (from the immediate node parent up to the DOM tree root).
Inherited []*CSSInheritedStyleEntry `json:"inherited,omitempty"`
// InheritedPseudoElements (optional) A chain of inherited pseudo element styles (from the immediate node parent up to the DOM tree root).
InheritedPseudoElements []*CSSInheritedPseudoElementMatches `json:"inheritedPseudoElements,omitempty"`
// CSSKeyframesRules (optional) A list of CSS keyframed animations matching this node.
CSSKeyframesRules []*CSSCSSKeyframesRule `json:"cssKeyframesRules,omitempty"`
// ParentLayoutNodeID (experimental) (optional) Id of the first parent element that does not have display: contents.
ParentLayoutNodeID DOMNodeID `json:"parentLayoutNodeId,omitempty"`
}
// CSSGetMediaQueries Returns all media queries parsed by the rendering engine.
type CSSGetMediaQueries struct {
}
// ProtoReq name
func (m CSSGetMediaQueries) ProtoReq() string { return "CSS.getMediaQueries" }
// Call the request
func (m CSSGetMediaQueries) Call(c Client) (*CSSGetMediaQueriesResult, error) {
var res CSSGetMediaQueriesResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// CSSGetMediaQueriesResult ...
type CSSGetMediaQueriesResult struct {
// Medias ...
Medias []*CSSCSSMedia `json:"medias"`
}
// CSSGetPlatformFontsForNode Requests information about platform fonts which we used to render child TextNodes in the given
// node.
type CSSGetPlatformFontsForNode struct {
// NodeID ...
NodeID DOMNodeID `json:"nodeId"`
}
// ProtoReq name
func (m CSSGetPlatformFontsForNode) ProtoReq() string { return "CSS.getPlatformFontsForNode" }
// Call the request
func (m CSSGetPlatformFontsForNode) Call(c Client) (*CSSGetPlatformFontsForNodeResult, error) {
var res CSSGetPlatformFontsForNodeResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// CSSGetPlatformFontsForNodeResult ...
type CSSGetPlatformFontsForNodeResult struct {
// Fonts Usage statistics for every employed platform font.
Fonts []*CSSPlatformFontUsage `json:"fonts"`
}
// CSSGetStyleSheetText Returns the current textual content for a stylesheet.
type CSSGetStyleSheetText struct {
// StyleSheetID ...
StyleSheetID CSSStyleSheetID `json:"styleSheetId"`
}
// ProtoReq name
func (m CSSGetStyleSheetText) ProtoReq() string { return "CSS.getStyleSheetText" }
// Call the request
func (m CSSGetStyleSheetText) Call(c Client) (*CSSGetStyleSheetTextResult, error) {
var res CSSGetStyleSheetTextResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// CSSGetStyleSheetTextResult ...
type CSSGetStyleSheetTextResult struct {
// Text The stylesheet text.
Text string `json:"text"`
}
// CSSGetLayersForNode (experimental) Returns all layers parsed by the rendering engine for the tree scope of a node.
// Given a DOM element identified by nodeId, getLayersForNode returns the root
// layer for the nearest ancestor document or shadow root. The layer root contains
// the full layer tree for the tree scope and their ordering.
type CSSGetLayersForNode struct {
// NodeID ...
NodeID DOMNodeID `json:"nodeId"`
}
// ProtoReq name
func (m CSSGetLayersForNode) ProtoReq() string { return "CSS.getLayersForNode" }
// Call the request
func (m CSSGetLayersForNode) Call(c Client) (*CSSGetLayersForNodeResult, error) {
var res CSSGetLayersForNodeResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// CSSGetLayersForNodeResult (experimental) ...
type CSSGetLayersForNodeResult struct {
// RootLayer ...
RootLayer *CSSCSSLayerData `json:"rootLayer"`
}
// CSSTrackComputedStyleUpdates (experimental) 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.
type CSSTrackComputedStyleUpdates struct {
// PropertiesToTrack ...
PropertiesToTrack []*CSSCSSComputedStyleProperty `json:"propertiesToTrack"`
}
// ProtoReq name
func (m CSSTrackComputedStyleUpdates) ProtoReq() string { return "CSS.trackComputedStyleUpdates" }
// Call sends the request
func (m CSSTrackComputedStyleUpdates) Call(c Client) error {
return call(m.ProtoReq(), m, nil, c)
}
// CSSTakeComputedStyleUpdates (experimental) Polls the next batch of computed style updates.
type CSSTakeComputedStyleUpdates struct {
}
// ProtoReq name
func (m CSSTakeComputedStyleUpdates) ProtoReq() string { return "CSS.takeComputedStyleUpdates" }
// Call the request
func (m CSSTakeComputedStyleUpdates) Call(c Client) (*CSSTakeComputedStyleUpdatesResult, error) {
var res CSSTakeComputedStyleUpdatesResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// CSSTakeComputedStyleUpdatesResult (experimental) ...
type CSSTakeComputedStyleUpdatesResult struct {
// NodeIds The list of node Ids that have their tracked computed styles updated
NodeIds []DOMNodeID `json:"nodeIds"`
}
// CSSSetEffectivePropertyValueForNode Find a rule with the given active property for the given node and set the new value for this
// property
type CSSSetEffectivePropertyValueForNode struct {
// NodeID The element id for which to set property.
NodeID DOMNodeID `json:"nodeId"`
// PropertyName ...
PropertyName string `json:"propertyName"`
// Value ...
Value string `json:"value"`
}
// ProtoReq name
func (m CSSSetEffectivePropertyValueForNode) ProtoReq() string {
return "CSS.setEffectivePropertyValueForNode"
}
// Call sends the request
func (m CSSSetEffectivePropertyValueForNode) Call(c Client) error {
return call(m.ProtoReq(), m, nil, c)
}
// CSSSetKeyframeKey Modifies the keyframe rule key text.
type CSSSetKeyframeKey struct {
// StyleSheetID ...
StyleSheetID CSSStyleSheetID `json:"styleSheetId"`
// Range ...
Range *CSSSourceRange `json:"range"`
// KeyText ...
KeyText string `json:"keyText"`
}
// ProtoReq name
func (m CSSSetKeyframeKey) ProtoReq() string { return "CSS.setKeyframeKey" }
// Call the request
func (m CSSSetKeyframeKey) Call(c Client) (*CSSSetKeyframeKeyResult, error) {
var res CSSSetKeyframeKeyResult
return &res, call(m.ProtoReq(), m, &res, c)
}
// CSSSetKeyframeKeyResult ...
type CSSSetKeyframeKeyResult struct {
// KeyText The resulting key text after modification.
KeyText *CSSValue `json:"keyText"`
}