mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:17:35 +00:00
LibWeb: Allow inline nodes to establish a stacking context
With this change, a stacking context can be established by any paintable, including inline paintables. The stacking context traversal is updated to remove the assumption that the stacking context root is paintable box.
This commit is contained in:
parent
6c645f3a9f
commit
3cf5ad002a
12 changed files with 253 additions and 151 deletions
|
@ -40,16 +40,6 @@ PaintableBox::~PaintableBox()
|
|||
{
|
||||
}
|
||||
|
||||
bool PaintableBox::is_visible() const
|
||||
{
|
||||
return computed_values().visibility() == CSS::Visibility::Visible && computed_values().opacity() != 0;
|
||||
}
|
||||
|
||||
void PaintableBox::invalidate_stacking_context()
|
||||
{
|
||||
m_stacking_context = nullptr;
|
||||
}
|
||||
|
||||
PaintableWithLines::PaintableWithLines(Layout::BlockContainer const& layout_box)
|
||||
: PaintableBox(layout_box)
|
||||
{
|
||||
|
@ -165,16 +155,6 @@ CSSPixelRect PaintableBox::absolute_paint_rect() const
|
|||
return *m_absolute_paint_rect;
|
||||
}
|
||||
|
||||
StackingContext* PaintableBox::enclosing_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 viewport's stacking context.
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Optional<CSSPixelRect> PaintableBox::get_clip_rect() const
|
||||
{
|
||||
auto clip = computed_values().clip();
|
||||
|
@ -748,11 +728,6 @@ Layout::BlockContainer& PaintableWithLines::layout_box()
|
|||
return static_cast<Layout::BlockContainer&>(PaintableBox::layout_box());
|
||||
}
|
||||
|
||||
void PaintableBox::set_stacking_context(NonnullOwnPtr<StackingContext> stacking_context)
|
||||
{
|
||||
m_stacking_context = move(stacking_context);
|
||||
}
|
||||
|
||||
Optional<HitTestResult> PaintableBox::hit_test(CSSPixelPoint position, HitTestType type) const
|
||||
{
|
||||
if (!is_visible())
|
||||
|
@ -828,17 +803,4 @@ Optional<HitTestResult> PaintableWithLines::hit_test(CSSPixelPoint position, Hit
|
|||
return {};
|
||||
}
|
||||
|
||||
PaintableBox const* PaintableBox::nearest_scrollable_ancestor_within_stacking_context() const
|
||||
{
|
||||
auto* ancestor = parent();
|
||||
while (ancestor) {
|
||||
if (ancestor->stacking_context_rooted_here())
|
||||
return nullptr;
|
||||
if (ancestor->is_paintable_box() && static_cast<PaintableBox const*>(ancestor)->has_scrollable_overflow())
|
||||
return static_cast<PaintableBox const*>(ancestor);
|
||||
ancestor = ancestor->parent();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue