mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 16:16:43 +00:00
LibWeb: Move the navigable's cursor position to be owned by the document
Navigables are re-used for navigations within the same tab. Its current ownership of the cursor position is a bit ad-hoc, so nothing in the spec indicates when to reset the cursor, nor do we manually do so. So when a cursor update happens on one page, that cursor is retained on the next page. Instead, let's have the document own the cursor. Each navigation results in a new document, thus we don't need to worry about resetting cursors. This also makes many of the callsites feel nicer. We were previously often going from the node, to the document, to the navigable, to the cursor. This patch removes the navigable hop.
This commit is contained in:
parent
f8d83b2922
commit
faebbbc281
Notes:
github-actions[bot]
2024-08-02 16:41:32 +00:00
Author: https://github.com/trflynn89
Commit: faebbbc281
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/932
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/shannonbooth
15 changed files with 155 additions and 159 deletions
|
@ -198,15 +198,6 @@ public:
|
|||
Web::EventHandler& event_handler() { return m_event_handler; }
|
||||
Web::EventHandler const& event_handler() const { return m_event_handler; }
|
||||
|
||||
void did_edit(Badge<EditEventHandler>);
|
||||
|
||||
JS::GCPtr<DOM::Position> cursor_position() const { return m_cursor_position; }
|
||||
void set_cursor_position(JS::NonnullGCPtr<DOM::Position>);
|
||||
bool increment_cursor_position_offset();
|
||||
bool decrement_cursor_position_offset();
|
||||
|
||||
bool cursor_blink_state() const { return m_cursor_blink_state; }
|
||||
|
||||
protected:
|
||||
explicit Navigable(JS::NonnullGCPtr<Page>);
|
||||
|
||||
|
@ -256,10 +247,6 @@ private:
|
|||
bool m_needs_repaint { false };
|
||||
|
||||
Web::EventHandler m_event_handler;
|
||||
|
||||
JS::GCPtr<DOM::Position> m_cursor_position;
|
||||
RefPtr<Core::Timer> m_cursor_blink_timer;
|
||||
bool m_cursor_blink_state { false };
|
||||
};
|
||||
|
||||
HashTable<Navigable*>& all_navigables();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue