Chromium Code Reviews| Index: third_party/WebKit/Source/core/html/HTMLFormElement.cpp |
| diff --git a/third_party/WebKit/Source/core/html/HTMLFormElement.cpp b/third_party/WebKit/Source/core/html/HTMLFormElement.cpp |
| index 6519101a9743c6e73b791bb93a824e24b3032c94..1255c8d3c8ddcea5d4b088b7e65730d9e5313ff3 100644 |
| --- a/third_party/WebKit/Source/core/html/HTMLFormElement.cpp |
| +++ b/third_party/WebKit/Source/core/html/HTMLFormElement.cpp |
| @@ -31,7 +31,6 @@ |
| #include "core/dom/Attribute.h" |
| #include "core/dom/Document.h" |
| #include "core/dom/ElementTraversal.h" |
| -#include "core/dom/IdTargetObserverRegistry.h" |
| #include "core/dom/NodeListsNodeData.h" |
| #include "core/events/AutocompleteErrorEvent.h" |
| #include "core/events/Event.h" |
| @@ -71,6 +70,7 @@ HTMLFormElement::HTMLFormElement(Document& document) |
| , m_associatedElementsAreDirty(false) |
| , m_imageElementsAreDirty(false) |
| , m_hasElementsAssociatedByParser(false) |
| + , m_hasElementsAssociatedByFormAttribute(false) |
| , m_didFinishParsingChildren(false) |
| , m_wasUserSubmitted(false) |
| , m_isSubmittingOrInUserJSSubmitEvent(false) |
| @@ -529,6 +529,8 @@ void HTMLFormElement::associate(FormAssociatedElement& e) |
| { |
| m_associatedElementsAreDirty = true; |
| m_associatedElements.clear(); |
| + if (toHTMLElement(e).fastHasAttribute(formAttr)) |
| + m_hasElementsAssociatedByFormAttribute = true; |
| } |
| void HTMLFormElement::disassociate(FormAssociatedElement& e) |
| @@ -607,7 +609,7 @@ const FormAssociatedElement::List& HTMLFormElement::associatedElements() const |
| Node* scope = mutableThis; |
| if (m_hasElementsAssociatedByParser) |
| scope = &NodeTraversal::highestAncestorOrSelf(*mutableThis); |
| - if (inDocument() && treeScope().idTargetObserverRegistry().hasObservers(fastGetAttribute(idAttr))) |
| + if (inDocument() && m_hasElementsAssociatedByFormAttribute) |
| scope = &treeScope().rootNode(); |
| ASSERT(scope); |
| collectAssociatedElements(*scope, mutableThis->m_associatedElements); |
| @@ -837,4 +839,14 @@ void HTMLFormElement::setDemoted(bool demoted) |
| m_wasDemoted = demoted; |
| } |
| +void HTMLFormElement::invalidateDefaultButtonStyle() const |
| +{ |
| + for (const auto& control : associatedElements()) { |
| + if (!control->isFormControlElement()) |
| + return; |
|
rune
2016/03/03 09:11:03
Should this have been "continue;"?
tkent
2016/03/04 00:05:08
Oops! You're right.
I fixed it, and update the te
|
| + if (toHTMLFormControlElement(control)->canBeSuccessfulSubmitButton()) |
| + toHTMLFormControlElement(control)->pseudoStateChanged(CSSSelector::PseudoDefault); |
| + } |
| +} |
| + |
| } // namespace blink |