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:
Aliaksandr Kalenik 2025-07-07 18:27:43 +02:00 committed by Jelle Raaijmakers
commit 773d19b406
Notes: github-actions[bot] 2025-07-07 16:56:54 +00:00
7 changed files with 54 additions and 46 deletions

View file

@ -142,9 +142,6 @@ public:
virtual void apply_clip_overflow_rect(PaintContext&, PaintPhase) const override;
virtual void clear_clip_overflow_rect(PaintContext&, PaintPhase) const override;
virtual void apply_own_clip_rect(PaintContext&, PaintPhase) const override;
virtual void clear_own_clip_rect(PaintContext&, PaintPhase) const override;
[[nodiscard]] virtual TraversalDecision hit_test(CSSPixelPoint position, HitTestType type, Function<TraversalDecision(HitTestResult)> const& callback) const override;
Optional<HitTestResult> hit_test(CSSPixelPoint, HitTestType) const;
[[nodiscard]] TraversalDecision hit_test_children(CSSPixelPoint, HitTestType, Function<TraversalDecision(HitTestResult)> const&) const;