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

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

Issue 2045603002: Handle the "key" field as opposed to keyIdentifier field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove initialization of the view Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return element().isRequired() && !element().checked(); 54 return element().isRequired() && !element().checked();
55 } 55 }
56 56
57 String CheckboxInputType::valueMissingText() const 57 String CheckboxInputType::valueMissingText() const
58 { 58 {
59 return locale().queryString(WebLocalizedString::ValidationValueMissingForChe ckbox); 59 return locale().queryString(WebLocalizedString::ValidationValueMissingForChe ckbox);
60 } 60 }
61 61
62 void CheckboxInputType::handleKeyupEvent(KeyboardEvent* event) 62 void CheckboxInputType::handleKeyupEvent(KeyboardEvent* event)
63 { 63 {
64 const String& key = event->keyIdentifier(); 64 const String& key = event->key();
65 if (key != "U+0020") 65 if (key != " ")
66 return; 66 return;
67 dispatchSimulatedClickIfActive(event); 67 dispatchSimulatedClickIfActive(event);
68 } 68 }
69 69
70 ClickHandlingState* CheckboxInputType::willDispatchClick() 70 ClickHandlingState* CheckboxInputType::willDispatchClick()
71 { 71 {
72 // An event handler can use preventDefault or "return false" to reverse the checking we do here. 72 // An event handler can use preventDefault or "return false" to reverse the checking we do here.
73 // The ClickHandlingState object contains what we need to undo what we did h ere in didDispatchClick. 73 // The ClickHandlingState object contains what we need to undo what we did h ere in didDispatchClick.
74 74
75 ClickHandlingState* state = new ClickHandlingState; 75 ClickHandlingState* state = new ClickHandlingState;
(...skipping 21 matching lines...) Expand all
97 // The work we did in willDispatchClick was default handling. 97 // The work we did in willDispatchClick was default handling.
98 event->setDefaultHandled(); 98 event->setDefaultHandled();
99 } 99 }
100 100
101 bool CheckboxInputType::shouldAppearIndeterminate() const 101 bool CheckboxInputType::shouldAppearIndeterminate() const
102 { 102 {
103 return element().indeterminate(); 103 return element().indeterminate();
104 } 104 }
105 105
106 } // namespace blink 106 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698