<?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>68034</bug_id>
          
          <creation_ts>2011-09-13 15:06:49 -0700</creation_ts>
          <short_desc>Update media-controls.js so it can find the timeline slider</short_desc>
          <delta_ts>2011-09-14 12:27:27 -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>Media</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</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>
          
          <blocked>68038</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Eric Carlson">eric.carlson</reporter>
          <assigned_to name="Eric Carlson">eric.carlson</assigned_to>
          <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>466586</commentid>
    <comment_count>0</comment_count>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2011-09-13 15:06:49 -0700</bug_when>
    <thetext>The mediaControlsButtonCoordinates() function in LayoutTests/media/media-controls.js returns the center point of an element in the media controller so it is possible to write cross-platform tests that use the controls. It doesn&apos;t work with the timeline slider or volume slider because it assumes that all of the elements in the controller are siblings.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466591</commentid>
    <comment_count>1</comment_count>
      <attachid>107239</attachid>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2011-09-13 15:12:53 -0700</bug_when>
    <thetext>Created attachment 107239
Proposed patch.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466682</commentid>
    <comment_count>2</comment_count>
      <attachid>107239</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2011-09-13 16:45:08 -0700</bug_when>
    <thetext>Comment on attachment 107239
Proposed patch.

View in context: https://bugs.webkit.org/attachment.cgi?id=107239&amp;action=review

r=me -- this code seems like it will work but there are some things worth fixing

&gt; LayoutTests/media/media-controls.js:2
&gt; +function mediaConrolsElement(parent, id)

Typo here: &quot;conrols&quot;.

Not sure that naming this argument “parent” is good; the code iterates the siblings of what’s passed in, not its children.

&gt; LayoutTests/media/media-controls.js:5
&gt; +    if (parent.nodeType !== Node.ELEMENT_NODE)
&gt; +        return null;

I don’t think this is needed. Not sure why you are checking the type of the first element in a sibling list but not the types of the rest. As far as I can tell no checking is needed.

&gt; LayoutTests/media/media-controls.js:7
&gt; +    controlID = &quot;-webkit-media-controls-&quot; + id;

Should use var here.

&gt; LayoutTests/media/media-controls.js:13
&gt; +            var childElement = mediaConrolsElement(element.firstChild, id);

This will work, but there are also non-recursive ways to walk an entire hierarchy.

&gt; LayoutTests/media/media-controls.js:25
&gt; +    var controlsShadow = internals.shadowRoot(element).firstChild.firstChild;

Would be nice to have a why comment here explaining why we are descending two levels deep with firstChild.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466744</commentid>
    <comment_count>3</comment_count>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2011-09-13 18:03:16 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; (From update of attachment 107239 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=107239&amp;action=review
&gt; 
&gt; r=me -- this code seems like it will work but there are some things worth fixing
&gt; 
&gt; &gt; LayoutTests/media/media-controls.js:2
&gt; &gt; +function mediaConrolsElement(parent, id)
&gt; 
&gt; Typo here: &quot;conrols&quot;.
&gt; 
&gt; Not sure that naming this argument “parent” is good; the code iterates the siblings of what’s passed in, not its children.
&gt; 
  Fixed both, thanks.

&gt; &gt; LayoutTests/media/media-controls.js:5
&gt; &gt; +    if (parent.nodeType !== Node.ELEMENT_NODE)
&gt; &gt; +        return null;
&gt; 
&gt; I don’t think this is needed. Not sure why you are checking the type of the first element in a sibling list but not the types of the rest. As far as I can tell no checking is needed.
&gt; 
  It was there because internals.shadowPseudoId() throws an exception if called for an element that doesn&apos;t have a shadow ID and the TEXT_NODE nodes don&apos;t, but a better way to deal with that is with a comment and a try block. Fixed.

&gt; &gt; LayoutTests/media/media-controls.js:7
&gt; &gt; +    controlID = &quot;-webkit-media-controls-&quot; + id;
&gt; 
&gt; Should use var here.
&gt; 
  Thanks, fixed.

&gt; &gt; LayoutTests/media/media-controls.js:13
&gt; &gt; +            var childElement = mediaConrolsElement(element.firstChild, id);
&gt; 
&gt; This will work, but there are also non-recursive ways to walk an entire hierarchy.
&gt; 
  The media controls hierarchy is small and shallow, so I left this as is for now.

&gt; &gt; LayoutTests/media/media-controls.js:25
&gt; &gt; +    var controlsShadow = internals.shadowRoot(element).firstChild.firstChild;
&gt; 
&gt; Would be nice to have a why comment here explaining why we are descending two levels deep with firstChild.
&gt;
  Good point, there isn&apos;t any reason to hard code it at two levels deep. Fixed.

Thanks!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>466780</commentid>
    <comment_count>4</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2011-09-13 19:10:56 -0700</bug_when>
    <thetext>&lt;rdar://problem/10120776&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>467236</commentid>
    <comment_count>5</comment_count>
    <who name="Eric Carlson">eric.carlson</who>
    <bug_when>2011-09-14 12:27:27 -0700</bug_when>
    <thetext>http://trac.webkit.org/changeset/95111</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>107239</attachid>
            <date>2011-09-13 15:12:53 -0700</date>
            <delta_ts>2011-09-13 16:45:08 -0700</delta_ts>
            <desc>Proposed patch.</desc>
            <filename>patch_1.txt</filename>
            <type>text/plain</type>
            <size>2367</size>
            <attacher name="Eric Carlson">eric.carlson</attacher>
            
              <data encoding="base64">SW5kZXg6IExheW91dFRlc3RzL0NoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBMYXlvdXRUZXN0cy9D
aGFuZ2VMb2cJKHJldmlzaW9uIDk1MDQ3KQorKysgTGF5b3V0VGVzdHMvQ2hhbmdlTG9nCSh3b3Jr
aW5nIGNvcHkpCkBAIC0xLDMgKzEsMTYgQEAKKzIwMTEtMDktMTMgIEVyaWMgQ2FybHNvbiAgPGVy
aWMuY2FybHNvbkBhcHBsZS5jb20+CisKKyAgICAgICAgVXBkYXRlIG1lZGlhLWNvbnRyb2xzLmpz
IHNvIGl0IGNhbiBmaW5kIHRoZSB0aW1lbGluZSBzbGlkZXIKKyAgICAgICAgaHR0cHM6Ly9idWdz
LndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTY4MDM0CisKKyAgICAgICAgRG9uJ3QgYXNzdW1l
IHRoYXQgYWxsIGVsZW1lbnRzIGluIHRoZSBtZWRpYSBjb250cm9sbGVyIHBzZXVkbyBET00gYXJl
IHNpYmxpbmdzLgorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAg
ICAgICogbWVkaWEvbWVkaWEtY29udHJvbHMuanM6CisgICAgICAgIChtZWRpYUNvbnJvbHNFbGVt
ZW50KToKKyAgICAgICAgKG1lZGlhQ29udHJvbHNCdXR0b25Db29yZGluYXRlcyk6CisKIDIwMTEt
MDktMTMgIFRpbSBIb3J0b24gIDx0aW1vdGh5X2hvcnRvbkBhcHBsZS5jb20+CiAKICAgICAgICAg
UkVHUkVTU0lPTiAoNjQyNzUpOiBTaGFwZSBwYXR0ZXJuLWltYWdlIGZpbGwgdHVybn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xlbWVudC5uZXh0U2libGluZykgeworICAgICAgICBp
ZiAoaW50ZXJuYWxzLnNoYWRvd1BzZXVkb0lkKGVsZW1lbnQpID09IGNvbnRyb2xJRCkKKyAgICAg
ICAgICAgIHJldHVybiBlbGVtZW50OworCisgICAgICAgIGlmIChlbGVtZW50LmZpcnN0Q2hpbGQp
IHsKKyAgICAgICAgICAgIHZhciBjaGlsZEVsZW1lbnQgPSBtZWRpYUNvbnJvbHNFbGVtZW50KGVs
ZW1lbnQuZmlyc3RDaGlsZCwgaWQpOworICAgICAgICAgICAgaWYgKGNoaWxkRWxlbWVudCkKKyAg
ICAgICAgICAgICAgICByZXR1cm4gY2hpbGRFbGVtZW50OwogICAgICAgICB9CiAgICAgfQogCisg
ICAgcmV0dXJuIG51bGw7Cit9CisKKworZnVuY3Rpb24gbWVkaWFDb250cm9sc0J1dHRvbkNvb3Jk
aW5hdGVzKGVsZW1lbnQsIGlkKQoreworICAgIHZhciBjb250cm9sc1NoYWRvdyA9IGludGVybmFs
cy5zaGFkb3dSb290KGVsZW1lbnQpLmZpcnN0Q2hpbGQuZmlyc3RDaGlsZDsKKyAgICB2YXIgYnV0
dG9uID0gbWVkaWFDb25yb2xzRWxlbWVudChjb250cm9sc1NoYWRvdywgaWQpOwogICAgIGlmICgh
YnV0dG9uKQotICAgICAgICB0aHJvdyAiRmFpbGVkIHRvIGZpbmQgYnV0dG9uICIgKyBpZDsKKyAg
ICAgICAgdGhyb3cgIkZhaWxlZCB0byBmaW5kIG1lZGlhIGNvbnRyb2wgZWxlbWVudCBJRCAnIiAr
IGlkICsgIiciOwogCiAgICAgdmFyIGJ1dHRvbkJvdW5kaW5nUmVjdCA9IGJ1dHRvbi5nZXRCb3Vu
ZGluZ0NsaWVudFJlY3QoKTsKICAgICB2YXIgeCA9IGJ1dHRvbkJvdW5kaW5nUmVjdC5sZWZ0ICsg
YnV0dG9uQm91bmRpbmdSZWN0LndpZHRoIC8gMjsK
</data>
<flag name="review"
          id="103882"
          type_id="1"
          status="+"
          setter="darin"
    />
          </attachment>
      

    </bug>

</bugzilla>