Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(549)

Unified Diff: third_party/WebKit/Source/core/html/forms/BaseButtonInputType.cpp

Issue 1756483005: Option, checkbox and radio should support ':default' selector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated as per review comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698