Bug 893332, part 2 - Update validity state before asserting range underflow state. r=baku
This commit is contained in:
@@ -1163,7 +1163,6 @@ HTMLInputElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
UpdateTypeMismatchValidityState();
|
||||
} else if (aName == nsGkAtoms::max) {
|
||||
UpdateHasRange();
|
||||
UpdateRangeOverflowValidityState();
|
||||
if (mType == NS_FORM_INPUT_RANGE) {
|
||||
// The value may need to change when @max changes since the value may
|
||||
// have been invalid and can now change to a valid value, or vice
|
||||
@@ -1181,25 +1180,29 @@ HTMLInputElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
nsresult rv =
|
||||
SetValueInternal(value, nsTextEditorState::eSetValue_Internal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
MOZ_ASSERT(!GetValidityState(VALIDITY_STATE_RANGE_UNDERFLOW),
|
||||
"HTML5 spec does not allow this");
|
||||
}
|
||||
// Validity state must be updated *after* the SetValueInternal call above
|
||||
UpdateRangeOverflowValidityState();
|
||||
MOZ_ASSERT(mType != NS_FORM_INPUT_RANGE ||
|
||||
!GetValidityState(VALIDITY_STATE_RANGE_UNDERFLOW),
|
||||
"HTML5 spec does not allow underflow for type=range");
|
||||
} else if (aName == nsGkAtoms::min) {
|
||||
UpdateHasRange();
|
||||
if (mType == NS_FORM_INPUT_RANGE) {
|
||||
// See @max comment
|
||||
nsAutoString value;
|
||||
GetValue(value);
|
||||
nsresult rv =
|
||||
SetValueInternal(value, nsTextEditorState::eSetValue_Internal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
// Validity state must be updated *after* the SetValueInternal call above
|
||||
UpdateRangeUnderflowValidityState();
|
||||
UpdateStepMismatchValidityState();
|
||||
if (mType == NS_FORM_INPUT_RANGE) {
|
||||
// See @max comment
|
||||
nsAutoString value;
|
||||
GetValue(value);
|
||||
nsresult rv =
|
||||
SetValueInternal(value, nsTextEditorState::eSetValue_Internal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
MOZ_ASSERT(!GetValidityState(VALIDITY_STATE_RANGE_UNDERFLOW),
|
||||
"HTML5 spec does not allow this");
|
||||
}
|
||||
MOZ_ASSERT(mType != NS_FORM_INPUT_RANGE ||
|
||||
!GetValidityState(VALIDITY_STATE_RANGE_UNDERFLOW),
|
||||
"HTML5 spec does not allow underflow for type=range");
|
||||
} else if (aName == nsGkAtoms::step) {
|
||||
UpdateStepMismatchValidityState();
|
||||
if (mType == NS_FORM_INPUT_RANGE) {
|
||||
// See @max comment
|
||||
nsAutoString value;
|
||||
@@ -1207,9 +1210,12 @@ HTMLInputElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
||||
nsresult rv =
|
||||
SetValueInternal(value, nsTextEditorState::eSetValue_Internal);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
MOZ_ASSERT(!GetValidityState(VALIDITY_STATE_RANGE_UNDERFLOW),
|
||||
"HTML5 spec does not allow this");
|
||||
}
|
||||
// Validity state must be updated *after* the SetValueInternal call above
|
||||
UpdateStepMismatchValidityState();
|
||||
MOZ_ASSERT(mType != NS_FORM_INPUT_RANGE ||
|
||||
!GetValidityState(VALIDITY_STATE_RANGE_UNDERFLOW),
|
||||
"HTML5 spec does not allow underflow for type=range");
|
||||
} else if (aName == nsGkAtoms::dir &&
|
||||
aValue && aValue->Equals(nsGkAtoms::_auto, eIgnoreCase)) {
|
||||
SetDirectionIfAuto(true, aNotify);
|
||||
|
||||
Reference in New Issue
Block a user