Index: Source/core/html/HTMLFormControlElement.cpp |
diff --git a/Source/core/html/HTMLFormControlElement.cpp b/Source/core/html/HTMLFormControlElement.cpp |
index bee7cdaa70ffabd5b984f581391aee2bfc2db3fe..0be3d405ff04e1fd7113338a602e3024229afb46 100644 |
--- a/Source/core/html/HTMLFormControlElement.cpp |
+++ b/Source/core/html/HTMLFormControlElement.cpp |
@@ -58,6 +58,7 @@ HTMLFormControlElement::HTMLFormControlElement(const QualifiedName& tagName, Doc |
, m_willValidateInitialized(false) |
, m_willValidate(true) |
, m_isValid(true) |
+ , m_validityIsDirty(true) |
, m_wasChangedSinceLastFormControlChangeEvent(false) |
, m_wasFocusedByMouse(false) |
{ |
@@ -483,20 +484,20 @@ bool HTMLFormControlElement::checkValidity(WillBeHeapVector<RefPtrWillBeMember<F |
bool HTMLFormControlElement::isValidFormControlElement() |
{ |
- // If the following assertion fails, setNeedsValidityCheck() is not called |
- // correctly when something which changes validity is updated. |
- ASSERT(m_isValid == valid()); |
+ if (m_validityIsDirty) { |
+ m_isValid = valid(); |
+ m_validityIsDirty = false; |
+ } |
tkent
2014/09/03 08:04:44
We should keep the ASSERT if !m_validityIsDirty.
spartha
2014/09/03 08:50:57
Wouldn't two calls to element.checkValidity() caus
tkent
2014/09/03 09:11:27
I don't think so.
spartha
2014/09/03 14:47:33
Done. You are right. I missed the placement of the
|
return m_isValid; |
} |
void HTMLFormControlElement::setNeedsValidityCheck() |
{ |
- bool newIsValid = valid(); |
- if (willValidate() && newIsValid != m_isValid) { |
+ if (!m_validityIsDirty && willValidate()) { |
// Update style for pseudo classes such as :valid :invalid. |
setNeedsStyleRecalc(SubtreeStyleChange); |
+ m_validityIsDirty = true; |
} |
- m_isValid = newIsValid; |
// Updates only if this control already has a validation message. |
if (isValidationMessageVisible()) { |