mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
layout: Introduce ReflowPhasesRun
(#38467)
There were various booleans on `ReflowResults` that represented various actions that might have been taken during a reflow request. Replace those with a bitflags that better represents what reflow phases have actually been run. Update variable names to reflect what they mean. In addition, run some post-layout tasks unconditionally. They are already contingent on the results returned from layout. This simplifies and clarifies the code a good deal. Testing: This should not change observable behavior and thus is covered by existing WPT tests. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
92a9d24a13
commit
3e856cbf11
5 changed files with 100 additions and 113 deletions
|
@ -68,7 +68,9 @@ use js::jsapi::{
|
|||
};
|
||||
use js::jsval::UndefinedValue;
|
||||
use js::rust::ParentRuntime;
|
||||
use layout_api::{LayoutConfig, LayoutFactory, RestyleReason, ScriptThreadFactory};
|
||||
use layout_api::{
|
||||
LayoutConfig, LayoutFactory, ReflowPhasesRun, RestyleReason, ScriptThreadFactory,
|
||||
};
|
||||
use media::WindowGLContext;
|
||||
use metrics::MAX_TASK_NS;
|
||||
use net_traits::image_cache::{ImageCache, ImageCacheResponseMessage};
|
||||
|
@ -1238,6 +1240,8 @@ impl ScriptThread {
|
|||
///
|
||||
/// Attempt to update the rendering and then do a microtask checkpoint if rendering was actually
|
||||
/// updated.
|
||||
///
|
||||
/// Returns true if any reflows produced a new display list.
|
||||
pub(crate) fn update_the_rendering(&self, can_gc: CanGc) -> bool {
|
||||
self.last_render_opportunity_time.set(Some(Instant::now()));
|
||||
self.cancel_scheduled_update_the_rendering();
|
||||
|
@ -1275,7 +1279,7 @@ impl ScriptThread {
|
|||
// 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.
|
||||
let mut saw_any_reflows = false;
|
||||
let mut built_any_display_lists = false;
|
||||
for pipeline_id in documents_in_order.iter() {
|
||||
let document = self
|
||||
.documents
|
||||
|
@ -1358,7 +1362,10 @@ impl ScriptThread {
|
|||
|
||||
// > Step 22: For each doc of docs, update the rendering or user interface of
|
||||
// > doc and its node navigable to reflect the current state.
|
||||
saw_any_reflows = document.update_the_rendering() || saw_any_reflows;
|
||||
built_any_display_lists = document
|
||||
.update_the_rendering()
|
||||
.contains(ReflowPhasesRun::BuiltDisplayList) ||
|
||||
built_any_display_lists;
|
||||
|
||||
// TODO: Process top layer removals according to
|
||||
// https://drafts.csswg.org/css-position-4/#process-top-layer-removals.
|
||||
|
@ -1367,7 +1374,7 @@ impl ScriptThread {
|
|||
// Perform a microtask checkpoint as the specifications says that *update the rendering*
|
||||
// should be run in a task and a microtask checkpoint is always done when running tasks.
|
||||
self.perform_a_microtask_checkpoint(can_gc);
|
||||
saw_any_reflows
|
||||
built_any_display_lists
|
||||
}
|
||||
|
||||
/// Schedule a rendering update ("update the rendering"), if necessary. This
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue