mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
layout: Clean up inline layout data types a bit (#34563)
- Remove the `LayoutBox::InlineBox` variant that was only used for inline level boxes. Now they are stored in `LayoutBox::InlineLevel` along with other kinds of out-of-flow and atomic inline items. - Reduce the size of `InlineItem` by 260 bytes per item by using atomic indirection / pointers. This adds a bit of overhead to access items in exchange for a lot of memory saved. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
f1b8d49e77
commit
9d11d584f6
6 changed files with 35 additions and 35 deletions
|
@ -82,7 +82,10 @@ impl InlineBoxes {
|
|||
.push(InlineBoxTreePathToken::End(identifier));
|
||||
}
|
||||
|
||||
pub(super) fn start_inline_box(&mut self, mut inline_box: InlineBox) -> InlineBoxIdentifier {
|
||||
pub(super) fn start_inline_box(
|
||||
&mut self,
|
||||
mut inline_box: InlineBox,
|
||||
) -> (InlineBoxIdentifier, ArcRefCell<InlineBox>) {
|
||||
assert!(self.inline_boxes.len() <= u32::MAX as usize);
|
||||
assert!(self.inline_box_tree.len() <= u32::MAX as usize);
|
||||
|
||||
|
@ -94,11 +97,13 @@ impl InlineBoxes {
|
|||
index_in_inline_boxes,
|
||||
};
|
||||
inline_box.identifier = identifier;
|
||||
let inline_box = ArcRefCell::new(inline_box);
|
||||
|
||||
self.inline_boxes.push(ArcRefCell::new(inline_box));
|
||||
self.inline_boxes.push(inline_box.clone());
|
||||
self.inline_box_tree
|
||||
.push(InlineBoxTreePathToken::Start(identifier));
|
||||
identifier
|
||||
|
||||
(identifier, inline_box)
|
||||
}
|
||||
|
||||
pub(super) fn get_path(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue