mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:47:46 +00:00
LibWeb: Add Paintable::stacking_context_rooted_here()
This is a convenience helper that lets you get the stacking context rooted at a given paintable, without checking that the paintable is a box first.
This commit is contained in:
parent
2138c164c9
commit
268492413a
3 changed files with 12 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2022-2023, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -7,6 +7,7 @@
|
|||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/Layout/BlockContainer.h>
|
||||
#include <LibWeb/Painting/Paintable.h>
|
||||
#include <LibWeb/Painting/PaintableBox.h>
|
||||
|
||||
namespace Web::Painting {
|
||||
|
||||
|
@ -86,4 +87,11 @@ Paintable const* Paintable::previous_sibling() const
|
|||
return layout_node ? layout_node->paintable() : nullptr;
|
||||
}
|
||||
|
||||
StackingContext const* Paintable::stacking_context_rooted_here() const
|
||||
{
|
||||
if (!layout_node().is_box())
|
||||
return nullptr;
|
||||
return static_cast<PaintableBox const&>(*this).stacking_context();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue