LibWeb: Allow stacking context to only be created by PaintableBox

For a while we used the wider Paintable type for stacking context,
because it was allowed to be created by InlinePaintable and
PaintableBox. Now, when InlinePaintable type is gone, we can use more
specific PaintableBox type for a stacking context.
This commit is contained in:
Aliaksandr Kalenik
2024-11-18 16:05:22 +01:00
committed by Andreas Kling
parent ed80e929e5
commit 9f541c363d
7 changed files with 103 additions and 120 deletions

View File

@@ -437,6 +437,16 @@ void PaintableBox::paint(PaintContext& context, PaintPhase phase) const
}
}
void PaintableBox::set_stacking_context(NonnullOwnPtr<StackingContext> stacking_context)
{
m_stacking_context = move(stacking_context);
}
void PaintableBox::invalidate_stacking_context()
{
m_stacking_context = nullptr;
}
BordersData PaintableBox::remove_element_kind_from_borders_data(PaintableBox::BordersDataWithElementKind borders_data)
{
return {
@@ -933,7 +943,7 @@ TraversalDecision PaintableWithLines::hit_test(CSSPixelPoint position, HitTestTy
}
for (auto const& fragment : fragments()) {
if (fragment.paintable().stacking_context())
if (fragment.paintable().has_stacking_context())
continue;
auto fragment_absolute_rect = fragment.absolute_rect();
if (fragment_absolute_rect.contains(position_adjusted_by_scroll_offset)) {