Bug 1386530. Fix handling of type changes that affect validity state to properly notify state changes. r=jessica
MozReview-Commit-ID: Khhzi1HyCpt
This commit is contained in:
@@ -3350,7 +3350,9 @@ HTMLInputElement::SetCheckedInternal(bool aChecked, bool aNotify)
|
||||
}
|
||||
}
|
||||
|
||||
UpdateAllValidityStates(aNotify);
|
||||
// No need to update element state, since we're about to call
|
||||
// UpdateState anyway.
|
||||
UpdateAllValidityStatesButNotElementState();
|
||||
|
||||
// Notify the document that the CSS :checked pseudoclass for this element
|
||||
// has changed state.
|
||||
@@ -5039,8 +5041,9 @@ HTMLInputElement::HandleTypeChange(uint8_t aNewType, bool aNotify)
|
||||
|
||||
UpdateHasRange();
|
||||
|
||||
// Do not notify, it will be done after if needed.
|
||||
UpdateAllValidityStates(false);
|
||||
// Update validity states, but not element state. We'll update
|
||||
// element state later, as part of this attribute change.
|
||||
UpdateAllValidityStatesButNotElementState();
|
||||
|
||||
UpdateApzAwareFlag();
|
||||
|
||||
@@ -7357,6 +7360,16 @@ void
|
||||
HTMLInputElement::UpdateAllValidityStates(bool aNotify)
|
||||
{
|
||||
bool validBefore = IsValid();
|
||||
UpdateAllValidityStatesButNotElementState();
|
||||
|
||||
if (validBefore != IsValid()) {
|
||||
UpdateState(aNotify);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
HTMLInputElement::UpdateAllValidityStatesButNotElementState()
|
||||
{
|
||||
UpdateTooLongValidityState();
|
||||
UpdateTooShortValidityState();
|
||||
UpdateValueMissingValidityState();
|
||||
@@ -7366,10 +7379,6 @@ HTMLInputElement::UpdateAllValidityStates(bool aNotify)
|
||||
UpdateRangeUnderflowValidityState();
|
||||
UpdateStepMismatchValidityState();
|
||||
UpdateBadInputValidityState();
|
||||
|
||||
if (validBefore != IsValid()) {
|
||||
UpdateState(aNotify);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user