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

40
Cargo.lock generated
View file

@ -1065,7 +1065,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
"windows-sys 0.59.0", "windows-sys 0.48.0",
] ]
[[package]] [[package]]
@ -2033,7 +2033,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18" checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18"
dependencies = [ dependencies = [
"libc", "libc",
"windows-sys 0.59.0", "windows-sys 0.52.0",
] ]
[[package]] [[package]]
@ -2560,7 +2560,7 @@ dependencies = [
"gobject-sys", "gobject-sys",
"libc", "libc",
"system-deps", "system-deps",
"windows-sys 0.59.0", "windows-sys 0.52.0",
] ]
[[package]] [[package]]
@ -4002,7 +4002,7 @@ checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9"
dependencies = [ dependencies = [
"hermit-abi 0.5.0", "hermit-abi 0.5.0",
"libc", "libc",
"windows-sys 0.59.0", "windows-sys 0.52.0",
] ]
[[package]] [[package]]
@ -4255,7 +4255,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a793df0d7afeac54f95b471d3af7f0d4fb975699f972341a4b76988d49cdf0c" checksum = "6a793df0d7afeac54f95b471d3af7f0d4fb975699f972341a4b76988d49cdf0c"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"windows-targets 0.52.6", "windows-targets 0.48.5",
] ]
[[package]] [[package]]
@ -6177,7 +6177,7 @@ dependencies = [
"errno", "errno",
"libc", "libc",
"linux-raw-sys", "linux-raw-sys",
"windows-sys 0.59.0", "windows-sys 0.52.0",
] ]
[[package]] [[package]]
@ -6509,7 +6509,7 @@ dependencies = [
[[package]] [[package]]
name = "selectors" name = "selectors"
version = "0.28.0" version = "0.28.0"
source = "git+https://github.com/servo/stylo?branch=2025-05-01#bc815af4b5ae01768eaef64d21cebe6d66be06ea" source = "git+https://github.com/servo/stylo?branch=2025-05-01#fb74b958cc7bb93a9335766130d6711ad3e071ce"
dependencies = [ dependencies = [
"bitflags 2.9.1", "bitflags 2.9.1",
"cssparser", "cssparser",
@ -6804,7 +6804,7 @@ dependencies = [
[[package]] [[package]]
name = "servo_arc" name = "servo_arc"
version = "0.4.1" version = "0.4.1"
source = "git+https://github.com/servo/stylo?branch=2025-05-01#bc815af4b5ae01768eaef64d21cebe6d66be06ea" source = "git+https://github.com/servo/stylo?branch=2025-05-01#fb74b958cc7bb93a9335766130d6711ad3e071ce"
dependencies = [ dependencies = [
"serde", "serde",
"stable_deref_trait", "stable_deref_trait",
@ -7265,7 +7265,7 @@ dependencies = [
[[package]] [[package]]
name = "stylo" name = "stylo"
version = "0.3.0" version = "0.3.0"
source = "git+https://github.com/servo/stylo?branch=2025-05-01#bc815af4b5ae01768eaef64d21cebe6d66be06ea" source = "git+https://github.com/servo/stylo?branch=2025-05-01#fb74b958cc7bb93a9335766130d6711ad3e071ce"
dependencies = [ dependencies = [
"app_units", "app_units",
"arrayvec", "arrayvec",
@ -7323,7 +7323,7 @@ dependencies = [
[[package]] [[package]]
name = "stylo_atoms" name = "stylo_atoms"
version = "0.3.0" version = "0.3.0"
source = "git+https://github.com/servo/stylo?branch=2025-05-01#bc815af4b5ae01768eaef64d21cebe6d66be06ea" source = "git+https://github.com/servo/stylo?branch=2025-05-01#fb74b958cc7bb93a9335766130d6711ad3e071ce"
dependencies = [ dependencies = [
"string_cache", "string_cache",
"string_cache_codegen", "string_cache_codegen",
@ -7332,12 +7332,12 @@ dependencies = [
[[package]] [[package]]
name = "stylo_config" name = "stylo_config"
version = "0.3.0" version = "0.3.0"
source = "git+https://github.com/servo/stylo?branch=2025-05-01#bc815af4b5ae01768eaef64d21cebe6d66be06ea" source = "git+https://github.com/servo/stylo?branch=2025-05-01#fb74b958cc7bb93a9335766130d6711ad3e071ce"
[[package]] [[package]]
name = "stylo_derive" name = "stylo_derive"
version = "0.3.0" version = "0.3.0"
source = "git+https://github.com/servo/stylo?branch=2025-05-01#bc815af4b5ae01768eaef64d21cebe6d66be06ea" source = "git+https://github.com/servo/stylo?branch=2025-05-01#fb74b958cc7bb93a9335766130d6711ad3e071ce"
dependencies = [ dependencies = [
"darling", "darling",
"proc-macro2", "proc-macro2",
@ -7349,7 +7349,7 @@ dependencies = [
[[package]] [[package]]
name = "stylo_dom" name = "stylo_dom"
version = "0.3.0" version = "0.3.0"
source = "git+https://github.com/servo/stylo?branch=2025-05-01#bc815af4b5ae01768eaef64d21cebe6d66be06ea" source = "git+https://github.com/servo/stylo?branch=2025-05-01#fb74b958cc7bb93a9335766130d6711ad3e071ce"
dependencies = [ dependencies = [
"bitflags 2.9.1", "bitflags 2.9.1",
"stylo_malloc_size_of", "stylo_malloc_size_of",
@ -7358,7 +7358,7 @@ dependencies = [
[[package]] [[package]]
name = "stylo_malloc_size_of" name = "stylo_malloc_size_of"
version = "0.3.0" version = "0.3.0"
source = "git+https://github.com/servo/stylo?branch=2025-05-01#bc815af4b5ae01768eaef64d21cebe6d66be06ea" source = "git+https://github.com/servo/stylo?branch=2025-05-01#fb74b958cc7bb93a9335766130d6711ad3e071ce"
dependencies = [ dependencies = [
"app_units", "app_units",
"cssparser", "cssparser",
@ -7375,12 +7375,12 @@ dependencies = [
[[package]] [[package]]
name = "stylo_static_prefs" name = "stylo_static_prefs"
version = "0.3.0" version = "0.3.0"
source = "git+https://github.com/servo/stylo?branch=2025-05-01#bc815af4b5ae01768eaef64d21cebe6d66be06ea" source = "git+https://github.com/servo/stylo?branch=2025-05-01#fb74b958cc7bb93a9335766130d6711ad3e071ce"
[[package]] [[package]]
name = "stylo_traits" name = "stylo_traits"
version = "0.3.0" version = "0.3.0"
source = "git+https://github.com/servo/stylo?branch=2025-05-01#bc815af4b5ae01768eaef64d21cebe6d66be06ea" source = "git+https://github.com/servo/stylo?branch=2025-05-01#fb74b958cc7bb93a9335766130d6711ad3e071ce"
dependencies = [ dependencies = [
"app_units", "app_units",
"bitflags 2.9.1", "bitflags 2.9.1",
@ -7544,7 +7544,7 @@ dependencies = [
"getrandom", "getrandom",
"once_cell", "once_cell",
"rustix", "rustix",
"windows-sys 0.59.0", "windows-sys 0.52.0",
] ]
[[package]] [[package]]
@ -7763,7 +7763,7 @@ dependencies = [
[[package]] [[package]]
name = "to_shmem" name = "to_shmem"
version = "0.2.0" version = "0.2.0"
source = "git+https://github.com/servo/stylo?branch=2025-05-01#bc815af4b5ae01768eaef64d21cebe6d66be06ea" source = "git+https://github.com/servo/stylo?branch=2025-05-01#fb74b958cc7bb93a9335766130d6711ad3e071ce"
dependencies = [ dependencies = [
"cssparser", "cssparser",
"servo_arc", "servo_arc",
@ -7776,7 +7776,7 @@ dependencies = [
[[package]] [[package]]
name = "to_shmem_derive" name = "to_shmem_derive"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/servo/stylo?branch=2025-05-01#bc815af4b5ae01768eaef64d21cebe6d66be06ea" source = "git+https://github.com/servo/stylo?branch=2025-05-01#fb74b958cc7bb93a9335766130d6711ad3e071ce"
dependencies = [ dependencies = [
"darling", "darling",
"proc-macro2", "proc-macro2",
@ -8901,7 +8901,7 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [ dependencies = [
"windows-sys 0.59.0", "windows-sys 0.48.0",
] ]
[[package]] [[package]]

View file

@ -126,15 +126,15 @@ impl LayoutBox {
.repair_style(context, node, new_style); .repair_style(context, node, new_style);
} }
}, },
LayoutBox::FlexLevel(flex_level_box) => { LayoutBox::FlexLevel(flex_level_box) => flex_level_box
flex_level_box.borrow_mut().repair_style(context, new_style) .borrow_mut()
}, .repair_style(context, node, new_style),
LayoutBox::TableLevelBox(table_level_box) => { LayoutBox::TableLevelBox(table_level_box) => {
table_level_box.repair_style(context, new_style) table_level_box.repair_style(context, node, new_style)
},
LayoutBox::TaffyItemBox(taffy_item_box) => {
taffy_item_box.borrow_mut().repair_style(context, new_style)
}, },
LayoutBox::TaffyItemBox(taffy_item_box) => taffy_item_box
.borrow_mut()
.repair_style(context, node, new_style),
} }
} }
} }

View file

@ -4,6 +4,7 @@
use geom::{FlexAxis, MainStartCrossStart}; use geom::{FlexAxis, MainStartCrossStart};
use malloc_size_of_derive::MallocSizeOf; use malloc_size_of_derive::MallocSizeOf;
use script::layout_dom::ServoLayoutNode;
use servo_arc::Arc as ServoArc; use servo_arc::Arc as ServoArc;
use style::context::SharedStyleContext; use style::context::SharedStyleContext;
use style::logical_geometry::WritingMode; use style::logical_geometry::WritingMode;
@ -154,16 +155,17 @@ impl FlexLevelBox {
pub(crate) fn repair_style( pub(crate) fn repair_style(
&mut self, &mut self,
context: &SharedStyleContext, context: &SharedStyleContext,
node: &ServoLayoutNode,
new_style: &ServoArc<ComputedValues>, new_style: &ServoArc<ComputedValues>,
) { ) {
match self { match self {
FlexLevelBox::FlexItem(flex_item_box) => flex_item_box FlexLevelBox::FlexItem(flex_item_box) => flex_item_box
.independent_formatting_context .independent_formatting_context
.repair_style(context, new_style), .repair_style(context, node, new_style),
FlexLevelBox::OutOfFlowAbsolutelyPositionedBox(positioned_box) => positioned_box FlexLevelBox::OutOfFlowAbsolutelyPositionedBox(positioned_box) => positioned_box
.borrow_mut() .borrow_mut()
.context .context
.repair_style(context, new_style), .repair_style(context, node, new_style),
} }
} }

View file

@ -31,7 +31,7 @@ pub(crate) struct InlineFormattingContextBuilder {
/// inline box stack, and importantly, one for every `display: contents` element that we are /// inline box stack, and importantly, one for every `display: contents` element that we are
/// currently processing. Normally `display: contents` elements don't affect the structure of /// currently processing. Normally `display: contents` elements don't affect the structure of
/// the [`InlineFormattingContext`], but the styles they provide do style their children. /// the [`InlineFormattingContext`], but the styles they provide do style their children.
shared_inline_styles_stack: Vec<SharedInlineStyles>, pub shared_inline_styles_stack: Vec<SharedInlineStyles>,
/// The collection of text strings that make up this [`InlineFormattingContext`] under /// The collection of text strings that make up this [`InlineFormattingContext`] under
/// construction. /// construction.

View file

@ -91,6 +91,7 @@ use line_breaker::LineBreaker;
use malloc_size_of_derive::MallocSizeOf; use malloc_size_of_derive::MallocSizeOf;
use range::Range; use range::Range;
use script::layout_dom::ServoLayoutNode; use script::layout_dom::ServoLayoutNode;
use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode};
use servo_arc::Arc; use servo_arc::Arc;
use style::Zero; use style::Zero;
use style::computed_values::text_wrap_mode::T as TextWrapMode; use style::computed_values::text_wrap_mode::T as TextWrapMode;
@ -158,6 +159,10 @@ pub(crate) struct InlineFormattingContext {
/// context in order to avoid duplicating this information. /// context in order to avoid duplicating this information.
pub font_metrics: Vec<FontKeyAndMetrics>, pub font_metrics: Vec<FontKeyAndMetrics>,
/// The [`SharedInlineStyles`] for the root of this [`InlineFormattingContext`] that are used to
/// share styles with all [`TextRun`] children.
pub(super) shared_inline_styles: SharedInlineStyles,
pub(super) text_decoration_line: TextDecorationLine, pub(super) text_decoration_line: TextDecorationLine,
/// Whether this IFC contains the 1st formatted line of an element: /// Whether this IFC contains the 1st formatted line of an element:
@ -237,12 +242,14 @@ impl InlineItem {
InlineItem::OutOfFlowAbsolutelyPositionedBox(positioned_box, ..) => positioned_box InlineItem::OutOfFlowAbsolutelyPositionedBox(positioned_box, ..) => positioned_box
.borrow_mut() .borrow_mut()
.context .context
.repair_style(context, new_style), .repair_style(context, node, new_style),
InlineItem::OutOfFlowFloatBox(float_box) => float_box InlineItem::OutOfFlowFloatBox(float_box) => float_box
.borrow_mut() .borrow_mut()
.contents .contents
.repair_style(context, new_style), .repair_style(context, node, new_style),
InlineItem::Atomic(atomic, ..) => atomic.borrow_mut().repair_style(context, new_style), InlineItem::Atomic(atomic, ..) => {
atomic.borrow_mut().repair_style(context, node, new_style)
},
} }
} }
@ -1699,6 +1706,11 @@ impl InlineFormattingContext {
inline_items: builder.inline_items, inline_items: builder.inline_items,
inline_boxes: builder.inline_boxes, inline_boxes: builder.inline_boxes,
font_metrics, font_metrics,
shared_inline_styles: builder
.shared_inline_styles_stack
.last()
.expect("Should have at least one SharedInlineStyle for the root of an IFC")
.clone(),
text_decoration_line: propagated_data.text_decoration, text_decoration_line: propagated_data.text_decoration,
has_first_formatted_line, has_first_formatted_line,
contains_floats: builder.contains_floats, contains_floats: builder.contains_floats,
@ -1707,6 +1719,11 @@ impl InlineFormattingContext {
} }
} }
pub(crate) fn repair_style(&self, node: &ServoLayoutNode, new_style: &Arc<ComputedValues>) {
*self.shared_inline_styles.style.borrow_mut() = new_style.clone();
*self.shared_inline_styles.selected.borrow_mut() = node.to_threadsafe().selected_style();
}
pub(super) fn layout( pub(super) fn layout(
&self, &self,
layout_context: &LayoutContext, layout_context: &LayoutContext,

View file

@ -78,6 +78,15 @@ impl BlockContainer {
BlockContainer::InlineFormattingContext(context) => context.contains_floats, BlockContainer::InlineFormattingContext(context) => context.contains_floats,
} }
} }
pub(crate) fn repair_style(&mut self, node: &ServoLayoutNode, new_style: &Arc<ComputedValues>) {
match self {
BlockContainer::BlockLevelBoxes(..) => {},
BlockContainer::InlineFormattingContext(inline_formatting_context) => {
inline_formatting_context.repair_style(node, new_style)
},
}
}
} }
#[derive(Debug, MallocSizeOf)] #[derive(Debug, MallocSizeOf)]
@ -106,20 +115,21 @@ impl BlockLevelBox {
match self { match self {
BlockLevelBox::Independent(independent_formatting_context) => { BlockLevelBox::Independent(independent_formatting_context) => {
independent_formatting_context.repair_style(context, new_style) independent_formatting_context.repair_style(context, node, new_style)
}, },
BlockLevelBox::OutOfFlowAbsolutelyPositionedBox(positioned_box) => positioned_box BlockLevelBox::OutOfFlowAbsolutelyPositionedBox(positioned_box) => positioned_box
.borrow_mut() .borrow_mut()
.context .context
.repair_style(context, new_style), .repair_style(context, node, new_style),
BlockLevelBox::OutOfFlowFloatBox(float_box) => { BlockLevelBox::OutOfFlowFloatBox(float_box) => {
float_box.contents.repair_style(context, new_style) float_box.contents.repair_style(context, node, new_style)
}, },
BlockLevelBox::OutsideMarker(outside_marker) => { BlockLevelBox::OutsideMarker(outside_marker) => {
outside_marker.repair_style(context, node, new_style) outside_marker.repair_style(context, node, new_style)
}, },
BlockLevelBox::SameFormattingContextBlock { base, .. } => { BlockLevelBox::SameFormattingContextBlock { base, contents, .. } => {
base.repair_style(new_style); base.repair_style(new_style);
contents.repair_style(node, new_style);
}, },
} }
} }
@ -477,6 +487,10 @@ impl BlockFormattingContext {
pub(crate) fn layout_style<'a>(&self, base: &'a LayoutBoxBase) -> LayoutStyle<'a> { pub(crate) fn layout_style<'a>(&self, base: &'a LayoutBoxBase) -> LayoutStyle<'a> {
LayoutStyle::Default(&base.style) LayoutStyle::Default(&base.style)
} }
pub(crate) fn repair_style(&mut self, node: &ServoLayoutNode, new_style: &Arc<ComputedValues>) {
self.contents.repair_style(node, new_style);
}
} }
/// Finds the min/max-content inline size of the block-level children of a block container. /// Finds the min/max-content inline size of the block-level children of a block container.

View file

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

View file

@ -76,7 +76,7 @@ pub(crate) use construct::AnonymousTableContent;
pub use construct::TableBuilder; pub use construct::TableBuilder;
use euclid::{Point2D, Size2D, UnknownUnit, Vector2D}; use euclid::{Point2D, Size2D, UnknownUnit, Vector2D};
use malloc_size_of_derive::MallocSizeOf; use malloc_size_of_derive::MallocSizeOf;
use script::layout_dom::ServoLayoutElement; use script::layout_dom::{ServoLayoutElement, ServoLayoutNode};
use servo_arc::Arc; use servo_arc::Arc;
use style::context::SharedStyleContext; use style::context::SharedStyleContext;
use style::properties::ComputedValues; use style::properties::ComputedValues;
@ -425,13 +425,14 @@ impl TableLevelBox {
pub(crate) fn repair_style( pub(crate) fn repair_style(
&self, &self,
context: &SharedStyleContext<'_>, context: &SharedStyleContext<'_>,
node: &ServoLayoutNode,
new_style: &Arc<ComputedValues>, new_style: &Arc<ComputedValues>,
) { ) {
match self { match self {
TableLevelBox::Caption(caption) => caption TableLevelBox::Caption(caption) => caption
.borrow_mut() .borrow_mut()
.context .context
.repair_style(context, new_style), .repair_style(context, node, new_style),
TableLevelBox::Cell(cell) => cell.borrow_mut().repair_style(new_style), TableLevelBox::Cell(cell) => cell.borrow_mut().repair_style(new_style),
TableLevelBox::TrackGroup(track_group) => { TableLevelBox::TrackGroup(track_group) => {
track_group.borrow_mut().repair_style(new_style); track_group.borrow_mut().repair_style(new_style);

View file

@ -7,6 +7,7 @@ use std::fmt;
use app_units::Au; use app_units::Au;
use malloc_size_of_derive::MallocSizeOf; use malloc_size_of_derive::MallocSizeOf;
use script::layout_dom::ServoLayoutNode;
use servo_arc::Arc; use servo_arc::Arc;
use style::context::SharedStyleContext; use style::context::SharedStyleContext;
use style::properties::ComputedValues; use style::properties::ComputedValues;
@ -152,17 +153,18 @@ impl TaffyItemBox {
pub(crate) fn repair_style( pub(crate) fn repair_style(
&mut self, &mut self,
context: &SharedStyleContext, context: &SharedStyleContext,
node: &ServoLayoutNode,
new_style: &Arc<ComputedValues>, new_style: &Arc<ComputedValues>,
) { ) {
self.style = new_style.clone(); self.style = new_style.clone();
match &mut self.taffy_level_box { match &mut self.taffy_level_box {
TaffyItemBoxInner::InFlowBox(independent_formatting_context) => { TaffyItemBoxInner::InFlowBox(independent_formatting_context) => {
independent_formatting_context.repair_style(context, new_style) independent_formatting_context.repair_style(context, node, new_style)
}, },
TaffyItemBoxInner::OutOfFlowAbsolutelyPositionedBox(positioned_box) => positioned_box TaffyItemBoxInner::OutOfFlowAbsolutelyPositionedBox(positioned_box) => positioned_box
.borrow_mut() .borrow_mut()
.context .context
.repair_style(context, new_style), .repair_style(context, node, new_style),
} }
} }
} }

View file

@ -112,15 +112,14 @@ pub(crate) fn compute_damage_and_repair_style_inner(
.element_data .element_data
.borrow_mut(); .borrow_mut();
original_damage = std::mem::take(&mut element_data.damage);
if let Some(ref style) = element_data.styles.primary { if let Some(ref style) = element_data.styles.primary {
if style.get_box().display == Display::None { if style.get_box().display == Display::None {
return parent_restyle_damage; return parent_restyle_damage;
} }
} }
original_damage = std::mem::take(&mut element_data.damage); original_damage | parent_restyle_damage
element_data.damage |= parent_restyle_damage;
element_data.damage
}; };
let mut propagated_damage = damage; let mut propagated_damage = damage;