From eecafc25db374838056fc2fd5f92842d1b5a8fe7 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Sat, 16 Oct 2021 12:43:03 +1100 Subject: [PATCH 1/3] Add bindings for `ResizeObserver` I had to add a `Constructor` attribute to `ResizeObserver`, since the new constructor syntax isn't supported yet (#1952). --- crates/web-sys/Cargo.toml | 5 ++ .../src/features/gen_ResizeObserver.rs | 56 +++++++++++++++++++ .../features/gen_ResizeObserverBoxOptions.rs | 12 ++++ .../src/features/gen_ResizeObserverEntry.rs | 51 +++++++++++++++++ .../src/features/gen_ResizeObserverOptions.rs | 41 ++++++++++++++ .../src/features/gen_ResizeObserverSize.rs | 28 ++++++++++ crates/web-sys/src/features/mod.rs | 30 ++++++++++ .../webidls/enabled/ResizeObserver.webidl | 34 +++++++++++ 8 files changed, 257 insertions(+) create mode 100644 crates/web-sys/src/features/gen_ResizeObserver.rs create mode 100644 crates/web-sys/src/features/gen_ResizeObserverBoxOptions.rs create mode 100644 crates/web-sys/src/features/gen_ResizeObserverEntry.rs create mode 100644 crates/web-sys/src/features/gen_ResizeObserverOptions.rs create mode 100644 crates/web-sys/src/features/gen_ResizeObserverSize.rs create mode 100644 crates/web-sys/webidls/enabled/ResizeObserver.webidl diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 666aadddc21..3227959f585 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -954,6 +954,11 @@ RequestInit = [] RequestMediaKeySystemAccessNotification = [] RequestMode = [] RequestRedirect = [] +ResizeObserver = [] +ResizeObserverBoxOptions = [] +ResizeObserverEntry = [] +ResizeObserverOptions = [] +ResizeObserverSize = [] Response = [] ResponseInit = [] ResponseType = [] diff --git a/crates/web-sys/src/features/gen_ResizeObserver.rs b/crates/web-sys/src/features/gen_ResizeObserver.rs new file mode 100644 index 00000000000..70df80b1209 --- /dev/null +++ b/crates/web-sys/src/features/gen_ResizeObserver.rs @@ -0,0 +1,56 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ResizeObserver , typescript_type = "ResizeObserver")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ResizeObserver` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResizeObserver`*"] + pub type ResizeObserver; + #[wasm_bindgen(catch, constructor, js_class = "ResizeObserver")] + #[doc = "The `new ResizeObserver(..)` constructor, creating a new instance of `ResizeObserver`."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/ResizeObserver)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResizeObserver`*"] + pub fn new(callback: &::js_sys::Function) -> Result; + # [wasm_bindgen (method , structural , js_class = "ResizeObserver" , js_name = disconnect)] + #[doc = "The `disconnect()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/disconnect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResizeObserver`*"] + pub fn disconnect(this: &ResizeObserver); + #[cfg(feature = "Element")] + # [wasm_bindgen (method , structural , js_class = "ResizeObserver" , js_name = observe)] + #[doc = "The `observe()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/observe)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`, `ResizeObserver`*"] + pub fn observe(this: &ResizeObserver, target: &Element); + #[cfg(all(feature = "Element", feature = "ResizeObserverOptions",))] + # [wasm_bindgen (method , structural , js_class = "ResizeObserver" , js_name = observe)] + #[doc = "The `observe()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/observe)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`, `ResizeObserver`, `ResizeObserverOptions`*"] + pub fn observe_with_options( + this: &ResizeObserver, + target: &Element, + options: &ResizeObserverOptions, + ); + #[cfg(feature = "Element")] + # [wasm_bindgen (method , structural , js_class = "ResizeObserver" , js_name = unobserve)] + #[doc = "The `unobserve()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/unobserve)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`, `ResizeObserver`*"] + pub fn unobserve(this: &ResizeObserver, target: &Element); +} diff --git a/crates/web-sys/src/features/gen_ResizeObserverBoxOptions.rs b/crates/web-sys/src/features/gen_ResizeObserverBoxOptions.rs new file mode 100644 index 00000000000..d2864fdc961 --- /dev/null +++ b/crates/web-sys/src/features/gen_ResizeObserverBoxOptions.rs @@ -0,0 +1,12 @@ +#![allow(unused_imports)] +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +#[doc = "The `ResizeObserverBoxOptions` enum."] +#[doc = ""] +#[doc = "*This API requires the following crate features to be activated: `ResizeObserverBoxOptions`*"] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub enum ResizeObserverBoxOptions { + BorderBox = "border-box", + ContentBox = "content-box", + DevicePixelContentBox = "device-pixel-content-box", +} diff --git a/crates/web-sys/src/features/gen_ResizeObserverEntry.rs b/crates/web-sys/src/features/gen_ResizeObserverEntry.rs new file mode 100644 index 00000000000..67f0cbff8e6 --- /dev/null +++ b/crates/web-sys/src/features/gen_ResizeObserverEntry.rs @@ -0,0 +1,51 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ResizeObserverEntry , typescript_type = "ResizeObserverEntry")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ResizeObserverEntry` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResizeObserverEntry`*"] + pub type ResizeObserverEntry; + #[cfg(feature = "Element")] + # [wasm_bindgen (structural , method , getter , js_class = "ResizeObserverEntry" , js_name = target)] + #[doc = "Getter for the `target` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/target)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `Element`, `ResizeObserverEntry`*"] + pub fn target(this: &ResizeObserverEntry) -> Element; + #[cfg(feature = "DomRectReadOnly")] + # [wasm_bindgen (structural , method , getter , js_class = "ResizeObserverEntry" , js_name = contentRect)] + #[doc = "Getter for the `contentRect` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/contentRect)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `DomRectReadOnly`, `ResizeObserverEntry`*"] + pub fn content_rect(this: &ResizeObserverEntry) -> DomRectReadOnly; + # [wasm_bindgen (structural , method , getter , js_class = "ResizeObserverEntry" , js_name = borderBoxSize)] + #[doc = "Getter for the `borderBoxSize` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/borderBoxSize)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResizeObserverEntry`*"] + pub fn border_box_size(this: &ResizeObserverEntry) -> ::js_sys::Array; + # [wasm_bindgen (structural , method , getter , js_class = "ResizeObserverEntry" , js_name = contentBoxSize)] + #[doc = "Getter for the `contentBoxSize` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/contentBoxSize)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResizeObserverEntry`*"] + pub fn content_box_size(this: &ResizeObserverEntry) -> ::js_sys::Array; + # [wasm_bindgen (structural , method , getter , js_class = "ResizeObserverEntry" , js_name = devicePixelContentBoxSize)] + #[doc = "Getter for the `devicePixelContentBoxSize` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/devicePixelContentBoxSize)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResizeObserverEntry`*"] + pub fn device_pixel_content_box_size(this: &ResizeObserverEntry) -> ::js_sys::Array; +} diff --git a/crates/web-sys/src/features/gen_ResizeObserverOptions.rs b/crates/web-sys/src/features/gen_ResizeObserverOptions.rs new file mode 100644 index 00000000000..7f096d1e3e8 --- /dev/null +++ b/crates/web-sys/src/features/gen_ResizeObserverOptions.rs @@ -0,0 +1,41 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ResizeObserverOptions)] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ResizeObserverOptions` dictionary."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResizeObserverOptions`*"] + pub type ResizeObserverOptions; +} +impl ResizeObserverOptions { + #[doc = "Construct a new `ResizeObserverOptions`."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResizeObserverOptions`*"] + pub fn new() -> Self { + #[allow(unused_mut)] + let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret + } + #[cfg(feature = "ResizeObserverBoxOptions")] + #[doc = "Change the `box` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResizeObserverBoxOptions`, `ResizeObserverOptions`*"] + pub fn box_(&mut self, val: ResizeObserverBoxOptions) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("box"), &JsValue::from(val)); + debug_assert!( + r.is_ok(), + "setting properties should never fail on our dictionary objects" + ); + let _ = r; + self + } +} +impl Default for ResizeObserverOptions { + fn default() -> Self { + Self::new() + } +} diff --git a/crates/web-sys/src/features/gen_ResizeObserverSize.rs b/crates/web-sys/src/features/gen_ResizeObserverSize.rs new file mode 100644 index 00000000000..1e6679eae94 --- /dev/null +++ b/crates/web-sys/src/features/gen_ResizeObserverSize.rs @@ -0,0 +1,28 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ResizeObserverSize , typescript_type = "ResizeObserverSize")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `ResizeObserverSize` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverSize)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResizeObserverSize`*"] + pub type ResizeObserverSize; + # [wasm_bindgen (structural , method , getter , js_class = "ResizeObserverSize" , js_name = inlineSize)] + #[doc = "Getter for the `inlineSize` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverSize/inlineSize)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResizeObserverSize`*"] + pub fn inline_size(this: &ResizeObserverSize) -> f64; + # [wasm_bindgen (structural , method , getter , js_class = "ResizeObserverSize" , js_name = blockSize)] + #[doc = "Getter for the `blockSize` field of this object."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverSize/blockSize)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `ResizeObserverSize`*"] + pub fn block_size(this: &ResizeObserverSize) -> f64; +} diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 54cacbade5b..c5560bad936 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -5542,6 +5542,36 @@ mod gen_RequestRedirect; #[cfg(feature = "RequestRedirect")] pub use gen_RequestRedirect::*; +#[cfg(feature = "ResizeObserver")] +#[allow(non_snake_case)] +mod gen_ResizeObserver; +#[cfg(feature = "ResizeObserver")] +pub use gen_ResizeObserver::*; + +#[cfg(feature = "ResizeObserverBoxOptions")] +#[allow(non_snake_case)] +mod gen_ResizeObserverBoxOptions; +#[cfg(feature = "ResizeObserverBoxOptions")] +pub use gen_ResizeObserverBoxOptions::*; + +#[cfg(feature = "ResizeObserverEntry")] +#[allow(non_snake_case)] +mod gen_ResizeObserverEntry; +#[cfg(feature = "ResizeObserverEntry")] +pub use gen_ResizeObserverEntry::*; + +#[cfg(feature = "ResizeObserverOptions")] +#[allow(non_snake_case)] +mod gen_ResizeObserverOptions; +#[cfg(feature = "ResizeObserverOptions")] +pub use gen_ResizeObserverOptions::*; + +#[cfg(feature = "ResizeObserverSize")] +#[allow(non_snake_case)] +mod gen_ResizeObserverSize; +#[cfg(feature = "ResizeObserverSize")] +pub use gen_ResizeObserverSize::*; + #[cfg(feature = "Response")] #[allow(non_snake_case)] mod gen_Response; diff --git a/crates/web-sys/webidls/enabled/ResizeObserver.webidl b/crates/web-sys/webidls/enabled/ResizeObserver.webidl new file mode 100644 index 00000000000..dec2f3b3b76 --- /dev/null +++ b/crates/web-sys/webidls/enabled/ResizeObserver.webidl @@ -0,0 +1,34 @@ +enum ResizeObserverBoxOptions { + "border-box", "content-box", "device-pixel-content-box" +}; + +dictionary ResizeObserverOptions { + ResizeObserverBoxOptions box = "content-box"; +}; + +// TODO: remove this once the `constructor()` syntax is supported. +[Constructor(ResizeObserverCallback callback), + Exposed=(Window)] +interface ResizeObserver { + constructor(ResizeObserverCallback callback); + undefined observe(Element target, optional ResizeObserverOptions options = {}); + undefined unobserve(Element target); + undefined disconnect(); +}; + +callback ResizeObserverCallback = undefined (sequence entries, ResizeObserver observer); + +[Exposed=Window] +interface ResizeObserverEntry { + readonly attribute Element target; + readonly attribute DOMRectReadOnly contentRect; + readonly attribute FrozenArray borderBoxSize; + readonly attribute FrozenArray contentBoxSize; + readonly attribute FrozenArray devicePixelContentBoxSize; +}; + +[Exposed=Window] +interface ResizeObserverSize { + readonly attribute unrestricted double inlineSize; + readonly attribute unrestricted double blockSize; +}; From 1cc347b6933f639f61868ced4626f026adaeca91 Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Wed, 20 Oct 2021 09:31:52 +1100 Subject: [PATCH 2/3] Mark API as unstable --- .../src/features/gen_ResizeObserver.rs | 24 +++++++++++++++++++ .../features/gen_ResizeObserverBoxOptions.rs | 4 ++++ .../src/features/gen_ResizeObserverEntry.rs | 24 +++++++++++++++++++ .../src/features/gen_ResizeObserverOptions.rs | 13 ++++++++++ .../src/features/gen_ResizeObserverSize.rs | 12 ++++++++++ .../ResizeObserver.webidl | 0 6 files changed, 77 insertions(+) rename crates/web-sys/webidls/{enabled => unstable}/ResizeObserver.webidl (100%) diff --git a/crates/web-sys/src/features/gen_ResizeObserver.rs b/crates/web-sys/src/features/gen_ResizeObserver.rs index 70df80b1209..8b3ef38d228 100644 --- a/crates/web-sys/src/features/gen_ResizeObserver.rs +++ b/crates/web-sys/src/features/gen_ResizeObserver.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ResizeObserver , typescript_type = "ResizeObserver")] @@ -10,21 +11,33 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResizeObserver`*"] + #[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 type ResizeObserver; + #[cfg(web_sys_unstable_apis)] #[wasm_bindgen(catch, constructor, js_class = "ResizeObserver")] #[doc = "The `new ResizeObserver(..)` constructor, creating a new instance of `ResizeObserver`."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/ResizeObserver)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResizeObserver`*"] + #[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 new(callback: &::js_sys::Function) -> Result; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "ResizeObserver" , js_name = disconnect)] #[doc = "The `disconnect()` method."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/disconnect)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResizeObserver`*"] + #[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 disconnect(this: &ResizeObserver); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "Element")] # [wasm_bindgen (method , structural , js_class = "ResizeObserver" , js_name = observe)] #[doc = "The `observe()` method."] @@ -32,7 +45,11 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/observe)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Element`, `ResizeObserver`*"] + #[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 observe(this: &ResizeObserver, target: &Element); + #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "Element", feature = "ResizeObserverOptions",))] # [wasm_bindgen (method , structural , js_class = "ResizeObserver" , js_name = observe)] #[doc = "The `observe()` method."] @@ -40,11 +57,15 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/observe)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Element`, `ResizeObserver`, `ResizeObserverOptions`*"] + #[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 observe_with_options( this: &ResizeObserver, target: &Element, options: &ResizeObserverOptions, ); + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "Element")] # [wasm_bindgen (method , structural , js_class = "ResizeObserver" , js_name = unobserve)] #[doc = "The `unobserve()` method."] @@ -52,5 +73,8 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/unobserve)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Element`, `ResizeObserver`*"] + #[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 unobserve(this: &ResizeObserver, target: &Element); } diff --git a/crates/web-sys/src/features/gen_ResizeObserverBoxOptions.rs b/crates/web-sys/src/features/gen_ResizeObserverBoxOptions.rs index d2864fdc961..fb8f3e1941f 100644 --- a/crates/web-sys/src/features/gen_ResizeObserverBoxOptions.rs +++ b/crates/web-sys/src/features/gen_ResizeObserverBoxOptions.rs @@ -1,9 +1,13 @@ #![allow(unused_imports)] use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] #[doc = "The `ResizeObserverBoxOptions` enum."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResizeObserverBoxOptions`*"] +#[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)*"] #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum ResizeObserverBoxOptions { BorderBox = "border-box", diff --git a/crates/web-sys/src/features/gen_ResizeObserverEntry.rs b/crates/web-sys/src/features/gen_ResizeObserverEntry.rs index 67f0cbff8e6..7b912228039 100644 --- a/crates/web-sys/src/features/gen_ResizeObserverEntry.rs +++ b/crates/web-sys/src/features/gen_ResizeObserverEntry.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ResizeObserverEntry , typescript_type = "ResizeObserverEntry")] @@ -10,7 +11,11 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResizeObserverEntry`*"] + #[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 type ResizeObserverEntry; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "Element")] # [wasm_bindgen (structural , method , getter , js_class = "ResizeObserverEntry" , js_name = target)] #[doc = "Getter for the `target` field of this object."] @@ -18,7 +23,11 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/target)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `Element`, `ResizeObserverEntry`*"] + #[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 target(this: &ResizeObserverEntry) -> Element; + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "DomRectReadOnly")] # [wasm_bindgen (structural , method , getter , js_class = "ResizeObserverEntry" , js_name = contentRect)] #[doc = "Getter for the `contentRect` field of this object."] @@ -26,26 +35,41 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/contentRect)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `DomRectReadOnly`, `ResizeObserverEntry`*"] + #[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 content_rect(this: &ResizeObserverEntry) -> DomRectReadOnly; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "ResizeObserverEntry" , js_name = borderBoxSize)] #[doc = "Getter for the `borderBoxSize` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/borderBoxSize)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResizeObserverEntry`*"] + #[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 border_box_size(this: &ResizeObserverEntry) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "ResizeObserverEntry" , js_name = contentBoxSize)] #[doc = "Getter for the `contentBoxSize` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/contentBoxSize)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResizeObserverEntry`*"] + #[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 content_box_size(this: &ResizeObserverEntry) -> ::js_sys::Array; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "ResizeObserverEntry" , js_name = devicePixelContentBoxSize)] #[doc = "Getter for the `devicePixelContentBoxSize` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverEntry/devicePixelContentBoxSize)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResizeObserverEntry`*"] + #[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 device_pixel_content_box_size(this: &ResizeObserverEntry) -> ::js_sys::Array; } diff --git a/crates/web-sys/src/features/gen_ResizeObserverOptions.rs b/crates/web-sys/src/features/gen_ResizeObserverOptions.rs index 7f096d1e3e8..e5f60a39255 100644 --- a/crates/web-sys/src/features/gen_ResizeObserverOptions.rs +++ b/crates/web-sys/src/features/gen_ResizeObserverOptions.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ResizeObserverOptions)] @@ -8,21 +9,32 @@ extern "C" { #[doc = "The `ResizeObserverOptions` dictionary."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResizeObserverOptions`*"] + #[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 type ResizeObserverOptions; } +#[cfg(web_sys_unstable_apis)] impl ResizeObserverOptions { #[doc = "Construct a new `ResizeObserverOptions`."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResizeObserverOptions`*"] + #[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 new() -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); ret } + #[cfg(web_sys_unstable_apis)] #[cfg(feature = "ResizeObserverBoxOptions")] #[doc = "Change the `box` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResizeObserverBoxOptions`, `ResizeObserverOptions`*"] + #[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 box_(&mut self, val: ResizeObserverBoxOptions) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("box"), &JsValue::from(val)); @@ -34,6 +46,7 @@ impl ResizeObserverOptions { self } } +#[cfg(web_sys_unstable_apis)] impl Default for ResizeObserverOptions { fn default() -> Self { Self::new() diff --git a/crates/web-sys/src/features/gen_ResizeObserverSize.rs b/crates/web-sys/src/features/gen_ResizeObserverSize.rs index 1e6679eae94..fbe899f69bc 100644 --- a/crates/web-sys/src/features/gen_ResizeObserverSize.rs +++ b/crates/web-sys/src/features/gen_ResizeObserverSize.rs @@ -1,6 +1,7 @@ #![allow(unused_imports)] use super::*; use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] #[wasm_bindgen] extern "C" { # [wasm_bindgen (extends = :: js_sys :: Object , js_name = ResizeObserverSize , typescript_type = "ResizeObserverSize")] @@ -10,19 +11,30 @@ extern "C" { #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverSize)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResizeObserverSize`*"] + #[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 type ResizeObserverSize; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "ResizeObserverSize" , js_name = inlineSize)] #[doc = "Getter for the `inlineSize` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverSize/inlineSize)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResizeObserverSize`*"] + #[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 inline_size(this: &ResizeObserverSize) -> f64; + #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "ResizeObserverSize" , js_name = blockSize)] #[doc = "Getter for the `blockSize` field of this object."] #[doc = ""] #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserverSize/blockSize)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `ResizeObserverSize`*"] + #[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 block_size(this: &ResizeObserverSize) -> f64; } diff --git a/crates/web-sys/webidls/enabled/ResizeObserver.webidl b/crates/web-sys/webidls/unstable/ResizeObserver.webidl similarity index 100% rename from crates/web-sys/webidls/enabled/ResizeObserver.webidl rename to crates/web-sys/webidls/unstable/ResizeObserver.webidl From 071bff7814813b598856d085840d08ad3874d51e Mon Sep 17 00:00:00 2001 From: Liam Murphy Date: Wed, 20 Oct 2021 11:05:21 +1100 Subject: [PATCH 3/3] reset ci