diff options
author | Martin Robinson <mrobinson@igalia.com> | 2025-01-13 10:59:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-13 09:59:59 +0000 |
commit | de780dcde418759156fb93470fac2c89228425ab (patch) | |
tree | aba9ac581530a5c56bfbd4320fd3eddb2c7e741f /components/layout_2020/fragment_tree/containing_block.rs | |
parent | c936dd6c4e80ac6e6f188fe629cc999f121e452d (diff) | |
download | servo-de780dcde418759156fb93470fac2c89228425ab.tar.gz servo-de780dcde418759156fb93470fac2c89228425ab.zip |
layout: Make `Fragment` hold `ArcRefCell` inside (#34923)
Push the interior mutability into enum variants of `Fragment`, so that
they can be cloned. This saves memory in the `Fragment` tree as the
`Fragment` enum is now a relatively wee 16 bytes and the interior parts
can be a variety of sizes. Before, every `Fragment` was the size of the
biggest kind (`BoxFragment` - 248 bytes).
This a step on the way toward incremental layout.
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Co-authored-by: Oriol Brufau <obrufau@igalia.com>
Diffstat (limited to 'components/layout_2020/fragment_tree/containing_block.rs')
-rw-r--r-- | components/layout_2020/fragment_tree/containing_block.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/components/layout_2020/fragment_tree/containing_block.rs b/components/layout_2020/fragment_tree/containing_block.rs index f7bda18f35f..6edd9bb379b 100644 --- a/components/layout_2020/fragment_tree/containing_block.rs +++ b/components/layout_2020/fragment_tree/containing_block.rs @@ -52,7 +52,7 @@ pub(crate) struct ContainingBlockManager<'a, T> { impl<'a, T> ContainingBlockManager<'a, T> { pub(crate) fn get_containing_block_for_fragment(&self, fragment: &Fragment) -> &T { if let Fragment::Box(box_fragment) = fragment { - match box_fragment.style.clone_position() { + match box_fragment.borrow().style.clone_position() { ComputedPosition::Fixed => self.for_absolute_and_fixed_descendants, ComputedPosition::Absolute => self .for_absolute_descendants |