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
use super::*;
/// The CSSPseudoElement class.
/// [`CSSPseudoElement`](https://developer.mozilla.org/en-US/docs/Web/API/CSSPseudoElement)
#[derive(Clone, Debug, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct CSSPseudoElement {
inner: EventTarget,
}
impl FromVal for CSSPseudoElement {
fn from_val(v: &Any) -> Self {
CSSPseudoElement {
inner: EventTarget::from_val(v),
}
}
fn take_ownership(v: AnyHandle) -> Self {
Self::from_val(&Any::take_ownership(v))
}
fn as_handle(&self) -> AnyHandle {
self.inner.as_handle()
}
}
impl core::ops::Deref for CSSPseudoElement {
type Target = EventTarget;
fn deref(&self) -> &Self::Target {
&self.inner
}
}
impl core::ops::DerefMut for CSSPseudoElement {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.inner
}
}
impl AsRef<Any> for CSSPseudoElement {
fn as_ref(&self) -> &Any {
&self.inner
}
}
impl AsMut<Any> for CSSPseudoElement {
fn as_mut(&mut self) -> &mut Any {
&mut self.inner
}
}
impl From<CSSPseudoElement> for Any {
fn from(s: CSSPseudoElement) -> Any {
let handle = s.inner.as_handle();
core::mem::forget(s);
Any::take_ownership(handle)
}
}
impl From<&CSSPseudoElement> for Any {
fn from(s: &CSSPseudoElement) -> Any {
s.inner.clone().into()
}
}
jsbind::utils::impl_dyn_cast!(CSSPseudoElement);
impl CSSPseudoElement {
/// Getter of the `type` attribute.
/// [`CSSPseudoElement.type`](https://developer.mozilla.org/en-US/docs/Web/API/CSSPseudoElement/type)
pub fn type_(&self) -> JsString {
self.inner.get("type").as_::<JsString>()
}
}
impl CSSPseudoElement {
/// Getter of the `element` attribute.
/// [`CSSPseudoElement.element`](https://developer.mozilla.org/en-US/docs/Web/API/CSSPseudoElement/element)
pub fn element(&self) -> Element {
self.inner.get("element").as_::<Element>()
}
}
impl CSSPseudoElement {
/// Getter of the `parent` attribute.
/// [`CSSPseudoElement.parent`](https://developer.mozilla.org/en-US/docs/Web/API/CSSPseudoElement/parent)
pub fn parent(&self) -> Any {
self.inner.get("parent").as_::<Any>()
}
}
impl CSSPseudoElement {
/// The pseudo method.
/// [`CSSPseudoElement.pseudo`](https://developer.mozilla.org/en-US/docs/Web/API/CSSPseudoElement/pseudo)
pub fn pseudo(&self, type_: &JsString) -> CSSPseudoElement {
self.inner
.call("pseudo", &[type_.into()])
.as_::<CSSPseudoElement>()
}
}
impl CSSPseudoElement {
/// The getBoxQuads method.
/// [`CSSPseudoElement.getBoxQuads`](https://developer.mozilla.org/en-US/docs/Web/API/CSSPseudoElement/getBoxQuads)
pub fn get_box_quads(&self) -> TypedArray<DOMQuad> {
self.inner
.call("getBoxQuads", &[])
.as_::<TypedArray<DOMQuad>>()
}
}
impl CSSPseudoElement {
/// The getBoxQuads method.
/// [`CSSPseudoElement.getBoxQuads`](https://developer.mozilla.org/en-US/docs/Web/API/CSSPseudoElement/getBoxQuads)
pub fn get_box_quads_with_options(&self, options: &BoxQuadOptions) -> TypedArray<DOMQuad> {
self.inner
.call("getBoxQuads", &[options.into()])
.as_::<TypedArray<DOMQuad>>()
}
}
impl CSSPseudoElement {
/// The convertQuadFromNode method.
/// [`CSSPseudoElement.convertQuadFromNode`](https://developer.mozilla.org/en-US/docs/Web/API/CSSPseudoElement/convertQuadFromNode)
pub fn convert_quad_from_node(&self, quad: &DOMQuadInit, from: &Any) -> DOMQuad {
self.inner
.call("convertQuadFromNode", &[quad.into(), from.into()])
.as_::<DOMQuad>()
}
}
impl CSSPseudoElement {
/// The convertQuadFromNode method.
/// [`CSSPseudoElement.convertQuadFromNode`](https://developer.mozilla.org/en-US/docs/Web/API/CSSPseudoElement/convertQuadFromNode)
pub fn convert_quad_from_node_with_options(
&self,
quad: &DOMQuadInit,
from: &Any,
options: &ConvertCoordinateOptions,
) -> DOMQuad {
self.inner
.call(
"convertQuadFromNode",
&[quad.into(), from.into(), options.into()],
)
.as_::<DOMQuad>()
}
}
impl CSSPseudoElement {
/// The convertRectFromNode method.
/// [`CSSPseudoElement.convertRectFromNode`](https://developer.mozilla.org/en-US/docs/Web/API/CSSPseudoElement/convertRectFromNode)
pub fn convert_rect_from_node(&self, rect: &DOMRectReadOnly, from: &Any) -> DOMQuad {
self.inner
.call("convertRectFromNode", &[rect.into(), from.into()])
.as_::<DOMQuad>()
}
}
impl CSSPseudoElement {
/// The convertRectFromNode method.
/// [`CSSPseudoElement.convertRectFromNode`](https://developer.mozilla.org/en-US/docs/Web/API/CSSPseudoElement/convertRectFromNode)
pub fn convert_rect_from_node_with_options(
&self,
rect: &DOMRectReadOnly,
from: &Any,
options: &ConvertCoordinateOptions,
) -> DOMQuad {
self.inner
.call(
"convertRectFromNode",
&[rect.into(), from.into(), options.into()],
)
.as_::<DOMQuad>()
}
}
impl CSSPseudoElement {
/// The convertPointFromNode method.
/// [`CSSPseudoElement.convertPointFromNode`](https://developer.mozilla.org/en-US/docs/Web/API/CSSPseudoElement/convertPointFromNode)
pub fn convert_point_from_node(&self, point: &DOMPointInit, from: &Any) -> DOMPoint {
self.inner
.call("convertPointFromNode", &[point.into(), from.into()])
.as_::<DOMPoint>()
}
}
impl CSSPseudoElement {
/// The convertPointFromNode method.
/// [`CSSPseudoElement.convertPointFromNode`](https://developer.mozilla.org/en-US/docs/Web/API/CSSPseudoElement/convertPointFromNode)
pub fn convert_point_from_node_with_options(
&self,
point: &DOMPointInit,
from: &Any,
options: &ConvertCoordinateOptions,
) -> DOMPoint {
self.inner
.call(
"convertPointFromNode",
&[point.into(), from.into(), options.into()],
)
.as_::<DOMPoint>()
}
}