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

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

Issue 16194013: Mouse press should focus on any types of form controls. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 6 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 | Annotate | Revision Log
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 event->setDefaultHandled(); 118 event->setDefaultHandled();
119 m_isActivatedSubmit = false; // Do this in case submission was cance led. 119 m_isActivatedSubmit = false; // Do this in case submission was cance led.
120 } 120 }
121 if (form() && m_type == RESET) { 121 if (form() && m_type == RESET) {
122 form()->reset(); 122 form()->reset();
123 event->setDefaultHandled(); 123 event->setDefaultHandled();
124 } 124 }
125 } 125 }
126 126
127 if (event->isKeyboardEvent()) { 127 if (event->isKeyboardEvent()) {
128 if (event->type() == eventNames().keydownEvent && static_cast<KeyboardEv ent*>(event)->keyIdentifier() == "U+0020") { 128 if (event->type() == eventNames().keydownEvent) {
129 setActive(true, true); 129 willHandleKeyDownEvent();
130 // No setDefaultHandled() - IE dispatches a keypress in this case. 130 if (static_cast<KeyboardEvent*>(event)->keyIdentifier() == "U+0020") {
131 return; 131 setActive(true, true);
132 // No setDefaultHandled() - IE dispatches a keypress in this cas e.
133 return;
134 }
132 } 135 }
133 if (event->type() == eventNames().keypressEvent) { 136 if (event->type() == eventNames().keypressEvent) {
134 switch (static_cast<KeyboardEvent*>(event)->charCode()) { 137 switch (static_cast<KeyboardEvent*>(event)->charCode()) {
135 case '\r': 138 case '\r':
136 dispatchSimulatedClick(event); 139 dispatchSimulatedClick(event);
137 event->setDefaultHandled(); 140 event->setDefaultHandled();
138 return; 141 return;
139 case ' ': 142 case ' ':
140 // Prevent scrolling down the page. 143 // Prevent scrolling down the page.
141 event->setDefaultHandled(); 144 event->setDefaultHandled();
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 { 204 {
202 return getAttribute(valueAttr); 205 return getAttribute(valueAttr);
203 } 206 }
204 207
205 bool HTMLButtonElement::recalcWillValidate() const 208 bool HTMLButtonElement::recalcWillValidate() const
206 { 209 {
207 return m_type == SUBMIT && HTMLFormControlElement::recalcWillValidate(); 210 return m_type == SUBMIT && HTMLFormControlElement::recalcWillValidate();
208 } 211 }
209 212
210 } // namespace 213 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698