Bug 1401657 - Make editor value changes always notify. r=masayuki
Not doing so is unsound in some cases, see the two referenced bugs. Differential Revision: https://phabricator.services.mozilla.com/D66697
This commit is contained in:
@@ -2684,7 +2684,7 @@ nsresult HTMLInputElement::SetValueInternal(const nsAString& aValue,
|
||||
}
|
||||
}
|
||||
if (mDoneCreating) {
|
||||
OnValueChanged(/* aNotify = */ true, ValueChangeKind::Internal);
|
||||
OnValueChanged(ValueChangeKind::Internal);
|
||||
}
|
||||
// else DoneCreatingElement calls us again once mDoneCreating is true
|
||||
}
|
||||
@@ -2702,8 +2702,7 @@ nsresult HTMLInputElement::SetValueInternal(const nsAString& aValue,
|
||||
// a single line text control, TextControlState::SetValue will call
|
||||
// nsHTMLInputElement::OnValueChanged which is going to call UpdateState()
|
||||
// if the element is focused. This bug 665547.
|
||||
if (PlaceholderApplies() &&
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder)) {
|
||||
if (PlaceholderApplies() && HasAttr(nsGkAtoms::placeholder)) {
|
||||
UpdateState(true);
|
||||
}
|
||||
|
||||
@@ -6608,22 +6607,21 @@ void HTMLInputElement::InitializeKeyboardEventListeners() {
|
||||
}
|
||||
}
|
||||
|
||||
void HTMLInputElement::OnValueChanged(bool aNotify, ValueChangeKind aKind) {
|
||||
void HTMLInputElement::OnValueChanged(ValueChangeKind aKind) {
|
||||
if (aKind != ValueChangeKind::Internal) {
|
||||
mLastValueChangeWasInteractive = aKind == ValueChangeKind::UserInteraction;
|
||||
}
|
||||
|
||||
UpdateAllValidityStates(aNotify);
|
||||
UpdateAllValidityStates(true);
|
||||
|
||||
if (HasDirAuto()) {
|
||||
SetDirectionFromValue(aNotify);
|
||||
SetDirectionFromValue(true);
|
||||
}
|
||||
|
||||
// :placeholder-shown pseudo-class may change when the value changes.
|
||||
// However, we don't want to waste cycles if the state doesn't apply.
|
||||
if (PlaceholderApplies() &&
|
||||
HasAttr(kNameSpaceID_None, nsGkAtoms::placeholder)) {
|
||||
UpdateState(aNotify);
|
||||
if (PlaceholderApplies() && HasAttr(nsGkAtoms::placeholder)) {
|
||||
UpdateState(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user