aboutsummaryrefslogtreecommitdiffstats
path: root/components/compositing/windowing.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2025-04-14 14:01:49 +0200
committerGitHub <noreply@github.com>2025-04-14 12:01:49 +0000
commitc6dc7c83a8d79a180847695aa15f65373868c73e (patch)
tree9df76bd58362cf1e7c801803bd08b8f47989836a /components/compositing/windowing.rs
parentf1417c4e75d80c0d07b2718423e042bd11f3bcd3 (diff)
downloadservo-c6dc7c83a8d79a180847695aa15f65373868c73e.tar.gz
servo-c6dc7c83a8d79a180847695aa15f65373868c73e.zip
libservo: Make zooming and HiDPI scaling work per-`WebView` (#36419)
libservo: Make zooming and HiDPI scaling work per-`WebView` This change moves all zooming and HiDPI scaling to work per-`WebView` in both libservo and Compositor. This means that you can pinch zoom one `WebView` and it should now work independently of other `WebView`s. This is accomplished by making each `WebView` in the WebRender scene have its own scaling reference frame. All WebViews are now expected to manage their HiDPI scaling factor and this can be set independently of other WebViews. Perhaps in the future this will become a Servo-wide setting. This allows full removal of the `WindowMethods` trait from Servo. Testing: There are not yet any tests for the WebView API, but I hope to add those soon. Co-authored-by: Shubham Gupta <shubham13297@gmail.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Shubham Gupta <shubham13297@gmail.com>
Diffstat (limited to 'components/compositing/windowing.rs')
-rw-r--r--components/compositing/windowing.rs13
1 files changed, 1 insertions, 12 deletions
diff --git a/components/compositing/windowing.rs b/components/compositing/windowing.rs
index 1ab30e73154..d311f499bcc 100644
--- a/components/compositing/windowing.rs
+++ b/components/compositing/windowing.rs
@@ -5,10 +5,8 @@
//! Abstract windowing methods. The concrete implementations of these can be found in `platform/`.
use embedder_traits::{EventLoopWaker, MouseButton};
-use euclid::Scale;
use net::protocols::ProtocolRegistry;
-use servo_geometry::DeviceIndependentPixel;
-use webrender_api::units::{DevicePixel, DevicePoint};
+use webrender_api::units::DevicePoint;
#[derive(Clone)]
pub enum MouseWindowEvent {
@@ -25,15 +23,6 @@ pub enum WebRenderDebugOption {
RenderTargetDebug,
}
-// TODO: this trait assumes that the window is responsible
-// for creating the GL context, making it current, buffer
-// swapping, etc. Really that should all be done by surfman.
-pub trait WindowMethods {
- /// Get the HighDPI factor of the native window, the screen and the framebuffer.
- /// TODO(martin): Move this to `RendererWebView` when possible.
- fn hidpi_factor(&self) -> Scale<f32, DeviceIndependentPixel, DevicePixel>;
-}
-
pub trait EmbedderMethods {
/// Returns a thread-safe object to wake up the window's event loop.
fn create_event_loop_waker(&mut self) -> Box<dyn EventLoopWaker>;