| 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);
|
|
|