Index: third_party/WebKit/Source/core/html/forms/BaseButtonInputType.cpp |
diff --git a/third_party/WebKit/Source/core/html/forms/BaseButtonInputType.cpp b/third_party/WebKit/Source/core/html/forms/BaseButtonInputType.cpp |
index 9eb0bbaf3e4c91e2a48d2369d6d9f5453b6e3163..8cf28d0579d08cb197b9d32a3df55c1dd534324e 100644 |
--- a/third_party/WebKit/Source/core/html/forms/BaseButtonInputType.cpp |
+++ b/third_party/WebKit/Source/core/html/forms/BaseButtonInputType.cpp |
@@ -34,6 +34,7 @@ |
#include "core/HTMLNames.h" |
#include "core/dom/Text.h" |
#include "core/dom/shadow/ShadowRoot.h" |
+#include "core/html/HTMLFormElement.h" |
#include "core/html/HTMLInputElement.h" |
#include "core/html/parser/HTMLParserIdioms.h" |
#include "core/layout/LayoutButton.h" |
@@ -82,4 +83,11 @@ void BaseButtonInputType::setValue(const String& sanitizedValue, bool, TextField |
element().setAttribute(valueAttr, AtomicString(sanitizedValue)); |
} |
+bool BaseButtonInputType::matchesDefaultPseudoClass() |
+{ |
+ // HTMLFormElement::findDefaultButton() traverses the tree. So we check |
+ // canBeSuccessfulSubmitButton() first for early return. |
+ return canBeSuccessfulSubmitButton() && element().form() && element().form()->findDefaultButton() == &element(); |
+} |
+ |
} // namespace blink |