summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibWeb/DOM/Document.cpp3
-rw-r--r--Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp6
-rw-r--r--Userland/Libraries/LibWeb/HTML/BrowsingContext.h2
3 files changed, 11 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp
index 286403d5d4..9ea97816b6 100644
--- a/Userland/Libraries/LibWeb/DOM/Document.cpp
+++ b/Userland/Libraries/LibWeb/DOM/Document.cpp
@@ -889,6 +889,9 @@ void Document::update_layout()
layout_state.commit();
+ // Broadcast the current viewport rect to any new paintables, so they know whether they're visible or not.
+ browsing_context()->inform_all_viewport_clients_about_the_current_viewport_rect();
+
browsing_context()->set_needs_display();
if (browsing_context()->is_top_level() && browsing_context()->active_document() == this) {
diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
index 874fce80b6..d0f6122ce2 100644
--- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
+++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
@@ -539,6 +539,12 @@ void BrowsingContext::set_active_document(JS::NonnullGCPtr<DOM::Document> docume
previously_active_document->did_stop_being_active_document_in_browsing_context({});
}
+void BrowsingContext::inform_all_viewport_clients_about_the_current_viewport_rect()
+{
+ for (auto* client : m_viewport_clients)
+ client->browsing_context_did_set_viewport_rect(viewport_rect());
+}
+
void BrowsingContext::set_viewport_rect(CSSPixelRect const& rect)
{
bool did_change = false;
diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h
index d043fa6982..162179015d 100644
--- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h
+++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h
@@ -277,6 +277,8 @@ public:
virtual String const& window_handle() const override { return m_window_handle; }
virtual void set_window_handle(String handle) override { m_window_handle = move(handle); }
+ void inform_all_viewport_clients_about_the_current_viewport_rect();
+
private:
explicit BrowsingContext(Page&, HTML::NavigableContainer*);