Bug 1856156 - Recompute auto directionality on input type changes. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D198588
This commit is contained in:
Emilio Cobos Álvarez
2024-01-15 19:35:43 +00:00
parent 3b9c142e33
commit 08a8d2d9f1
7 changed files with 58 additions and 43 deletions

View File

@@ -1112,7 +1112,7 @@ class HTMLInputElement final : public TextControlElement,
* Sets the direction from the input value. if aKnownValue is provided, it
* saves a GetValue call.
*/
void SetDirectionFromValue(bool aNotify,
void SetAutoDirectionality(bool aNotify,
const nsAString* aKnownValue = nullptr);
/**
@@ -1600,8 +1600,8 @@ class HTMLInputElement final : public TextControlElement,
/**
* https://html.spec.whatwg.org/#auto-directionality-form-associated-elements
*/
bool IsAutoDirectionalityAssociated() const {
switch (mType) {
static bool IsAutoDirectionalityAssociated(FormControlType aType) {
switch (aType) {
case FormControlType::InputHidden:
case FormControlType::InputText:
case FormControlType::InputSearch:
@@ -1618,6 +1618,10 @@ class HTMLInputElement final : public TextControlElement,
}
}
bool IsAutoDirectionalityAssociated() const {
return IsAutoDirectionalityAssociated(mType);
}
static bool CreatesDateTimeWidget(FormControlType aType) {
return aType == FormControlType::InputDate ||
aType == FormControlType::InputTime ||