LibWeb: Make input type state change handling specification compliant

This change ensures that the value sanitization algorithm is run and
the text cursor is set to the correct position when the type attribute
of an input is changed.
This commit is contained in:
Tim Ledbetter 2024-09-10 09:24:00 +01:00 committed by Tim Ledbetter
commit 1b74104c17
Notes: github-actions[bot] 2024-09-10 15:13:57 +00:00
6 changed files with 138 additions and 13 deletions

View file

@ -205,12 +205,16 @@ public:
bool select_applies() const;
bool selection_or_range_applies() const;
static bool selection_or_range_applies_for_type_state(TypeAttributeState);
protected:
void selection_was_changed(size_t selection_start, size_t selection_end) override;
private:
HTMLInputElement(DOM::Document&, DOM::QualifiedName);
void type_attribute_changed(TypeAttributeState old_state, TypeAttributeState new_state);
// ^DOM::Node
virtual bool is_html_input_element() const final { return true; }
@ -280,6 +284,7 @@ private:
DefaultOn,
Filename,
};
static ValueAttributeMode value_attribute_mode_for_type_state(TypeAttributeState);
ValueAttributeMode value_attribute_mode() const;
void update_placeholder_visibility();