WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
24955
space bar does not play/pause when in standalone QuickTime movie
https://bugs.webkit.org/show_bug.cgi?id=24955
Summary
space bar does not play/pause when in standalone QuickTime movie
Dean Jackson
Reported
2009-03-30 18:07:17 PDT
Standalone MediaDocuments do not play/pause when you press space bar. <
rdar://problem/6635099
>
Attachments
patch
(2.05 KB, patch)
2009-03-30 18:10 PDT
,
Dean Jackson
simon.fraser
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Dean Jackson
Comment 1
2009-03-30 18:10:15 PDT
Created
attachment 29102
[details]
patch Needs manual testing since it is a standalone media document.
Simon Fraser (smfr)
Comment 2
2009-03-30 18:16:59 PDT
Comment on
attachment 29102
[details]
patch
> diff --git a/WebCore/loader/MediaDocument.cpp b/WebCore/loader/MediaDocument.cpp > index b89ac10..85aa48d 100644
> + if (event->type() == eventNames().keydownEvent && event->isKeyboardEvent()) { > + KeyboardEvent* k = static_cast<KeyboardEvent*>(event);
Please use a better variable name than 'k'.
> + HTMLVideoElement* video; > + if (targetNode) { > + if (targetNode->hasTagName(videoTag)) > + video = static_cast<HTMLVideoElement*>(targetNode); > + else { > + RefPtr<NodeList> nodeList = targetNode->getElementsByTagName("video"); > + if (nodeList.get()->length() > 0) > + video = static_cast<HTMLVideoElement*>(nodeList.get()->item(0));
When does this happen? When the event target is the document? Since this is MediaDocument.cpp, can you get to the media element directly?
> + } > + }
What about standalone audio?
> + if (video) { > + if (k->keyIdentifier() == "U+0020") { // space
This is convention used elsewhere? r- for now, but I think it's generally sound.
Dean Jackson
Comment 3
2009-03-30 18:30:49 PDT
> When does this happen? When the event target is the document? Since this is MediaDocument.cpp, > can you get to the media element directly?
Yes, when the target is the document. The alternative would be to have the user focus the media element and then wait for the keyboard event, which is obviously not useful (and a regression). And no, you can't get to the media element directly. The MediaDocument fires up a tokeniser which inserts the video directly. I could work it so the document holds a reference to the media - I wasn't sure which was the best way.
> What about standalone audio?
Standalone audio is standalone video. The MediaDocument tokeniser always makes a video element.
> This is convention used elsewhere?
I had a choice here between looking at the keyCode (would be 32 for space) or the keyIdentifier. Most of the other code I looked at uses keyIdentifier. I'm not sure why, since it is string comparison.
Dean Jackson
Comment 4
2009-03-30 18:35:17 PDT
Looking again, it seems sometimes people use keyCode and sometimes they use keyIdentifier. Obviously they use keyIdentifier for things like PageUp and Enter, but see HTMLButtonElement for an example checking for U+0020 like I do. I don't care either way.
Dean Jackson
Comment 5
2009-03-30 18:38:00 PDT
Keeping a reference to the media element would be a more intrusive change (eg. changing two class definitions rather than just this method). However, since we're in a standalone document it's only one extra reference - not a memory issue. Upside is that we don't search the document with every keypress. Either way fine with me, but I'm tempted to keep the changes to a minimum.
Dean Jackson
Comment 6
2009-03-30 18:40:35 PDT
Of course, I meant ie not eg. See
http://www.imdb.com/title/tt0113161/quotes
Simon Fraser (smfr)
Comment 7
2009-03-30 20:04:48 PDT
Comment on
attachment 29102
[details]
patch OK, r+ but please use a better name than 'k' (suggest: "keyboardEvent").
Dean Jackson
Comment 8
2009-03-31 12:51:19 PDT
Committed
r42134
M WebCore/ChangeLog M WebCore/loader/MediaDocument.cpp
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug