LibWeb: Only update paint-only properties in affected subtrees

Before this change, we always updated paint-only properties for every
single paintable after layout or style changes.

This could get very expensive in large documents, so this patch makes
it something we can do partially based on "repaint" invalidations.

This cuts down time spent in paint-only property update when scrolling
https://imdb.com/ from 19% to 5%.
This commit is contained in:
Andreas Kling 2025-09-23 23:28:11 +02:00 committed by Alexander Kalenik
commit eff9989aeb
Notes: github-actions[bot] 2025-09-24 22:01:01 +00:00
6 changed files with 41 additions and 7 deletions

View file

@ -10,6 +10,7 @@
#include <LibWeb/DOMURL/DOMURL.h>
#include <LibWeb/Fetch/Fetching/Fetching.h>
#include <LibWeb/HTML/SharedResourceRequest.h>
#include <LibWeb/Painting/ViewportPaintable.h>
namespace Web::CSS {
@ -131,7 +132,8 @@ GC::Ptr<HTML::SharedResourceRequest> fetch_an_external_image_for_a_stylesheet(St
if (auto navigable = document->navigable()) {
// Once the image has loaded, we need to re-resolve CSS properties that depend on the image's dimensions.
document->set_needs_to_resolve_paint_only_properties();
if (auto paintable = document->paintable())
paintable->set_needs_paint_only_properties_update(true);
// FIXME: Do less than a full repaint if possible?
document->set_needs_display();