Bug 57391 - Introduce SimulatedClickEvent and move all simulated-click dispatch code there.
Summary: Introduce SimulatedClickEvent and move all simulated-click dispatch code there.
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Dimitri Glazkov (Google)
URL:
Keywords:
Depends on:
Blocks: 55515
  Show dependency treegraph
 
Reported: 2011-03-29 15:02 PDT by Dimitri Glazkov (Google)
Modified: 2011-03-29 16:05 PDT (History)
2 users (show)

See Also:


Attachments
Patch (28.84 KB, patch)
2011-03-29 15:10 PDT, Dimitri Glazkov (Google)
no flags Details | Formatted Diff | Diff
Rebased to ToT and sorted xcodeproj. (29.35 KB, patch)
2011-03-29 15:33 PDT, Dimitri Glazkov (Google)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitri Glazkov (Google) 2011-03-29 15:02:14 PDT
Introduce SimulatedClickEvent and move all simulated-click dispatch code there.
Comment 1 Dimitri Glazkov (Google) 2011-03-29 15:10:26 PDT
Created attachment 87415 [details]
Patch
Comment 2 Dimitri Glazkov (Google) 2011-03-29 15:33:09 PDT
Created attachment 87418 [details]
Rebased to ToT and sorted xcodeproj.
Comment 3 Darin Adler 2011-03-29 15:43:28 PDT
Comment on attachment 87415 [details]
Patch

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

> Source/WebCore/ChangeLog:8
> +        The SimulatedClickEvent, instead of dispatching self, fires one or more SimulatedMouseEvents.

I don’t understand why a simulated click, which is a sequence of events, now needs to be a kind of event. Can’t we simulate clicks by sending a sequence of events? Why do we need to trigger that with yet another event?
Comment 4 Dimitri Glazkov (Google) 2011-03-29 15:51:11 PDT
(In reply to comment #3)
> (From update of attachment 87415 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=87415&action=review
> 
> > Source/WebCore/ChangeLog:8
> > +        The SimulatedClickEvent, instead of dispatching self, fires one or more SimulatedMouseEvents.
> 
> I don’t understand why a simulated click, which is a sequence of events, now needs to be a kind of event. Can’t we simulate clicks by sending a sequence of events? Why do we need to trigger that with yet another event?

The fact that it fires multiple events is a detail that isn't exposed anywhere from the call site of Node::dispatchSimulatedClick, just like dispatchMouseEvent may fire an extra dblclick event.

Wrapping this into an Event seems consistent with how any other event would be dispatched: dispatchEvent(FooEvent::create(...)).

Also, it wraps the logic neatly into its own class.
Comment 5 Dimitri Glazkov (Google) 2011-03-29 15:55:26 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > (From update of attachment 87415 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=87415&action=review
> > 
> > > Source/WebCore/ChangeLog:8
> > > +        The SimulatedClickEvent, instead of dispatching self, fires one or more SimulatedMouseEvents.
> > 
> > I don’t understand why a simulated click, which is a sequence of events, now needs to be a kind of event. Can’t we simulate clicks by sending a sequence of events? Why do we need to trigger that with yet another event?
> 
> The fact that it fires multiple events is a detail that isn't exposed anywhere from the call site of Node::dispatchSimulatedClick, just like dispatchMouseEvent may fire an extra dblclick event.
> 
> Wrapping this into an Event seems consistent with how any other event would be dispatched: dispatchEvent(FooEvent::create(...)).
> 
> Also, it wraps the logic neatly into its own class.

I can also just have SimulatedMouseEvent (possibly put it the MouseEvent files), then leave EventDispatcher::dispatchSimulatedClick using them.
Comment 6 Darin Adler 2011-03-29 16:00:55 PDT
(In reply to comment #4)
> The fact that it fires multiple events is a detail that isn't exposed anywhere from the call site of Node::dispatchSimulatedClick, just like dispatchMouseEvent may fire an extra dblclick event.

Sure, we can encapsulate that into a function.

> Wrapping this into an Event seems consistent with how any other event would be dispatched: dispatchEvent(FooEvent::create(...)).

This seems to be the sole benefit, and I’m not sure it’s better.

> Also, it wraps the logic neatly into its own class.

You could do that without having the class be derived from Event.
Comment 7 Darin Adler 2011-03-29 16:01:13 PDT
(In reply to comment #5)
> I can also just have SimulatedMouseEvent (possibly put it the MouseEvent files), then leave EventDispatcher::dispatchSimulatedClick using them.

I’d prefer that.
Comment 8 Dimitri Glazkov (Google) 2011-03-29 16:05:48 PDT
(In reply to comment #7)
> (In reply to comment #5)
> > I can also just have SimulatedMouseEvent (possibly put it the MouseEvent files), then leave EventDispatcher::dispatchSimulatedClick using them.
> 
> I’d prefer that.

ok, patch coming up.