From ee440ea9222d0e4b0646dadc2872ede6113f4ae9 Mon Sep 17 00:00:00 2001 From: Nulled <63370961+Nul-led@users.noreply.github.com> Date: Sat, 10 Feb 2024 01:20:56 +0100 Subject: [PATCH 1/9] feat: add support for CanvasState.reset --- crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl b/crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl index 557246d3333..82157774a2c 100644 --- a/crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl +++ b/crates/web-sys/webidls/enabled/CanvasRenderingContext2D.webidl @@ -131,6 +131,7 @@ interface mixin CanvasState { // state undefined save(); // push state on state stack undefined restore(); // pop state stack and restore state + undefined reset(); // clears the backing buffer, drawing state stack, any defined paths, and styles }; interface mixin CanvasTransform { From cfab3cd7523290c4e8a5694ac78c672a00aa13af Mon Sep 17 00:00:00 2001 From: Nulled <63370961+Nul-led@users.noreply.github.com> Date: Sat, 10 Feb 2024 01:30:06 +0100 Subject: [PATCH 2/9] chore: add generated binding for reset method --- .../web-sys/src/features/gen_CanvasRenderingContext2d.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs b/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs index c5878c132f0..bdcda88509b 100644 --- a/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs +++ b/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs @@ -1280,6 +1280,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] pub fn save(this: &CanvasRenderingContext2d); + # [wasm_bindgen (method , structural , js_class = "CanvasRenderingContext2D" , js_name = reset)] + #[doc = "The `reset()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/reset)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] + pub fn reset(this: &CanvasRenderingContext2d); # [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = fillText)] #[doc = "The `fillText()` method."] #[doc = ""] From 795a8c2b2982f7bbef183cca61c89ce0cb91ebc3 Mon Sep 17 00:00:00 2001 From: Nulled <63370961+Nul-led@users.noreply.github.com> Date: Sat, 10 Feb 2024 01:32:11 +0100 Subject: [PATCH 3/9] chore: add generated binding for reset method (offscreen canvas) --- .../src/features/gen_OffscreenCanvasRenderingContext2d.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs b/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs index aed70a10e68..38917f632f8 100644 --- a/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs +++ b/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs @@ -1236,6 +1236,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] pub fn save(this: &OffscreenCanvasRenderingContext2d); + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = reset)] + #[doc = "The `reset()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/reset)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + pub fn reset(this: &OffscreenCanvasRenderingContext2d); # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fillText)] #[doc = "The `fillText()` method."] #[doc = ""] From 4cff864f9594c6c3dd417a9c0142b71f02fd9229 Mon Sep 17 00:00:00 2001 From: Nulled <63370961+Nul-led@users.noreply.github.com> Date: Sat, 10 Feb 2024 02:31:14 +0100 Subject: [PATCH 4/9] fix: paste at the wrong line --- .../src/features/gen_CanvasRenderingContext2d.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs b/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs index bdcda88509b..5d4a7f79c27 100644 --- a/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs +++ b/crates/web-sys/src/features/gen_CanvasRenderingContext2d.rs @@ -1266,6 +1266,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] pub fn stroke_rect(this: &CanvasRenderingContext2d, x: f64, y: f64, w: f64, h: f64); + # [wasm_bindgen (method , structural , js_class = "CanvasRenderingContext2D" , js_name = reset)] + #[doc = "The `reset()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/reset)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] + pub fn reset(this: &CanvasRenderingContext2d); # [wasm_bindgen (method , structural , js_class = "CanvasRenderingContext2D" , js_name = restore)] #[doc = "The `restore()` method."] #[doc = ""] @@ -1280,13 +1287,6 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] pub fn save(this: &CanvasRenderingContext2d); - # [wasm_bindgen (method , structural , js_class = "CanvasRenderingContext2D" , js_name = reset)] - #[doc = "The `reset()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/reset)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `CanvasRenderingContext2d`*"] - pub fn reset(this: &CanvasRenderingContext2d); # [wasm_bindgen (catch , method , structural , js_class = "CanvasRenderingContext2D" , js_name = fillText)] #[doc = "The `fillText()` method."] #[doc = ""] From 647a2cdd691eb6910d7863ac2e41696612428a7a Mon Sep 17 00:00:00 2001 From: Nulled <63370961+Nul-led@users.noreply.github.com> Date: Sat, 10 Feb 2024 02:32:53 +0100 Subject: [PATCH 5/9] fix: paste at wrong line --- .../gen_OffscreenCanvasRenderingContext2d.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs b/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs index 38917f632f8..c1b066e482c 100644 --- a/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs +++ b/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs @@ -1222,6 +1222,13 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] pub fn stroke_rect(this: &OffscreenCanvasRenderingContext2d, x: f64, y: f64, w: f64, h: f64); + # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = reset)] + #[doc = "The `reset()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/reset)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] + pub fn reset(this: &OffscreenCanvasRenderingContext2d); # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = restore)] #[doc = "The `restore()` method."] #[doc = ""] @@ -1242,13 +1249,6 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/reset)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] - pub fn reset(this: &OffscreenCanvasRenderingContext2d); - # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fillText)] - #[doc = "The `fillText()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fillText)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] pub fn fill_text( this: &OffscreenCanvasRenderingContext2d, text: &str, From 75c4c3e58864772df9cee56ee5b29cb143d6dae5 Mon Sep 17 00:00:00 2001 From: Nulled <63370961+Nul-led@users.noreply.github.com> Date: Sat, 10 Feb 2024 02:38:21 +0100 Subject: [PATCH 6/9] fix: old docs --- .../src/features/gen_OffscreenCanvasRenderingContext2d.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs b/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs index c1b066e482c..c795d1a8659 100644 --- a/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs +++ b/crates/web-sys/src/features/gen_OffscreenCanvasRenderingContext2d.rs @@ -1243,10 +1243,10 @@ extern "C" { #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] pub fn save(this: &OffscreenCanvasRenderingContext2d); - # [wasm_bindgen (method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = reset)] - #[doc = "The `reset()` method."] + # [wasm_bindgen (catch , method , structural , js_class = "OffscreenCanvasRenderingContext2D" , js_name = fillText)] + #[doc = "The `fillText()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/reset)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/OffscreenCanvasRenderingContext2D/fillText)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `OffscreenCanvasRenderingContext2d`*"] pub fn fill_text( From 5c8436b70de42217757fc2ebff6a18e3c8ab26ed Mon Sep 17 00:00:00 2001 From: Nulled <63370961+Nul-led@users.noreply.github.com> Date: Sat, 10 Feb 2024 08:53:47 +0100 Subject: [PATCH 7/9] chore: add changelog entry for CanvasState.reset --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1650b86efb5..eb30b18d237 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ * Add bindings for `RTCPeerConnectionIceErrorEvent`. [#3835](https://github.com/rustwasm/wasm-bindgen/pull/3835) +* Add bindings for `CanvasState.reset()`, affecting `CanvasRenderingContext2D` and `OffscreenCanvasRenderingContext2D`. + +[#3844](https://github.com/rustwasm/wasm-bindgen/pull/3844) + -------------------------------------------------------------------------------- ## [0.2.91](https://github.com/rustwasm/wasm-bindgen/compare/0.2.90...0.2.91) From 9a136f2dd65b198628f6d174e77edf8f820555d2 Mon Sep 17 00:00:00 2001 From: Nulled <63370961+Nul-led@users.noreply.github.com> Date: Sat, 10 Feb 2024 08:56:24 +0100 Subject: [PATCH 8/9] fix: inline the href --- CHANGELOG.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eb30b18d237..2b13e1a8ca9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,7 @@ * Add bindings for `RTCPeerConnectionIceErrorEvent`. [#3835](https://github.com/rustwasm/wasm-bindgen/pull/3835) -* Add bindings for `CanvasState.reset()`, affecting `CanvasRenderingContext2D` and `OffscreenCanvasRenderingContext2D`. - -[#3844](https://github.com/rustwasm/wasm-bindgen/pull/3844) +* Add bindings for `CanvasState.reset()`, affecting `CanvasRenderingContext2D` and `OffscreenCanvasRenderingContext2D`. [#3844](https://github.com/rustwasm/wasm-bindgen/pull/3844) -------------------------------------------------------------------------------- From 3af14fc4a0bf650f0aea25c65b4d8a4a17a4d227 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Sat, 10 Feb 2024 09:00:06 +0100 Subject: [PATCH 9/9] Update CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b13e1a8ca9..56fb600f0c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,8 @@ * Add bindings for `RTCPeerConnectionIceErrorEvent`. [#3835](https://github.com/rustwasm/wasm-bindgen/pull/3835) -* Add bindings for `CanvasState.reset()`, affecting `CanvasRenderingContext2D` and `OffscreenCanvasRenderingContext2D`. [#3844](https://github.com/rustwasm/wasm-bindgen/pull/3844) +* Add bindings for `CanvasState.reset()`, affecting `CanvasRenderingContext2D` and `OffscreenCanvasRenderingContext2D`. + [#3844](https://github.com/rustwasm/wasm-bindgen/pull/3844) --------------------------------------------------------------------------------