mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
script: Include constructors and static methods in generated DOM traits (#33665)
* Add all constructors, special operations, and static methods to generated DOM interface traits. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Move all constructors and static methods defined in bare impl blocks inside FooMethods trait impls. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Add missing doc links. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
946fa9cdee
commit
7d931e673a
133 changed files with 1479 additions and 1438 deletions
|
@ -51,8 +51,15 @@ impl DOMMatrix {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn from_readonly(global: &GlobalScope, ro: &DOMMatrixReadOnly) -> DomRoot<Self> {
|
||||
Self::new(global, ro.is2D(), *ro.matrix())
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
impl DOMMatrixMethods for DOMMatrix {
|
||||
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-dommatrixreadonly
|
||||
pub fn Constructor(
|
||||
fn Constructor(
|
||||
global: &GlobalScope,
|
||||
proto: Option<HandleObject>,
|
||||
can_gc: CanGc,
|
||||
|
@ -88,16 +95,12 @@ impl DOMMatrix {
|
|||
}
|
||||
|
||||
// https://drafts.fxtf.org/geometry-1/#dom-dommatrix-frommatrix
|
||||
pub fn FromMatrix(global: &GlobalScope, other: &DOMMatrixInit) -> Fallible<DomRoot<Self>> {
|
||||
fn FromMatrix(global: &GlobalScope, other: &DOMMatrixInit) -> Fallible<DomRoot<Self>> {
|
||||
dommatrixinit_to_matrix(other).map(|(is2D, matrix)| Self::new(global, is2D, matrix))
|
||||
}
|
||||
|
||||
pub fn from_readonly(global: &GlobalScope, ro: &DOMMatrixReadOnly) -> DomRoot<Self> {
|
||||
Self::new(global, ro.is2D(), *ro.matrix())
|
||||
}
|
||||
|
||||
// https://drafts.fxtf.org/geometry-1/#dom-dommatrix-fromfloat32array
|
||||
pub fn FromFloat32Array(
|
||||
fn FromFloat32Array(
|
||||
global: &GlobalScope,
|
||||
array: CustomAutoRooterGuard<Float32Array>,
|
||||
) -> Fallible<DomRoot<DOMMatrix>> {
|
||||
|
@ -111,7 +114,7 @@ impl DOMMatrix {
|
|||
}
|
||||
|
||||
// https://drafts.fxtf.org/geometry-1/#dom-dommatrix-fromfloat64array
|
||||
pub fn FromFloat64Array(
|
||||
fn FromFloat64Array(
|
||||
global: &GlobalScope,
|
||||
array: CustomAutoRooterGuard<Float64Array>,
|
||||
) -> Fallible<DomRoot<DOMMatrix>> {
|
||||
|
@ -123,10 +126,7 @@ impl DOMMatrix {
|
|||
Some(StringOrUnrestrictedDoubleSequence::UnrestrictedDoubleSequence(vec)),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
impl DOMMatrixMethods for DOMMatrix {
|
||||
// https://drafts.fxtf.org/geometry-1/#dom-dommatrixreadonly-m11
|
||||
fn M11(&self) -> f64 {
|
||||
self.upcast::<DOMMatrixReadOnly>().M11()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue