mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 05:09:12 +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
|
@ -174,7 +174,7 @@ void CanvasRenderingContext2D::did_draw(Gfx::FloatRect const&)
|
|||
// FIXME: Make use of the rect to reduce the invalidated area when possible.
|
||||
if (!canvas_element().paintable())
|
||||
return;
|
||||
canvas_element().paintable()->set_needs_display();
|
||||
canvas_element().paintable()->set_needs_display(InvalidateDisplayList::No);
|
||||
}
|
||||
|
||||
Gfx::Painter* CanvasRenderingContext2D::painter()
|
||||
|
|
|
@ -2012,7 +2012,7 @@ void Navigable::set_viewport_size(CSSPixelSize size)
|
|||
}
|
||||
|
||||
if (auto document = active_document()) {
|
||||
document->set_needs_display();
|
||||
document->set_needs_display(InvalidateDisplayList::No);
|
||||
|
||||
document->inform_all_viewport_clients_about_the_current_viewport_rect();
|
||||
|
||||
|
@ -2028,7 +2028,7 @@ void Navigable::perform_scroll_of_viewport(CSSPixelPoint new_position)
|
|||
scroll_offset_did_change();
|
||||
|
||||
if (auto document = active_document()) {
|
||||
document->set_needs_display();
|
||||
document->set_needs_display(InvalidateDisplayList::No);
|
||||
document->set_needs_to_refresh_scroll_state(true);
|
||||
document->inform_all_viewport_clients_about_the_current_viewport_rect();
|
||||
}
|
||||
|
@ -2038,10 +2038,10 @@ void Navigable::perform_scroll_of_viewport(CSSPixelPoint new_position)
|
|||
HTML::main_thread_event_loop().schedule();
|
||||
}
|
||||
|
||||
void Navigable::set_needs_display()
|
||||
void Navigable::set_needs_display(InvalidateDisplayList should_invalidate_display_list)
|
||||
{
|
||||
if (auto document = active_document(); document) {
|
||||
document->set_needs_display();
|
||||
document->set_needs_display(should_invalidate_display_list);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <LibWeb/HTML/SourceSnapshotParams.h>
|
||||
#include <LibWeb/HTML/StructuredSerialize.h>
|
||||
#include <LibWeb/HTML/TokenizedFeatures.h>
|
||||
#include <LibWeb/InvalidateDisplayList.h>
|
||||
#include <LibWeb/Page/EventHandler.h>
|
||||
#include <LibWeb/Painting/DisplayList.h>
|
||||
#include <LibWeb/PixelUnits.h>
|
||||
|
@ -170,7 +171,7 @@ public:
|
|||
void set_viewport_size(CSSPixelSize);
|
||||
void perform_scroll_of_viewport(CSSPixelPoint position);
|
||||
|
||||
void set_needs_display();
|
||||
void set_needs_display(InvalidateDisplayList = InvalidateDisplayList::Yes);
|
||||
|
||||
void set_is_popup(TokenizedFeature::Popup is_popup) { m_is_popup = is_popup; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue