mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
layout: Cache IndependentNonReplacedContents::layout()
(#36082)
This replaces `IndependentLayout` with `CacheableLayoutResult` and stores it in `LayoutBoxBase` so it can be reused when we need to lay out a box multiple times. This is a generalization of the caching that we had for flexbox, which is now removed in favor of the new one. With this, the number of runs per second in the Chromium perf test `flexbox-deeply-nested-column-flow.html` are multiplied by 3. Signed-off-by: Oriol Brufau <obrufau@igalia.com> Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
efd6e86393
commit
c09eed759b
12 changed files with 216 additions and 160 deletions
|
@ -41,6 +41,7 @@ pub(crate) struct AbsolutelyPositionedBox {
|
|||
pub context: IndependentFormattingContext,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct PositioningContext {
|
||||
for_nearest_positioned_ancestor: Option<Vec<HoistedAbsolutelyPositionedBox>>,
|
||||
|
||||
|
@ -50,6 +51,7 @@ pub(crate) struct PositioningContext {
|
|||
for_nearest_containing_block_for_all_descendants: Vec<HoistedAbsolutelyPositionedBox>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct HoistedAbsolutelyPositionedBox {
|
||||
absolutely_positioned_box: ArcRefCell<AbsolutelyPositionedBox>,
|
||||
|
||||
|
@ -299,7 +301,7 @@ impl PositioningContext {
|
|||
.push(box_)
|
||||
}
|
||||
|
||||
fn is_empty(&self) -> bool {
|
||||
pub(crate) fn is_empty(&self) -> bool {
|
||||
self.for_nearest_containing_block_for_all_descendants
|
||||
.is_empty() &&
|
||||
self.for_nearest_positioned_ancestor
|
||||
|
@ -627,6 +629,7 @@ impl HoistedAbsolutelyPositionedBox {
|
|||
&mut positioning_context,
|
||||
&containing_block_for_children,
|
||||
containing_block,
|
||||
false, /* depends_on_block_constraints */
|
||||
);
|
||||
|
||||
let inline_size = if let Some(inline_size) =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue