From d6964278b557e1d4cf608d1dfb67162b1ce3b53a Mon Sep 17 00:00:00 2001 From: daxpedda Date: Tue, 31 Jan 2023 10:32:04 +0100 Subject: [PATCH] Implement `ImageBitmapOptions` (#3269) --- crates/web-sys/Cargo.toml | 5 + .../src/features/gen_ColorSpaceConversion.rs | 11 + .../src/features/gen_ImageBitmapOptions.rs | 133 +++++++++ .../src/features/gen_ImageDecoderInit.rs | 44 +++ .../src/features/gen_ImageOrientation.rs | 11 + .../src/features/gen_PremultiplyAlpha.rs | 12 + .../web-sys/src/features/gen_ResizeQuality.rs | 13 + crates/web-sys/src/features/gen_Window.rs | 260 ++++++++++++++++++ .../src/features/gen_WorkerGlobalScope.rs | 260 ++++++++++++++++++ crates/web-sys/src/features/mod.rs | 30 ++ .../webidls/enabled/ImageBitmap.webidl | 14 + .../enabled/WindowOrWorkerGlobalScope.webidl | 7 +- crates/webidl/src/constants.rs | 24 ++ crates/webidl/src/util.rs | 9 +- 14 files changed, 830 insertions(+), 3 deletions(-) create mode 100644 crates/web-sys/src/features/gen_ColorSpaceConversion.rs create mode 100644 crates/web-sys/src/features/gen_ImageBitmapOptions.rs create mode 100644 crates/web-sys/src/features/gen_ImageOrientation.rs create mode 100644 crates/web-sys/src/features/gen_PremultiplyAlpha.rs create mode 100644 crates/web-sys/src/features/gen_ResizeQuality.rs diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 6663b222d93..8fbc9384d68 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -194,6 +194,7 @@ CloseEvent = ["Event"] CloseEventInit = [] CodecState = [] CollectedClientData = [] +ColorSpaceConversion = [] Comment = ["CharacterData", "EventTarget", "Node"] CompositeOperation = [] CompositionEvent = ["Event", "UiEvent"] @@ -692,6 +693,7 @@ IirFilterNode = ["AudioNode", "EventTarget"] IirFilterOptions = [] ImageBitmap = [] ImageBitmapFormat = [] +ImageBitmapOptions = [] ImageBitmapRenderingContext = [] ImageCapture = [] ImageCaptureError = [] @@ -702,6 +704,7 @@ ImageDecodeOptions = [] ImageDecodeResult = [] ImageDecoder = [] ImageDecoderInit = [] +ImageOrientation = [] ImageTrack = ["EventTarget"] ImageTrackList = [] InputEvent = ["Event", "UiEvent"] @@ -933,6 +936,7 @@ Position = [] PositionAlignSetting = [] PositionError = [] PositionOptions = [] +PremultiplyAlpha = [] Presentation = [] PresentationAvailability = ["EventTarget"] PresentationConnection = ["EventTarget"] @@ -1017,6 +1021,7 @@ ResizeObserverBoxOptions = [] ResizeObserverEntry = [] ResizeObserverOptions = [] ResizeObserverSize = [] +ResizeQuality = [] Response = [] ResponseInit = [] ResponseType = [] diff --git a/crates/web-sys/src/features/gen_ColorSpaceConversion.rs b/crates/web-sys/src/features/gen_ColorSpaceConversion.rs new file mode 100644 index 00000000000..becd676d01d --- /dev/null +++ b/crates/web-sys/src/features/gen_ColorSpaceConversion.rs @@ -0,0 +1,11 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +#[doc = "The `ColorSpaceConversion` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `ColorSpaceConversion`*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ColorSpaceConversion { + None = "none", + Default = "default", +} diff --git a/crates/web-sys/src/features/gen_ImageBitmapOptions.rs b/crates/web-sys/src/features/gen_ImageBitmapOptions.rs new file mode 100644 index 00000000000..e789794d0a1 --- /dev/null +++ b/crates/web-sys/src/features/gen_ImageBitmapOptions.rs @@ -0,0 +1,133 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ImageBitmapOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ImageBitmapOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`*"] + pub type ImageBitmapOptions; +} +impl ImageBitmapOptions { + #[doc = "Construct a new `ImageBitmapOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(feature = "ColorSpaceConversion")] + #[doc = "Change the `colorSpaceConversion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ColorSpaceConversion`, `ImageBitmapOptions`*"] + pub fn color_space_conversion(&mut self, val: ColorSpaceConversion) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("colorSpaceConversion"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(feature = "ImageOrientation")] + #[doc = "Change the `imageOrientation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `ImageOrientation`*"] + pub fn image_orientation(&mut self, val: ImageOrientation) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("imageOrientation"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(feature = "PremultiplyAlpha")] + #[doc = "Change the `premultiplyAlpha` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `PremultiplyAlpha`*"] + pub fn premultiply_alpha(&mut self, val: PremultiplyAlpha) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("premultiplyAlpha"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `resizeHeight` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`*"] + pub fn resize_height(&mut self, val: u32) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("resizeHeight"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(feature = "ResizeQuality")] + #[doc = "Change the `resizeQuality` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `ResizeQuality`*"] + pub fn resize_quality(&mut self, val: ResizeQuality) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("resizeQuality"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[doc = "Change the `resizeWidth` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`*"] + pub fn resize_width(&mut self, val: u32) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("resizeWidth"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +impl Default for ImageBitmapOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_ImageDecoderInit.rs b/crates/web-sys/src/features/gen_ImageDecoderInit.rs index 87bd70c957b..a787ca67205 100644 --- a/crates/web-sys/src/features/gen_ImageDecoderInit.rs +++ b/crates/web-sys/src/features/gen_ImageDecoderInit.rs @@ -30,6 +30,28 @@ impl ImageDecoderInit { ret } #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "ColorSpaceConversion")] + #[doc = "Change the `colorSpaceConversion` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ColorSpaceConversion`, `ImageDecoderInit`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn color_space_conversion(&mut self, val: ColorSpaceConversion) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("colorSpaceConversion"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] #[doc = "Change the `data` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"] @@ -110,6 +132,28 @@ impl ImageDecoderInit { self } #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "PremultiplyAlpha")] + #[doc = "Change the `premultiplyAlpha` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`, `PremultiplyAlpha`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn premultiply_alpha(&mut self, val: PremultiplyAlpha) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("premultiplyAlpha"), + &JsValue::from(val), + ); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } + #[cfg(web_sys_unstable_apis)] #[doc = "Change the `type` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ImageDecoderInit`*"] diff --git a/crates/web-sys/src/features/gen_ImageOrientation.rs b/crates/web-sys/src/features/gen_ImageOrientation.rs new file mode 100644 index 00000000000..8c1c25c1321 --- /dev/null +++ b/crates/web-sys/src/features/gen_ImageOrientation.rs @@ -0,0 +1,11 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +#[doc = "The `ImageOrientation` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `ImageOrientation`*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ImageOrientation { + FromImage = "from-image", + FlipY = "flipY", +} diff --git a/crates/web-sys/src/features/gen_PremultiplyAlpha.rs b/crates/web-sys/src/features/gen_PremultiplyAlpha.rs new file mode 100644 index 00000000000..f838d000e7b --- /dev/null +++ b/crates/web-sys/src/features/gen_PremultiplyAlpha.rs @@ -0,0 +1,12 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +#[doc = "The `PremultiplyAlpha` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `PremultiplyAlpha`*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum PremultiplyAlpha { + None = "none", + Premultiply = "premultiply", + Default = "default", +} diff --git a/crates/web-sys/src/features/gen_ResizeQuality.rs b/crates/web-sys/src/features/gen_ResizeQuality.rs new file mode 100644 index 00000000000..fbb1e106672 --- /dev/null +++ b/crates/web-sys/src/features/gen_ResizeQuality.rs @@ -0,0 +1,13 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +#[doc = "The `ResizeQuality` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `ResizeQuality`*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ResizeQuality { + Pixelated = "pixelated", + Low = "low", + Medium = "medium", + High = "high", +} diff --git a/crates/web-sys/src/features/gen_Window.rs b/crates/web-sys/src/features/gen_Window.rs index 3d6d1ec099e..724f293baf6 100644 --- a/crates/web-sys/src/features/gen_Window.rs +++ b/crates/web-sys/src/features/gen_Window.rs @@ -2438,6 +2438,118 @@ extern "C" { this: &Window, a_image: &ImageData, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlImageElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`, `ImageBitmapOptions`, `Window`*"] + pub fn create_image_bitmap_with_html_image_element_and_image_bitmap_options( + this: &Window, + a_image: &HtmlImageElement, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "SvgImageElement",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `SvgImageElement`, `Window`*"] + pub fn create_image_bitmap_with_svg_image_element_and_image_bitmap_options( + this: &Window, + a_image: &SvgImageElement, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlCanvasElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`, `ImageBitmapOptions`, `Window`*"] + pub fn create_image_bitmap_with_html_canvas_element_and_image_bitmap_options( + this: &Window, + a_image: &HtmlCanvasElement, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlVideoElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlVideoElement`, `ImageBitmapOptions`, `Window`*"] + pub fn create_image_bitmap_with_html_video_element_and_image_bitmap_options( + this: &Window, + a_image: &HtmlVideoElement, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmap", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `ImageBitmapOptions`, `Window`*"] + pub fn create_image_bitmap_with_image_bitmap_and_image_bitmap_options( + this: &Window, + a_image: &ImageBitmap, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "OffscreenCanvas",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `OffscreenCanvas`, `Window`*"] + pub fn create_image_bitmap_with_offscreen_canvas_and_image_bitmap_options( + this: &Window, + a_image: &OffscreenCanvas, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "ImageBitmapOptions", feature = "VideoFrame",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `VideoFrame`, `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_image_bitmap_with_video_frame_and_image_bitmap_options( + this: &Window, + a_image: &VideoFrame, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "Blob", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Blob`, `ImageBitmapOptions`, `Window`*"] + pub fn create_image_bitmap_with_blob_and_image_bitmap_options( + this: &Window, + a_image: &Blob, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "ImageData",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `ImageData`, `Window`*"] + pub fn create_image_bitmap_with_image_data_and_image_bitmap_options( + this: &Window, + a_image: &ImageData, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "HtmlImageElement")] # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] @@ -2577,6 +2689,154 @@ extern "C" { a_sw: i32, a_sh: i32, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlImageElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`, `ImageBitmapOptions`, `Window`*"] + pub fn create_image_bitmap_with_html_image_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &Window, + a_image: &HtmlImageElement, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "SvgImageElement",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `SvgImageElement`, `Window`*"] + pub fn create_image_bitmap_with_svg_image_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &Window, + a_image: &SvgImageElement, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlCanvasElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`, `ImageBitmapOptions`, `Window`*"] + pub fn create_image_bitmap_with_html_canvas_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &Window, + a_image: &HtmlCanvasElement, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlVideoElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlVideoElement`, `ImageBitmapOptions`, `Window`*"] + pub fn create_image_bitmap_with_html_video_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &Window, + a_image: &HtmlVideoElement, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmap", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `ImageBitmapOptions`, `Window`*"] + pub fn create_image_bitmap_with_image_bitmap_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &Window, + a_image: &ImageBitmap, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "OffscreenCanvas",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `OffscreenCanvas`, `Window`*"] + pub fn create_image_bitmap_with_offscreen_canvas_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &Window, + a_image: &OffscreenCanvas, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "ImageBitmapOptions", feature = "VideoFrame",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `VideoFrame`, `Window`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_image_bitmap_with_video_frame_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &Window, + a_image: &VideoFrame, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "Blob", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Blob`, `ImageBitmapOptions`, `Window`*"] + pub fn create_image_bitmap_with_blob_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &Window, + a_image: &Blob, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "ImageData",))] + # [wasm_bindgen (catch , method , structural , js_class = "Window" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `ImageData`, `Window`*"] + pub fn create_image_bitmap_with_image_data_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &Window, + a_image: &ImageData, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "Request")] # [wasm_bindgen (method , structural , js_class = "Window" , js_name = fetch)] #[doc = "The `fetch()` method."] diff --git a/crates/web-sys/src/features/gen_WorkerGlobalScope.rs b/crates/web-sys/src/features/gen_WorkerGlobalScope.rs index 353e8207318..52e9a44c963 100644 --- a/crates/web-sys/src/features/gen_WorkerGlobalScope.rs +++ b/crates/web-sys/src/features/gen_WorkerGlobalScope.rs @@ -361,6 +361,118 @@ extern "C" { this: &WorkerGlobalScope, a_image: &ImageData, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlImageElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`, `ImageBitmapOptions`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_html_image_element_and_image_bitmap_options( + this: &WorkerGlobalScope, + a_image: &HtmlImageElement, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "SvgImageElement",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `SvgImageElement`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_svg_image_element_and_image_bitmap_options( + this: &WorkerGlobalScope, + a_image: &SvgImageElement, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlCanvasElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`, `ImageBitmapOptions`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_html_canvas_element_and_image_bitmap_options( + this: &WorkerGlobalScope, + a_image: &HtmlCanvasElement, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlVideoElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlVideoElement`, `ImageBitmapOptions`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_html_video_element_and_image_bitmap_options( + this: &WorkerGlobalScope, + a_image: &HtmlVideoElement, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmap", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `ImageBitmapOptions`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_image_bitmap_and_image_bitmap_options( + this: &WorkerGlobalScope, + a_image: &ImageBitmap, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "OffscreenCanvas",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `OffscreenCanvas`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_offscreen_canvas_and_image_bitmap_options( + this: &WorkerGlobalScope, + a_image: &OffscreenCanvas, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "ImageBitmapOptions", feature = "VideoFrame",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `VideoFrame`, `WorkerGlobalScope`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_image_bitmap_with_video_frame_and_image_bitmap_options( + this: &WorkerGlobalScope, + a_image: &VideoFrame, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "Blob", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Blob`, `ImageBitmapOptions`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_blob_and_image_bitmap_options( + this: &WorkerGlobalScope, + a_image: &Blob, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "ImageData",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `ImageData`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_image_data_and_image_bitmap_options( + this: &WorkerGlobalScope, + a_image: &ImageData, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "HtmlImageElement")] # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] #[doc = "The `createImageBitmap()` method."] @@ -500,6 +612,154 @@ extern "C" { a_sw: i32, a_sh: i32, ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlImageElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlImageElement`, `ImageBitmapOptions`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_html_image_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &WorkerGlobalScope, + a_image: &HtmlImageElement, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "SvgImageElement",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `SvgImageElement`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_svg_image_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &WorkerGlobalScope, + a_image: &SvgImageElement, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlCanvasElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlCanvasElement`, `ImageBitmapOptions`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_html_canvas_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &WorkerGlobalScope, + a_image: &HtmlCanvasElement, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "HtmlVideoElement", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `HtmlVideoElement`, `ImageBitmapOptions`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_html_video_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &WorkerGlobalScope, + a_image: &HtmlVideoElement, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmap", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmap`, `ImageBitmapOptions`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_image_bitmap_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &WorkerGlobalScope, + a_image: &ImageBitmap, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "OffscreenCanvas",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `OffscreenCanvas`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_offscreen_canvas_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &WorkerGlobalScope, + a_image: &OffscreenCanvas, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "ImageBitmapOptions", feature = "VideoFrame",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `VideoFrame`, `WorkerGlobalScope`*"] + #[doc = ""] + #[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"] + #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] + pub fn create_image_bitmap_with_video_frame_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &WorkerGlobalScope, + a_image: &VideoFrame, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "Blob", feature = "ImageBitmapOptions",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Blob`, `ImageBitmapOptions`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_blob_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &WorkerGlobalScope, + a_image: &Blob, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; + #[cfg(all(feature = "ImageBitmapOptions", feature = "ImageData",))] + # [wasm_bindgen (catch , method , structural , js_class = "WorkerGlobalScope" , js_name = createImageBitmap)] + #[doc = "The `createImageBitmap()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/WorkerGlobalScope/createImageBitmap)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ImageBitmapOptions`, `ImageData`, `WorkerGlobalScope`*"] + pub fn create_image_bitmap_with_image_data_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options( + this: &WorkerGlobalScope, + a_image: &ImageData, + a_sx: i32, + a_sy: i32, + a_sw: i32, + a_sh: i32, + a_options: &ImageBitmapOptions, + ) -> Result<::js_sys::Promise, JsValue>; #[cfg(feature = "Request")] # [wasm_bindgen (method , structural , js_class = "WorkerGlobalScope" , js_name = fetch)] #[doc = "The `fetch()` method."] diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index a83613cea17..680471c2fb4 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -970,6 +970,12 @@ mod gen_CollectedClientData; #[cfg(feature = "CollectedClientData")] pub use gen_CollectedClientData::*; +#[cfg(feature = "ColorSpaceConversion")] +#[allow(non_snake_case)] +mod gen_ColorSpaceConversion; +#[cfg(feature = "ColorSpaceConversion")] +pub use gen_ColorSpaceConversion::*; + #[cfg(feature = "Comment")] #[allow(non_snake_case)] mod gen_Comment; @@ -3952,6 +3958,12 @@ mod gen_ImageBitmap; #[cfg(feature = "ImageBitmap")] pub use gen_ImageBitmap::*; +#[cfg(feature = "ImageBitmapOptions")] +#[allow(non_snake_case)] +mod gen_ImageBitmapOptions; +#[cfg(feature = "ImageBitmapOptions")] +pub use gen_ImageBitmapOptions::*; + #[cfg(feature = "ImageBitmapRenderingContext")] #[allow(non_snake_case)] mod gen_ImageBitmapRenderingContext; @@ -4012,6 +4024,12 @@ mod gen_ImageDecoderInit; #[cfg(feature = "ImageDecoderInit")] pub use gen_ImageDecoderInit::*; +#[cfg(feature = "ImageOrientation")] +#[allow(non_snake_case)] +mod gen_ImageOrientation; +#[cfg(feature = "ImageOrientation")] +pub use gen_ImageOrientation::*; + #[cfg(feature = "ImageTrack")] #[allow(non_snake_case)] mod gen_ImageTrack; @@ -5398,6 +5416,12 @@ mod gen_PositionOptions; #[cfg(feature = "PositionOptions")] pub use gen_PositionOptions::*; +#[cfg(feature = "PremultiplyAlpha")] +#[allow(non_snake_case)] +mod gen_PremultiplyAlpha; +#[cfg(feature = "PremultiplyAlpha")] +pub use gen_PremultiplyAlpha::*; + #[cfg(feature = "Presentation")] #[allow(non_snake_case)] mod gen_Presentation; @@ -5902,6 +5926,12 @@ mod gen_ResizeObserverSize; #[cfg(feature = "ResizeObserverSize")] pub use gen_ResizeObserverSize::*; +#[cfg(feature = "ResizeQuality")] +#[allow(non_snake_case)] +mod gen_ResizeQuality; +#[cfg(feature = "ResizeQuality")] +pub use gen_ResizeQuality::*; + #[cfg(feature = "Response")] #[allow(non_snake_case)] mod gen_Response; diff --git a/crates/web-sys/webidls/enabled/ImageBitmap.webidl b/crates/web-sys/webidls/enabled/ImageBitmap.webidl index 02fc0a66e1e..e9120355a7c 100644 --- a/crates/web-sys/webidls/enabled/ImageBitmap.webidl +++ b/crates/web-sys/webidls/enabled/ImageBitmap.webidl @@ -30,3 +30,17 @@ partial interface ImageBitmap { // Dispose of all graphical resources associated with this ImageBitmap. undefined close(); }; + +enum ImageOrientation { "from-image", "flipY" }; +enum PremultiplyAlpha { "none", "premultiply", "default" }; +enum ColorSpaceConversion { "none", "default" }; +enum ResizeQuality { "pixelated", "low", "medium", "high" }; + +dictionary ImageBitmapOptions { + ImageOrientation imageOrientation = "from-image"; + PremultiplyAlpha premultiplyAlpha = "default"; + ColorSpaceConversion colorSpaceConversion = "default"; + [EnforceRange] unsigned long resizeWidth; + [EnforceRange] unsigned long resizeHeight; + ResizeQuality resizeQuality = "low"; +}; diff --git a/crates/web-sys/webidls/enabled/WindowOrWorkerGlobalScope.webidl b/crates/web-sys/webidls/enabled/WindowOrWorkerGlobalScope.webidl index c7b7dd698f0..89b818c4b63 100644 --- a/crates/web-sys/webidls/enabled/WindowOrWorkerGlobalScope.webidl +++ b/crates/web-sys/webidls/enabled/WindowOrWorkerGlobalScope.webidl @@ -37,9 +37,12 @@ interface mixin WindowOrWorkerGlobalScope { // ImageBitmap [Throws] - Promise createImageBitmap(ImageBitmapSource aImage); + Promise createImageBitmap(ImageBitmapSource aImage, + optional ImageBitmapOptions aOptions = {}); [Throws] - Promise createImageBitmap(ImageBitmapSource aImage, long aSx, long aSy, long aSw, long aSh); + Promise createImageBitmap(ImageBitmapSource aImage, + long aSx, long aSy, long aSw, long aSh, + optional ImageBitmapOptions aOptions = {}); }; // https://fetch.spec.whatwg.org/#fetch-method diff --git a/crates/webidl/src/constants.rs b/crates/webidl/src/constants.rs index 0124d4d7a96..79814e4644b 100644 --- a/crates/webidl/src/constants.rs +++ b/crates/webidl/src/constants.rs @@ -1,4 +1,5 @@ use once_cell::sync::Lazy; +use std::collections::BTreeMap; use std::collections::BTreeSet; use std::iter::FromIterator; @@ -93,3 +94,26 @@ pub(crate) static IMMUTABLE_SLICE_WHITELIST: Lazy> = Lazy "FontFace", // TODO: Add another type's functions here. Leave a comment header with the type name ]) }); + +pub(crate) static FIXED_INTERFACES: Lazy> = Lazy::new(|| { + BTreeMap::from_iter(vec![ + ("create_image_bitmap_with_html_image_element_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_html_image_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), + ("create_image_bitmap_with_svg_image_element_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_svg_image_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), + ("create_image_bitmap_with_html_canvas_element_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_html_canvas_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), + ("create_image_bitmap_with_html_video_element_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_html_video_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), + ("create_image_bitmap_with_image_bitmap_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_image_bitmap_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), + ("create_image_bitmap_with_offscreen_canvas_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_offscreen_canvas_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), + ("create_image_bitmap_with_video_frame_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_video_frame_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), + ("create_image_bitmap_with_blob_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_blob_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), + ("create_image_bitmap_with_image_data_and_i32_and_a_sy_and_a_sw_and_a_sh", "create_image_bitmap_with_image_data_and_a_sx_and_a_sy_and_a_sw_and_a_sh"), + ("create_image_bitmap_with_html_image_element_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_html_image_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), + ("create_image_bitmap_with_svg_image_element_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_svg_image_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), + ("create_image_bitmap_with_html_canvas_element_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_html_canvas_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), + ("create_image_bitmap_with_html_video_element_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_html_video_element_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), + ("create_image_bitmap_with_image_bitmap_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_image_bitmap_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), + ("create_image_bitmap_with_offscreen_canvas_and_i32_and_a_sy_and_a_sw_and_a_sh_and_a_options", "create_image_bitmap_with_offscreen_canvas_and_a_sx_and_a_sy_and_a_sw_and_a_sh_and_a_options"), + ("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"), + ]) +}); diff --git a/crates/webidl/src/util.rs b/crates/webidl/src/util.rs index c738de8292f..dd6a4cc4ec8 100644 --- a/crates/webidl/src/util.rs +++ b/crates/webidl/src/util.rs @@ -13,7 +13,7 @@ use weedle::common::Identifier; use weedle::literal::{ConstValue as ConstValueLit, FloatLit, IntegerLit}; use weedle::types::{MayBeNull, NonAnyType, SingleType}; -use crate::constants::IMMUTABLE_SLICE_WHITELIST; +use crate::constants::{FIXED_INTERFACES, IMMUTABLE_SLICE_WHITELIST}; use crate::first_pass::{FirstPassRecord, OperationData, OperationId, Signature}; use crate::generator::{ConstValue, InterfaceMethod, InterfaceMethodKind}; use crate::idl_type::{IdlType, ToIdlType}; @@ -498,6 +498,13 @@ impl<'src> FirstPassRecord<'src> { } } } + + for interface in &mut ret { + if let Some(fixed) = FIXED_INTERFACES.get(&interface.name.to_string().as_ref()) { + interface.name = rust_ident(fixed); + } + } + return ret; }