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

Side by Side Diff: Source/core/html/MediaDocument.cpp

Issue 214793005: Use HTMLMediaElement::togglePlayState() where appropriate (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: documentation Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « Source/core/html/MediaControllerInterface.h ('k') | Source/core/html/shadow/MediaControlElements.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698