LibWeb: Route repaint requests through paintables, not Document

Rename Document::set_needs_display() to set_needs_repaint() and make it
private. External callers must now go through Node/Paintable which
route the request to the document internally.

Fix one existing misuse in AnimationEffect that was calling
document-level set_needs_display() instead of routing through the
target element's paintable.

This is preparation for per-paintable display list command caching:
repaint requests must go through specific paintables so their cached
command lists can be invalidated.
This commit is contained in:
Aliaksandr Kalenik
2026-03-04 16:02:14 +01:00
committed by Alexander Kalenik
parent 0356f1b510
commit eae94a8a46
Notes: github-actions[bot] 2026-03-04 18:37:01 +00:00
25 changed files with 62 additions and 79 deletions

View File

@@ -2621,7 +2621,7 @@ void Navigable::set_viewport_size(CSSPixelSize size, InvalidateDisplayList inval
}
if (auto document = active_document()) {
document->set_needs_display(invalidate_display_list);
document->set_needs_repaint(Badge<HTML::Navigable> {}, invalidate_display_list);
document->inform_all_viewport_clients_about_the_current_viewport_rect();
@@ -2660,7 +2660,7 @@ void Navigable::perform_scroll_of_viewport_scrolling_box(CSSPixelPoint new_posit
scroll_offset_did_change();
if (auto document = active_document()) {
document->set_needs_display(InvalidateDisplayList::No);
document->set_needs_repaint(Badge<HTML::Navigable> {}, InvalidateDisplayList::No);
document->set_needs_to_refresh_scroll_state(true);
document->inform_all_viewport_clients_about_the_current_viewport_rect();
}
@@ -3001,9 +3001,9 @@ GC::Ref<WebIDL::Promise> Navigable::perform_a_scroll_of_the_viewport(CSSPixelPoi
vv->scroll_by({ visual_dx, visual_dy });
if (visual_dx != 0.0 || visual_dy != 0.0) {
doc->set_needs_accumulated_visual_contexts_update(true);
doc->set_needs_display(InvalidateDisplayList::Yes);
doc->set_needs_repaint(Badge<HTML::Navigable> {}, InvalidateDisplayList::Yes);
} else {
doc->set_needs_display(InvalidateDisplayList::No);
doc->set_needs_repaint(Badge<HTML::Navigable> {}, InvalidateDisplayList::No);
}
// 16. Let scrollPromise be a new Promise.