mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-21 09:49:21 +00:00
LibWeb: Expand ClipFrame into clip rectangles during display list replay
Until now, every paint phase of every PaintableBox injected its own clipping sequence into the display list: ``` before_paint: Save AddClipRect (1) ...clip rectangles for each containing block with clip... AddClipRect (N) paint: ...paint phase items... after_paint: Restore ``` Because we ran that sequence for every phase of every box, Skia had to rebuild clip stack `paint_phases * paintable_boxes` times. Worse, usually most paint phases contribute no visible drawing at all, yet we still had to emit clipping items because `before_paint()` has no way to know that in advance. This change takes a different approach: - Clip information is now attached as metadata `ClipFrame` to each DisplayList item. - `DisplayListPlayer` groups consecutive commands that share a `ClipFrame`, applying the clip once at the start of the group and restoring it once at the end. Going from 10 ms to 5 ms in rasterization on Discord might not sound like much, but keep in mind that for 60fps we have 16 ms per frame and there is a lot more work besides display list rasterization we do in each frame. * https://discord.com/channels/1247070541085671459/1247090064480014443 - DisplayList items: 81844 -> 3671 - rasterize time: 10 ms -> 5 ms - record time: 5 ms -> 3 ms * https://github.com/LadybirdBrowser/ladybird - DisplayList items: 7902 -> 1176 - rasterize time: 4 ms -> 4 ms - record time: 3 ms -> 2 ms
This commit is contained in:
parent
7e333cdcf7
commit
eed47acb1f
Notes:
github-actions[bot]
2025-07-14 13:49:39 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: eed47acb1f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5431
Reviewed-by: https://github.com/gmta ✅
Reviewed-by: https://github.com/konradekk
8 changed files with 104 additions and 72 deletions
|
@ -305,9 +305,6 @@ private:
|
|||
bool scrollbar_contains_mouse_position(ScrollDirection, CSSPixelPoint);
|
||||
void scroll_to_mouse_position(CSSPixelPoint);
|
||||
|
||||
static void apply_clip(PaintContext&, RefPtr<ClipFrame const> const&);
|
||||
static void restore_clip(PaintContext&, RefPtr<ClipFrame const> const&);
|
||||
|
||||
OwnPtr<StackingContext> m_stacking_context;
|
||||
|
||||
Optional<OverflowData> m_overflow_data;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue