diff options
author | Josh Matthews <josh@joshmatthews.net> | 2024-10-07 21:51:58 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-08 01:51:58 +0000 |
commit | 7d931e673af2780f3f62d52cb17324ec2cc68c71 (patch) | |
tree | 450d534196e9eb8d0e04db37203b414f5d92420d /components/script/dom/dommatrix.rs | |
parent | 946fa9cdee68bb834a3b75821e8e7f94cf86d31c (diff) | |
download | servo-7d931e673af2780f3f62d52cb17324ec2cc68c71.tar.gz servo-7d931e673af2780f3f62d52cb17324ec2cc68c71.zip |
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>
Diffstat (limited to 'components/script/dom/dommatrix.rs')
-rw-r--r-- | components/script/dom/dommatrix.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/components/script/dom/dommatrix.rs b/components/script/dom/dommatrix.rs index 6a8be5e313f..66455e459de 100644 --- a/components/script/dom/dommatrix.rs +++ b/components/script/dom/dommatrix.rs @@ -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() |