mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 17:49:40 +00:00
LibWeb: Apply either enclosing or own clip rect depending on PaintPhase
Previously, we always applied the enclosing clip rectangle for all paint phases except overlays, and the own clip rectangle for the background and foreground phases. The problem is that applying a clip rectangle means emitting an AddClipRect display list item for each clip rectangle in the containing block. With this change, we choose whether to include the own clip based on the paint phase and this way avoid emitting AddClipRect for enclosing clip rectangles twice.
This commit is contained in:
parent
05ee3f1876
commit
773d19b406
Notes:
github-actions[bot]
2025-07-07 16:56:54 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 773d19b406
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5341
Reviewed-by: https://github.com/gmta ✅
7 changed files with 54 additions and 46 deletions
|
@ -24,6 +24,26 @@ SVGSVGPaintable::SVGSVGPaintable(Layout::SVGSVGBox const& layout_box)
|
|||
{
|
||||
}
|
||||
|
||||
void SVGSVGPaintable::before_paint(PaintContext& context, PaintPhase phase) const
|
||||
{
|
||||
if (!is_visible())
|
||||
return;
|
||||
if (!has_css_transform()) {
|
||||
apply_clip_overflow_rect(context, phase);
|
||||
}
|
||||
apply_scroll_offset(context, phase);
|
||||
}
|
||||
|
||||
void SVGSVGPaintable::after_paint(PaintContext& context, PaintPhase phase) const
|
||||
{
|
||||
if (!is_visible())
|
||||
return;
|
||||
reset_scroll_offset(context, phase);
|
||||
if (!has_css_transform()) {
|
||||
clear_clip_overflow_rect(context, phase);
|
||||
}
|
||||
}
|
||||
|
||||
Layout::SVGSVGBox const& SVGSVGPaintable::layout_box() const
|
||||
{
|
||||
return static_cast<Layout::SVGSVGBox const&>(layout_node());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue