mirror of
https://github.com/tlsnotary/wasm-bindgen.git
synced 2026-01-09 15:08:01 -05:00
Add bindings for VisualViewport (#3931)
This commit is contained in:
@@ -27,6 +27,9 @@
|
||||
* Add bindings for `RTCRtpReceiver.getCapabilities(DOMString)` method.
|
||||
[#3941](https://github.com/rustwasm/wasm-bindgen/pull/3941)
|
||||
|
||||
* Add bindings for `VisualViewport`.
|
||||
[#3931](https://github.com/rustwasm/wasm-bindgen/pull/3931)
|
||||
|
||||
### Changed
|
||||
|
||||
* Stabilize Web Share API.
|
||||
|
||||
@@ -1476,6 +1476,7 @@ VideoTrackList = ["EventTarget"]
|
||||
VideoTransferCharacteristics = []
|
||||
ViewTransition = []
|
||||
VisibilityState = []
|
||||
VisualViewport = ["EventTarget"]
|
||||
VoidCallback = []
|
||||
VrDisplay = ["EventTarget"]
|
||||
VrDisplayCapabilities = []
|
||||
|
||||
106
crates/web-sys/src/features/gen_VisualViewport.rs
Normal file
106
crates/web-sys/src/features/gen_VisualViewport.rs
Normal file
@@ -0,0 +1,106 @@
|
||||
#![allow(unused_imports)]
|
||||
#![allow(clippy::all)]
|
||||
use super::*;
|
||||
use wasm_bindgen::prelude::*;
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
# [wasm_bindgen (extends = EventTarget , extends = :: js_sys :: Object , js_name = VisualViewport , typescript_type = "VisualViewport")]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
#[doc = "The `VisualViewport` class."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"]
|
||||
pub type VisualViewport;
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "VisualViewport" , js_name = offsetLeft)]
|
||||
#[doc = "Getter for the `offsetLeft` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/offsetLeft)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"]
|
||||
pub fn offset_left(this: &VisualViewport) -> f64;
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "VisualViewport" , js_name = offsetTop)]
|
||||
#[doc = "Getter for the `offsetTop` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/offsetTop)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"]
|
||||
pub fn offset_top(this: &VisualViewport) -> f64;
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "VisualViewport" , js_name = pageLeft)]
|
||||
#[doc = "Getter for the `pageLeft` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/pageLeft)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"]
|
||||
pub fn page_left(this: &VisualViewport) -> f64;
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "VisualViewport" , js_name = pageTop)]
|
||||
#[doc = "Getter for the `pageTop` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/pageTop)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"]
|
||||
pub fn page_top(this: &VisualViewport) -> f64;
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "VisualViewport" , js_name = width)]
|
||||
#[doc = "Getter for the `width` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/width)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"]
|
||||
pub fn width(this: &VisualViewport) -> f64;
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "VisualViewport" , js_name = height)]
|
||||
#[doc = "Getter for the `height` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/height)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"]
|
||||
pub fn height(this: &VisualViewport) -> f64;
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "VisualViewport" , js_name = scale)]
|
||||
#[doc = "Getter for the `scale` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/scale)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"]
|
||||
pub fn scale(this: &VisualViewport) -> f64;
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "VisualViewport" , js_name = onresize)]
|
||||
#[doc = "Getter for the `onresize` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/onresize)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"]
|
||||
pub fn onresize(this: &VisualViewport) -> Option<::js_sys::Function>;
|
||||
# [wasm_bindgen (structural , method , setter , js_class = "VisualViewport" , js_name = onresize)]
|
||||
#[doc = "Setter for the `onresize` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/onresize)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"]
|
||||
pub fn set_onresize(this: &VisualViewport, value: Option<&::js_sys::Function>);
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "VisualViewport" , js_name = onscroll)]
|
||||
#[doc = "Getter for the `onscroll` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/onscroll)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"]
|
||||
pub fn onscroll(this: &VisualViewport) -> Option<::js_sys::Function>;
|
||||
# [wasm_bindgen (structural , method , setter , js_class = "VisualViewport" , js_name = onscroll)]
|
||||
#[doc = "Setter for the `onscroll` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/onscroll)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"]
|
||||
pub fn set_onscroll(this: &VisualViewport, value: Option<&::js_sys::Function>);
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "VisualViewport" , js_name = onscrollend)]
|
||||
#[doc = "Getter for the `onscrollend` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/onscrollend)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"]
|
||||
pub fn onscrollend(this: &VisualViewport) -> Option<::js_sys::Function>;
|
||||
# [wasm_bindgen (structural , method , setter , js_class = "VisualViewport" , js_name = onscrollend)]
|
||||
#[doc = "Setter for the `onscrollend` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/VisualViewport/onscrollend)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `VisualViewport`*"]
|
||||
pub fn set_onscrollend(this: &VisualViewport, value: Option<&::js_sys::Function>);
|
||||
}
|
||||
@@ -236,6 +236,14 @@ extern "C" {
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `Screen`, `Window`*"]
|
||||
pub fn screen(this: &Window) -> Result<Screen, JsValue>;
|
||||
#[cfg(feature = "VisualViewport")]
|
||||
# [wasm_bindgen (structural , method , getter , js_class = "Window" , js_name = visualViewport)]
|
||||
#[doc = "Getter for the `visualViewport` field of this object."]
|
||||
#[doc = ""]
|
||||
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/Window/visualViewport)"]
|
||||
#[doc = ""]
|
||||
#[doc = "*This API requires the following crate features to be activated: `VisualViewport`, `Window`*"]
|
||||
pub fn visual_viewport(this: &Window) -> Option<VisualViewport>;
|
||||
# [wasm_bindgen (structural , catch , method , getter , js_class = "Window" , js_name = innerWidth)]
|
||||
#[doc = "Getter for the `innerWidth` field of this object."]
|
||||
#[doc = ""]
|
||||
|
||||
@@ -10113,6 +10113,13 @@ mod gen_VisibilityState;
|
||||
#[allow(unused_imports)]
|
||||
pub use gen_VisibilityState::*;
|
||||
|
||||
#[cfg(feature = "VisualViewport")]
|
||||
#[allow(non_snake_case)]
|
||||
mod gen_VisualViewport;
|
||||
#[cfg(feature = "VisualViewport")]
|
||||
#[allow(unused_imports)]
|
||||
pub use gen_VisualViewport::*;
|
||||
|
||||
#[cfg(feature = "VoidCallback")]
|
||||
#[allow(non_snake_case)]
|
||||
mod gen_VoidCallback;
|
||||
|
||||
26
crates/web-sys/webidls/enabled/VisualViewport.webidl
vendored
Normal file
26
crates/web-sys/webidls/enabled/VisualViewport.webidl
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* https://drafts.csswg.org/cssom-view/#visualViewport
|
||||
*/
|
||||
|
||||
[Exposed=Window]
|
||||
interface VisualViewport : EventTarget {
|
||||
readonly attribute double offsetLeft;
|
||||
readonly attribute double offsetTop;
|
||||
|
||||
readonly attribute double pageLeft;
|
||||
readonly attribute double pageTop;
|
||||
|
||||
readonly attribute double width;
|
||||
readonly attribute double height;
|
||||
|
||||
readonly attribute double scale;
|
||||
|
||||
attribute EventHandler onresize;
|
||||
attribute EventHandler onscroll;
|
||||
attribute EventHandler onscrollend;
|
||||
};
|
||||
1
crates/web-sys/webidls/enabled/Window.webidl
vendored
1
crates/web-sys/webidls/enabled/Window.webidl
vendored
@@ -146,6 +146,7 @@ partial interface Window {
|
||||
// nsGlobalWindow::Cleanup. :(
|
||||
//[SameObject, Replaceable, Throws] readonly attribute Screen screen;
|
||||
[Replaceable, Throws] readonly attribute Screen screen;
|
||||
[SameObject, Replaceable] readonly attribute VisualViewport? visualViewport;
|
||||
|
||||
// browsing context
|
||||
//[Throws] undefined moveTo(double x, double y);
|
||||
|
||||
Reference in New Issue
Block a user