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

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

Issue 2390563002: Reflow comments in core/html/forms/. (Closed)
Patch Set: Created 4 years, 2 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) 2010, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2010, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2011 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 25 matching lines...) Expand all
36 36
37 namespace blink { 37 namespace blink {
38 38
39 using namespace HTMLNames; 39 using namespace HTMLNames;
40 40
41 void KeyboardClickableInputTypeView::handleKeydownEvent(KeyboardEvent* event) { 41 void KeyboardClickableInputTypeView::handleKeydownEvent(KeyboardEvent* event) {
42 const String& key = event->key(); 42 const String& key = event->key();
43 if (key == " ") { 43 if (key == " ") {
44 element().setActive(true); 44 element().setActive(true);
45 // No setDefaultHandled(), because IE dispatches a keypress in this case 45 // No setDefaultHandled(), because IE dispatches a keypress in this case
46 // and the caller will only dispatch a keypress if we don't call setDefaultH andled(). 46 // and the caller will only dispatch a keypress if we don't call
47 // setDefaultHandled().
47 } 48 }
48 } 49 }
49 50
50 void KeyboardClickableInputTypeView::handleKeypressEvent(KeyboardEvent* event) { 51 void KeyboardClickableInputTypeView::handleKeypressEvent(KeyboardEvent* event) {
51 int charCode = event->charCode(); 52 int charCode = event->charCode();
52 if (charCode == '\r') { 53 if (charCode == '\r') {
53 element().dispatchSimulatedClick(event); 54 element().dispatchSimulatedClick(event);
54 event->setDefaultHandled(); 55 event->setDefaultHandled();
55 return; 56 return;
56 } 57 }
57 if (charCode == ' ') { 58 if (charCode == ' ') {
58 // Prevent scrolling down the page. 59 // Prevent scrolling down the page.
59 event->setDefaultHandled(); 60 event->setDefaultHandled();
60 } 61 }
61 } 62 }
62 63
63 void KeyboardClickableInputTypeView::handleKeyupEvent(KeyboardEvent* event) { 64 void KeyboardClickableInputTypeView::handleKeyupEvent(KeyboardEvent* event) {
64 const String& key = event->key(); 65 const String& key = event->key();
65 if (key != " ") 66 if (key != " ")
66 return; 67 return;
67 // Simulate mouse click for spacebar for button types. 68 // Simulate mouse click for spacebar for button types.
68 dispatchSimulatedClickIfActive(event); 69 dispatchSimulatedClickIfActive(event);
69 } 70 }
70 71
71 // FIXME: Could share this with BaseCheckableInputType and RangeInputType if we had a common base class. 72 // FIXME: Could share this with BaseCheckableInputType and RangeInputType if we
73 // had a common base class.
72 void KeyboardClickableInputTypeView::accessKeyAction(bool sendMouseEvents) { 74 void KeyboardClickableInputTypeView::accessKeyAction(bool sendMouseEvents) {
73 InputTypeView::accessKeyAction(sendMouseEvents); 75 InputTypeView::accessKeyAction(sendMouseEvents);
74 element().dispatchSimulatedClick( 76 element().dispatchSimulatedClick(
75 0, sendMouseEvents ? SendMouseUpDownEvents : SendNoEvents); 77 0, sendMouseEvents ? SendMouseUpDownEvents : SendNoEvents);
76 } 78 }
77 79
78 } // namespace blink 80 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698