LibWeb: Deduplicate clipping code

This makes it so that PaintableWithLines no longer has its own
bespoke clipping logic, using the same code as regular scroll/
overflow clipping.
This commit is contained in:
Psychpsyo 2025-05-03 11:22:14 +02:00 committed by Alexander Kalenik
commit 85883ee5ce
Notes: github-actions[bot] 2025-05-13 12:32:43 +00:00
7 changed files with 52 additions and 44 deletions

View file

@ -38,11 +38,9 @@ Optional<CSSPixelRect> ClippableAndScrollable::clip_rect_for_hit_testing() const
return {};
}
void ClippableAndScrollable::apply_clip(PaintContext& context) const
void ClippableAndScrollable::apply_clip(PaintContext& context, RefPtr<ClipFrame const> from_clip_frame) const
{
if (!m_enclosing_clip_frame)
return;
auto const& clip_rects = m_enclosing_clip_frame->clip_rects();
auto const& clip_rects = from_clip_frame->clip_rects();
if (clip_rects.is_empty())
return;
@ -64,11 +62,9 @@ void ClippableAndScrollable::apply_clip(PaintContext& context) const
}
}
void ClippableAndScrollable::restore_clip(PaintContext& context) const
void ClippableAndScrollable::restore_clip(PaintContext& context, RefPtr<ClipFrame const> from_clip_frame) const
{
if (!m_enclosing_clip_frame)
return;
auto const& clip_rects = m_enclosing_clip_frame->clip_rects();
auto const& clip_rects = from_clip_frame->clip_rects();
if (clip_rects.is_empty())
return;