Add Servo page zoom support

This commit is contained in:
2026-05-09 12:32:44 -04:00
parent 088d1166c4
commit 1faa7423c1
26 changed files with 697 additions and 280 deletions
+3 -1
View File
@@ -165,7 +165,9 @@ fn append_snapshot_args(
.arg("--scroll-x")
.arg(request.scroll_x.to_string())
.arg("--scroll-y")
.arg(request.scroll_y.to_string());
.arg(request.scroll_y.to_string())
.arg("--page-zoom-percent")
.arg(request.page_zoom_percent.to_string());
}
impl SidecarSnapshotRequest {
@@ -1,4 +1,7 @@
use ely_domain::{ProfileId, SiteOrigin, SitePermissionDecision, SitePermissionFeature, UrlText};
use ely_domain::{
DEFAULT_ZOOM_PERCENT, ProfileId, SiteOrigin, SitePermissionDecision, SitePermissionFeature,
UrlText,
};
use super::ProfileDataMode;
@@ -11,6 +14,7 @@ pub struct SidecarSnapshotRequest {
pub(in crate::services) height: u32,
pub(in crate::services) scroll_x: i32,
pub(in crate::services) scroll_y: i32,
pub(in crate::services) page_zoom_percent: u16,
pub(in crate::services) click_point: Option<SidecarClickPoint>,
pub(in crate::services) typed_text: Option<String>,
pub(in crate::services) site_permissions: Vec<SidecarSitePermission>,
@@ -27,6 +31,7 @@ impl SidecarSnapshotRequest {
height,
scroll_x: 0,
scroll_y: 0,
page_zoom_percent: DEFAULT_ZOOM_PERCENT,
click_point: None,
typed_text: None,
site_permissions: Vec::new(),
@@ -46,6 +51,12 @@ impl SidecarSnapshotRequest {
self
}
#[must_use]
pub fn with_page_zoom_percent(mut self, page_zoom_percent: u16) -> Self {
self.page_zoom_percent = page_zoom_percent;
self
}
#[must_use]
pub fn with_click_point(mut self, x: u32, y: u32) -> Self {
self.click_point = Some(SidecarClickPoint { x, y });
@@ -78,6 +89,11 @@ impl SidecarSnapshotRequest {
pub(crate) fn profile_data_mode_for_test(&self) -> ProfileDataMode {
self.profile_data_mode
}
#[cfg(test)]
pub(crate) fn page_zoom_percent_for_test(&self) -> u16 {
self.page_zoom_percent
}
}
#[derive(Clone, Copy, Debug)]