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

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>16673</bug_id>
          
          <creation_ts>2012-04-09 21:18:39 +0000</creation_ts>
          <short_desc>Specify how MouseEventExtension coordinates are set using initMouseEvent()</short_desc>
          <delta_ts>2015-10-05 00:56:16 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>CSS</product>
          <component>CSSOM View</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Jacob Rossi [MSFT]">jrossi</reporter>
          <assigned_to name="Simon Pieters">zcorpan</assigned_to>
          <cc>bzbarsky</cc>
    
    <cc>travil</cc>
    
    <cc>zcorpan</cc>
          
          <qa_contact>public-css-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>66536</commentid>
    <comment_count>0</comment_count>
    <who name="Jacob Rossi [MSFT]">jrossi</who>
    <bug_when>2012-04-09 21:18:39 +0000</bug_when>
    <thetext>The initMouseEvent() method from DOM L3 Events allows for the creation of synthetic mouse events [1]. However, it seems it was defined prior to the existence/standardization of the extensions to MouseEvent [2]. For compatibility reasons, we don&apos;t believe we can change the signature of initMouseEvent() to include properties like pageX/pageY.  Instead, we suggest calculating these values based on the inputs provided for clientX/clientY. This seems to be what Webkit (and to some extent, Firefox) do.

pageX =  clientX + scrollLeft  (using the values at the time of calling initMouseEvent)
pageY = clientY + scrollTop
x = clientX
y = clientY

Prior to calling dispatchEvent() (which indicates a target element for the event)&quot;
offsetX = pageX
offsetY = pageY

After calling dispatchEvent()  (e.g. during and after the dispatch of the event):
offsetX = the x offset relative to the padding edge of the target element (as reported in the element&apos;s coordinate space)
offsetY = the y offset relative to the padding edge of the target element (as reported in the element&apos;s coordinate space)

