OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |