mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
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:
parent
155e60a5ff
commit
85883ee5ce
Notes:
github-actions[bot]
2025-05-13 12:32:43 +00:00
Author: https://github.com/Psychpsyo
Commit: 85883ee5ce
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4565
Reviewed-by: https://github.com/gmta
Reviewed-by: https://github.com/kalenikaliaksandr
7 changed files with 52 additions and 44 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue