<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&#64;apple.com" title="Beth Dakin &lt;bdakin&#64;apple.com&gt;"> <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">&gt; Comment on <span class=""><a href="attachment.cgi?id=250904&amp;action=diff" name="attach_250904" title="Patch with tests">attachment 250904</a> <a href="attachment.cgi?id=250904&amp;action=edit" title="Patch with tests">[details]</a></span>
&gt; Patch with tests
&gt; 
&gt; View in context:
&gt; <a href="https://bugs.webkit.org/attachment.cgi?id=250904&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=250904&amp;action=review</a>
&gt; 
&gt; &gt; Source/WebCore/page/EventHandler.cpp:2124
&gt; &gt; +    bool swallowedEvent = !dispatchMouseEvent(eventNames().webkitmouseforcechangedEvent, mouseEvent.targetNode(), false, 0, event, false);
&gt; &gt; +    if (event.type() == PlatformEvent::MouseForceDown)
&gt; &gt; +        swallowedEvent = !dispatchMouseEvent(eventNames().webkitmouseforcedownEvent, mouseEvent.targetNode(), false, 0, event, false);
&gt; &gt; +    if (event.type() == PlatformEvent::MouseForceUp)
&gt; &gt; +        swallowedEvent = !dispatchMouseEvent(eventNames().webkitmouseforceupEvent, mouseEvent.targetNode(), false, 0, event, false);
&gt; 
&gt; Does this mean we can only swallow the event from forcechanged if down/up
&gt; also swallow?
&gt; 
&gt; Technically I guess you could return from within both conditionals.
&gt; </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">&gt; &gt; Source/WebCore/replay/UserInputBridge.cpp:163
&gt; &gt; +bool UserInputBridge::handleMouseForceChangedEvent(const PlatformMouseEvent&amp; mouseEvent, InputSource)
&gt; &gt; +{
&gt; &gt; +    return m_page.mainFrame().eventHandler().handleMouseForceEvent(mouseEvent);
&gt; &gt; +}
&gt; &gt; +
&gt; &gt; +bool UserInputBridge::handleMouseForceDownEvent(const PlatformMouseEvent&amp; mouseEvent, InputSource)
&gt; &gt; +{
&gt; &gt; +    return m_page.mainFrame().eventHandler().handleMouseForceEvent(mouseEvent);
&gt; &gt; +}
&gt; &gt; +
&gt; &gt; +bool UserInputBridge::handleMouseForceUpEvent(const PlatformMouseEvent&amp; mouseEvent, InputSource)
&gt; &gt; +{
&gt; &gt; +    return m_page.mainFrame().eventHandler().handleMouseForceEvent(mouseEvent);
&gt; &gt; +}
&gt; 
&gt; I haven't looked at how these are called, but is there any reason why they
&gt; can't all be done in one handleMouseForceEvent? Do we need one for each type
&gt; of input event name?
&gt; </span >

Fixed this!

<span class="quote">&gt; &gt; Source/WebKit2/Shared/mac/WebEventFactory.mm:384
&gt; &gt; +        if (lastPressureEvent.stage == 1 &amp;&amp; event.stage == 2)
&gt; &gt; +            type = WebEvent::MouseForceDown;
&gt; &gt; +        else if (lastPressureEvent.stage == 2 &amp;&amp; event.stage == 1)
&gt; &gt; +            type = WebEvent::MouseForceUp;
&gt; &gt; +        else
&gt; 
&gt; This is probably silly, but I wonder if we should have enums for the stage
&gt; values so they read a bit better. Or are they actually just a count?
&gt; </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">&gt; &gt; Source/WebKit2/WebProcess/WebPage/WebPage.cpp:1912
&gt; &gt; +        case PlatformEvent::MouseForceChanged:
&gt; &gt; +            return page-&gt;corePage()-&gt;userInputBridge().handleMouseForceChangedEvent(platformMouseEvent);
&gt; &gt; +        case PlatformEvent::MouseForceDown:
&gt; &gt; +            return page-&gt;corePage()-&gt;userInputBridge().handleMouseForceDownEvent(platformMouseEvent);
&gt; &gt; +        case PlatformEvent::MouseForceUp:
&gt; &gt; +            return page-&gt;corePage()-&gt;userInputBridge().handleMouseForceUpEvent(platformMouseEvent);
&gt; 
&gt; Ooooh. Here's my answer to the other bit. So, considering these all do the
&gt; same thing on the other end, do you think it makes sense to have a single
&gt; handle function?
&gt; </span >

Yes, good call. Done.

<span class="quote">&gt; &gt; Tools/WebKitTestRunner/mac/EventSenderProxy.mm:73
&gt; &gt; +    self = [super init];
&gt; &gt; +
&gt; &gt; +    if (self) {
&gt; &gt; +        _eventSender_location = location;
&gt; &gt; +        _eventSender_locationInWindow = globalLocation; //????????
&gt; &gt; +        _eventSender_stage = stage;
&gt; &gt; +        _eventSender_pressure = pressure;
&gt; &gt; +        _eventSender_phase = phase;
&gt; &gt; +        _eventSender_timestamp = time;
&gt; &gt; +        _eventSender_eventNumber = eventNumber;
&gt; &gt; +    }
&gt; &gt; +
&gt; &gt; +    return self;
&gt; 
&gt; I know this isn't the general ObjC convention, but I was looking at Safari
&gt; code yesterday that did this the other way around:
&gt; 
&gt; if (!self)
&gt;   return nil;
&gt; 
&gt; // other setup stuff
&gt; 
&gt; 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>