diff --git a/CHANGELOG.md b/CHANGELOG.md index 0862a5d8fd1..c07eb12e3da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,9 @@ * Add unstable bindings for the Prioritized Task Scheduling API. [#3566](https://github.com/rustwasm/wasm-bindgen/pull/3566) +* Add bindings for `CanvasTransform.setTransform(DOMMatrix2DInit)`. + [#3580](https://github.com/rustwasm/wasm-bindgen/pull/3580) + ### Changed * Updated the WebGPU WebIDL. diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 64d7700131b..ab52e7a142f 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -306,6 +306,8 @@ DomError = [] DomException = [] DomImplementation = [] DomMatrix = ["DomMatrixReadOnly"] +DomMatrix2dInit = [] +DomMatrixInit = [] DomMatrixReadOnly = [] DomParser = [] DomPoint = ["DomPointReadOnly"] diff --git a/crates/web-sys/src/features/gen_CanvasPattern.rs b/crates/web-sys/src/features/gen_CanvasPattern.rs index bc939b0df17..cab7fbaebb7 100644 --- a/crates/web-sys/src/features/gen_CanvasPattern.rs +++ b/crates/web-sys/src/features/gen_CanvasPattern.rs @@ -19,5 +19,5 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasPattern/setTransform)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasPattern`, `SvgMatrix`*"] - pub fn set_transform(this: &CanvasPattern, matrix: &SvgMatrix); + pub fn set_transform_with_default_dom_matrix_2d_init(this: &CanvasPattern, matrix: &SvgMatrix); } diff --git a/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs b/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs index 3355768706e..c5878c132f0 100644 --- a/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs +++ b/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs @@ -1385,6 +1385,26 @@ extern "C" { e: f64, f: f64, ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = setTransform)] + #[doc = "The `setTransform()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setTransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] + pub fn set_transform_with_default_dom_matrix_2d_init( + this: &CanvasRenderingContext2d, + ) -> Result<(), JsValue>; + #[cfg(feature = "DomMatrix2dInit")] + # [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = setTransform)] + #[doc = "The `setTransform()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/setTransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`, `DomMatrix2dInit`*"] + pub fn set_transform_with_dom_matrix_2d_init( + this: &CanvasRenderingContext2d, + transform: &DomMatrix2dInit, + ) -> Result<(), JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = transform)] #[doc = "The `transform()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_DomMatrix2dInit.rs b/crates/web-sys/src/features/gen_DomMatrix2dInit.rs new file mode 100644 index 00000000000..f91b401cec6 --- /dev/null +++ b/crates/web-sys/src/features/gen_DomMatrix2dInit.rs @@ -0,0 +1,184 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = DOMMatrix2DInit)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `DomMatrix2dInit` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub type DomMatrix2dInit; +} +impl DomMatrix2dInit { + #[doc = "Construct a new `DomMatrix2dInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[doc = "Change the `a` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn a(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("a"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `b` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn b(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("b"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `c` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn c(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("c"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `d` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn d(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("d"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `e` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn e(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("e"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `f` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn f(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("f"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m11` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn m11(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m11"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m12` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn m12(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m12"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m21` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn m21(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m21"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m22` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn m22(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m22"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m41` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn m41(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m41"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m42` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`*"] + pub fn m42(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m42"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +impl Default for DomMatrix2dInit { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_DomMatrixInit.rs b/crates/web-sys/src/features/gen_DomMatrixInit.rs new file mode 100644 index 00000000000..573a0c4d65e --- /dev/null +++ b/crates/web-sys/src/features/gen_DomMatrixInit.rs @@ -0,0 +1,327 @@ +#![allow(unused_imports)] +#![allow(clippy::all)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = DOMMatrixInit)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `DomMatrixInit` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub type DomMatrixInit; +} +impl DomMatrixInit { + #[doc = "Construct a new `DomMatrixInit`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[doc = "Change the `a` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn a(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("a"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `b` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn b(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("b"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `c` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn c(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("c"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `d` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn d(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("d"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `e` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn e(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("e"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `f` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn f(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("f"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m11` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m11(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m11"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m12` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m12(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m12"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m21` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m21(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m21"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m22` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m22(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m22"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m41` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m41(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m41"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m42` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m42(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m42"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `is2D` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn is_2d(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("is2D"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m13` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m13(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m13"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m14` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m14(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m14"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m23` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m23(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m23"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m24` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m24(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m24"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m31` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m31(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m31"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m32` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m32(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m32"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m33` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m33(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m33"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m34` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m34(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m34"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m43` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m43(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m43"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `m44` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrixInit`*"] + pub fn m44(&mut self, val: f64) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("m44"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +impl Default for DomMatrixInit { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs b/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs index ef40e59a5a3..aed70a10e68 100644 --- a/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs +++ b/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs @@ -1341,6 +1341,26 @@ extern "C" { e: f64, f: f64, ) -> Result<(), JsValue>; + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = setTransform)] + #[doc = "The `setTransform()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/setTransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + pub fn set_transform_with_default_dom_matrix_2d_init( + this: &OffscreenCanvasRenderingContext2d, + ) -> Result<(), JsValue>; + #[cfg(feature = "DomMatrix2dInit")] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = setTransform)] + #[doc = "The `setTransform()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/setTransform)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomMatrix2dInit`, `OffscreenCanvasRenderingContext2d`*"] + pub fn set_transform_with_dom_matrix_2d_init( + this: &OffscreenCanvasRenderingContext2d, + transform: &DomMatrix2dInit, + ) -> Result<(), JsValue>; # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = transform)] #[doc = "The `transform()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 2a27e7dfe2b..3e0f90fd6a4 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -1648,6 +1648,18 @@ mod gen_DomMatrix; #[cfg(feature = "DomMatrix")] pub use gen_DomMatrix::*; +#[cfg(feature = "DomMatrix2dInit")] +#[allow(non_snake_case)] +mod gen_DomMatrix2dInit; +#[cfg(feature = "DomMatrix2dInit")] +pub use gen_DomMatrix2dInit::*; + +#[cfg(feature = "DomMatrixInit")] +#[allow(non_snake_case)] +mod gen_DomMatrixInit; +#[cfg(feature = "DomMatrixInit")] +pub use gen_DomMatrixInit::*; + #[cfg(feature = "DomMatrixReadOnly")] #[allow(non_snake_case)] mod gen_DomMatrixReadOnly; diff --git a/crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl b/crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl index a21b0e5ae55..557246d3333 100644 --- a/crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl +++ b/crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl @@ -147,6 +147,8 @@ interface mixin CanvasTransform { [Throws, LenientFloat] undefined setTransform(double a, double b, double c, double d, double e, double f); [Throws] + undefined setTransform(optional DOMMatrix2DInit transform = {}); + [Throws] undefined resetTransform(); [NewObject, Throws] DOMMatrix getTransform(); diff --git a/crates/web-sys/webidls/enabled/DOMMatrix.webidl b/crates/web-sys/webidls/enabled/DOMMatrix.webidl index 06a0da44b3e..e4080137330 100644 --- a/crates/web-sys/webidls/enabled/DOMMatrix.webidl +++ b/crates/web-sys/webidls/enabled/DOMMatrix.webidl @@ -148,3 +148,31 @@ interface DOMMatrix : DOMMatrixReadOnly { [Throws] DOMMatrix setMatrixValue(DOMString transformList); }; +dictionary DOMMatrix2DInit { + unrestricted double a; + unrestricted double b; + unrestricted double c; + unrestricted double d; + unrestricted double e; + unrestricted double f; + unrestricted double m11; + unrestricted double m12; + unrestricted double m21; + unrestricted double m22; + unrestricted double m41; + unrestricted double m42; +}; + +dictionary DOMMatrixInit : DOMMatrix2DInit { + unrestricted double m13 = 0; + unrestricted double m14 = 0; + unrestricted double m23 = 0; + unrestricted double m24 = 0; + unrestricted double m31 = 0; + unrestricted double m32 = 0; + unrestricted double m33 = 1; + unrestricted double m34 = 0; + unrestricted double m43 = 0; + unrestricted double m44 = 1; + boolean is2D; +}; diff --git a/crates/webidl/src/constants.rs b/crates/webidl/src/constants.rs index 3118807ff81..3d02b820bab 100644 --- a/crates/webidl/src/constants.rs +++ b/crates/webidl/src/constants.rs @@ -117,5 +117,7 @@ pub(crate) static FIXED_INTERFACES: Lazy> = ("create_image_bitmap_with_video_frame_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_video_frame_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), ("create_image_bitmap_with_blob_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_blob_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), ("create_image_bitmap_with_image_data_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_image_data_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), + ("set_transform", "set_transform_with_default_dom_matrix_2d_init"), + ("set_transform_with_a_and_b_and_c_and_d_and_e_and_f", "set_transform"), ]) });