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.

(cherry picked from commit faebbbc281d1267062770b02fc6d962d92a3bd62)
This commit is contained in:
Timothy Flynn
2024-08-02 07:31:40 -04:00
committed by Nico Weber
parent 58674191c2
commit c62dd41874
15 changed files with 155 additions and 159 deletions

View File

@@ -143,7 +143,7 @@ public:
WebIDL::ExceptionOr<void> show_picker();
// ^DOM::EditableTextNodeOwner
virtual void did_edit_text_node(Badge<Navigable>) override;
virtual void did_edit_text_node(Badge<DOM::Document>) override;
// ^EventTarget
// https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-input-element