<?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>18780</bug_id>
          
          <creation_ts>2012-09-05 18:07:45 +0000</creation_ts>
          <short_desc>Fix event dispatching for shadow DOM and &lt;iframe seamless&gt;</short_desc>
          <delta_ts>2016-01-23 05:18:50 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>DOM</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</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>
          <dependson>21066</dependson>
          <blocked>16487</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Ian &apos;Hixie&apos; Hickson">ian</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>bugs</cc>
    
    <cc>dglazkov</cc>
    
    <cc>erik.arvidsson</cc>
    
    <cc>hayato</cc>
    
    <cc>ian</cc>
    
    <cc>jonas</cc>
    
    <cc>mike</cc>
    
    <cc>ojan</cc>
    
    <cc>www-dom</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>73243</commentid>
    <comment_count>0</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-09-05 18:07:45 +0000</bug_when>
    <thetext>This is to address the issues here:
   http://www.whatwg.org/issues/#seamless-events

Basically I&apos;d like a way to be able to, from the HTML spec, set up event retargetting so that I don&apos;t have to monkeypatch the DOM event dispatch model, I just need to invoke some hooks and get the effect described in the e-mails above. No need for DOM Core to know about Window, &lt;iframe&gt;, or MouseEvents, just define a way to configure the dispatch tree, and a &quot;spec callback&quot; that is invoked when events are to be cloned, to set up the events&apos; attributes and to determine if the events should be retargetted or something.

Ideally this would be specced in such a way that it could also be used for Web components when the dispatching for those is defined.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>73247</commentid>
    <comment_count>1</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2012-09-05 18:19:26 +0000</bug_when>
    <thetext>I thought it was agreed that event retargeting won&apos;t work with seamless.
However there were some comments about pre-calculating event target chain, if 
a new event would be dispatched to the outer document.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>73282</commentid>
    <comment_count>2</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2012-09-06 08:18:01 +0000</bug_when>
    <thetext>Since for seamless the trees can access each other synchronously, why not set the coordinates for mouse events and such relative to the outer document when dispatched within a seamless document and just extend the event tree (as is done already for Window).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>73285</commentid>
    <comment_count>3</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2012-09-06 09:01:34 +0000</bug_when>
    <thetext>Because the coordinates would be then wrong in the child document.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78616</commentid>
    <comment_count>4</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-11-21 23:56:02 +0000</bug_when>
    <thetext>Why wouldn&apos;t retargeting work? So long as it&apos;s a separate object, it seems like it&apos;d work fine.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78641</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2012-11-22 09:44:14 +0000</bug_when>
    <thetext>Dispatching takes an optional &quot;re-dispatching steps&quot;. After the capturing phase is completed, if those steps are given, those steps are run, and then it skips the target phase.

So you dispatch on the parent document first with those re-dispatching steps, and those re-dispatching steps get passed the event object (or a copy if you wish) which you mutate and dispatch on your document.

Does that work or did you envision something else?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78648</commentid>
    <comment_count>6</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2012-11-22 12:14:28 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; Why wouldn&apos;t retargeting work? So long as it&apos;s a separate object, it seems
&gt; like it&apos;d work fine.
If it is a separate object (which in case of mouse and touch etc events have coordinates related to event.defaultView) and not just re-targeting, the
it should work.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78660</commentid>
    <comment_count>7</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-11-22 19:23:21 +0000</bug_when>
    <thetext>I was hoping for something that would take care of more of it for me, but I&apos;ll have to see how this works. :-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>78701</commentid>
    <comment_count>8</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2012-11-23 14:23:24 +0000</bug_when>
    <thetext>https://github.com/whatwg/dom/commit/22ce02cb28a5225355883c4d77a3f3b1f257d820

Basically, you determine if you want to dispatch in the parent instead. If you do, you dispatch it there with redispatching steps attached. The redispatching steps manipulate the copy of event as desired and then dispatch it.

