mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
constellation: Stop assuming that the viewport is shared by all WebViews (#36312)
The `Constellation` previously held a `window_size` member, but this assumes that all `WebView`s have the same size. This change removes that assumption as well as making sure that all `WebView`s pass their size and HiDIP scaling to the `Constellation` when they are created. In addition - `WindowSizeData` is renamed to `ViewportDetails`, as it was holding more than just the size and it didn't necessarily correspond to a "window." It's used for tracking viewport data, whether for an `<iframe>` or the main `WebView` viewport. - `ViewportDetails` is stored more consistently so that conceptually an `<iframe>` can also have its own HiDPI scaling. This isn't something we necessarily want, but it makes everything conceptually simpler. The goal with this change is to work toward allowing per-`WebView` HiDPI scaling and sizing. There are still some corresponding changes in the compositor to make that happen, but they will in a subsequent change. Testing: This is covered by existing tests. There should be no behavior changes. Fixes: This is part of #36232. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
7c89e24f34
commit
fb344ba4e9
26 changed files with 272 additions and 256 deletions
|
@ -6,8 +6,8 @@ use std::cell::Cell;
|
|||
|
||||
use base::id::{BrowsingContextId, PipelineId, WebViewId};
|
||||
use bitflags::bitflags;
|
||||
use constellation_traits::WindowSizeData;
|
||||
use dom_struct::dom_struct;
|
||||
use embedder_traits::ViewportDetails;
|
||||
use html5ever::{LocalName, Prefix, local_name, namespace_url, ns};
|
||||
use js::rust::HandleObject;
|
||||
use net_traits::ReferrerPolicy;
|
||||
|
@ -196,12 +196,12 @@ impl HTMLIFrameElement {
|
|||
history_handling,
|
||||
};
|
||||
|
||||
let window_size = WindowSizeData {
|
||||
initial_viewport: window
|
||||
.get_iframe_size_if_known(browsing_context_id, can_gc)
|
||||
.unwrap_or_default(),
|
||||
device_pixel_ratio: window.device_pixel_ratio(),
|
||||
};
|
||||
let viewport_details = window
|
||||
.get_iframe_viewport_details_if_known(browsing_context_id, can_gc)
|
||||
.unwrap_or_else(|| ViewportDetails {
|
||||
hidpi_scale_factor: window.device_pixel_ratio(),
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
match pipeline_type {
|
||||
PipelineType::InitialAboutBlank => {
|
||||
|
@ -212,7 +212,7 @@ impl HTMLIFrameElement {
|
|||
load_data: load_data.clone(),
|
||||
old_pipeline_id,
|
||||
sandbox: sandboxed,
|
||||
window_size,
|
||||
viewport_details,
|
||||
};
|
||||
window
|
||||
.as_global_scope()
|
||||
|
@ -227,7 +227,7 @@ impl HTMLIFrameElement {
|
|||
webview_id,
|
||||
opener: None,
|
||||
load_data,
|
||||
window_size,
|
||||
viewport_details,
|
||||
};
|
||||
|
||||
self.pipeline_id.set(Some(new_pipeline_id));
|
||||
|
@ -239,7 +239,7 @@ impl HTMLIFrameElement {
|
|||
load_data,
|
||||
old_pipeline_id,
|
||||
sandbox: sandboxed,
|
||||
window_size,
|
||||
viewport_details,
|
||||
};
|
||||
window
|
||||
.as_global_scope()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue