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..ebc2ecddc4c74bafd565b1ab24af3c29265c8ea2 100644 |
| --- a/Source/core/html/HTMLFormControlElement.cpp |
| +++ b/Source/core/html/HTMLFormControlElement.cpp |
| @@ -469,7 +469,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 +480,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. |
| @@ -493,6 +493,13 @@ void HTMLFormControlElement::setNeedsValidityCheck() |
| bool newIsValid = valid(); |
| if (willValidate() && newIsValid != m_isValid) { |
| // Update style for pseudo classes such as :valid :invalid. |
| + // A change here could've affected the style of the form itself and |
| + // other form elemetns, so recaluclate the entire form's subtree. |
|
keishi
2014/10/01 09:25:27
nit: /elemetns/elements/
nit: /recaluclate/recalcu
Bartek Nowierski
2014/10/02 14:26:42
Done.
|
| + HTMLFormElement* form = formOwner(); |
| + if (form) |
| + form->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Invalid)); |
| + // Then recalculate the element itself (and its subtree), because |
| + // it might not be in the tree of the owner form. |
| setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::createWithExtraData(StyleChangeReason::PseudoClass, StyleChangeExtraData::Invalid)); |
| } |
| m_isValid = newIsValid; |