mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
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>
This commit is contained in:
parent
c936dd6c4e
commit
de780dcde4
18 changed files with 257 additions and 233 deletions
|
@ -357,11 +357,7 @@ impl BoxTree {
|
|||
&(&initial_containing_block).into(),
|
||||
);
|
||||
|
||||
let mut root_fragments = independent_layout
|
||||
.fragments
|
||||
.into_iter()
|
||||
.map(ArcRefCell::new)
|
||||
.collect::<Vec<_>>();
|
||||
let mut root_fragments = independent_layout.fragments.into_iter().collect::<Vec<_>>();
|
||||
|
||||
// Zero box for `:root { display: none }`, one for the root element otherwise.
|
||||
assert!(root_fragments.len() <= 1);
|
||||
|
@ -378,7 +374,7 @@ impl BoxTree {
|
|||
let scrollable_overflow = root_fragments
|
||||
.iter()
|
||||
.fold(PhysicalRect::zero(), |acc, child| {
|
||||
let child_overflow = child.borrow().scrollable_overflow();
|
||||
let child_overflow = child.scrollable_overflow();
|
||||
|
||||
// https://drafts.csswg.org/css-overflow/#scrolling-direction
|
||||
// We want to clip scrollable overflow on box-start and inline-start
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue