mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Invalidate the display list when calling set_needs_display()
Calls to `Document::set_needs_display()` and `Paintable::set_needs_display()` now invalidate the display list by default. This behavior can be changed by passing `InvalidateDisplayList::No` to the function where invalidating the display list is not necessary.
This commit is contained in:
parent
46649fbe1b
commit
5800b7e884
Notes:
github-actions[bot]
2024-09-02 18:13:03 +00:00
Author: https://github.com/tcl3
Commit: 5800b7e884
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1240
Reviewed-by: https://github.com/kalenikaliaksandr ✅
Reviewed-by: https://github.com/trflynn89 ✅
12 changed files with 53 additions and 28 deletions
|
@ -384,7 +384,6 @@ Document::Document(JS::Realm& realm, const URL::URL& url, TemporaryDocumentForFr
|
|||
if (!navigable || !navigable->is_focused())
|
||||
return;
|
||||
|
||||
node->document().invalidate_display_list();
|
||||
node->document().update_layout();
|
||||
|
||||
if (node->paintable()) {
|
||||
|
@ -5383,18 +5382,22 @@ void Document::set_cached_navigable(JS::GCPtr<HTML::Navigable> navigable)
|
|||
m_cached_navigable = navigable.ptr();
|
||||
}
|
||||
|
||||
void Document::set_needs_display()
|
||||
void Document::set_needs_display(InvalidateDisplayList should_invalidate_display_list)
|
||||
{
|
||||
set_needs_display(viewport_rect());
|
||||
set_needs_display(viewport_rect(), should_invalidate_display_list);
|
||||
}
|
||||
|
||||
void Document::set_needs_display(CSSPixelRect const&)
|
||||
void Document::set_needs_display(CSSPixelRect const&, InvalidateDisplayList should_invalidate_display_list)
|
||||
{
|
||||
// FIXME: Ignore updates outside the visible viewport rect.
|
||||
// This requires accounting for fixed-position elements in the input rect, which we don't do yet.
|
||||
|
||||
m_needs_repaint = true;
|
||||
|
||||
if (should_invalidate_display_list == InvalidateDisplayList::Yes) {
|
||||
invalidate_display_list();
|
||||
}
|
||||
|
||||
auto navigable = this->navigable();
|
||||
if (!navigable)
|
||||
return;
|
||||
|
@ -5404,8 +5407,8 @@ void Document::set_needs_display(CSSPixelRect const&)
|
|||
return;
|
||||
}
|
||||
|
||||
if (navigable->container()) {
|
||||
navigable->container()->document().set_needs_display();
|
||||
if (auto container = navigable->container()) {
|
||||
container->document().set_needs_display(should_invalidate_display_list);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5417,8 +5420,8 @@ void Document::invalidate_display_list()
|
|||
if (!navigable)
|
||||
return;
|
||||
|
||||
if (navigable->container()) {
|
||||
navigable->container()->document().invalidate_display_list();
|
||||
if (auto container = navigable->container()) {
|
||||
container->document().invalidate_display_list();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue