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

Unified Diff: Source/core/html/HTMLFormElement.cpp

Issue 60573007: Non-activated default buttons prevent implicit form submission. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Retire dated comment on button names Created 7 years, 1 month 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
« no previous file with comments | « Source/core/html/HTMLFormControlElement.cpp ('k') | Source/core/html/HTMLInputElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLFormElement.cpp
diff --git a/Source/core/html/HTMLFormElement.cpp b/Source/core/html/HTMLFormElement.cpp
index 7649e6e3900f6acf67e6fd2a13e0ff3512c587c2..61305ef52daea29c0f01e99a7127c392c317f461 100644
--- a/Source/core/html/HTMLFormElement.cpp
+++ b/Source/core/html/HTMLFormElement.cpp
@@ -173,18 +173,27 @@ Node* HTMLFormElement::item(unsigned index)
void HTMLFormElement::submitImplicitly(Event* event, bool fromImplicitSubmissionTrigger)
{
int submissionTriggerCount = 0;
+ bool seenDefaultButton = false;
for (unsigned i = 0; i < m_associatedElements.size(); ++i) {
FormAssociatedElement* formAssociatedElement = m_associatedElements[i];
if (!formAssociatedElement->isFormControlElement())
continue;
HTMLFormControlElement* control = toHTMLFormControlElement(formAssociatedElement);
- if (control->isSuccessfulSubmitButton()) {
- if (control->renderer()) {
- control->dispatchSimulatedClick(event);
+ if (!seenDefaultButton && control->canBeSuccessfulSubmitButton()) {
+ if (fromImplicitSubmissionTrigger)
+ seenDefaultButton = true;
+ if (control->isSuccessfulSubmitButton()) {
+ if (control->renderer()) {
+ control->dispatchSimulatedClick(event);
+ return;
+ }
+ } else if (fromImplicitSubmissionTrigger) {
+ // Default (submit) button is not activated; no implicit submission.
return;
}
- } else if (control->canTriggerImplicitSubmission())
+ } else if (control->canTriggerImplicitSubmission()) {
++submissionTriggerCount;
+ }
}
if (fromImplicitSubmissionTrigger && submissionTriggerCount == 1)
prepareForSubmission(event);
« no previous file with comments | « Source/core/html/HTMLFormControlElement.cpp ('k') | Source/core/html/HTMLInputElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698