Bug 1528644 - Internal value changes shouldn't change validity state. r=masayuki
Even less so on reframe, where it's just unsound to do so. I had to give a value to eSetValue_Internal, since otherwise I cannot check for its presence. I can further special-case the reframe case if you prefer. Differential Revision: https://phabricator.services.mozilla.com/D20133
This commit is contained in:
@@ -2604,8 +2604,10 @@ nsresult HTMLInputElement::SetValueInternal(const nsAString& aValue,
|
||||
// If the caller won't dispatch "input" event via
|
||||
// nsContentUtils::DispatchInputEvent(), we need to modify
|
||||
// validationMessage value here.
|
||||
if (aFlags & (nsTextEditorState::eSetValue_Internal |
|
||||
nsTextEditorState::eSetValue_ByContent)) {
|
||||
//
|
||||
// FIXME(emilio): eSetValue_Internal is not supposed to change state,
|
||||
// but maybe we could run this too?
|
||||
if (aFlags & nsTextEditorState::eSetValue_ByContent) {
|
||||
MaybeUpdateAllValidityStates();
|
||||
}
|
||||
} else {
|
||||
@@ -2640,8 +2642,7 @@ nsresult HTMLInputElement::SetValueInternal(const nsAString& aValue,
|
||||
}
|
||||
}
|
||||
if (mDoneCreating) {
|
||||
OnValueChanged(/* aNotify = */ true,
|
||||
/* aWasInteractiveUserChange = */ false);
|
||||
OnValueChanged(/* aNotify = */ true, ValueChangeKind::Internal);
|
||||
}
|
||||
// else DoneCreatingElement calls us again once mDoneCreating is true
|
||||
}
|
||||
@@ -6753,8 +6754,10 @@ HTMLInputElement::InitializeKeyboardEventListeners() {
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(void)
|
||||
HTMLInputElement::OnValueChanged(bool aNotify, bool aWasInteractiveUserChange) {
|
||||
mLastValueChangeWasInteractive = aWasInteractiveUserChange;
|
||||
HTMLInputElement::OnValueChanged(bool aNotify, ValueChangeKind aKind) {
|
||||
if (aKind != ValueChangeKind::Internal) {
|
||||
mLastValueChangeWasInteractive = aKind == ValueChangeKind::UserInteraction;
|
||||
}
|
||||
|
||||
UpdateAllValidityStates(aNotify);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user