mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-06 02:55:49 +03:00
LibWeb: Simplify PaintableBox::enclosing_stacking_context()
This commit is contained in:
parent
6e3177e2fc
commit
6238860c6d
Notes:
sideshowbarker
2024-07-17 11:06:06 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/6238860c6d Pull-request: https://github.com/SerenityOS/serenity/pull/20823
@ -168,14 +168,11 @@ CSSPixelRect PaintableBox::absolute_paint_rect() const
|
||||
|
||||
StackingContext* PaintableBox::enclosing_stacking_context()
|
||||
{
|
||||
for (auto* ancestor = layout_box().parent(); ancestor; ancestor = ancestor->parent()) {
|
||||
if (!is<Layout::Box>(ancestor))
|
||||
continue;
|
||||
auto& ancestor_box = static_cast<Layout::Box&>(const_cast<Layout::NodeWithStyle&>(*ancestor));
|
||||
if (auto* ancestor_paintable_box = ancestor_box.paintable_box(); ancestor_paintable_box && ancestor_paintable_box->stacking_context())
|
||||
return const_cast<StackingContext*>(ancestor_paintable_box->stacking_context());
|
||||
for (auto* ancestor = parent(); ancestor; ancestor = ancestor->parent()) {
|
||||
if (auto* stacking_context = ancestor->stacking_context_rooted_here())
|
||||
return const_cast<StackingContext*>(stacking_context);
|
||||
}
|
||||
// We should always reach the Layout::Viewport stacking context.
|
||||
// We should always reach the viewport's stacking context.
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user