LibWeb: Make PaintableBox::enclosing_stacking_context() cheaper
No need to call the expensive establishes_stacking_context() here, as we've already built the stacking context tree and can simply test for the presence of existing stacking contexts.
This commit is contained in:
parent
ef8a72ff3f
commit
15dc48b431
Notes:
sideshowbarker
2024-07-17 17:11:30 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/15dc48b431
1 changed files with 2 additions and 4 deletions
|
@ -86,10 +86,8 @@ Painting::StackingContext* PaintableBox::enclosing_stacking_context()
|
|||
if (!is<Layout::Box>(ancestor))
|
||||
continue;
|
||||
auto& ancestor_box = static_cast<Layout::Box&>(const_cast<Layout::NodeWithStyle&>(*ancestor));
|
||||
if (!ancestor_box.establishes_stacking_context())
|
||||
continue;
|
||||
VERIFY(ancestor_box.paint_box()->stacking_context());
|
||||
return const_cast<StackingContext*>(ancestor_box.paint_box()->stacking_context());
|
||||
if (auto* ancestor_paint_box = ancestor_box.paint_box(); ancestor_paint_box && ancestor_paint_box->stacking_context())
|
||||
return const_cast<StackingContext*>(ancestor_paint_box->stacking_context());
|
||||
}
|
||||
// We should always reach the Layout::InitialContainingBlock stacking context.
|
||||
VERIFY_NOT_REACHED();
|
||||
|
|
Loading…
Add table
Reference in a new issue