LibWeb: Follow spec steps to set the selectionDirection attribute value

(cherry picked from commit d0b97873d421d092eb41e3b7a7d8959347b3b436)
This commit is contained in:
Tim Ledbetter
2024-10-04 12:12:39 +01:00
committed by Nico Weber
parent 48ce92598d
commit 05e8835555
10 changed files with 68 additions and 4 deletions

View File

@@ -2370,6 +2370,21 @@ bool HTMLInputElement::selection_or_range_applies() const
return selection_or_range_applies_for_type_state(type_state());
}
// https://html.spec.whatwg.org/multipage/input.html#do-not-apply
bool HTMLInputElement::selection_direction_applies() const
{
switch (type_state()) {
case TypeAttributeState::Text:
case TypeAttributeState::Search:
case TypeAttributeState::Telephone:
case TypeAttributeState::URL:
case TypeAttributeState::Password:
return true;
default:
return false;
}
}
bool HTMLInputElement::has_selectable_text() const
{
// Potential FIXME: Date, Month, Week, Time and LocalDateAndTime are rendered as a basic text input for now,