mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
script: Remove 'pending reflow' concept and some explicit reflows (#34558)
The `pending reflow` concept isn't necessary now that *update the rendering* is taking care of triggering reflows at the correct time. `Window::reflow` already avoids reflows if the page is not dirty, so pending reflows is now just an extraneous check as long as *update the rendering* runs properly. This change also removes some explicit reflows, which now wait until the appropriate moment during *update the rendering*. This should remove some extra reflows that are not necessary. Servo needs some way to track that resizing the web view needs to re-layout due to the initial containing block changing. Move handling of `Document::needs_paint` to the script thread and use this, expanding the rustdoc to explain what it is for a bit more clearly. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
bc741bdc0b
commit
3f85a27097
10 changed files with 43 additions and 122 deletions
|
@ -59,7 +59,7 @@ use profile_traits::time::{
|
|||
self as profile_time, TimerMetadata, TimerMetadataFrameType, TimerMetadataReflowType,
|
||||
};
|
||||
use profile_traits::{path, time_profile};
|
||||
use script::layout_dom::{ServoLayoutDocument, ServoLayoutElement, ServoLayoutNode};
|
||||
use script::layout_dom::{ServoLayoutElement, ServoLayoutNode};
|
||||
use script_layout_interface::wrapper_traits::LayoutNode;
|
||||
use script_layout_interface::{
|
||||
Layout, LayoutConfig, LayoutFactory, NodesFromPointQueryType, OffsetParentResponse, Reflow,
|
||||
|
@ -844,7 +844,6 @@ impl LayoutThread {
|
|||
&self,
|
||||
data: &Reflow,
|
||||
reflow_goal: &ReflowGoal,
|
||||
document: Option<&ServoLayoutDocument>,
|
||||
layout_root: &mut dyn Flow,
|
||||
layout_context: &mut LayoutContext,
|
||||
) {
|
||||
|
@ -901,18 +900,8 @@ impl LayoutThread {
|
|||
}
|
||||
|
||||
if !reflow_goal.needs_display() {
|
||||
// Defer the paint step until the next ForDisplay.
|
||||
//
|
||||
// We need to tell the document about this so it doesn't
|
||||
// incorrectly suppress reflows. See #13131.
|
||||
document
|
||||
.expect("No document in a non-display reflow?")
|
||||
.needs_paint_from_layout();
|
||||
return;
|
||||
}
|
||||
if let Some(document) = document {
|
||||
document.will_paint();
|
||||
}
|
||||
|
||||
let mut display_list = self.display_list.borrow_mut();
|
||||
let display_list = display_list.as_mut().unwrap();
|
||||
|
@ -1176,7 +1165,6 @@ impl LayoutThread {
|
|||
&mut root_flow,
|
||||
&data.reflow_info,
|
||||
&data.reflow_goal,
|
||||
Some(&document),
|
||||
&mut layout_context,
|
||||
thread_pool,
|
||||
);
|
||||
|
@ -1251,7 +1239,6 @@ impl LayoutThread {
|
|||
root_flow: &mut FlowRef,
|
||||
data: &Reflow,
|
||||
reflow_goal: &ReflowGoal,
|
||||
document: Option<&ServoLayoutDocument>,
|
||||
context: &mut LayoutContext,
|
||||
thread_pool: Option<&rayon::ThreadPool>,
|
||||
) {
|
||||
|
@ -1337,7 +1324,7 @@ impl LayoutThread {
|
|||
},
|
||||
);
|
||||
|
||||
self.perform_post_main_layout_passes(data, root_flow, reflow_goal, document, context);
|
||||
self.perform_post_main_layout_passes(data, root_flow, reflow_goal, context);
|
||||
}
|
||||
|
||||
fn perform_post_main_layout_passes(
|
||||
|
@ -1345,14 +1332,12 @@ impl LayoutThread {
|
|||
data: &Reflow,
|
||||
root_flow: &mut FlowRef,
|
||||
reflow_goal: &ReflowGoal,
|
||||
document: Option<&ServoLayoutDocument>,
|
||||
layout_context: &mut LayoutContext,
|
||||
) {
|
||||
// Build the display list if necessary, and send it to the painter.
|
||||
self.compute_abs_pos_and_build_display_list(
|
||||
data,
|
||||
reflow_goal,
|
||||
document,
|
||||
FlowRef::deref_mut(root_flow),
|
||||
&mut *layout_context,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue