1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:57:44 +00:00

LibWeb: Move viewport subscriptions from BrowsingContext to Document

With this change, elements that want to receive viewport rect updates
will need to register on document instead of the browsing context.

This change solves the problem where a browsing context for a document
is guaranteed to exist only while the document is active so browsing
context might not exit by the time DOM node that want to register is
constructed.

This is a part of preparation work before switching to navigables where
this issue becomes more visible.
This commit is contained in:
Aliaksandr Kalenik 2023-08-23 18:58:42 +02:00 committed by Andreas Kling
parent 48e9097aa4
commit 5ff7448fee
10 changed files with 66 additions and 61 deletions

View file

@ -118,14 +118,6 @@ public:
return IterationDecision::Continue;
}
class ViewportClient {
public:
virtual ~ViewportClient() = default;
virtual void browsing_context_did_set_viewport_rect(CSSPixelRect const&) = 0;
};
void register_viewport_client(ViewportClient&);
void unregister_viewport_client(ViewportClient&);
bool is_top_level() const;
bool is_focused_context() const;
@ -277,8 +269,6 @@ 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*);
@ -324,8 +314,6 @@ private:
RefPtr<Core::Timer> m_cursor_blink_timer;
bool m_cursor_blink_state { false };
HashTable<ViewportClient*> m_viewport_clients;
HashMap<AK::URL, size_t> m_frame_nesting_levels;
DeprecatedString m_name;