| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 | 57 |
| 58 void CheckboxInputType::handleKeyupEvent(KeyboardEvent* event) { | 58 void CheckboxInputType::handleKeyupEvent(KeyboardEvent* event) { |
| 59 const String& key = event->key(); | 59 const String& key = event->key(); |
| 60 if (key != " ") | 60 if (key != " ") |
| 61 return; | 61 return; |
| 62 dispatchSimulatedClickIfActive(event); | 62 dispatchSimulatedClickIfActive(event); |
| 63 } | 63 } |
| 64 | 64 |
| 65 ClickHandlingState* CheckboxInputType::willDispatchClick() { | 65 ClickHandlingState* CheckboxInputType::willDispatchClick() { |
| 66 // An event handler can use preventDefault or "return false" to reverse the ch
ecking we do here. | 66 // An event handler can use preventDefault or "return false" to reverse the |
| 67 // The ClickHandlingState object contains what we need to undo what we did her
e in didDispatchClick. | 67 // checking we do here. The ClickHandlingState object contains what we need |
| 68 // to undo what we did here in didDispatchClick. |
| 68 | 69 |
| 69 ClickHandlingState* state = new ClickHandlingState; | 70 ClickHandlingState* state = new ClickHandlingState; |
| 70 | 71 |
| 71 state->checked = element().checked(); | 72 state->checked = element().checked(); |
| 72 state->indeterminate = element().indeterminate(); | 73 state->indeterminate = element().indeterminate(); |
| 73 | 74 |
| 74 if (state->indeterminate) | 75 if (state->indeterminate) |
| 75 element().setIndeterminate(false); | 76 element().setIndeterminate(false); |
| 76 | 77 |
| 77 element().setChecked(!state->checked, DispatchChangeEvent); | 78 element().setChecked(!state->checked, DispatchChangeEvent); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 90 m_isInClickHandler = false; | 91 m_isInClickHandler = false; |
| 91 // The work we did in willDispatchClick was default handling. | 92 // The work we did in willDispatchClick was default handling. |
| 92 event->setDefaultHandled(); | 93 event->setDefaultHandled(); |
| 93 } | 94 } |
| 94 | 95 |
| 95 bool CheckboxInputType::shouldAppearIndeterminate() const { | 96 bool CheckboxInputType::shouldAppearIndeterminate() const { |
| 96 return element().indeterminate(); | 97 return element().indeterminate(); |
| 97 } | 98 } |
| 98 | 99 |
| 99 } // namespace blink | 100 } // namespace blink |
| OLD | NEW |