Bug 57562

Summary: Introduce EventDispatchMediator abstraction, which encapsulate all non-trivial logic around firing a specific type of an event.
Product: WebKit Reporter: Dimitri Glazkov (Google) <dglazkov>
Component: New BugsAssignee: Dimitri Glazkov (Google) <dglazkov>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, darin, sam
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: OS X 10.5   
Bug Depends on:    
Bug Blocks: 55515, 57521, 57639    
Attachments:
Description Flags
EventManager sketch.
none
Patch abarth: review+, abarth: commit-queue-

Dimitri Glazkov (Google)
Reported 2011-03-31 10:30:01 PDT
Introduce EventManager abstraction, which encapsulate all non-trivial logic around firing a specific type of an event.
Attachments
EventManager sketch. (7.22 KB, patch)
2011-03-31 10:30 PDT, Dimitri Glazkov (Google)
no flags
Patch (7.67 KB, patch)
2011-03-31 18:33 PDT, Dimitri Glazkov (Google)
abarth: review+
abarth: commit-queue-
Dimitri Glazkov (Google)
Comment 1 2011-03-31 10:30:46 PDT
Created attachment 87760 [details] EventManager sketch.
Darin Adler
Comment 2 2011-03-31 10:32:30 PDT
Comment on attachment 87760 [details] EventManager sketch. View in context: https://bugs.webkit.org/attachment.cgi?id=87760&action=review > Source/WebCore/ChangeLog:6 > + Introduce EventManager abstraction, which encapsulate all non-trivial logic around firing a specific type of an event. > + https://bugs.webkit.org/show_bug.cgi?id=57562 I like the idea of factoring like this. I do not like the name “manager”. Having objects that are “managers” is something of a class design anti-pattern. We should think about other names and get a more specific sense of what this class is so we can name it well.
Dimitri Glazkov (Google)
Comment 3 2011-03-31 10:32:47 PDT
Event and KeyboardEvent are converted to use the abstraction in this patch. It's not terribly exciting, but it will get more interesting with MouseEventManager, WheelEventManager, and SimulatedClickEventManager. WDYT?
Dimitri Glazkov (Google)
Comment 4 2011-03-31 10:33:52 PDT
(In reply to comment #2) > (From update of attachment 87760 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=87760&action=review > > > Source/WebCore/ChangeLog:6 > > + Introduce EventManager abstraction, which encapsulate all non-trivial logic around firing a specific type of an event. > > + https://bugs.webkit.org/show_bug.cgi?id=57562 > > I like the idea of factoring like this. > > I do not like the name “manager”. Having objects that are “managers” is something of a class design anti-pattern. > > We should think about other names and get a more specific sense of what this class is so we can name it well. Mediator?
Dimitri Glazkov (Google)
Comment 5 2011-03-31 10:34:17 PDT
(In reply to comment #4) > (In reply to comment #2) > > (From update of attachment 87760 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=87760&action=review > > > > > Source/WebCore/ChangeLog:6 > > > + Introduce EventManager abstraction, which encapsulate all non-trivial logic around firing a specific type of an event. > > > + https://bugs.webkit.org/show_bug.cgi?id=57562 > > > > I like the idea of factoring like this. > > > > I do not like the name “manager”. Having objects that are “managers” is something of a class design anti-pattern. > > > > We should think about other names and get a more specific sense of what this class is so we can name it well. > > Mediator? http://en.wikipedia.org/wiki/Mediator_pattern
Dimitri Glazkov (Google)
Comment 6 2011-03-31 10:46:50 PDT
(In reply to comment #5) > (In reply to comment #4) > > (In reply to comment #2) > > > (From update of attachment 87760 [details] [details] [details]) > > > View in context: https://bugs.webkit.org/attachment.cgi?id=87760&action=review > > > > > > > Source/WebCore/ChangeLog:6 > > > > + Introduce EventManager abstraction, which encapsulate all non-trivial logic around firing a specific type of an event. > > > > + https://bugs.webkit.org/show_bug.cgi?id=57562 > > > > > > I like the idea of factoring like this. > > > > > > I do not like the name “manager”. Having objects that are “managers” is something of a class design anti-pattern. > > > > > > We should think about other names and get a more specific sense of what this class is so we can name it well. > > > > Mediator? > > http://en.wikipedia.org/wiki/Mediator_pattern It's an EventDispatchMediator, which is a mouthful. Maybe Sam can shine his moniker-smithing brilliance at us? BTW, I am sorry I forgot to tell Dominic to add the test to wk2/Skipped list! :)
Dimitri Glazkov (Google)
Comment 7 2011-03-31 18:33:21 PDT
Adam Barth
Comment 8 2011-04-04 14:37:38 PDT
Comment on attachment 87813 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=87813&action=review > Source/WebCore/dom/Event.h:196 > +class EventDispatchMediator { We usually have one class per file. However, EventDispatchMediator looks pretty trivial, so maybe it makes sense to keep here... > Source/WebCore/dom/Event.h:198 > + EventDispatchMediator(PassRefPtr<Event>); Please add the explicit keyword. The style checker should really complain about that. > Source/WebCore/dom/KeyboardEvent.h:119 > + KeyboardEventDispatchMediator(PassRefPtr<KeyboardEvent>); explicit
Adam Barth
Comment 9 2011-04-04 14:39:18 PDT
https://bugs.webkit.org/show_bug.cgi?id=57791 is the check-webkit-style bug.
Dimitri Glazkov (Google)
Comment 10 2011-04-04 16:23:15 PDT
Note You need to log in before you can comment on or make changes to this bug.