<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>24955</bug_id>
          
          <creation_ts>2009-03-30 18:07:17 -0700</creation_ts>
          <short_desc>space bar does not play/pause when in standalone QuickTime movie</short_desc>
          <delta_ts>2009-03-31 12:51:19 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Platform</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Dean Jackson">dino</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>cmarrin</cc>
    
    <cc>eric.carlson</cc>
    
    <cc>simon.fraser</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>115949</commentid>
    <comment_count>0</comment_count>
    <who name="Dean Jackson">dino</who>
    <bug_when>2009-03-30 18:07:17 -0700</bug_when>
    <thetext>Standalone MediaDocuments do not play/pause when you press space bar.
&lt;rdar://problem/6635099&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>115950</commentid>
    <comment_count>1</comment_count>
      <attachid>29102</attachid>
    <who name="Dean Jackson">dino</who>
    <bug_when>2009-03-30 18:10:15 -0700</bug_when>
    <thetext>Created attachment 29102
patch

Needs manual testing since it is a standalone media document.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>115953</commentid>
    <comment_count>2</comment_count>
      <attachid>29102</attachid>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2009-03-30 18:16:59 -0700</bug_when>
    <thetext>Comment on attachment 29102
patch


&gt; diff --git a/WebCore/loader/MediaDocument.cpp b/WebCore/loader/MediaDocument.cpp
&gt; index b89ac10..85aa48d 100644

&gt; +    if (event-&gt;type() == eventNames().keydownEvent &amp;&amp; event-&gt;isKeyboardEvent()) {
&gt; +        KeyboardEvent* k = static_cast&lt;KeyboardEvent*&gt;(event);

Please use a better variable name than &apos;k&apos;.

&gt; +        HTMLVideoElement* video;
&gt; +        if (targetNode) {
&gt; +            if (targetNode-&gt;hasTagName(videoTag))
&gt; +                video = static_cast&lt;HTMLVideoElement*&gt;(targetNode);
&gt; +            else {
&gt; +                RefPtr&lt;NodeList&gt; nodeList = targetNode-&gt;getElementsByTagName(&quot;video&quot;);
&gt; +                if (nodeList.get()-&gt;length() &gt; 0)
&gt; +                    video = static_cast&lt;HTMLVideoElement*&gt;(nodeList.get()-&gt;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?

&gt; +            }
&gt; +        }

What about standalone audio?

&gt; +        if (video) {
&gt; +            if (k-&gt;keyIdentifier() == &quot;U+0020&quot;) { // space

This is convention used elsewhere?

r- for now, but I think it&apos;s generally sound.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>115957</commentid>
    <comment_count>3</comment_count>
    <who name="Dean Jackson">dino</who>
    <bug_when>2009-03-30 18:30:49 -0700</bug_when>
    <thetext>&gt; When does this happen? When the event target is the document? Since this is MediaDocument.cpp,
&gt; 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&apos;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&apos;t sure which was the best way.

&gt; What about standalone audio?

Standalone audio is standalone video. The MediaDocument tokeniser always makes a video element.

&gt; 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&apos;m not sure why, since it is string comparison.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>115958</commentid>
    <comment_count>4</comment_count>
    <who name="Dean Jackson">dino</who>
    <bug_when>2009-03-30 18:35:17 -0700</bug_when>
    <thetext>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&apos;t care either way.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>115959</commentid>
    <comment_count>5</comment_count>
    <who name="Dean Jackson">dino</who>
    <bug_when>2009-03-30 18:38:00 -0700</bug_when>
    <thetext>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&apos;re in a standalone document it&apos;s only one extra reference - not a memory issue. Upside is that we don&apos;t search the document with every keypress.

Either way fine with me, but I&apos;m tempted to keep the changes to a minimum.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>115961</commentid>
    <comment_count>6</comment_count>
    <who name="Dean Jackson">dino</who>
    <bug_when>2009-03-30 18:40:35 -0700</bug_when>
    <thetext>Of course, I meant ie not eg.
See http://www.imdb.com/title/tt0113161/quotes
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>115979</commentid>
    <comment_count>7</comment_count>
      <attachid>29102</attachid>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2009-03-30 20:04:48 -0700</bug_when>
    <thetext>Comment on attachment 29102
patch

OK, r+ but please use a better name than &apos;k&apos; (suggest: &quot;keyboardEvent&quot;).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116056</commentid>
    <comment_count>8</comment_count>
    <who name="Dean Jackson">dino</who>
    <bug_when>2009-03-31 12:51:19 -0700</bug_when>
    <thetext>Committed r42134
	M	WebCore/ChangeLog
	M	WebCore/loader/MediaDocument.cpp
</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>29102</attachid>
            <date>2009-03-30 18:10:15 -0700</date>
            <delta_ts>2009-03-30 20:04:48 -0700</delta_ts>
            <desc>patch</desc>
            <filename>spacebar.patch</filename>
            <type>text/plain</type>
            <size>2100</size>
            <attacher name="Dean Jackson">dino</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1dlYkNvcmUvQ2hhbmdlTG9nIGIvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXgg
MWE5NDJmMS4uYjAwOTJhYiAxMDA2NDQKLS0tIGEvV2ViQ29yZS9DaGFuZ2VMb2cKKysrIGIvV2Vi
Q29yZS9DaGFuZ2VMb2cKQEAgLTEsMyArMSwxNCBAQAorMjAwOS0wMy0zMCAgRGVhbiBKYWNrc29u
ICA8ZGlub0BhcHBsZS5jb20+CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISku
CisKKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTI0OTU1
CisgICAgICAgIAorICAgICAgICBTcGFjZWJhciBkaWRuJ3QgcGxheS9wYXVzZSBpbiBzdGFuZGFs
b25lIE1lZGlhRG9jdW1lbnQKKyAgICAgICAgCisgICAgICAgICogbG9hZGVyL01lZGlhRG9jdW1l
bnQuY3BwOgorICAgICAgICAoV2ViQ29yZTo6TWVkaWFEb2N1bWVudDo6ZGVmYXVsdEV2ZW50SGFu
ZGxlcik6CisKIDIwMDktMDMtMzAgIFRpbW90aHkgSGF0Y2hlciAgPHRpbW90aHlAYXBwbGUuY29t
PgogCiAgICAgICAgIDxyZGFyOi8vcHJvYmxlbS81ODM4ODcxPiBDcmFzaFRyYWNlcjogMTQ4MyBj
cmFzaGVzIFF1aWNrbG9va2luZwpkaWZmIC0tZ2l0IGEvV2ViQ29yZS9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dmlkZW8gPSBzdGF0aWNfY2FzdDxIVE1MVmlkZW9FbGVtZW50Kj4odGFyZ2V0Tm9kZSk7CisgICAg
ICAgICAgICBlbHNlIHsKKyAgICAgICAgICAgICAgICBSZWZQdHI8Tm9kZUxpc3Q+IG5vZGVMaXN0
ID0gdGFyZ2V0Tm9kZS0+Z2V0RWxlbWVudHNCeVRhZ05hbWUoInZpZGVvIik7CisgICAgICAgICAg
ICAgICAgaWYgKG5vZGVMaXN0LmdldCgpLT5sZW5ndGgoKSA+IDApCisgICAgICAgICAgICAgICAg
ICAgIHZpZGVvID0gc3RhdGljX2Nhc3Q8SFRNTFZpZGVvRWxlbWVudCo+KG5vZGVMaXN0LmdldCgp
LT5pdGVtKDApKTsKKyAgICAgICAgICAgIH0KKyAgICAgICAgfQorICAgICAgICBpZiAodmlkZW8p
IHsKKyAgICAgICAgICAgIGlmIChrLT5rZXlJZGVudGlmaWVyKCkgPT0gIlUrMDAyMCIpIHsgLy8g
c3BhY2UKKyAgICAgICAgICAgICAgICBpZiAodmlkZW8tPnBhdXNlZCgpKSB7CisgICAgICAgICAg
ICAgICAgICAgIGlmICh2aWRlby0+Y2FuUGxheSgpKQorICAgICAgICAgICAgICAgICAgICAgICAg
dmlkZW8tPnBsYXkoKTsKKyAgICAgICAgICAgICAgICB9IGVsc2UKKyAgICAgICAgICAgICAgICAg
ICAgdmlkZW8tPnBhdXNlKCk7CisgICAgICAgICAgICAgICAgZXZlbnQtPnNldERlZmF1bHRIYW5k
bGVkKCk7CisgICAgICAgICAgICB9CisgICAgICAgIH0KKyAgICB9CiB9CiAKIH0K
</data>
<flag name="review"
          id="14417"
          type_id="1"
          status="+"
          setter="simon.fraser"
    />
          </attachment>
      

    </bug>

</bugzilla>