Chromium Code Reviews| Index: Source/core/html/HTMLFormControlElement.cpp |
| diff --git a/Source/core/html/HTMLFormControlElement.cpp b/Source/core/html/HTMLFormControlElement.cpp |
| index 6029f3fe1e814339a8d896db5eb0e1bf69de265b..9f54f16e3e6e3b56e6d503d7757fd850f91bcf90 100644 |
| --- a/Source/core/html/HTMLFormControlElement.cpp |
| +++ b/Source/core/html/HTMLFormControlElement.cpp |
| @@ -246,6 +246,13 @@ void HTMLFormControlElement::didMoveToNewDocument(Document& oldDocument) |
| HTMLElement::didMoveToNewDocument(oldDocument); |
| } |
| +void HTMLFormControlElement::formOwnerSetNeedsValidityCheck() |
| +{ |
| + HTMLFormElement* form = formOwner(); |
| + if (form) |
| + form->setNeedsValidityCheck(); |
| +} |
| + |
| Node::InsertionNotificationRequest HTMLFormControlElement::insertedInto(ContainerNode* insertionPoint) |
| { |
| m_ancestorDisabledState = AncestorDisabledStateUnknown; |
| @@ -253,11 +260,16 @@ Node::InsertionNotificationRequest HTMLFormControlElement::insertedInto(Containe |
| setNeedsWillValidateCheck(); |
| HTMLElement::insertedInto(insertionPoint); |
| FormAssociatedElement::insertedInto(insertionPoint); |
| + |
| + formOwnerSetNeedsValidityCheck(); |
|
keishi
2014/10/03 06:34:41
I'm sorry. I told you to put it here yesterday but
Bartek Nowierski
2014/10/03 07:16:57
That makes sense! I added a test for that too.
keishi
2014/10/03 08:01:59
Thanks!
|
| + |
| return InsertionDone; |
| } |
| void HTMLFormControlElement::removedFrom(ContainerNode* insertionPoint) |
| { |
| + formOwnerSetNeedsValidityCheck(); |
| + |
| hideVisibleValidationMessage(); |
| m_hasValidationMessage = false; |
| m_ancestorDisabledState = AncestorDisabledStateUnknown; |
| @@ -469,7 +481,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 +492,7 @@ bool HTMLFormControlElement::checkValidity(WillBeHeapVector<RefPtrWillBeMember<F |
| return false; |
| } |
| -bool HTMLFormControlElement::isValidFormControlElement() |
| +bool HTMLFormControlElement::isValidElement() |
| { |
| // If the following assertion fails, setNeedsValidityCheck() is not called |
| // correctly when something which changes validity is updated. |
| @@ -492,6 +504,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)); |
| } |