layout: Allow same ScriptThread <iframe>s to be resized synchronously (#34656)

Post layout, when a `Window` has all of the new `<iframe>` sizes, size
any `Window`s for `Pipeline`s in the same `ScriptThread` synchronously.
This ensures that when laying out from the outermost frame to the
innermost frames, the frames sizes are set properly.

There is still an issue where a non-same-`ScriptThread` `<iframe>` sits
in between two `<iframe>`s of the same origin. According to the
specification these frames should all be synchrnously laid out --
something quite difficult in Servo. This is issue #34655.

This is the first change in a series of changes to improve the
consistency of `<iframe>` loading and sizing.

Fixes #14719.
Fixes #24569.
Fixes #24571.
Fixes #25269.
Fixes #25275.
Fixes #25285.
Fixes #30571.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2024-12-17 10:37:52 +01:00 committed by GitHub
parent 1e17dfdf31
commit 0a01d06968
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 56 additions and 80 deletions

View file

@ -1546,8 +1546,10 @@ impl ScriptThread {
// > the order it is found in the list.
let documents_in_order = self.documents.borrow().documents_in_order();
// Note: the spec reads: "for doc in docs" at each step
// whereas this runs all steps per doc in docs.
// TODO: The specification reads: "for doc in docs" at each step whereas this runs all
// steps per doc in docs. Currently `<iframe>` resizing depends on a parent being able to
// queue resize events on a child and have those run in the same call to this method, so
// that needs to be sorted out to fix this.
for pipeline_id in documents_in_order.iter() {
let document = self
.documents
@ -1619,8 +1621,6 @@ impl ScriptThread {
// TODO: Mark paint timing from https://w3c.github.io/paint-timing.
// TODO(#31871): Update the rendering: consolidate all reflow calls into one here?
#[cfg(feature = "webgpu")]
document.update_rendering_of_webgpu_canvases();
@ -2828,7 +2828,7 @@ impl ScriptThread {
/// Batch window resize operations into a single "update the rendering" task,
/// or, if a load is in progress, set the window size directly.
fn handle_resize_message(
pub(crate) fn handle_resize_message(
&self,
id: PipelineId,
size: WindowSizeData,
@ -2843,9 +2843,7 @@ impl ScriptThread {
let mut loads = self.incomplete_loads.borrow_mut();
if let Some(ref mut load) = loads.iter_mut().find(|load| load.pipeline_id == id) {
load.window_size = size;
return;
}
warn!("resize sent to nonexistent pipeline");
})
}