mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01: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
|
@ -8,7 +8,6 @@ use style::logical_geometry::WritingMode;
|
|||
use style::values::specified::align::AlignFlags;
|
||||
|
||||
use super::Fragment;
|
||||
use crate::cell::ArcRefCell;
|
||||
use crate::geom::{LogicalVec2, PhysicalRect, PhysicalVec};
|
||||
|
||||
/// A reference to a Fragment which is shared between `HoistedAbsolutelyPositionedBox`
|
||||
|
@ -16,7 +15,7 @@ use crate::geom::{LogicalVec2, PhysicalRect, PhysicalVec};
|
|||
/// This will be used later in order to paint this hoisted box in tree order.
|
||||
#[derive(Serialize)]
|
||||
pub(crate) struct HoistedSharedFragment {
|
||||
pub fragment: Option<ArcRefCell<Fragment>>,
|
||||
pub fragment: Option<Fragment>,
|
||||
/// The "static-position rect" of this absolutely positioned box. This is defined by the
|
||||
/// layout mode from which the box originates.
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue