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.

(cherry picked from commit 1b74104c17726018788034f2ad66201889ce6225)
This commit is contained in:
Tim Ledbetter
2024-09-10 09:24:00 +01:00
committed by Nico Weber
parent f24a625eb0
commit c7a699ed73
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();