RESOLVED FIXED 57642
Move WheelEvent-dispatching logic into WheelEventDispatchMediator.
https://bugs.webkit.org/show_bug.cgi?id=57642
Summary Move WheelEvent-dispatching logic into WheelEventDispatchMediator.
Dimitri Glazkov (Google)
Reported 2011-04-01 10:00:52 PDT
Move WheelEvent-dispatching logic into WheelEventDispatchMediator.
Attachments
Patch (8.26 KB, patch)
2011-04-01 12:53 PDT, Dimitri Glazkov (Google)
no flags
Ready to bake on EWSs. (9.89 KB, patch)
2011-04-05 10:38 PDT, Dimitri Glazkov (Google)
no flags
Patch (9.83 KB, patch)
2011-04-06 21:10 PDT, Dimitri Glazkov (Google)
darin: review+
Dimitri Glazkov (Google)
Comment 1 2011-04-01 12:53:13 PDT
Dimitri Glazkov (Google)
Comment 2 2011-04-05 10:38:21 PDT
Created attachment 88274 [details] Ready to bake on EWSs.
Eric Seidel (no email)
Comment 3 2011-04-06 09:40:44 PDT
Comment on attachment 88274 [details] Ready to bake on EWSs. View in context: https://bugs.webkit.org/attachment.cgi?id=88274&action=review > Source/WebCore/ChangeLog:8 > + No new tests. (OOPS!) I guess you've not written the ChangelOg yet? > Source/WebCore/dom/Event.h:204 > + EventDispatchMediator(); What does this class mediate between?
Dimitri Glazkov (Google)
Comment 4 2011-04-06 11:34:28 PDT
(In reply to comment #3) > (From update of attachment 88274 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=88274&action=review > > > Source/WebCore/ChangeLog:8 > > + No new tests. (OOPS!) > > I guess you've not written the ChangelOg yet? No, I just forgot to replace this line :) > > > Source/WebCore/dom/Event.h:204 > > + EventDispatchMediator(); > > What does this class mediate between? It mediates event dispatch. This class knows specifics of firing events, helping EventDispatcher do the right thing without having to know how.
Dimitri Glazkov (Google)
Comment 5 2011-04-06 11:41:30 PDT
(In reply to comment #4) > (In reply to comment #3) > > (From update of attachment 88274 [details] [details]) > > View in context: https://bugs.webkit.org/attachment.cgi?id=88274&action=review > > > > > Source/WebCore/ChangeLog:8 > > > + No new tests. (OOPS!) > > > > I guess you've not written the ChangelOg yet? > > No, I just forgot to replace this line :) > > > > > > Source/WebCore/dom/Event.h:204 > > > + EventDispatchMediator(); > > > > What does this class mediate between? > > It mediates event dispatch. This class knows specifics of firing events, helping EventDispatcher do the right thing without having to know how. Believe it or not, the whole EventDispatchMediator was born out of your comment: you said the EventDispatcher knows too much :)
Darin Adler
Comment 6 2011-04-06 17:15:30 PDT
Comment on attachment 88274 [details] Ready to bake on EWSs. View in context: https://bugs.webkit.org/attachment.cgi?id=88274&action=review > Source/WebCore/dom/Node.cpp:2665 > -void Node::dispatchWheelEvent(PlatformWheelEvent& e) > +bool Node::dispatchWheelEvent(PlatformWheelEvent& e) > { > - EventDispatcher::dispatchWheelEvent(this, e); > + return EventDispatcher::dispatchEvent(this, WheelEventDispatchMediator(e, document()->defaultView())); > } As long as you are touching this, I would prefer the name “event” to “e”. > Source/WebCore/dom/Node.h:536 > - void dispatchWheelEvent(PlatformWheelEvent&); > + bool dispatchWheelEvent(PlatformWheelEvent&); Is this really a good change? The DOM establishes a pattern where events themselves know if they have been handled. I think this is clearer than a boolean return value. It’s hard to name a function so you can understand what its boolean return value means. Worse, we have functions that tell whether an event is handled both with a return value and with state in the event too! Although this is not one of them. If you really ant to change this then I think it should take a const&. The reason this took a non-const before was so it could record that the event was handled. > Source/WebCore/dom/WheelEvent.cpp:104 > + : EventDispatchMediator() Do you need to say this explicitly? I am surprised if so.
Dimitri Glazkov (Google)
Comment 7 2011-04-06 20:22:31 PDT
Comment on attachment 88274 [details] Ready to bake on EWSs. View in context: https://bugs.webkit.org/attachment.cgi?id=88274&action=review Darin, thank you for review. Will upload new patch shortly. >> Source/WebCore/dom/Node.cpp:2665 >> } > > As long as you are touching this, I would prefer the name “event” to “e”. Will change. >> Source/WebCore/dom/Node.h:536 >> + bool dispatchWheelEvent(PlatformWheelEvent&); > > Is this really a good change? > > The DOM establishes a pattern where events themselves know if they have been handled. I think this is clearer than a boolean return value. It’s hard to name a function so you can understand what its boolean return value means. > > Worse, we have functions that tell whether an event is handled both with a return value and with state in the event too! Although this is not one of them. > > If you really ant to change this then I think it should take a const&. The reason this took a non-const before was so it could record that the event was handled. This just brings it in line with other similar events. Both dispatchEvent and dispatchKeyEvent return false when they weren't handled. I definitely overlooked the non-const ref. Will change that. >> Source/WebCore/dom/WheelEvent.cpp:104 >> + : EventDispatchMediator() > > Do you need to say this explicitly? I am surprised if so. No. I just got too mechanical in writing the code. I'll remove.
Dimitri Glazkov (Google)
Comment 8 2011-04-06 21:10:51 PDT
Dimitri Glazkov (Google)
Comment 9 2011-04-07 15:06:06 PDT
<3
Dimitri Glazkov (Google)
Comment 10 2011-04-08 08:48:32 PDT
Note You need to log in before you can comment on or make changes to this bug.