If rather than a parent you an ancestor the dispatching steps will need a slightly more complex definition. Exercise for the reader ;-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79433</commentid>
    <comment_count>9</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2012-12-04 20:56:32 +0000</bug_when>
    <thetext>1. https://github.com/whatwg/dom/commit/22ce02cb28a5225355883c4d77a3f3b1f257d820

2. http://krijnhoetmer.nl/irc-logs/whatwg/20121204#l-1344 (and around there)

This is kinda super complex, so if implementors are not sure they&apos;re going to implement this, I&apos;d like to know :-)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79434</commentid>
    <comment_count>10</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2012-12-04 20:57:15 +0000</bug_when>
    <thetext>Revert 1. I meant.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79441</commentid>
    <comment_count>11</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-12-04 23:08:55 +0000</bug_when>
    <thetext>See also: http://krijnhoetmer.nl/irc-logs/whatwg/20121205#l-4</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>79446</commentid>
    <comment_count>12</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2012-12-04 23:59:20 +0000</bug_when>
    <thetext>HTML spec now references the &quot;event cross-boundary parent&quot; (for seamless iframes) and (in a comment currently) the &quot;event parent&quot; (for Window).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83385</commentid>
    <comment_count>13</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-02-20 11:53:49 +0000</bug_when>
    <thetext>I thought I should explain that the reason this is taking ages is because Shadow DOM has requirements for modifying the dispatch chain as well that are slightly more involved than the requirements for &lt;iframe&gt;.

Shadow DOM requires that when building the dispatch chain for each node in that dispatch chain we also cache a target and if the event being dispatched is a MouseEvent or FocusEvent, a relatedTarget. (For touch events it would be even more involved I think, but there&apos;s no implementation of that yet.)

Given the way Shadow DOM creates this dispatch chain I don&apos;t see a clean way of providing hooks in the DOM that would make all this work neatly together. It seems the entire algorithm would have to be in the DOM, including the concept of shadow trees.

Input welcome.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83386</commentid>
    <comment_count>14</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-02-20 11:55:40 +0000</bug_when>
    <thetext>Relevant code to study:

http://trac.webkit.org/browser/trunk/Source/WebCore/dom/EventRetargeter.cpp
http://trac.webkit.org/browser/trunk/Source/WebCore/dom/EventDispatcher.cpp</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>83389</commentid>
    <comment_count>15</comment_count>
    <who name="Hayato Ito">hayato</who>
    <bug_when>2013-02-20 13:18:17 +0000</bug_when>
    <thetext>I am the author of these code, EventDispatcher.cpp and EventRetargter.cpp in WebKit. I am glad if I could help.

(In reply to comment #14)
&gt; Relevant code to study:
&gt; 
&gt; http://trac.webkit.org/browser/trunk/Source/WebCore/dom/EventRetargeter.cpp
&gt; http://trac.webkit.org/browser/trunk/Source/WebCore/dom/EventDispatcher.cpp</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100429</commentid>
    <comment_count>16</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-02-12 19:50:20 +0000</bug_when>
    <thetext>Ian, is seamless dead now Chrome killed it?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>100436</commentid>
    <comment_count>17</comment_count>
    <who name="Ojan Vafai">ojan</who>
    <bug_when>2014-02-12 20:44:42 +0000</bug_when>
    <thetext>FWIW, we&apos;re not opposed to the feature. Finishing our implementation was just not at the top of our priorities at the moment and won&apos;t be anytime in the near future.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102209</commentid>
    <comment_count>18</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-03-11 16:58:55 +0000</bug_when>
    <thetext>Seamless is not dead; see bug 24400.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>120233</commentid>
    <comment_count>19</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-05-08 09:20:49 +0000</bug_when>
    <thetext>Are we going to wait another year for implementations to emerge? (Fine by me btw.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124679</commentid>
    <comment_count>20</comment_count>
    <who name="Michael[tm] Smith">mike</who>
    <bug_when>2016-01-23 05:18:50 +0000</bug_when>
    <thetext>Resolving this since iframe[seamless] has in fact now been dropped from HTML:
 
https://github.com/whatwg/html/commit/1490eba4dba5ab476f0981443a86c01acae01311</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>