LibWeb: Don't move focus when setting input value

This commit is contained in:
Gingeh 2024-09-10 11:28:44 +10:00 committed by Jelle Raaijmakers
commit 1d9c404b8c
Notes: github-actions[bot] 2024-09-12 09:46:32 +00:00
7 changed files with 59 additions and 26 deletions

View file

@ -122,6 +122,11 @@ private:
bool m_parser_inserted { false };
};
enum class SelectionSource {
UI,
DOM,
};
class FormAssociatedTextControlElement : public FormAssociatedElement {
public:
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-textarea/input-relevant-value
@ -151,7 +156,7 @@ public:
WebIDL::ExceptionOr<void> set_range_text(String const& replacement, WebIDL::UnsignedLong start, WebIDL::UnsignedLong end, Bindings::SelectionMode = Bindings::SelectionMode::Preserve);
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-textarea/input-setselectionrange
void set_the_selection_range(Optional<WebIDL::UnsignedLong> start, Optional<WebIDL::UnsignedLong> end, SelectionDirection direction = SelectionDirection::None);
void set_the_selection_range(Optional<WebIDL::UnsignedLong> start, Optional<WebIDL::UnsignedLong> end, SelectionDirection direction = SelectionDirection::None, SelectionSource source = SelectionSource::DOM);
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#dom-textarea/input-setselectionrange
WebIDL::ExceptionOr<void> set_selection_range(Optional<WebIDL::UnsignedLong> start, Optional<WebIDL::UnsignedLong> end, Optional<String> direction);