<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Force mouse events should go through normal mouse event handling code paths"
href="https://bugs.webkit.org/show_bug.cgi?id=143749#c14">Comment # 14</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Force mouse events should go through normal mouse event handling code paths"
href="https://bugs.webkit.org/show_bug.cgi?id=143749">bug 143749</a>
from <span class="vcard"><a class="email" href="mailto:bdakin@apple.com" title="Beth Dakin <bdakin@apple.com>"> <span class="fn">Beth Dakin</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=143749#c13">comment #13</a>)
<span class="quote">> Comment on <span class=""><a href="attachment.cgi?id=250904&action=diff" name="attach_250904" title="Patch with tests">attachment 250904</a> <a href="attachment.cgi?id=250904&action=edit" title="Patch with tests">[details]</a></span>
> Patch with tests
>
> View in context:
> <a href="https://bugs.webkit.org/attachment.cgi?id=250904&action=review">https://bugs.webkit.org/attachment.cgi?id=250904&action=review</a>
>
> > 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.
> </span >
I'm still not 100% on the right thing to do here, but I changed it to |=, which I think is right.
<span class="quote">> > 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?
> </span >
Fixed this!
<span class="quote">> > 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?
> </span >
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.
<span class="quote">> > 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?
> </span >
Yes, good call. Done.
<span class="quote">> > 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?</span >
Sounds nicer to me! I switched to this format.
I also added releases to the NSEvents for smfr.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>