1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 23:07:34 +00:00
serenity/Userland/Libraries/LibWeb/Painting
Aliaksandr Kalenik 76d1536307 LibWeb: Optimize scroll offset and clip state recalculation
In this commit we have optimized the handling of scroll offsets and
clip rectangles to improve performance. Previously, the process
involved multiple full traversals of the paintable tree before each
repaint, which was highly inefficient, especially on pages with a
large number of paintables. The steps were:

1. Traverse the paintable tree to identify all boxes with scrollable or
   clipped overflow.
2. Gather the accumulated scroll offset or clip rectangle for each box.
3. Perform another traversal to apply the corresponding scroll offset
   and clip rectangle to each paintable.

To address this, we've adopted a new strategy that separates the
assignment of the scroll/clip frame from the refresh of accumulated
scroll offsets and clip rectangles, thus reducing the workload:

1. Post-relayout: Identify all boxes with overflow and link each
   paintable to the state of its containing scroll/clip frame.
2. Pre-repaint: Update the clip rectangle and scroll offset only in the
   previously identified boxes.

This adjustment ensures that the costly tree traversals are only
necessary after a relayout, substantially decreasing the amount of work
required before each repaint.
2024-02-09 16:45:44 +01:00
..
AudioPaintable.cpp LibWeb: Rename painter() to recording_painter() in PaintContext 2023-11-27 21:53:38 +01:00
AudioPaintable.h LibWeb: Begin implementing the HTMLAudioElement for audio playback 2023-06-13 06:14:01 +02:00
BackgroundPainting.cpp LibWeb: Paint 1x1 backgrounds as color fill instead of tiling bitmap 2024-01-01 15:16:58 +01:00
BackgroundPainting.h LibWeb: Convert background painting to new pixel units 2022-12-14 16:47:57 +00:00
BorderPainting.cpp LibWeb: Resolve border radius during layout and save it in paintables 2023-12-07 10:52:47 +01:00
BorderPainting.h LibWeb: Resolve border radius during layout and save it in paintables 2023-12-07 10:52:47 +01:00
BorderRadiiData.cpp LibWeb: Move clip rect calculation to happen before painting 2024-01-28 08:25:28 +01:00
BorderRadiiData.h LibWeb: Move clip rect calculation to happen before painting 2024-01-28 08:25:28 +01:00
BorderRadiusCornerClipper.cpp LibWeb: Check if corners have radius after converting to device pixels 2024-01-15 15:21:17 +01:00
BorderRadiusCornerClipper.h LibWeb: Move border radius sampling config preparation into a function 2023-12-17 23:12:48 +01:00
BordersData.cpp LibWeb: Change paint_all_borders() to accept only device pixel values 2023-11-20 14:59:47 +01:00
BordersData.h LibWeb: Change paint_all_borders() to accept only device pixel values 2023-11-20 14:59:47 +01:00
ButtonPaintable.cpp LibWeb: Shift button paintable clip rectangle by scroll offset 2024-02-06 13:06:16 +01:00
ButtonPaintable.h LibWeb: Make the paint tree GC-allocated 2023-01-11 12:55:00 +01:00
CanvasPaintable.cpp LibWeb: Rename painter() to recording_painter() in PaintContext 2023-11-27 21:53:38 +01:00
CanvasPaintable.h LibWeb: Make the paint tree GC-allocated 2023-01-11 12:55:00 +01:00
CheckBoxPaintable.cpp LibWeb: Rename painter() to recording_painter() in PaintContext 2023-11-27 21:53:38 +01:00
CheckBoxPaintable.h LibWeb: Add scaleable checkboxes (with theme/accent-color support) 2023-03-23 08:27:51 +00:00
FilterPainting.cpp LibWeb: Rename painter() to recording_painter() in PaintContext 2023-11-27 21:53:38 +01:00
FilterPainting.h LibWeb: Resolve backdrop filter length in apply_style() 2023-10-12 07:38:48 +02:00
GradientData.h LibWeb: Introduce RecordingPainter to serialize painting commands 2023-10-18 10:58:42 +02:00
GradientPainting.cpp LibWeb: Rename painter() to recording_painter() in PaintContext 2023-11-27 21:53:38 +01:00
GradientPainting.h LibWeb: Introduce RecordingPainter to serialize painting commands 2023-10-18 10:58:42 +02:00
ImagePaintable.cpp LibWeb: Remove SetFont painting command 2024-01-25 21:33:54 +01:00
ImagePaintable.h LibWeb: Move viewport subscriptions from BrowsingContext to Document 2023-08-23 20:14:20 +02:00
InlinePaintable.cpp LibWeb: Optimize scroll offset and clip state recalculation 2024-02-09 16:45:44 +01:00
InlinePaintable.h LibWeb: Optimize scroll offset and clip state recalculation 2024-02-09 16:45:44 +01:00
InputColors.h LibWeb: Move checkbox color palette computation to helper header 2023-03-24 09:57:48 +00:00
LabelablePaintable.cpp LibWeb: Use paintable to represent event tracking node 2024-01-15 09:00:35 +01:00
LabelablePaintable.h LibWeb: Make the paint tree GC-allocated 2023-01-11 12:55:00 +01:00
LinearGradientData.h LibWeb: Introduce RecordingPainter to serialize painting commands 2023-10-18 10:58:42 +02:00
MarkerPaintable.cpp LibWeb: Don't pass StringView to RecordingPainter, to avoid copy 2023-12-27 11:41:15 +01:00
MarkerPaintable.h LibWeb: Make the paint tree GC-allocated 2023-01-11 12:55:00 +01:00
MediaPaintable.cpp LibWeb: Use paintable to represent event tracking node 2024-01-15 09:00:35 +01:00
MediaPaintable.h LibWeb: Introduce RecordingPainter to serialize painting commands 2023-10-18 10:58:42 +02:00
NestedBrowsingContextPaintable.cpp LibWeb+WebContent: Move paint recording init into Navigable 2024-01-15 14:33:56 +01:00
NestedBrowsingContextPaintable.h LibWeb: Make the paint tree GC-allocated 2023-01-11 12:55:00 +01:00
Paintable.cpp LibWeb: Don't crash when querying offsets of empty inline elements 2024-01-28 23:32:40 +01:00
Paintable.h LibWeb: Fix invalidation of CSS properties that do not affect layout 2024-02-03 09:28:03 +01:00
PaintableBox.cpp LibWeb: Optimize scroll offset and clip state recalculation 2024-02-09 16:45:44 +01:00
PaintableBox.h LibWeb: Optimize scroll offset and clip state recalculation 2024-02-09 16:45:44 +01:00
PaintableFragment.cpp LibWeb: Avoid expensive containing_block lookups in PaintableFragment 2024-01-27 14:31:47 +01:00
PaintableFragment.h LibWeb: Fix invalidation of CSS properties that do not affect layout 2024-02-03 09:28:03 +01:00
PaintContext.cpp LibWeb: Rename painter() to recording_painter() in PaintContext 2023-11-27 21:53:38 +01:00
PaintContext.h LibWeb: Move clip rect calculation to happen before painting 2024-01-28 08:25:28 +01:00
PaintingCommandExecutorCPU.cpp LibWeb: Remove SetFont painting command 2024-01-25 21:33:54 +01:00
PaintingCommandExecutorCPU.h LibWeb: Remove SetFont painting command 2024-01-25 21:33:54 +01:00
PaintingCommandExecutorGPU.cpp LibWeb: Remove SetFont painting command 2024-01-25 21:33:54 +01:00
PaintingCommandExecutorGPU.h LibWeb: Remove SetFont painting command 2024-01-25 21:33:54 +01:00
PaintOuterBoxShadowParams.h LibWeb: Introduce RecordingPainter to serialize painting commands 2023-10-18 10:58:42 +02:00
RadioButtonPaintable.cpp LibWeb: Rename painter() to recording_painter() in PaintContext 2023-11-27 21:53:38 +01:00
RadioButtonPaintable.h LibWeb: Make the paint tree GC-allocated 2023-01-11 12:55:00 +01:00
RecordingPainter.cpp LibWeb: Remove SetFont painting command 2024-01-25 21:33:54 +01:00
RecordingPainter.h LibWeb: Apply scroll offset to PushStackingContext command 2024-02-01 13:38:45 +01:00
ShadowData.h LibWeb: Introduce RecordingPainter to serialize painting commands 2023-10-18 10:58:42 +02:00
ShadowPainting.cpp LibWeb: Scale font per-glyph in paint_text_shadow() 2024-01-13 12:03:32 +01:00
ShadowPainting.h LibWeb: Use separate structure to represent fragments in paintable tree 2024-01-13 10:53:38 +01:00
StackingContext.cpp LibWeb: Apply scroll offset to PushStackingContext command 2024-02-01 13:38:45 +01:00
StackingContext.h LibWeb: Resolve CSS transform properties during layout commit 2024-01-16 21:54:10 +01:00
SVGGraphicsPaintable.cpp LibWeb/Painting: Introduce PaintingCommandExecutor 2023-10-26 11:02:04 +02:00
SVGGraphicsPaintable.h LibWeb: Layout SVG <text> elements during layout (not while painting) 2023-10-30 19:44:54 +01:00
SVGPaintable.cpp LibWeb: Resolve and paint simple SVG masks 2023-09-19 10:46:05 +02:00
SVGPaintable.h LibWeb: Remove SVGContext 2023-07-02 01:31:18 +02:00
SVGPathPaintable.cpp LibWeb: Add initial support for nesting SVG viewports 2024-01-27 18:12:13 +01:00
SVGPathPaintable.h LibWeb: Support transforms, stroking, gradients, etc for SVG <text> 2023-11-05 02:46:46 +01:00
SVGSVGPaintable.cpp LibWeb: Shift SVG paintable clip rectangle by scroll offset 2024-02-06 13:06:16 +01:00
SVGSVGPaintable.h LibWeb: Make a handful of paintable leaf classes final 2023-01-11 14:03:25 +01:00
TableBordersPainting.cpp LibWeb: Rename painter() to recording_painter() in PaintContext 2023-11-27 21:53:38 +01:00
TableBordersPainting.h LibWeb: Make StackingContext point to paint tree instead of layout tree 2023-08-20 05:02:59 +02:00
TextPaintable.cpp LibWeb: Use paintable to represent event tracking node 2024-01-15 09:00:35 +01:00
TextPaintable.h LibWeb: Resolve text-decoration-thickness during layout commit 2024-01-26 07:36:40 +01:00
VideoPaintable.cpp LibWeb: Rename painter() to recording_painter() in PaintContext 2023-11-27 21:53:38 +01:00
VideoPaintable.h LibWeb: Extract media element timeline painting to a base class 2023-06-13 06:14:01 +02:00
ViewportPaintable.cpp LibWeb: Optimize scroll offset and clip state recalculation 2024-02-09 16:45:44 +01:00
ViewportPaintable.h LibWeb: Optimize scroll offset and clip state recalculation 2024-02-09 16:45:44 +01:00