[1]http://dev.w3.org/2006/webapi/DOM-Level-3-Events/html/DOM3-Events.html#events-event-type-initMouseEvent
[2]http://dev.w3.org/csswg/cssom-view/#extensions-to-the-mouseevent-interface</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71799</commentid>
    <comment_count>1</comment_count>
    <who name="Glenn Adams">glenn</who>
    <bug_when>2012-08-03 05:55:15 +0000</bug_when>
    <thetext>reassign to myself; apparently i am not the default assignee for this component</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87707</commentid>
    <comment_count>2</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2013-05-15 09:57:26 +0000</bug_when>
    <thetext>(In reply to comment #0)
&gt; pageX =  clientX + scrollLeft  (using the values at the time of calling
&gt; initMouseEvent)
&gt; pageY = clientY + scrollTop

scrollLeft and scrollTop of what?

Do you have test cases in this area I can look at?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89407</commentid>
    <comment_count>3</comment_count>
      <attachid>1373</attachid>
    <who name="Travis Leithead [MSFT]">travil</who>
    <bug_when>2013-06-17 19:15:15 +0000</bug_when>
    <thetext>Created attachment 1373
Test case for synthetic event pageX/pageY calculation...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89408</commentid>
    <comment_count>4</comment_count>
    <who name="Travis Leithead [MSFT]">travil</who>
    <bug_when>2013-06-17 19:17:07 +0000</bug_when>
    <thetext>In IE/Firefox, this appears to be the scrollLeft/Top of the documentElement (HTML).

Chrome&apos;s scrollLeft/top for the viewport are on body, but regardless, Chrome does not seem to do this pageX/pageY calculation on dispatch.

Attachment included.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>89455</commentid>
    <comment_count>5</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2013-06-18 08:42:35 +0000</bug_when>
    <thetext>Thanks!

https://dvcs.w3.org/hg/csswg/rev/39af9667776a</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123218</commentid>
    <comment_count>6</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2015-09-16 07:17:41 +0000</bug_when>
    <thetext>The fix here seems to have caused some other problems, see
https://bugzilla.mozilla.org/show_bug.cgi?id=1203404</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123229</commentid>
    <comment_count>7</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2015-09-16 14:58:59 +0000</bug_when>
    <thetext>That&apos;s because the fix here didn&apos;t match the behavior description in comment 0.  From comment 0 again:

  Prior to calling dispatchEvent() (which indicates a target element for the
  event)&quot;
    offsetX = pageX

  After calling dispatchEvent()  (e.g. during and after the dispatch of the
  event):
    offsetX = the x offset relative to the padding edge of the target element (as
    reported in the element&apos;s coordinate space)

The behavior in the spec doesn&apos;t do &quot;during and after the dispatch&quot;.  It just does &quot;during the dispatch&quot;, and goes back to &quot;pageX&quot; after the dispatch.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>1373</attachid>
            <date>2013-06-17 19:15:15 +0000</date>
            <delta_ts>2013-06-17 19:15:15 +0000</delta_ts>
            <desc>Test case for synthetic event pageX/pageY calculation...</desc>
            <filename>computedPageXY.htm</filename>
            <type>text/html</type>
            <size>1664</size>
            <attacher name="Travis Leithead [MSFT]">travil</attacher>
            
              <data encoding="base64">PCFET0NUWVBFIGh0bWw+DQo8Ym9keT4NCjxwcmU+DQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoN
Cg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0K
DQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoN
Cg0KDQoNCg0KDQoNCg0KDQoNCg0KDQoNCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg
ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgDQo8L3ByZT4NCjxidXR0b24gc3R5
bGU9ImZsb2F0OnJpZ2h0Ij50ZXN0PC9idXR0b24+DQo8ZGl2IGlkPSJ0YXJnZXQiPjwvZGl2Pg0K
PHNjcmlwdD4NCmRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoImJ1dHRvbiIpLmFkZEV2ZW50TGlzdGVu
ZXIoImNsaWNrIiwgZnVuY3Rpb24gKGUpIHsNCiAgdmFyIG1lID0gZG9jdW1lbnQuY3JlYXRlRXZl
bnQoIk1vdXNlRXZlbnQiKTsNCiAgbWUuaW5pdE1vdXNlRXZlbnQoIm1vdXNlZG93biIsIHRydWUs
IHRydWUsIA0KICAgICAgICAgICAgICAgICAgLyp3aW5kb3cqL251bGwsIC8qZGV0YWlsKi8wLCAN
CiAgICAgICAgICAgICAgICAgIC8qc2NyZWVuWCovMzUwLCAvKnNjcmVlblkqLzM1MCwNCiAgICAg
ICAgICAgICAgICAgIC8qY2xpZW50WCovNTAsIC8qY2xpZW50WSovNTAsDQogICAgICAgICAgICAg
ICAgICAvKmN0cmwqL2ZhbHNlLCAvKmFsdCovZmFsc2UsIC8qc2hpZnQqL2ZhbHNlLCAvKm1ldGEq
L2ZhbHNlLA0KICAgICAgICAgICAgICAgICAgLypidXR0b24qLzAsDQogICAgICAgICAgICAgICAg
ICAvKnJlbGF0ZWRUYXJnZXQqL251bGwpOw0KICBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKCIjdGFy
Z2V0IikuZGlzcGF0Y2hFdmVudChtZSk7DQogIGUuc3RvcFByb3BhZ2F0aW9uKCk7DQp9KTsNCmRv
Y3VtZW50LnF1ZXJ5U2VsZWN0b3IoIiN0YXJnZXQiKS5hZGRFdmVudExpc3RlbmVyKCJtb3VzZWRv
d24iLCBmdW5jdGlvbihlKSB7DQogICBhbGVydCgic3ludGhldGljIG1vdXNlZG93biBmaXJlZFxu
XG4iICsgDQogICAgICAgICAiZG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50LnNjcm9sbExlZnQoIiAr
IGRvY3VtZW50LmRvY3VtZW50RWxlbWVudC5zY3JvbGxMZWZ0ICsgIikgKyAiICsgDQogICAgICAg
ICAiY2xpZW50WCgiICsgZS5jbGllbnRYICsgIikgPSAiICsNCiAgICAgICAgICJwYWdlWCgiICsg
ZS5wYWdlWCArICIpXG4iICsgDQogICAgICAgICAiZG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50LnNj
cm9sbFRvcCgiICsgZG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50LnNjcm9sbFRvcCArICIpICsgIiAr
IA0KICAgICAgICAgImNsaWVudFkoIiArIGUuY2xpZW50WSArICIpID0gIiArDQogICAgICAgICAi
cGFnZVkoIiArIGUucGFnZVkgKyAiKVxuIik7DQogICBlLnN0b3BQcm9wYWdhdGlvbigpOw0KfSk7
DQo8L3NjcmlwdD4=
</data>

          </attachment>
      

    </bug>

</bugzilla>