mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
LibWeb: Cache display list commands per paintable
Cache the display list commands produced by each PaintableBox's paint() on a per-phase basis. On subsequent display list rebuilds, if a paintable's cache is still valid, replay the recorded commands directly — skipping paint() and all the property resolution it entails. Besides saving time on property resolution, this also enables Skia to reuse path tessellation results across frames — e.g. border paths are preserved in the cache and don't need to be re-tessellated on every repaint.
This commit is contained in:
committed by
Alexander Kalenik
parent
eae94a8a46
commit
5bfc4a3c41
Notes:
github-actions[bot]
2026-03-04 18:36:56 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/5bfc4a3c41b Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8271
@@ -182,6 +182,7 @@
|
||||
#include <LibWeb/Painting/AccumulatedVisualContext.h>
|
||||
#include <LibWeb/Painting/DisplayList.h>
|
||||
#include <LibWeb/Painting/DisplayListCommand.h>
|
||||
#include <LibWeb/Painting/DisplayListRecorder.h>
|
||||
#include <LibWeb/Painting/PaintableBox.h>
|
||||
#include <LibWeb/Painting/StackingContext.h>
|
||||
#include <LibWeb/Painting/ViewportPaintable.h>
|
||||
@@ -7306,6 +7307,11 @@ void Document::invalidate_display_list()
|
||||
return;
|
||||
|
||||
if (auto container = navigable->container()) {
|
||||
// The container's paintable may have cached paint commands that include a PaintNestedDisplayList
|
||||
// holding a stale reference to this document's old display list. Clear the cache so the container
|
||||
// re-executes paint() and picks up the freshly recorded display list.
|
||||
if (auto* paintable_box = container->unsafe_paintable_box())
|
||||
paintable_box->invalidate_paint_cache();
|
||||
container->document().invalidate_display_list();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user