diff options
-rw-r--r-- | Userland/Services/WebContent/PageHost.cpp | 10 | ||||
-rw-r--r-- | Userland/Services/WebContent/PageHost.h | 3 |
2 files changed, 11 insertions, 2 deletions
diff --git a/Userland/Services/WebContent/PageHost.cpp b/Userland/Services/WebContent/PageHost.cpp index 4dcbabfdf7..0414a88044 100644 --- a/Userland/Services/WebContent/PageHost.cpp +++ b/Userland/Services/WebContent/PageHost.cpp @@ -21,6 +21,10 @@ PageHost::PageHost(ClientConnection& client) , m_page(make<Web::Page>(*this)) { setup_palette(); + m_invalidation_coalescing_timer = Core::Timer::create_single_shot(0, [this] { + m_client.async_did_invalidate_content_rect(m_invalidation_rect); + m_invalidation_rect = {}; + }); } PageHost::~PageHost() @@ -77,9 +81,11 @@ void PageHost::set_viewport_rect(const Gfx::IntRect& rect) page().top_level_browsing_context().set_viewport_rect(rect); } -void PageHost::page_did_invalidate(const Gfx::IntRect& content_rect) +void PageHost::page_did_invalidate(Gfx::IntRect const& content_rect) { - m_client.async_did_invalidate_content_rect(content_rect); + m_invalidation_rect = m_invalidation_rect.united(content_rect); + if (!m_invalidation_coalescing_timer->is_active()) + m_invalidation_coalescing_timer->start(); } void PageHost::page_did_change_selection() diff --git a/Userland/Services/WebContent/PageHost.h b/Userland/Services/WebContent/PageHost.h index ef4b48208a..1db072ede9 100644 --- a/Userland/Services/WebContent/PageHost.h +++ b/Userland/Services/WebContent/PageHost.h @@ -72,6 +72,9 @@ private: RefPtr<Gfx::PaletteImpl> m_palette_impl; Gfx::IntRect m_screen_rect; bool m_should_show_line_box_borders { false }; + + RefPtr<Core::Timer> m_invalidation_coalescing_timer; + Gfx::IntRect m_invalidation_rect; }; } |