Bug 65613 - ScopedEventQueue should enqueue an EventDispatchMediator
Summary: ScopedEventQueue should enqueue an EventDispatchMediator
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: UI Events (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Hayato Ito
URL:
Keywords:
Depends on:
Blocks: 64249
  Show dependency treegraph
 
Reported: 2011-08-03 05:34 PDT by Hayato Ito
Modified: 2011-08-04 23:14 PDT (History)
6 users (show)

See Also:


Attachments
Supports EventDispatchMediator (9.83 KB, patch)
2011-08-03 05:37 PDT, Hayato Ito
no flags Details | Formatted Diff | Diff
no more parallel structure (8.57 KB, patch)
2011-08-04 02:05 PDT, Hayato Ito
no flags Details | Formatted Diff | Diff
remove enqueueEvent and clients of that (8.51 KB, patch)
2011-08-04 20:00 PDT, Hayato Ito
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hayato Ito 2011-08-03 05:34:39 PDT
This patch is the 2nd separated patch from bug 64249.

ScopedEventQueue should support enqueuing an EventDispatchMediator so that it supports coming FocusIn/FocusOutEventDispatchMediator.
Comment 1 Hayato Ito 2011-08-03 05:37:16 PDT
Created attachment 102769 [details]
Supports EventDispatchMediator
Comment 2 Dimitri Glazkov (Google) 2011-08-03 08:18:11 PDT
Comment on attachment 102769 [details]
Supports EventDispatchMediator

I am not sure I like this patch. Now that we can pass around EventDispatchMediator, we should be able to convert all scoped event dispatches to use it, instead of building a parallel structure. Right?
Comment 3 Hayato Ito 2011-08-03 08:42:06 PDT
Thank you for the review.

(In reply to comment #2)
> (From update of attachment 102769 [details])
> I am not sure I like this patch. Now that we can pass around EventDispatchMediator, we should be able to convert all scoped event dispatches to use it, instead of building a parallel structure. Right?

That makes sense and actually I tried that at first. AFAIR, I gave up that for some reasons, which I can't recall now.
Let me retry that tomorrow again to recall the reason.
Comment 4 Hayato Ito 2011-08-04 02:05:16 PDT
Created attachment 102886 [details]
no more parallel structure
Comment 5 Hayato Ito 2011-08-04 02:12:59 PDT
Hi Dimitri,

I updated a patch so that only a EventDispatchMediator, instead of a parallel structure, is enqueued into a internal queue of ScopedEventQueue.
To do so, I had to make EventDispatchMediator::event() public, not private.
I guess making it public is not desirable, but that's much better than maintaing parallel data structure in ScopedEventQueue.

(In reply to comment #3)
> Thank you for the review.
> 
> (In reply to comment #2)
> > (From update of attachment 102769 [details] [details])
> > I am not sure I like this patch. Now that we can pass around EventDispatchMediator, we should be able to convert all scoped event dispatches to use it, instead of building a parallel structure. Right?
> 
> That makes sense and actually I tried that at first. AFAIR, I gave up that for some reasons, which I can't recall now.
> Let me retry that tomorrow again to recall the reason.
Comment 6 Dimitri Glazkov (Google) 2011-08-04 09:01:54 PDT
Comment on attachment 102886 [details]
no more parallel structure

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

I like it, but it doesn't go far enough. Be brave, Ito-san! :)

> Source/WebCore/dom/ScopedEventQueue.cpp:70
>  void ScopedEventQueue::enqueueEvent(PassRefPtr<Event> event)
>  {
>      if (m_scopingLevel)
> -        m_queuedEvents.append(event);
> +        m_queuedEventDispatchMediators.append(EventDispatchMediator::create(event));
> +    else {
> +        RefPtr<EventTarget> eventTarget = event->target();
> +        eventTarget->dispatchEvent(event);
> +    }
> +}

Can we just kill all callsites for this and remove it?
Comment 7 Hayato Ito 2011-08-04 20:00:45 PDT
Created attachment 103024 [details]
remove enqueueEvent and clients of that
Comment 8 Hayato Ito 2011-08-04 20:03:47 PDT
Hi Dimitri,
Thank you for the review.

(In reply to comment #6)
> (From update of attachment 102886 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=102886&action=review
> 
> I like it, but it doesn't go far enough. Be brave, Ito-san! :)
> 
> > Source/WebCore/dom/ScopedEventQueue.cpp:70
> >  void ScopedEventQueue::enqueueEvent(PassRefPtr<Event> event)
> >  {
> >      if (m_scopingLevel)
> > -        m_queuedEvents.append(event);
> > +        m_queuedEventDispatchMediators.append(EventDispatchMediator::create(event));
> > +    else {
> > +        RefPtr<EventTarget> eventTarget = event->target();
> > +        eventTarget->dispatchEvent(event);
> > +    }
> > +}
> 
> Can we just kill all callsites for this and remove it?

Sure. We can remove them to simplify code. Done.
Comment 9 Dimitri Glazkov (Google) 2011-08-04 21:12:45 PDT
Comment on attachment 103024 [details]
remove enqueueEvent and clients of that

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

> Source/WebCore/dom/Node.cpp:2710
>  void Node::dispatchScopedEvent(PassRefPtr<Event> event)

Can we remove this too?
Comment 10 Hayato Ito 2011-08-04 21:51:51 PDT
Thank you for the review again.

(In reply to comment #9)
> (From update of attachment 103024 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=103024&action=review
> 
> > Source/WebCore/dom/Node.cpp:2710
> >  void Node::dispatchScopedEvent(PassRefPtr<Event> event)
> 
> Can we remove this too?

We can. But we have to touch a lot of files to remove that because there are a lot of clients using that function.

If we remove that, all clientes will be forced to use 

  node->dispatchEvent(EventDispatchMediater::create(Event:create(....,));

instead of

  node->dispatchEvent(Event:create(....,));.

Is it okay?
Anyway, that requires touching a lot of files. So it might be done in another patch.
I am going to this patch.
Comment 11 Hayato Ito 2011-08-04 21:53:03 PDT
s/ I am going to this patch / I am going to land this patch./
Comment 12 Ryosuke Niwa 2011-08-04 23:13:21 PDT
Please cc me for these scopedEventQueue-related bugs in the future.
Comment 13 WebKit Review Bot 2011-08-04 23:14:26 PDT
Comment on attachment 103024 [details]
remove enqueueEvent and clients of that

Clearing flags on attachment: 103024

Committed r92450: <http://trac.webkit.org/changeset/92450>
Comment 14 WebKit Review Bot 2011-08-04 23:14:31 PDT
All reviewed patches have been landed.  Closing bug.