aboutsummaryrefslogtreecommitdiffstats
path: root/components/servo/webview_delegate.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2025-04-02 13:17:24 +0200
committerGitHub <noreply@github.com>2025-04-02 11:17:24 +0000
commitb925c3142407f977cd77b695b750177a9eaf940d (patch)
treee3e2b910dca81ec2e26adf2c970846fb2c5d17a8 /components/servo/webview_delegate.rs
parent520a7f7bc509cc96a8c2dffd447cd06218cff636 (diff)
downloadservo-b925c3142407f977cd77b695b750177a9eaf940d.tar.gz
servo-b925c3142407f977cd77b695b750177a9eaf940d.zip
libservo: Start moving `WindowMethods` to `WebViewDelegate` (#36223)
`WindowMethods` is used by the embedding layer to get information from the embedder. This change moves the functionality for getting screen size and `WebView` offsets to `WebViewDelegate`. This is important because `WebView`s might be on different screens or have different offsets on the screen itself, so it makes sense for this to be per-`WebView` and not global to the embedder. HiDPI and animation state functionality will move to the embedder in subsequent changes. Signed-off-by: Martin Robinson <mrobinson@igalia.com> <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes do not require tests because they just modify the `WebView` API surface a bit. <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/servo/webview_delegate.rs')
-rw-r--r--components/servo/webview_delegate.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/components/servo/webview_delegate.rs b/components/servo/webview_delegate.rs
index 9ea75e32af6..0af15d7e417 100644
--- a/components/servo/webview_delegate.rs
+++ b/components/servo/webview_delegate.rs
@@ -9,7 +9,7 @@ use constellation_traits::ConstellationMsg;
use embedder_traits::{
AllowOrDeny, AuthenticationResponse, ContextMenuResult, Cursor, FilterPattern,
GamepadHapticEffectType, InputMethodType, LoadStatus, MediaSessionEvent, Notification,
- PermissionFeature, SimpleDialog, WebResourceRequest, WebResourceResponse,
+ PermissionFeature, ScreenGeometry, SimpleDialog, WebResourceRequest, WebResourceResponse,
WebResourceResponseMsg,
};
use ipc_channel::ipc::IpcSender;
@@ -297,6 +297,12 @@ impl Drop for InterceptedWebResourceLoad {
}
pub trait WebViewDelegate {
+ /// Get the [`ScreenGeometry`] for this [`WebView`]. If this is unimplemented or returns `None`
+ /// the screen will have the size of the [`WebView`]'s `RenderingContext` and `WebView` will be
+ /// considered to be positioned at the screen's origin.
+ fn screen_geometry(&self, _webview: WebView) -> Option<ScreenGeometry> {
+ None
+ }
/// The URL of the currently loaded page in this [`WebView`] has changed. The new
/// URL can accessed via [`WebView::url`].
fn notify_url_changed(&self, _webview: WebView, _url: Url) {}