layout: Correct damage propagation and style repair for repaint-only layout (#37004)

When making last-minute changes to the repaint-only layout pass, damage
propagation was broken, meaning that full layout was always done. This
change fixes that, meaning that times in the `blaster.html` test case
now reflect those described in the original commit message from #36978.

In addition, some style repair is now fixed:
- `InlineFormattingContext`s now keep a `SharedInlineStyles` for the
root of the IFC
    which is updated during style repair.
 - `BlockFormattingContext`s now properly update their style.

These changes are verified by turning on repaint only layout for more
properties
in Stylo via servo/stylo#183.

Testing: Manual performance testing via `blaster.html`.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-05-19 12:17:49 +02:00 committed by GitHub
parent 89f7026cc8
commit 573663d502
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 91 additions and 48 deletions

View file

@ -4,7 +4,7 @@
use app_units::Au;
use malloc_size_of_derive::MallocSizeOf;
use script::layout_dom::ServoLayoutElement;
use script::layout_dom::{ServoLayoutElement, ServoLayoutNode};
use servo_arc::Arc;
use style::context::SharedStyleContext;
use style::properties::ComputedValues;
@ -223,12 +223,13 @@ impl IndependentFormattingContext {
pub(crate) fn repair_style(
&mut self,
context: &SharedStyleContext,
node: &ServoLayoutNode,
new_style: &Arc<ComputedValues>,
) {
self.base.repair_style(new_style);
match &mut self.contents {
IndependentFormattingContextContents::NonReplaced(content) => {
content.repair_style(context, new_style);
content.repair_style(context, node, new_style);
},
IndependentFormattingContextContents::Replaced(..) => {},
}
@ -356,9 +357,16 @@ impl IndependentNonReplacedContents {
matches!(self, Self::Table(_))
}
fn repair_style(&mut self, context: &SharedStyleContext, new_style: &Arc<ComputedValues>) {
fn repair_style(
&mut self,
context: &SharedStyleContext,
node: &ServoLayoutNode,
new_style: &Arc<ComputedValues>,
) {
match self {
IndependentNonReplacedContents::Flow(..) => {},
IndependentNonReplacedContents::Flow(block_formatting_context) => {
block_formatting_context.repair_style(node, new_style);
},
IndependentNonReplacedContents::Flex(flex_container) => {
flex_container.repair_style(new_style)
},