Bug 1850293 - Make CHECKED/DEFAULT states not intrinsic. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D186933
This commit is contained in:
Emilio Cobos Álvarez
2023-08-30 09:18:31 +00:00
parent 3e9e56e2c8
commit 76e9b5e83c
12 changed files with 118 additions and 209 deletions

View File

@@ -1120,12 +1120,8 @@ void HTMLTextAreaElement::InitializeKeyboardEventListeners() {
}
void HTMLTextAreaElement::UpdatePlaceholderShownState() {
const bool shown = IsValueEmpty() && HasAttr(nsGkAtoms::placeholder);
if (shown) {
AddStates(ElementState::PLACEHOLDER_SHOWN);
} else {
RemoveStates(ElementState::PLACEHOLDER_SHOWN);
}
SetStates(ElementState::PLACEHOLDER_SHOWN,
IsValueEmpty() && HasAttr(nsGkAtoms::placeholder));
}
void HTMLTextAreaElement::OnValueChanged(ValueChangeKind aKind,
@@ -1136,11 +1132,7 @@ void HTMLTextAreaElement::OnValueChanged(ValueChangeKind aKind,
}
if (aNewValueEmpty != IsValueEmpty()) {
if (aNewValueEmpty) {
AddStates(ElementState::VALUE_EMPTY);
} else {
RemoveStates(ElementState::VALUE_EMPTY);
}
SetStates(ElementState::VALUE_EMPTY, aNewValueEmpty);
UpdatePlaceholderShownState();
}