| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 return; | 135 return; |
| 136 | 136 |
| 137 if (event->type() == EventTypeNames::keydown && event->isKeyboardEvent()) { | 137 if (event->type() == EventTypeNames::keydown && event->isKeyboardEvent()) { |
| 138 HTMLVideoElement* video = Traversal<HTMLVideoElement>::firstWithin(*targ
etNode); | 138 HTMLVideoElement* video = Traversal<HTMLVideoElement>::firstWithin(*targ
etNode); |
| 139 if (!video) | 139 if (!video) |
| 140 return; | 140 return; |
| 141 | 141 |
| 142 KeyboardEvent* keyboardEvent = toKeyboardEvent(event); | 142 KeyboardEvent* keyboardEvent = toKeyboardEvent(event); |
| 143 if (keyboardEvent->keyIdentifier() == "U+0020" || keyboardEvent->keyCode
() == VKEY_MEDIA_PLAY_PAUSE) { | 143 if (keyboardEvent->keyIdentifier() == "U+0020" || keyboardEvent->keyCode
() == VKEY_MEDIA_PLAY_PAUSE) { |
| 144 // space or media key (play/pause) | 144 // space or media key (play/pause) |
| 145 if (video->paused()) { | 145 video->togglePlayState(); |
| 146 if (video->canPlay()) | |
| 147 video->play(); | |
| 148 } else | |
| 149 video->pause(); | |
| 150 event->setDefaultHandled(); | 146 event->setDefaultHandled(); |
| 151 } | 147 } |
| 152 } | 148 } |
| 153 } | 149 } |
| 154 | 150 |
| 155 } | 151 } |
| OLD | NEW |