[Webkit-unassigned] [Bug 143749] Force mouse events should go through normal mouse event handling code paths
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Apr 16 13:46:09 PDT 2015
https://bugs.webkit.org/show_bug.cgi?id=143749
--- Comment #14 from Beth Dakin <bdakin at apple.com> ---
(In reply to comment #13)
> Comment on attachment 250904 [details]
> Patch with tests
>
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=250904&action=review
>
> > Source/WebCore/page/EventHandler.cpp:2124
> > + bool swallowedEvent = !dispatchMouseEvent(eventNames().webkitmouseforcechangedEvent, mouseEvent.targetNode(), false, 0, event, false);
> > + if (event.type() == PlatformEvent::MouseForceDown)
> > + swallowedEvent = !dispatchMouseEvent(eventNames().webkitmouseforcedownEvent, mouseEvent.targetNode(), false, 0, event, false);
> > + if (event.type() == PlatformEvent::MouseForceUp)
> > + swallowedEvent = !dispatchMouseEvent(eventNames().webkitmouseforceupEvent, mouseEvent.targetNode(), false, 0, event, false);
>
> Does this mean we can only swallow the event from forcechanged if down/up
> also swallow?
>
> Technically I guess you could return from within both conditionals.
>
I'm still not 100% on the right thing to do here, but I changed it to |=, which I think is right.
> > Source/WebCore/replay/UserInputBridge.cpp:163
> > +bool UserInputBridge::handleMouseForceChangedEvent(const PlatformMouseEvent& mouseEvent, InputSource)
> > +{
> > + return m_page.mainFrame().eventHandler().handleMouseForceEvent(mouseEvent);
> > +}
> > +
> > +bool UserInputBridge::handleMouseForceDownEvent(const PlatformMouseEvent& mouseEvent, InputSource)
> > +{
> > + return m_page.mainFrame().eventHandler().handleMouseForceEvent(mouseEvent);
> > +}
> > +
> > +bool UserInputBridge::handleMouseForceUpEvent(const PlatformMouseEvent& mouseEvent, InputSource)
> > +{
> > + return m_page.mainFrame().eventHandler().handleMouseForceEvent(mouseEvent);
> > +}
>
> I haven't looked at how these are called, but is there any reason why they
> can't all be done in one handleMouseForceEvent? Do we need one for each type
> of input event name?
>
Fixed this!
> > Source/WebKit2/Shared/mac/WebEventFactory.mm:384
> > + if (lastPressureEvent.stage == 1 && event.stage == 2)
> > + type = WebEvent::MouseForceDown;
> > + else if (lastPressureEvent.stage == 2 && event.stage == 1)
> > + type = WebEvent::MouseForceUp;
> > + else
>
> This is probably silly, but I wonder if we should have enums for the stage
> values so they read a bit better. Or are they actually just a count?
>
I don't think it's silly at all because it is very confusing! But since the use of stage is limited to this one function at this time, I don't think it's super worthwhile. If we end up needing to use the stage in more places or propagate it down to WebCore, we should absolutely use an enum.
> > Source/WebKit2/WebProcess/WebPage/WebPage.cpp:1912
> > + case PlatformEvent::MouseForceChanged:
> > + return page->corePage()->userInputBridge().handleMouseForceChangedEvent(platformMouseEvent);
> > + case PlatformEvent::MouseForceDown:
> > + return page->corePage()->userInputBridge().handleMouseForceDownEvent(platformMouseEvent);
> > + case PlatformEvent::MouseForceUp:
> > + return page->corePage()->userInputBridge().handleMouseForceUpEvent(platformMouseEvent);
>
> Ooooh. Here's my answer to the other bit. So, considering these all do the
> same thing on the other end, do you think it makes sense to have a single
> handle function?
>
Yes, good call. Done.
> > Tools/WebKitTestRunner/mac/EventSenderProxy.mm:73
> > + self = [super init];
> > +
> > + if (self) {
> > + _eventSender_location = location;
> > + _eventSender_locationInWindow = globalLocation; //????????
> > + _eventSender_stage = stage;
> > + _eventSender_pressure = pressure;
> > + _eventSender_phase = phase;
> > + _eventSender_timestamp = time;
> > + _eventSender_eventNumber = eventNumber;
> > + }
> > +
> > + return self;
>
> I know this isn't the general ObjC convention, but I was looking at Safari
> code yesterday that did this the other way around:
>
> if (!self)
> return nil;
>
> // other setup stuff
>
> I guess we don't have coding style for that?
Sounds nicer to me! I switched to this format.
I also added releases to the NSEvents for smfr.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20150416/647f0b9a/attachment-0001.html>
More information about the webkit-unassigned
mailing list