Index: Source/core/html/HTMLFormControlElement.cpp |
diff --git a/Source/core/html/HTMLFormControlElement.cpp b/Source/core/html/HTMLFormControlElement.cpp |
index 8c540e3f7c6fafd9ab9c17efd75216d38be4e7d6..3526e51947edbc61ba26f5b8826b2fe9d2bd844c 100644 |
--- a/Source/core/html/HTMLFormControlElement.cpp |
+++ b/Source/core/html/HTMLFormControlElement.cpp |
@@ -266,6 +266,25 @@ void HTMLFormControlElement::removedFrom(ContainerNode* insertionPoint) |
FormAssociatedElement::removedFrom(insertionPoint); |
} |
+void HTMLFormControlElement::willChangeForm() |
+{ |
+ formOwnerSetNeedsValidityCheck(); |
+ FormAssociatedElement::willChangeForm(); |
+} |
+ |
+void HTMLFormControlElement::didChangeForm() |
+{ |
+ formOwnerSetNeedsValidityCheck(); |
+ FormAssociatedElement::didChangeForm(); |
+} |
+ |
+void HTMLFormControlElement::formOwnerSetNeedsValidityCheck() |
+{ |
+ HTMLFormElement* form = formOwner(); |
+ if (form) |
+ form->setNeedsValidityCheck(); |
+} |
+ |
void HTMLFormControlElement::setChangedSinceLastFormControlChangeEvent(bool changed) |
{ |
m_wasChangedSinceLastFormControlChangeEvent = changed; |
@@ -469,7 +488,7 @@ ValidationMessageClient* HTMLFormControlElement::validationMessageClient() const |
bool HTMLFormControlElement::checkValidity(WillBeHeapVector<RefPtrWillBeMember<FormAssociatedElement> >* unhandledInvalidControls) |
{ |
- if (!willValidate() || isValidFormControlElement()) |
+ if (!willValidate() || isValidElement()) |
return true; |
// An event handler can deref this object. |
RefPtrWillBeRawPtr<HTMLFormControlElement> protector(this); |
@@ -480,7 +499,12 @@ bool HTMLFormControlElement::checkValidity(WillBeHeapVector<RefPtrWillBeMember<F |
return false; |
} |
-bool HTMLFormControlElement::isValidFormControlElement() |
+bool HTMLFormControlElement::matchesValidityPseudoClasses() const |
+{ |
+ return willValidate(); |
+} |
+ |
+bool HTMLFormControlElement::isValidElement() |
{ |
// If the following assertion fails, setNeedsValidityCheck() is not called |
// correctly when something which changes validity is updated. |
@@ -492,6 +516,7 @@ void HTMLFormControlElement::setNeedsValidityCheck() |
{ |
bool newIsValid = valid(); |
if (willValidate() && newIsValid != m_isValid) { |
+ formOwnerSetNeedsValidityCheck(); |
// Update style for pseudo classes such as :valid :invalid. |
setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Invalid)); |
} |