rustenium_cdp_definitions/browser_protocol/css/
events.rs1use serde::{Deserialize, Serialize};
2#[doc = "Fires whenever a web font is updated. A non-empty font parameter indicates a successfully loaded\nweb font.\n[fontsUpdated](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#event-fontsUpdated)"]
3#[derive(Debug, Clone, PartialEq, Default, Serialize, Deserialize)]
4pub struct FontsUpdatedParams {
5 #[doc = "The web font that has loaded."]
6 #[serde(rename = "font")]
7 #[serde(skip_serializing_if = "Option::is_none")]
8 #[serde(default)]
9 pub font: Option<super::types::FontFace>,
10}
11#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
12pub enum FontsUpdatedMethod {
13 #[serde(rename = "CSS.fontsUpdated")]
14 FontsUpdated,
15}
16#[doc = "Fires whenever a web font is updated. A non-empty font parameter indicates a successfully loaded\nweb font.\n[fontsUpdated](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#event-fontsUpdated)"]
17#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
18pub struct FontsUpdated {
19 pub method: FontsUpdatedMethod,
20 pub params: FontsUpdatedParams,
21}
22impl FontsUpdated {
23 pub const IDENTIFIER: &'static str = "CSS.fontsUpdated";
24 pub fn identifier(&self) -> &'static str {
25 Self::IDENTIFIER
26 }
27}
28#[doc = "Fires whenever a MediaQuery result changes (for example, after a browser window has been\nresized.) The current implementation considers only viewport-dependent media features.\n[mediaQueryResultChanged](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#event-mediaQueryResultChanged)"]
29#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
30pub struct MediaQueryResultChangedParams {}
31#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
32pub enum MediaQueryResultChangedMethod {
33 #[serde(rename = "CSS.mediaQueryResultChanged")]
34 MediaQueryResultChanged,
35}
36#[doc = "Fires whenever a MediaQuery result changes (for example, after a browser window has been\nresized.) The current implementation considers only viewport-dependent media features.\n[mediaQueryResultChanged](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#event-mediaQueryResultChanged)"]
37#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
38pub struct MediaQueryResultChanged {
39 pub method: MediaQueryResultChangedMethod,
40 pub params: MediaQueryResultChangedParams,
41}
42impl MediaQueryResultChanged {
43 pub const IDENTIFIER: &'static str = "CSS.mediaQueryResultChanged";
44 pub fn identifier(&self) -> &'static str {
45 Self::IDENTIFIER
46 }
47}
48#[doc = "Fired whenever an active document stylesheet is added.\n[styleSheetAdded](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#event-styleSheetAdded)"]
49#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
50pub struct StyleSheetAddedParams {
51 #[doc = "Added stylesheet metainfo."]
52 #[serde(rename = "header")]
53 pub header: super::types::CssStyleSheetHeader,
54}
55#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
56pub enum StyleSheetAddedMethod {
57 #[serde(rename = "CSS.styleSheetAdded")]
58 StyleSheetAdded,
59}
60#[doc = "Fired whenever an active document stylesheet is added.\n[styleSheetAdded](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#event-styleSheetAdded)"]
61#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
62pub struct StyleSheetAdded {
63 pub method: StyleSheetAddedMethod,
64 pub params: StyleSheetAddedParams,
65}
66impl StyleSheetAdded {
67 pub const IDENTIFIER: &'static str = "CSS.styleSheetAdded";
68 pub fn identifier(&self) -> &'static str {
69 Self::IDENTIFIER
70 }
71}
72#[doc = "Fired whenever a stylesheet is changed as a result of the client operation.\n[styleSheetChanged](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#event-styleSheetChanged)"]
73#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
74pub struct StyleSheetChangedParams {
75 #[serde(rename = "styleSheetId")]
76 pub style_sheet_id: crate::browser_protocol::dom::types::StyleSheetId,
77}
78#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
79pub enum StyleSheetChangedMethod {
80 #[serde(rename = "CSS.styleSheetChanged")]
81 StyleSheetChanged,
82}
83#[doc = "Fired whenever a stylesheet is changed as a result of the client operation.\n[styleSheetChanged](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#event-styleSheetChanged)"]
84#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
85pub struct StyleSheetChanged {
86 pub method: StyleSheetChangedMethod,
87 pub params: StyleSheetChangedParams,
88}
89impl StyleSheetChanged {
90 pub const IDENTIFIER: &'static str = "CSS.styleSheetChanged";
91 pub fn identifier(&self) -> &'static str {
92 Self::IDENTIFIER
93 }
94}
95#[doc = "Fired whenever an active document stylesheet is removed.\n[styleSheetRemoved](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#event-styleSheetRemoved)"]
96#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
97pub struct StyleSheetRemovedParams {
98 #[doc = "Identifier of the removed stylesheet."]
99 #[serde(rename = "styleSheetId")]
100 pub style_sheet_id: crate::browser_protocol::dom::types::StyleSheetId,
101}
102#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
103pub enum StyleSheetRemovedMethod {
104 #[serde(rename = "CSS.styleSheetRemoved")]
105 StyleSheetRemoved,
106}
107#[doc = "Fired whenever an active document stylesheet is removed.\n[styleSheetRemoved](https://chromedevtools.github.io/devtools-protocol/tot/CSS/#event-styleSheetRemoved)"]
108#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
109pub struct StyleSheetRemoved {
110 pub method: StyleSheetRemovedMethod,
111 pub params: StyleSheetRemovedParams,
112}
113impl StyleSheetRemoved {
114 pub const IDENTIFIER: &'static str = "CSS.styleSheetRemoved";
115 pub fn identifier(&self) -> &'static str {
116 Self::IDENTIFIER
117 }
118}
119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
120pub struct ComputedStyleUpdatedParams {
121 #[doc = "The node id that has updated computed styles."]
122 #[serde(rename = "nodeId")]
123 pub node_id: crate::browser_protocol::dom::types::NodeId,
124}
125#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
126pub enum ComputedStyleUpdatedMethod {
127 #[serde(rename = "CSS.computedStyleUpdated")]
128 ComputedStyleUpdated,
129}
130#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
131pub struct ComputedStyleUpdated {
132 pub method: ComputedStyleUpdatedMethod,
133 pub params: ComputedStyleUpdatedParams,
134}
135impl ComputedStyleUpdated {
136 pub const IDENTIFIER: &'static str = "CSS.computedStyleUpdated";
137 pub fn identifier(&self) -> &'static str {
138 Self::IDENTIFIER
139 }
140}
141group_enum ! (CssEvents { FontsUpdated (FontsUpdated) , MediaQueryResultChanged (MediaQueryResultChanged) , StyleSheetAdded (StyleSheetAdded) , StyleSheetChanged (StyleSheetChanged) , StyleSheetRemoved (StyleSheetRemoved) , ComputedStyleUpdated (ComputedStyleUpdated) } + identifiable);