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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLButtonElement.cpp

Issue 2900943002: Clicking a button on disconnected form should not fire submit event. (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 if (formOwner() && isConnected()) 98 if (formOwner() && isConnected())
99 formOwner()->InvalidateDefaultButtonStyle(); 99 formOwner()->InvalidateDefaultButtonStyle();
100 } else { 100 } else {
101 if (params.name == formactionAttr) 101 if (params.name == formactionAttr)
102 LogUpdateAttributeIfIsolatedWorldAndInDocument("button", params); 102 LogUpdateAttributeIfIsolatedWorldAndInDocument("button", params);
103 HTMLFormControlElement::ParseAttribute(params); 103 HTMLFormControlElement::ParseAttribute(params);
104 } 104 }
105 } 105 }
106 106
107 void HTMLButtonElement::DefaultEventHandler(Event* event) { 107 void HTMLButtonElement::DefaultEventHandler(Event* event) {
108 if (!isConnected())
tkent 2017/05/23 06:55:26 Here is not a right place to check this. We have a
Shanmuga Pandi 2017/05/23 10:34:04 Done.
109 return;
110
108 if (event->type() == EventTypeNames::DOMActivate && 111 if (event->type() == EventTypeNames::DOMActivate &&
109 !IsDisabledFormControl()) { 112 !IsDisabledFormControl()) {
110 if (Form() && type_ == SUBMIT) { 113 if (Form() && type_ == SUBMIT) {
111 Form()->PrepareForSubmission(event, this); 114 Form()->PrepareForSubmission(event, this);
112 event->SetDefaultHandled(); 115 event->SetDefaultHandled();
113 } 116 }
114 if (Form() && type_ == RESET) { 117 if (Form() && type_ == RESET) {
115 Form()->reset(); 118 Form()->reset();
116 event->SetDefaultHandled(); 119 event->SetDefaultHandled();
117 } 120 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 Node::InsertionNotificationRequest HTMLButtonElement::InsertedInto( 212 Node::InsertionNotificationRequest HTMLButtonElement::InsertedInto(
210 ContainerNode* insertion_point) { 213 ContainerNode* insertion_point) {
211 InsertionNotificationRequest request = 214 InsertionNotificationRequest request =
212 HTMLFormControlElement::InsertedInto(insertion_point); 215 HTMLFormControlElement::InsertedInto(insertion_point);
213 LogAddElementIfIsolatedWorldAndInDocument("button", typeAttr, formmethodAttr, 216 LogAddElementIfIsolatedWorldAndInDocument("button", typeAttr, formmethodAttr,
214 formactionAttr); 217 formactionAttr);
215 return request; 218 return request;
216 } 219 }
217 220
218 } // namespace blink 221 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/external/wpt/html/semantics/forms/the-button-element/button-click-submits-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698