Re: [whatwg] seamless iframes and event propagation

On Mon, Jul 16, 2012 at 9:24 AM, Dimitri Glazkov <dglazkov@chromium.org>wrote:

> On Sat, Jul 14, 2012 at 4:45 AM, Olli Pettay <Olli.Pettay@helsinki.fi>
> wrote:
> >
> > On 07/14/2012 12:38 AM, Ojan Vafai wrote:
> >>
> >> It's been pointed out to me that what I'm asking for is essentially the
> >> same retargeting as we do for shadow DOMs in web components, where the
> >> iframe is the shadow host and the document is the shadow root. This
> covers
> >> all the details of what properties need to be updated when crossing the
> >> document boundary. The only addition on top of that is that we need to
> >> convert the coordinate space of mouse events appropriately when we cross
> >> the boundary.
> >
> >
> >
> > What, you'd propagate mouse events to parent doc but update coordinate
> related coordinates when
> > passing the doc boundary... that is odd.
> > Something in the original target document may keep a reference to the
> event and then suddenly during event dispatch the
> > coordinate values would change.
>
> We should probably recreate an event object at each seamless frame
> boundary.
>

As I look at the event retargetting spec more closely, I think it's dealing
with a different set of design constraints and the seamless iframe
retargeting could do something much simpler.

Here's how I picture it working:
1. Create an event in the outer document with the seamless iframe
as its target and mouse events in the outer document's coordinate space and
begin the capture phase.
2. When the capture phase is done, if stopPropagation was not called, fire
a new event in the inner document as normal.
3. Execute target phase in the outer document.
4. Execute the bubble phase in the outer document.

If preventDefault is called on either the outer document's event or the
inner document's event, then the default action of the event is prevented.

It's not clear to me if any events should be exempt from this. For example,
should focuses/blurs that are entirely contained within the seamless iframe
fire in the outer document? My intuition is no, but I could easily be
swayed either way.

Ojan

Received on Tuesday, 17 July 2012 23:29:06 UTC