<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:dino&#64;apple.com" title="Dean Jackson &lt;dino&#64;apple.com&gt;"> <span class="fn">Dean Jackson</span></a>
</span> changed
              <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>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Attachment #250904 Flags</td>
           <td>review?
           </td>
           <td>review+
           </td>
         </tr></table>
      <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#c13">Comment # 13</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:dino&#64;apple.com" title="Dean Jackson &lt;dino&#64;apple.com&gt;"> <span class="fn">Dean Jackson</span></a>
</span></b>
        <pre>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>
Patch with tests

View in context: <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>

<span class="quote">&gt; Source/WebCore/page/EventHandler.cpp:2124
&gt; +    bool swallowedEvent = !dispatchMouseEvent(eventNames().webkitmouseforcechangedEvent, mouseEvent.targetNode(), false, 0, event, false);
&gt; +    if (event.type() == PlatformEvent::MouseForceDown)
&gt; +        swallowedEvent = !dispatchMouseEvent(eventNames().webkitmouseforcedownEvent, mouseEvent.targetNode(), false, 0, event, false);
&gt; +    if (event.type() == PlatformEvent::MouseForceUp)
&gt; +        swallowedEvent = !dispatchMouseEvent(eventNames().webkitmouseforceupEvent, mouseEvent.targetNode(), false, 0, event, false);</span >

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 class="quote">&gt; Source/WebCore/replay/UserInputBridge.cpp:163
&gt; +bool UserInputBridge::handleMouseForceChangedEvent(const PlatformMouseEvent&amp; mouseEvent, InputSource)
&gt; +{
&gt; +    return m_page.mainFrame().eventHandler().handleMouseForceEvent(mouseEvent);
&gt; +}
&gt; +
&gt; +bool UserInputBridge::handleMouseForceDownEvent(const PlatformMouseEvent&amp; mouseEvent, InputSource)
&gt; +{
&gt; +    return m_page.mainFrame().eventHandler().handleMouseForceEvent(mouseEvent);
&gt; +}
&gt; +
&gt; +bool UserInputBridge::handleMouseForceUpEvent(const PlatformMouseEvent&amp; mouseEvent, InputSource)
&gt; +{
&gt; +    return m_page.mainFrame().eventHandler().handleMouseForceEvent(mouseEvent);
&gt; +}</span >

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 class="quote">&gt; Source/WebKit2/Shared/mac/WebEventFactory.mm:384
&gt; +        if (lastPressureEvent.stage == 1 &amp;&amp; event.stage == 2)
&gt; +            type = WebEvent::MouseForceDown;
&gt; +        else if (lastPressureEvent.stage == 2 &amp;&amp; event.stage == 1)
&gt; +            type = WebEvent::MouseForceUp;
&gt; +        else</span >

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 class="quote">&gt; Source/WebKit2/WebProcess/WebPage/WebPage.cpp:1912
&gt; +        case PlatformEvent::MouseForceChanged:
&gt; +            return page-&gt;corePage()-&gt;userInputBridge().handleMouseForceChangedEvent(platformMouseEvent);
&gt; +        case PlatformEvent::MouseForceDown:
&gt; +            return page-&gt;corePage()-&gt;userInputBridge().handleMouseForceDownEvent(platformMouseEvent);
&gt; +        case PlatformEvent::MouseForceUp:
&gt; +            return page-&gt;corePage()-&gt;userInputBridge().handleMouseForceUpEvent(platformMouseEvent);</span >

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 class="quote">&gt; Tools/WebKitTestRunner/mac/EventSenderProxy.mm:73
&gt; +    self = [super init];
&gt; +
&gt; +    if (self) {
&gt; +        _eventSender_location = location;
&gt; +        _eventSender_locationInWindow = globalLocation; //????????
&gt; +        _eventSender_stage = stage;
&gt; +        _eventSender_pressure = pressure;
&gt; +        _eventSender_phase = phase;
&gt; +        _eventSender_timestamp = time;
&gt; +        _eventSender_eventNumber = eventNumber;
&gt; +    }
&gt; +
&gt; +    return self;</span >

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?</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>