aboutsummaryrefslogtreecommitdiffstats
path: root/components/servo/tests
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/servo/tests
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/servo/tests')
-rw-r--r--components/servo/tests/common/mod.rs12
1 files changed, 1 insertions, 11 deletions
diff --git a/components/servo/tests/common/mod.rs b/components/servo/tests/common/mod.rs
index 2807a3134ec..d147ff75722 100644
--- a/components/servo/tests/common/mod.rs
+++ b/components/servo/tests/common/mod.rs
@@ -7,14 +7,12 @@ use std::sync::Arc;
use std::sync::atomic::{AtomicBool, Ordering};
use std::time::Duration;
-use compositing::windowing::{EmbedderMethods, WindowMethods};
+use compositing::windowing::EmbedderMethods;
use compositing_traits::rendering_context::{RenderingContext, SoftwareRenderingContext};
use dpi::PhysicalSize;
use embedder_traits::EventLoopWaker;
use euclid::Scale;
use servo::Servo;
-use servo_geometry::DeviceIndependentPixel;
-use webrender_api::units::DevicePixel;
pub struct ServoTest {
servo: Servo,
@@ -39,13 +37,6 @@ impl ServoTest {
}
}
- struct WindowMethodsImpl;
- impl WindowMethods for WindowMethodsImpl {
- fn hidpi_factor(&self) -> Scale<f32, DeviceIndependentPixel, DevicePixel> {
- Scale::new(1.0)
- }
- }
-
#[derive(Clone)]
struct EventLoopWakerImpl(Arc<AtomicBool>);
impl EventLoopWaker for EventLoopWakerImpl {
@@ -64,7 +55,6 @@ impl ServoTest {
Default::default(),
rendering_context.clone(),
Box::new(EmbedderMethodsImpl(user_event_triggered)),
- Rc::new(WindowMethodsImpl),
Default::default(),
);
Self { servo }