Index: Source/core/html/HTMLFormControlElement.cpp |
diff --git a/Source/core/html/HTMLFormControlElement.cpp b/Source/core/html/HTMLFormControlElement.cpp |
index 4972a38a1bd7908f3be7cff35fbaaf736b078e9a..632f17c258c7bbaa3d6226c5dab49085f69d62c8 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) |
{ |
@@ -482,20 +483,25 @@ 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; |
+ } else { |
+ // If the following assertion fails, setNeedsValidityCheck() is not called |
+ // correctly when something which changes validity is updated. |
+ ASSERT(m_isValid == valid()); |
+ } |
return m_isValid; |
} |
void HTMLFormControlElement::setNeedsValidityCheck() |
{ |
- bool newIsValid = valid(); |
- if (willValidate() && newIsValid != m_isValid) { |
+ if (willValidate()) { |
// Update style for pseudo classes such as :valid :invalid. |
- setNeedsStyleRecalc(SubtreeStyleChange); |
+ if (valid() != m_isValid) |
tkent
2014/09/25 05:35:55
This is incorrect. Because setNeedsValidityCheck()
spartha
2014/09/25 06:38:05
As you suggest removing the validity cache should
|
+ setNeedsStyleRecalc(SubtreeStyleChange); |
+ m_validityIsDirty = true; |
} |
- m_isValid = newIsValid; |
// Updates only if this control already has a validation message. |
if (isValidationMessageVisible()) { |