T13: push display scale factor into Servo's hidpi so Retina pages lay out at logical CSS dimensions

This commit is contained in:
2026-05-11 00:46:32 -04:00
parent 60a3b9b050
commit b70fa71a9f
9 changed files with 139 additions and 13 deletions
+13
View File
@@ -235,6 +235,17 @@ pub struct PageZoomRequest {
pub zoom_factor: f32,
}
/// Set the WebView's hidpi (device → CSS pixel) scale. Servo's
/// builder defaults this to 1.0; on Retina hosts that produces
/// half-size layout because the page treats physical pixels as CSS
/// pixels. The embedder should mirror the platform's reported scale
/// factor on every viewport-bound change.
#[derive(Clone, Debug, PartialEq)]
pub struct HidpiScaleRequest {
pub webview_id: WebViewId,
pub scale_factor: f32,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct MouseClickRequest {
pub webview_id: WebViewId,
@@ -316,6 +327,8 @@ pub trait ServoHost {
fn set_page_zoom(&mut self, request: PageZoomRequest) -> Result<(), ServoHostError>;
fn set_hidpi_scale(&mut self, request: HidpiScaleRequest) -> Result<(), ServoHostError>;
fn click(&mut self, request: MouseClickRequest) -> Result<(), ServoHostError>;
fn hover(&mut self, request: MouseHoverRequest) -> Result<(), ServoHostError>;