mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
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:
parent
1e17dfdf31
commit
0a01d06968
11 changed files with 56 additions and 80 deletions
|
@ -151,7 +151,7 @@ use crate::script_runtime::{
|
||||||
CanGc, CommonScriptMsg, JSContext, Runtime, ScriptChan, ScriptPort, ScriptThreadEventCategory,
|
CanGc, CommonScriptMsg, JSContext, Runtime, ScriptChan, ScriptPort, ScriptThreadEventCategory,
|
||||||
};
|
};
|
||||||
use crate::script_thread::{
|
use crate::script_thread::{
|
||||||
ImageCacheMsg, MainThreadScriptChan, MainThreadScriptMsg, ScriptThread,
|
with_script_thread, ImageCacheMsg, MainThreadScriptChan, MainThreadScriptMsg, ScriptThread,
|
||||||
SendableMainThreadScriptChan,
|
SendableMainThreadScriptChan,
|
||||||
};
|
};
|
||||||
use crate::task_manager::TaskManager;
|
use crate::task_manager::TaskManager;
|
||||||
|
@ -380,6 +380,8 @@ pub struct Window {
|
||||||
|
|
||||||
/// Sizes of the various `<iframes>` that we might have on this [`Window`].
|
/// Sizes of the various `<iframes>` that we might have on this [`Window`].
|
||||||
/// This is used to:
|
/// This is used to:
|
||||||
|
/// - Let same-`ScriptThread` `<iframe>`s know synchronously when their
|
||||||
|
/// size has changed, ensuring that the next layout has the right size.
|
||||||
/// - Send the proper size for the `<iframe>` during new-Pipeline creation
|
/// - Send the proper size for the `<iframe>` during new-Pipeline creation
|
||||||
/// when the `src` attribute changes.
|
/// when the `src` attribute changes.
|
||||||
/// - Let the `Constellation` know about `BrowsingContext` (one per `<iframe>`)
|
/// - Let the `Constellation` know about `BrowsingContext` (one per `<iframe>`)
|
||||||
|
@ -1982,6 +1984,24 @@ impl Window {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Batch resize message to any local `Pipeline`s now, rather than waiting for them
|
||||||
|
// to filter asynchronously through the `Constellation`. This allows the new value
|
||||||
|
// to be reflected immediately in layout.
|
||||||
|
let device_pixel_ratio = self.device_pixel_ratio();
|
||||||
|
with_script_thread(|script_thread| {
|
||||||
|
for iframe_size in new_iframe_sizes.values() {
|
||||||
|
script_thread.handle_resize_message(
|
||||||
|
iframe_size.pipeline_id,
|
||||||
|
WindowSizeData {
|
||||||
|
initial_viewport: iframe_size.size,
|
||||||
|
device_pixel_ratio,
|
||||||
|
},
|
||||||
|
// TODO: This might send an extra resize event. This can fixed by explicitly
|
||||||
|
// supporting `<iframe>` creation when the size isn't known yet.
|
||||||
|
WindowSizeType::Resize,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
// Send asynchronous updates to `Constellation.`
|
// Send asynchronous updates to `Constellation.`
|
||||||
let size_messages: Vec<_> = new_iframe_sizes
|
let size_messages: Vec<_> = new_iframe_sizes
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
@ -1546,8 +1546,10 @@ impl ScriptThread {
|
||||||
// > the order it is found in the list.
|
// > the order it is found in the list.
|
||||||
let documents_in_order = self.documents.borrow().documents_in_order();
|
let documents_in_order = self.documents.borrow().documents_in_order();
|
||||||
|
|
||||||
// Note: the spec reads: "for doc in docs" at each step
|
// TODO: The specification reads: "for doc in docs" at each step whereas this runs all
|
||||||
// whereas this runs all steps per doc in docs.
|
// 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() {
|
for pipeline_id in documents_in_order.iter() {
|
||||||
let document = self
|
let document = self
|
||||||
.documents
|
.documents
|
||||||
|
@ -1619,8 +1621,6 @@ impl ScriptThread {
|
||||||
|
|
||||||
// TODO: Mark paint timing from https://w3c.github.io/paint-timing.
|
// 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")]
|
#[cfg(feature = "webgpu")]
|
||||||
document.update_rendering_of_webgpu_canvases();
|
document.update_rendering_of_webgpu_canvases();
|
||||||
|
|
||||||
|
@ -2828,7 +2828,7 @@ impl ScriptThread {
|
||||||
|
|
||||||
/// Batch window resize operations into a single "update the rendering" task,
|
/// Batch window resize operations into a single "update the rendering" task,
|
||||||
/// or, if a load is in progress, set the window size directly.
|
/// or, if a load is in progress, set the window size directly.
|
||||||
fn handle_resize_message(
|
pub(crate) fn handle_resize_message(
|
||||||
&self,
|
&self,
|
||||||
id: PipelineId,
|
id: PipelineId,
|
||||||
size: WindowSizeData,
|
size: WindowSizeData,
|
||||||
|
@ -2843,9 +2843,7 @@ impl ScriptThread {
|
||||||
let mut loads = self.incomplete_loads.borrow_mut();
|
let mut loads = self.incomplete_loads.borrow_mut();
|
||||||
if let Some(ref mut load) = loads.iter_mut().find(|load| load.pipeline_id == id) {
|
if let Some(ref mut load) = loads.iter_mut().find(|load| load.pipeline_id == id) {
|
||||||
load.window_size = size;
|
load.window_size = size;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
warn!("resize sent to nonexistent pipeline");
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
[dynamic-viewport-units-rule-cache.html]
|
|
||||||
expected: TIMEOUT
|
|
||||||
[dynamic-viewport-units-rule-cache]
|
|
||||||
expected: TIMEOUT
|
|
|
@ -4,12 +4,3 @@
|
||||||
|
|
||||||
[throws if handleEvent is thruthy and not callable]
|
[throws if handleEvent is thruthy and not callable]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[looks up handleEvent method on every event dispatch]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[doesn't look up handleEvent method on callable event listeners]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[rethrows errors when getting handleEvent]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,18 +1,3 @@
|
||||||
[MediaQueryList-addListener-removeListener.html]
|
[MediaQueryList-addListener-removeListener.html]
|
||||||
[listeners are called when <iframe> is resized]
|
[listeners are called when <iframe> is resized]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[listeners are called correct number of times]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[listeners are called in order they were added]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[listener that was added twice is called only once]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[listeners are called in order their MQLs were created]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[removing listener from one MQL doesn't remove it from all MQLs]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
[MediaQueryList-extends-EventTarget-interop.html]
|
|
||||||
[listener added with addListener and addEventListener (capture) is called twice]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[removeEventListener (capture) doesn't remove listener added with addListener]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[removeListener doesn't remove listener added with addEventListener (capture)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[capturing event listener fires before non-capturing listener at target]
|
|
||||||
expected: FAIL
|
|
|
@ -1,9 +0,0 @@
|
||||||
[MediaQueryList-extends-EventTarget.html]
|
|
||||||
[onchange removes listener]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[listeners for "change" type are called]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[addEventListener "once" option is respected]
|
|
||||||
expected: FAIL
|
|
|
@ -1,6 +0,0 @@
|
||||||
[MediaQueryListEvent.html]
|
|
||||||
[argument of onchange]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[constructor of "change" event]
|
|
||||||
expected: FAIL
|
|
|
@ -1,5 +1,4 @@
|
||||||
[element-img-environment-change.https.sub.html]
|
[element-img-environment-change.https.sub.html]
|
||||||
expected: TIMEOUT
|
|
||||||
[sec-fetch-site - Cross-site, no attributes]
|
[sec-fetch-site - Cross-site, no attributes]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
@ -59,3 +58,9 @@
|
||||||
|
|
||||||
[sec-fetch-site - Same origin, no attributes]
|
[sec-fetch-site - Same origin, no attributes]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
[sec-fetch-storage-access - Cross-site, no attributes]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[sec-fetch-storage-access - Same site, no attributes]
|
||||||
|
expected: FAIL
|
||||||
|
|
|
@ -1,46 +1,54 @@
|
||||||
[element-img-environment-change.sub.html]
|
[element-img-environment-change.sub.html]
|
||||||
expected: TIMEOUT
|
|
||||||
[sec-fetch-site - Not sent to non-trustworthy same-site destination, no attributes]
|
[sec-fetch-site - Not sent to non-trustworthy same-site destination, no attributes]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[sec-fetch-site - Not sent to non-trustworthy cross-site destination, no attributes]
|
[sec-fetch-site - Not sent to non-trustworthy cross-site destination, no attributes]
|
||||||
expected: NOTRUN
|
expected: FAIL
|
||||||
|
|
||||||
[sec-fetch-mode - Not sent to non-trustworthy same-origin destination, no attributes]
|
[sec-fetch-mode - Not sent to non-trustworthy same-origin destination, no attributes]
|
||||||
expected: NOTRUN
|
expected: FAIL
|
||||||
|
|
||||||
[sec-fetch-mode - Not sent to non-trustworthy same-site destination, no attributes]
|
[sec-fetch-mode - Not sent to non-trustworthy same-site destination, no attributes]
|
||||||
expected: NOTRUN
|
expected: FAIL
|
||||||
|
|
||||||
[sec-fetch-mode - Not sent to non-trustworthy cross-site destination, no attributes]
|
[sec-fetch-mode - Not sent to non-trustworthy cross-site destination, no attributes]
|
||||||
expected: NOTRUN
|
expected: FAIL
|
||||||
|
|
||||||
[sec-fetch-dest - Not sent to non-trustworthy same-origin destination, no attributes]
|
[sec-fetch-dest - Not sent to non-trustworthy same-origin destination, no attributes]
|
||||||
expected: NOTRUN
|
expected: FAIL
|
||||||
|
|
||||||
[sec-fetch-dest - Not sent to non-trustworthy same-site destination, no attributes]
|
[sec-fetch-dest - Not sent to non-trustworthy same-site destination, no attributes]
|
||||||
expected: NOTRUN
|
expected: FAIL
|
||||||
|
|
||||||
[sec-fetch-dest - Not sent to non-trustworthy cross-site destination, no attributes]
|
[sec-fetch-dest - Not sent to non-trustworthy cross-site destination, no attributes]
|
||||||
expected: NOTRUN
|
expected: FAIL
|
||||||
|
|
||||||
[sec-fetch-user - Not sent to non-trustworthy same-origin destination, no attributes]
|
[sec-fetch-user - Not sent to non-trustworthy same-origin destination, no attributes]
|
||||||
expected: NOTRUN
|
expected: FAIL
|
||||||
|
|
||||||
[sec-fetch-user - Not sent to non-trustworthy same-site destination, no attributes]
|
[sec-fetch-user - Not sent to non-trustworthy same-site destination, no attributes]
|
||||||
expected: NOTRUN
|
expected: FAIL
|
||||||
|
|
||||||
[sec-fetch-user - Not sent to non-trustworthy cross-site destination, no attributes]
|
[sec-fetch-user - Not sent to non-trustworthy cross-site destination, no attributes]
|
||||||
expected: NOTRUN
|
expected: FAIL
|
||||||
|
|
||||||
[sec-fetch-site - HTTPS downgrade (header not sent), no attributes]
|
[sec-fetch-site - HTTPS downgrade (header not sent), no attributes]
|
||||||
expected: NOTRUN
|
expected: FAIL
|
||||||
|
|
||||||
[sec-fetch-site - HTTPS upgrade, no attributes]
|
[sec-fetch-site - HTTPS upgrade, no attributes]
|
||||||
expected: NOTRUN
|
expected: FAIL
|
||||||
|
|
||||||
[sec-fetch-site - HTTPS downgrade-upgrade, no attributes]
|
[sec-fetch-site - HTTPS downgrade-upgrade, no attributes]
|
||||||
expected: NOTRUN
|
expected: FAIL
|
||||||
|
|
||||||
[sec-fetch-site - Not sent to non-trustworthy same-origin destination, no attributes]
|
[sec-fetch-site - Not sent to non-trustworthy same-origin destination, no attributes]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
[sec-fetch-storage-access - Not sent to non-trustworthy same-origin destination, no attributes]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[sec-fetch-storage-access - Not sent to non-trustworthy same-site destination, no attributes]
|
||||||
|
expected: FAIL
|
||||||
|
|
||||||
|
[sec-fetch-storage-access - Not sent to non-trustworthy cross-site destination, no attributes]
|
||||||
|
expected: FAIL
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
[Navigating to a different document with link click]
|
[Navigating to a different document with link click]
|
||||||
expected: TIMEOUT
|
expected: FAIL
|
||||||
|
|
||||||
[Navigating to a different document with form submission]
|
[Navigating to a different document with form submission]
|
||||||
expected: NOTRUN
|
expected: TIMEOUT
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue