Title: [184244] branches/safari-601.1.32-branch

Diff

Modified: branches/safari-601.1.32-branch/Source/WebCore/ChangeLog (184243 => 184244)


--- branches/safari-601.1.32-branch/Source/WebCore/ChangeLog	2015-05-13 03:58:15 UTC (rev 184243)
+++ branches/safari-601.1.32-branch/Source/WebCore/ChangeLog	2015-05-13 03:58:20 UTC (rev 184244)
@@ -2,177 +2,203 @@
 Dana Burkart  <[email protected]
 [email protected]>
 
-        Merge r183953. rdar://problem/19997548
+        Merge r183954. rdar://problem/20281886
 
-    2015-05-06  Roger Fong  <[email protected]>
+    2015-05-07  Beth Dakin  <[email protected]>
 
-            Media Controls: Scrubber should be independent of actual video time, causes scrubber to be jumpy.
-            https://bugs.webkit.org/show_bug.cgi?id=144700.
-            <rdar://problem/19997548>
+            New force-related DOM events should fire in WK1 views
+            https://bugs.webkit.org/show_bug.cgi?id=144663
+            -and corresponding-
+            rdar://problem/20281886
 
-            Reviewed by Jer Noble.
+            Reviewed by Sam Weinig.
 
-            Update time and timeline during the timeline input event instead of the wrapper's mousemove.
-            (Controller.prototype.handleWrapperMouseMove):
-            (Controller.prototype.handleTimelineMouseMove):
-            (Controller.prototype.drawTimelineBackground):
+            All of the WK1 mouse events need to take the correspondingPressureEvent.
+            * page/EventHandler.h:
 
-            (Controller.prototype.updateControlsWhileScrubbing):
-            Updates time and scrubber to reflect timeline user input.
+            Make correspondingPressureEvent a part of CurrentEventScope. This is needed to
+            have accurate pressure information for all of the mouse events in subframes.
+            * page/mac/EventHandlerMac.mm:
+            (WebCore::correspondingPressureEventSlot):
+            (WebCore::EventHandler::correspondingPressureEvent):
+            (WebCore::CurrentEventScope::CurrentEventScope):
+            (WebCore::CurrentEventScope::~CurrentEventScope):
 
+            These events don’t have an associated pressure, so send nil for the
+            correspondingPressureEvent.
+            (WebCore::EventHandler::wheelEvent):
+            (WebCore::EventHandler::keyEvent):
+
+            Pipe through correspondingPressureEvent.
+            (WebCore::EventHandler::mouseDown):
+            (WebCore::EventHandler::mouseDragged):
+            (WebCore::EventHandler::mouseUp):
+            (WebCore::EventHandler::mouseMoved):
+
+            New function to handle pressure change events.
+            (WebCore::EventHandler::pressureChange):
+
+            Pipe through correspondingPressureEvent.
+            (WebCore::EventHandler::passMouseMovedEventToScrollbars):
+            (WebCore::EventHandler::currentPlatformMouseEvent):
+
+            Take the correspondingPressureEvent in order to build a PlatformMouseEvent with
+            the correct pressure information.
+            * platform/mac/PlatformEventFactoryMac.h:
+            * platform/mac/PlatformEventFactoryMac.mm:
+            (WebCore::globalPointForEvent):
+            (WebCore::pointForEvent):
+            (WebCore::mouseButtonForEvent):
+            (WebCore::PlatformMouseEventBuilder::PlatformMouseEventBuilder):
+            (WebCore::PlatformEventFactory::createPlatformMouseEvent):
+
     2015-05-12  Dana Burkart
     Dana Burkart  <[email protected]
     [email protected]>
 
-            Merge r183943. rdar://problem/19913748
+            Merge r183953. rdar://problem/19997548
 
-        2015-05-07  Simon Fraser  <[email protected]>
+        2015-05-06  Roger Fong  <[email protected]>
 
-                Remove the WK1-only code path for independently composited iframes
-                https://bugs.webkit.org/show_bug.cgi?id=144722
+                Media Controls: Scrubber should be independent of actual video time, causes scrubber to be jumpy.
+                https://bugs.webkit.org/show_bug.cgi?id=144700.
+                <rdar://problem/19997548>
 
-                Reviewed by Dean Jackson.
+                Reviewed by Jer Noble.
 
-                In WebKit1 on Mac, we allowed iframes to be composited independently of their
-                parent document, relying on the fact that the frame's platform view can host
-                a layer-backed view. However, this ran into bugs (rdar://problem/18862298),
-                and triggers the assertion at the end of FrameView::updateLayoutAndStyleIfNeededRecursive(),
-                because the compositing update after a layout can dirty style in notifyIFramesOfCompositingChange().
+                Update time and timeline during the timeline input event instead of the wrapper's mousemove.
+                (Controller.prototype.handleWrapperMouseMove):
+                (Controller.prototype.handleTimelineMouseMove):
+                (Controller.prototype.drawTimelineBackground):
 
-                Removing the WK1-only code path solves these problems. It also eliminates the need
-                to do compositing-specific frame overlap testing.
+                (Controller.prototype.updateControlsWhileScrubbing):
+                Updates time and scrubber to reflect timeline user input.
 
-                * page/FrameView.cpp:
-                (WebCore::FrameView::setIsOverlapped): No need to do compositing-related things here.
-                Any iframe that gets composited will participate in the normal compositing overlap
-                testing in its parent frame.
-                (WebCore::FrameView::hasCompositedContentIncludingDescendants): Deleted.
-                (WebCore::FrameView::hasCompositingAncestor): Deleted.
-                * page/FrameView.h:
-                * rendering/RenderLayerCompositor.cpp: Replace ownerElement() checks in this file
-                with an isMainFrameCompositor() for readability. Some 0->nullptr.
-                (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags):
-                (WebCore::RenderLayerCompositor::chromeClient):
-                (WebCore::RenderLayerCompositor::enclosingCompositorFlushingLayers):
-                (WebCore::RenderLayerCompositor::updateCompositingLayers):
-                (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
-                (WebCore::RenderLayerCompositor::updateBacking):
-                (WebCore::RenderLayerCompositor::layerTreeAsText):
-                (WebCore::RenderLayerCompositor::frameContentsCompositor):
-                (WebCore::RenderLayerCompositor::setIsInWindow):
-                (WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame):
-                (WebCore::RenderLayerCompositor::requiresCompositingForFrame): frameRenderer.requiresAcceleratedCompositing()
-                already bails on no content RenderView, so the shouldPropagateCompositingToEnclosingFrame() check does
-                nothing and is removed.
-                (WebCore::RenderLayerCompositor::isAsyncScrollableStickyLayer):
-                (WebCore::RenderLayerCompositor::requiresScrollLayer):
-                (WebCore::RenderLayerCompositor::documentUsesTiledBacking):
-                (WebCore::RenderLayerCompositor::isMainFrameCompositor):
-                (WebCore::RenderLayerCompositor::shouldCompositeOverflowControls):
-                (WebCore::RenderLayerCompositor::requiresOverhangAreasLayer):
-                (WebCore::RenderLayerCompositor::requiresContentShadowLayer):
-                (WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea):
-                (WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea):
-                (WebCore::RenderLayerCompositor::updateLayerForHeader):
-                (WebCore::RenderLayerCompositor::updateLayerForFooter):
-                (WebCore::RenderLayerCompositor::ensureRootLayer): Main frame attaches via ChromeClient,
-                all other frames attach via parent frame.
-                (WebCore::RenderLayerCompositor::notifyIFramesOfCompositingChange): This call to
-                scheduleSetNeedsStyleRecalc(SyntheticStyleChange) was the source of dirtying style after
-                layout, but is no longer needed so remove it.
-                (WebCore::RenderLayerCompositor::registerAllViewportConstrainedLayers):
-                (WebCore::RenderLayerCompositor::unregisterAllViewportConstrainedLayers):
-                (WebCore::RenderLayerCompositor::scrollingCoordinator):
-                (WebCore::RenderLayerCompositor::graphicsLayerFactory):
-                (WebCore::RenderLayerCompositor::allowsIndependentlyCompositedFrames): Deleted.
-                (WebCore::RenderLayerCompositor::shouldPropagateCompositingToEnclosingFrame): Deleted.
-                (WebCore::RenderLayerCompositor::mainFrameBackingIsTiled): Deleted. This was mis-named;
-                it really asks whether the document uses tiled backing, but does not check for main frame.
-                * rendering/RenderLayerCompositor.h:
-                * rendering/RenderWidget.cpp:
-                (WebCore::RenderWidget::paintContents): No need to do frame overlap testing for
-                compositing now.
-
         2015-05-12  Dana Burkart
         Dana Burkart  <[email protected]
         [email protected]>
 
-                Merge r183927. rdar://problem/20854785
+                Merge r183943. rdar://problem/19913748
 
-            2015-05-07  Eric Carlson  <[email protected]>
+            2015-05-07  Simon Fraser  <[email protected]>
 
-                    [Mac] Playback target isn't set on new element
-                    https://bugs.webkit.org/show_bug.cgi?id=144724
+                    Remove the WK1-only code path for independently composited iframes
+                    https://bugs.webkit.org/show_bug.cgi?id=144722
 
-                    Reviewed by Jer Noble.
+                    Reviewed by Dean Jackson.
 
-                    * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
-                    * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
-                    (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): Call setShouldPlayToPlaybackTarget
-                    if necessary.
-                    (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget): Remember
-                    the setting in case we don't have an AVPlayer yet.
+                    In WebKit1 on Mac, we allowed iframes to be composited independently of their
+                    parent document, relying on the fact that the frame's platform view can host
+                    a layer-backed view. However, this ran into bugs (rdar://problem/18862298),
+                    and triggers the assertion at the end of FrameView::updateLayoutAndStyleIfNeededRecursive(),
+                    because the compositing update after a layout can dirty style in notifyIFramesOfCompositingChange().
 
+                    Removing the WK1-only code path solves these problems. It also eliminates the need
+                    to do compositing-specific frame overlap testing.
+
+                    * page/FrameView.cpp:
+                    (WebCore::FrameView::setIsOverlapped): No need to do compositing-related things here.
+                    Any iframe that gets composited will participate in the normal compositing overlap
+                    testing in its parent frame.
+                    (WebCore::FrameView::hasCompositedContentIncludingDescendants): Deleted.
+                    (WebCore::FrameView::hasCompositingAncestor): Deleted.
+                    * page/FrameView.h:
+                    * rendering/RenderLayerCompositor.cpp: Replace ownerElement() checks in this file
+                    with an isMainFrameCompositor() for readability. Some 0->nullptr.
+                    (WebCore::RenderLayerCompositor::cacheAcceleratedCompositingFlags):
+                    (WebCore::RenderLayerCompositor::chromeClient):
+                    (WebCore::RenderLayerCompositor::enclosingCompositorFlushingLayers):
+                    (WebCore::RenderLayerCompositor::updateCompositingLayers):
+                    (WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
+                    (WebCore::RenderLayerCompositor::updateBacking):
+                    (WebCore::RenderLayerCompositor::layerTreeAsText):
+                    (WebCore::RenderLayerCompositor::frameContentsCompositor):
+                    (WebCore::RenderLayerCompositor::setIsInWindow):
+                    (WebCore::RenderLayerCompositor::requiresCompositingForScrollableFrame):
+                    (WebCore::RenderLayerCompositor::requiresCompositingForFrame): frameRenderer.requiresAcceleratedCompositing()
+                    already bails on no content RenderView, so the shouldPropagateCompositingToEnclosingFrame() check does
+                    nothing and is removed.
+                    (WebCore::RenderLayerCompositor::isAsyncScrollableStickyLayer):
+                    (WebCore::RenderLayerCompositor::requiresScrollLayer):
+                    (WebCore::RenderLayerCompositor::documentUsesTiledBacking):
+                    (WebCore::RenderLayerCompositor::isMainFrameCompositor):
+                    (WebCore::RenderLayerCompositor::shouldCompositeOverflowControls):
+                    (WebCore::RenderLayerCompositor::requiresOverhangAreasLayer):
+                    (WebCore::RenderLayerCompositor::requiresContentShadowLayer):
+                    (WebCore::RenderLayerCompositor::updateLayerForTopOverhangArea):
+                    (WebCore::RenderLayerCompositor::updateLayerForBottomOverhangArea):
+                    (WebCore::RenderLayerCompositor::updateLayerForHeader):
+                    (WebCore::RenderLayerCompositor::updateLayerForFooter):
+                    (WebCore::RenderLayerCompositor::ensureRootLayer): Main frame attaches via ChromeClient,
+                    all other frames attach via parent frame.
+                    (WebCore::RenderLayerCompositor::notifyIFramesOfCompositingChange): This call to
+                    scheduleSetNeedsStyleRecalc(SyntheticStyleChange) was the source of dirtying style after
+                    layout, but is no longer needed so remove it.
+                    (WebCore::RenderLayerCompositor::registerAllViewportConstrainedLayers):
+                    (WebCore::RenderLayerCompositor::unregisterAllViewportConstrainedLayers):
+                    (WebCore::RenderLayerCompositor::scrollingCoordinator):
+                    (WebCore::RenderLayerCompositor::graphicsLayerFactory):
+                    (WebCore::RenderLayerCompositor::allowsIndependentlyCompositedFrames): Deleted.
+                    (WebCore::RenderLayerCompositor::shouldPropagateCompositingToEnclosingFrame): Deleted.
+                    (WebCore::RenderLayerCompositor::mainFrameBackingIsTiled): Deleted. This was mis-named;
+                    it really asks whether the document uses tiled backing, but does not check for main frame.
+                    * rendering/RenderLayerCompositor.h:
+                    * rendering/RenderWidget.cpp:
+                    (WebCore::RenderWidget::paintContents): No need to do frame overlap testing for
+                    compositing now.
+
             2015-05-12  Dana Burkart
             Dana Burkart  <[email protected]
             [email protected]>
 
-                    Merge r183909. rdar://problem/18894598
+                    Merge r183927. rdar://problem/20854785
 
-                2015-05-06  Daniel Bates  <[email protected]>
+                2015-05-07  Eric Carlson  <[email protected]>
 
-                        [iOS][WK2] Pause/resume database thread when UIProcess enters/leaves the background
-                        https://bugs.webkit.org/show_bug.cgi?id=144657
-                        <rdar://problem/18894598>
+                        [Mac] Playback target isn't set on new element
+                        https://bugs.webkit.org/show_bug.cgi?id=144724
 
-                        Reviewed by Andy Estes.
+                        Reviewed by Jer Noble.
 
-                        Export WebCore functionality to pause and resume the database thread so that we can
-                        make use of this functionality from WebKit2.
+                        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.h:
+                        * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+                        (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer): Call setShouldPlayToPlaybackTarget
+                        if necessary.
+                        (WebCore::MediaPlayerPrivateAVFoundationObjC::setShouldPlayToPlaybackTarget): Remember
+                        the setting in case we don't have an AVPlayer yet.
 
-                        * Modules/webdatabase/AbstractDatabaseServer.h:
-                        * Modules/webdatabase/DatabaseManager.cpp:
-                        (WebCore::DatabaseManager::setPauseAllDatabases): Added; turns around and calls DatabaseServer::setPauseAllDatabases().
-                        * Modules/webdatabase/DatabaseManager.h:
-                        * Modules/webdatabase/DatabaseServer.cpp:
-                        (WebCore::DatabaseServer::setPauseAllDatabases): Added; turns around and calls
-                        DatabaseTracker::tracker().setDatabasesPaused() to pause or resume the database thread.
-                        For now, we guard this call with PLATFORM(IOS). We'll look to remove this guard once
-                        we fix <https://bugs.webkit.org/show_bug.cgi?id=144660>.
-                        * Modules/webdatabase/DatabaseServer.h:
-
                 2015-05-12  Dana Burkart
-                Dana Burkart  <[email protected]>
+                Dana Burkart  <[email protected]
+                [email protected]>
 
-                        Merge r183942. rdar://problem/20049088
+                        Merge r183909. rdar://problem/18894598
 
-                    2015-05-06  Dean Jackson  <[email protected]>
+                    2015-05-06  Daniel Bates  <[email protected]>
 
-                            Handle backdrop views that have to tile
-                            https://bugs.webkit.org/show_bug.cgi?id=142317
-                            <rdar://problem/20049088>
+                            [iOS][WK2] Pause/resume database thread when UIProcess enters/leaves the background
+                            https://bugs.webkit.org/show_bug.cgi?id=144657
+                            <rdar://problem/18894598>
 
-                            Reviewed by Simon Fraser.
+                            Reviewed by Andy Estes.
 
-                            Take 2 - this was rolled out because Mavericks was crashing.
+                            Export WebCore functionality to pause and resume the database thread so that we can
+                            make use of this functionality from WebKit2.
 
-                            Make sure backdrop layers don't tile. If they are big
-                            enough, we'll leave it to the platform compositor to handle.
+                            * Modules/webdatabase/AbstractDatabaseServer.h:
+                            * Modules/webdatabase/DatabaseManager.cpp:
+                            (WebCore::DatabaseManager::setPauseAllDatabases): Added; turns around and calls DatabaseServer::setPauseAllDatabases().
+                            * Modules/webdatabase/DatabaseManager.h:
+                            * Modules/webdatabase/DatabaseServer.cpp:
+                            (WebCore::DatabaseServer::setPauseAllDatabases): Added; turns around and calls
+                            DatabaseTracker::tracker().setDatabasesPaused() to pause or resume the database thread.
+                            For now, we guard this call with PLATFORM(IOS). We'll look to remove this guard once
+                            we fix <https://bugs.webkit.org/show_bug.cgi?id=144660>.
+                            * Modules/webdatabase/DatabaseServer.h:
 
-                            This also fixes a bug where if a layer changed from a backdrop
-                            type to a tiled type, it would still retain its custom appearance
-                            and we'd try to add children to the wrong layer.
-
-                            Test: compositing/media-controls-bar-appearance-big.html
-
-                            * platform/graphics/ca/GraphicsLayerCA.cpp:
-                            (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): Check if
-                            a layer needs a backdrop before checking if it needs to tile.
-
                     2015-05-12  Dana Burkart
                     Dana Burkart  <[email protected]>
 
-                            Merge r183894. rdar://problem/20049088
+                            Merge r183942. rdar://problem/20049088
 
                         2015-05-06  Dean Jackson  <[email protected]>
 
@@ -182,6 +208,8 @@
 
                                 Reviewed by Simon Fraser.
 
+                                Take 2 - this was rolled out because Mavericks was crashing.
+
                                 Make sure backdrop layers don't tile. If they are big
                                 enough, we'll leave it to the platform compositor to handle.
 
@@ -195,6 +223,32 @@
                                 (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): Check if
                                 a layer needs a backdrop before checking if it needs to tile.
 
+                        2015-05-12  Dana Burkart
+                        Dana Burkart  <[email protected]>
+
+                                Merge r183894. rdar://problem/20049088
+
+                            2015-05-06  Dean Jackson  <[email protected]>
+
+                                    Handle backdrop views that have to tile
+                                    https://bugs.webkit.org/show_bug.cgi?id=142317
+                                    <rdar://problem/20049088>
+
+                                    Reviewed by Simon Fraser.
+
+                                    Make sure backdrop layers don't tile. If they are big
+                                    enough, we'll leave it to the platform compositor to handle.
+
+                                    This also fixes a bug where if a layer changed from a backdrop
+                                    type to a tiled type, it would still retain its custom appearance
+                                    and we'd try to add children to the wrong layer.
+
+                                    Test: compositing/media-controls-bar-appearance-big.html
+
+                                    * platform/graphics/ca/GraphicsLayerCA.cpp:
+                                    (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers): Check if
+                                    a layer needs a backdrop before checking if it needs to tile.
+
 2015-05-06  Brent Fulgham  <[email protected]>
 
         Scroll-snap points do not handle margins and padding propertly

Modified: branches/safari-601.1.32-branch/Source/WebCore/page/EventHandler.h (184243 => 184244)


--- branches/safari-601.1.32-branch/Source/WebCore/page/EventHandler.h	2015-05-13 03:58:15 UTC (rev 184243)
+++ branches/safari-601.1.32-branch/Source/WebCore/page/EventHandler.h	2015-05-13 03:58:20 UTC (rev 184244)
@@ -266,10 +266,11 @@
 
 #if PLATFORM(COCOA) && defined(__OBJC__)
 #if !PLATFORM(IOS)
-    WEBCORE_EXPORT void mouseDown(NSEvent *);
-    WEBCORE_EXPORT void mouseDragged(NSEvent *);
-    WEBCORE_EXPORT void mouseUp(NSEvent *);
-    WEBCORE_EXPORT void mouseMoved(NSEvent *);
+    WEBCORE_EXPORT void mouseDown(NSEvent *, NSEvent *correspondingPressureEvent);
+    WEBCORE_EXPORT void mouseDragged(NSEvent *, NSEvent *correspondingPressureEvent);
+    WEBCORE_EXPORT void mouseUp(NSEvent *, NSEvent *correspondingPressureEvent);
+    WEBCORE_EXPORT void mouseMoved(NSEvent *, NSEvent *correspondingPressureEvent);
+    WEBCORE_EXPORT void pressureChange(NSEvent *, NSEvent* correspondingPressureEvent);
     WEBCORE_EXPORT bool keyEvent(NSEvent *);
     WEBCORE_EXPORT bool wheelEvent(NSEvent *);
 #else
@@ -285,7 +286,7 @@
 #endif
 
 #if !PLATFORM(IOS)
-    WEBCORE_EXPORT void passMouseMovedEventToScrollbars(NSEvent *);
+    WEBCORE_EXPORT void passMouseMovedEventToScrollbars(NSEvent *, NSEvent* correspondingPressureEvent);
 
     WEBCORE_EXPORT void sendFakeEventsAfterWidgetTracking(NSEvent *initiatingEvent);
 #endif
@@ -294,6 +295,7 @@
     void setActivationEventNumber(int num) { m_activationEventNumber = num; }
 
     WEBCORE_EXPORT static NSEvent *currentNSEvent();
+    static NSEvent *correspondingPressureEvent();
 #else
     static WebEvent *currentEvent();
 #endif // !PLATFORM(IOS)

Modified: branches/safari-601.1.32-branch/Source/WebCore/page/mac/EventHandlerMac.mm (184243 => 184244)


--- branches/safari-601.1.32-branch/Source/WebCore/page/mac/EventHandlerMac.mm	2015-05-13 03:58:15 UTC (rev 184243)
+++ branches/safari-601.1.32-branch/Source/WebCore/page/mac/EventHandlerMac.mm	2015-05-13 03:58:20 UTC (rev 184244)
@@ -81,10 +81,21 @@
     return currentNSEventSlot().get();
 }
 
+static RetainPtr<NSEvent>& correspondingPressureEventSlot()
+{
+    static NeverDestroyed<RetainPtr<NSEvent>> event;
+    return event;
+}
+
+NSEvent *EventHandler::correspondingPressureEvent()
+{
+    return correspondingPressureEventSlot().get();
+}
+
 class CurrentEventScope {
      WTF_MAKE_NONCOPYABLE(CurrentEventScope);
 public:
-    CurrentEventScope(NSEvent *);
+    CurrentEventScope(NSEvent *, NSEvent *correspondingPressureEvent);
     ~CurrentEventScope();
 
 private:
@@ -92,21 +103,27 @@
 #ifndef NDEBUG
     RetainPtr<NSEvent> m_event;
 #endif
+    RetainPtr<NSEvent> m_savedPressureEvent;
+    RetainPtr<NSEvent> m_correspondingPressureEvent;
 };
 
-inline CurrentEventScope::CurrentEventScope(NSEvent *event)
+inline CurrentEventScope::CurrentEventScope(NSEvent *event, NSEvent *correspondingPressureEvent)
     : m_savedCurrentEvent(currentNSEventSlot())
 #ifndef NDEBUG
     , m_event(event)
 #endif
+    , m_savedPressureEvent(correspondingPressureEventSlot())
+    , m_correspondingPressureEvent(correspondingPressureEvent)
 {
     currentNSEventSlot() = event;
+    correspondingPressureEventSlot() = correspondingPressureEvent;
 }
 
 inline CurrentEventScope::~CurrentEventScope()
 {
     ASSERT(currentNSEventSlot() == m_event);
     currentNSEventSlot() = m_savedCurrentEvent;
+    correspondingPressureEventSlot() = m_savedPressureEvent;
 }
 
 bool EventHandler::wheelEvent(NSEvent *event)
@@ -115,7 +132,7 @@
     if (!page)
         return false;
 
-    CurrentEventScope scope(event);
+    CurrentEventScope scope(event, nil);
     return handleWheelEvent(PlatformEventFactory::createPlatformWheelEvent(event, page->chrome().platformPageClient()));
 }
 
@@ -125,7 +142,7 @@
 
     ASSERT([event type] == NSKeyDown || [event type] == NSKeyUp);
 
-    CurrentEventScope scope(event);
+    CurrentEventScope scope(event, nil);
     return keyEvent(PlatformEventFactory::createPlatformKeyboardEvent(event));
 
     END_BLOCK_OBJC_EXCEPTIONS;
@@ -469,7 +486,7 @@
     return false;
 }
 
-void EventHandler::mouseDown(NSEvent *event)
+void EventHandler::mouseDown(NSEvent *event, NSEvent *correspondingPressureEvent)
 {
     FrameView* v = m_frame.view();
     if (!v || m_sendingEventToSubview)
@@ -479,14 +496,14 @@
     
     m_mouseDownView = nil;
     
-    CurrentEventScope scope(event);
+    CurrentEventScope scope(event, correspondingPressureEvent);
 
     handleMousePressEvent(currentPlatformMouseEvent());
 
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 
-void EventHandler::mouseDragged(NSEvent *event)
+void EventHandler::mouseDragged(NSEvent *event, NSEvent *correspondingPressureEvent)
 {
     FrameView* v = m_frame.view();
     if (!v || m_sendingEventToSubview)
@@ -494,13 +511,13 @@
 
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
 
-    CurrentEventScope scope(event);
+    CurrentEventScope scope(event, correspondingPressureEvent);
     handleMouseMoveEvent(currentPlatformMouseEvent());
 
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 
-void EventHandler::mouseUp(NSEvent *event)
+void EventHandler::mouseUp(NSEvent *event, NSEvent *correspondingPressureEvent)
 {
     FrameView* v = m_frame.view();
     if (!v || m_sendingEventToSubview)
@@ -508,7 +525,7 @@
 
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
 
-    CurrentEventScope scope(event);
+    CurrentEventScope scope(event, correspondingPressureEvent);
 
     // Our behavior here is a little different that Qt. Qt always sends
     // a mouse release event, even for a double click. To correct problems
@@ -595,7 +612,7 @@
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 
-void EventHandler::mouseMoved(NSEvent *event)
+void EventHandler::mouseMoved(NSEvent *event, NSEvent* correspondingPressureEvent)
 {
     // Reject a mouse moved if the button is down - screws up tracking during autoscroll
     // These happen because WebKit sometimes has to fake up moved events.
@@ -603,20 +620,31 @@
         return;
 
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    CurrentEventScope scope(event);
+    CurrentEventScope scope(event, correspondingPressureEvent);
     mouseMoved(currentPlatformMouseEvent());
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 
-void EventHandler::passMouseMovedEventToScrollbars(NSEvent *event)
+void EventHandler::pressureChange(NSEvent *event, NSEvent* correspondingPressureEvent)
 {
+    if (!m_frame.view() || m_sendingEventToSubview)
+        return;
+
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    CurrentEventScope scope(event, correspondingPressureEvent);
+    handleMouseForceEvent(currentPlatformMouseEvent());
+    END_BLOCK_OBJC_EXCEPTIONS;
+}
+
+void EventHandler::passMouseMovedEventToScrollbars(NSEvent *event, NSEvent* correspondingPressureEvent)
+{
     // Reject a mouse moved if the button is down - screws up tracking during autoscroll
     // These happen because WebKit sometimes has to fake up moved events.
     if (!m_frame.view() || m_mousePressed || m_sendingEventToSubview)
         return;
 
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    CurrentEventScope scope(event);
+    CurrentEventScope scope(event, correspondingPressureEvent);
     passMouseMovedEventToScrollbars(currentPlatformMouseEvent());
     END_BLOCK_OBJC_EXCEPTIONS;
 }
@@ -674,7 +702,7 @@
     NSView *windowView = nil;
     if (Page* page = m_frame.page())
         windowView = page->chrome().platformPageClient();
-    return PlatformEventFactory::createPlatformMouseEvent(currentNSEvent(), windowView);
+    return PlatformEventFactory::createPlatformMouseEvent(currentNSEvent(), correspondingPressureEvent(), windowView);
 }
 
 bool EventHandler::eventActivatedView(const PlatformMouseEvent& event) const

Modified: branches/safari-601.1.32-branch/Source/WebCore/platform/mac/PlatformEventFactoryMac.h (184243 => 184244)


--- branches/safari-601.1.32-branch/Source/WebCore/platform/mac/PlatformEventFactoryMac.h	2015-05-13 03:58:15 UTC (rev 184243)
+++ branches/safari-601.1.32-branch/Source/WebCore/platform/mac/PlatformEventFactoryMac.h	2015-05-13 03:58:20 UTC (rev 184244)
@@ -34,7 +34,7 @@
 
 class PlatformEventFactory {
 public:
-    WEBCORE_EXPORT static PlatformMouseEvent createPlatformMouseEvent(NSEvent *, NSView *windowView);
+    WEBCORE_EXPORT static PlatformMouseEvent createPlatformMouseEvent(NSEvent *, NSEvent *correspondingPressureEvent, NSView *windowView);
     static PlatformWheelEvent createPlatformWheelEvent(NSEvent *, NSView *windowView);
     WEBCORE_EXPORT static PlatformKeyboardEvent createPlatformKeyboardEvent(NSEvent *);
 };

Modified: branches/safari-601.1.32-branch/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm (184243 => 184244)


--- branches/safari-601.1.32-branch/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm	2015-05-13 03:58:15 UTC (rev 184243)
+++ branches/safari-601.1.32-branch/Source/WebCore/platform/mac/PlatformEventFactoryMac.mm	2015-05-13 03:58:20 UTC (rev 184244)
@@ -49,6 +49,9 @@
 static IntPoint globalPointForEvent(NSEvent *event)
 {
     switch ([event type]) {
+#if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+        case NSEventTypePressure:
+#endif
         case NSLeftMouseDown:
         case NSLeftMouseDragged:
         case NSLeftMouseUp:
@@ -71,6 +74,9 @@
 static IntPoint pointForEvent(NSEvent *event, NSView *windowView)
 {
     switch ([event type]) {
+#if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+        case NSEventTypePressure:
+#endif
         case NSLeftMouseDown:
         case NSLeftMouseDragged:
         case NSLeftMouseUp:
@@ -99,6 +105,9 @@
 static MouseButton mouseButtonForEvent(NSEvent *event)
 {
     switch ([event type]) {
+#if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+        case NSEventTypePressure:
+#endif
         case NSLeftMouseDown:
         case NSLeftMouseUp:
         case NSLeftMouseDragged:
@@ -411,29 +420,53 @@
     
 class PlatformMouseEventBuilder : public PlatformMouseEvent {
 public:
-    PlatformMouseEventBuilder(NSEvent *event, NSView *windowView)
+    PlatformMouseEventBuilder(NSEvent *event, NSEvent *correspondingPressureEvent, NSView *windowView)
     {
         // PlatformEvent
-        m_type                              = mouseEventTypeForEvent(event);
-        m_modifiers                         = modifiersForEvent(event);
-        m_timestamp                         = eventTimeStampSince1970(event);
+        m_type = mouseEventTypeForEvent(event);
 
+#if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+        BOOL eventIsPressureEvent = [event type] == NSEventTypePressure;
+        if (eventIsPressureEvent) {
+            // Since AppKit doesn't send mouse events for force down or force up, we have to use the current pressure
+            // event and correspondingPressureEvent to detect if this is MouseForceDown, MouseForceUp, or just MouseForceChanged.
+            if (correspondingPressureEvent.stage == 1 && event.stage == 2)
+                m_type = PlatformEvent::MouseForceDown;
+            else if (correspondingPressureEvent.stage == 2 && event.stage == 1)
+                m_type = PlatformEvent::MouseForceUp;
+            else
+                m_type = PlatformEvent::MouseForceChanged;
+        }
+#else
+        UNUSED_PARAM(correspondingPressureEvent);
+#endif
+
+        m_modifiers = modifiersForEvent(event);
+        m_timestamp = eventTimeStampSince1970(event);
+
         // PlatformMouseEvent
-        m_position                          = pointForEvent(event, windowView);
-        m_globalPosition                    = globalPointForEvent(event);
-        m_button                            = mouseButtonForEvent(event);
-        m_clickCount                        = clickCountForEvent(event);
-        
+        m_position = pointForEvent(event, windowView);
+        m_globalPosition = globalPointForEvent(event);
+        m_button = mouseButtonForEvent(event);
+        m_clickCount = clickCountForEvent(event);
+
+        m_force = 0;
+#if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+        int stage = eventIsPressureEvent ? event.stage : correspondingPressureEvent.stage;
+        double pressure = eventIsPressureEvent ? event.pressure : correspondingPressureEvent.pressure;
+        m_force = stage < 1 ? pressure : pressure + stage - 1;
+#endif
+
         // Mac specific
-        m_modifierFlags                     = [event modifierFlags];
-        m_eventNumber                       = [event eventNumber];
-        m_menuTypeForEvent                  = typeForEvent(event);
+        m_modifierFlags = [event modifierFlags];
+        m_eventNumber = [event eventNumber];
+        m_menuTypeForEvent = typeForEvent(event);
     }
 };
 
-PlatformMouseEvent PlatformEventFactory::createPlatformMouseEvent(NSEvent *event, NSView *windowView)
+PlatformMouseEvent PlatformEventFactory::createPlatformMouseEvent(NSEvent *event, NSEvent *correspondingPressureEvent, NSView *windowView)
 {
-    return PlatformMouseEventBuilder(event, windowView);
+    return PlatformMouseEventBuilder(event, correspondingPressureEvent, windowView);
 }
 
 

Modified: branches/safari-601.1.32-branch/Source/WebKit/ChangeLog (184243 => 184244)


--- branches/safari-601.1.32-branch/Source/WebKit/ChangeLog	2015-05-13 03:58:15 UTC (rev 184243)
+++ branches/safari-601.1.32-branch/Source/WebKit/ChangeLog	2015-05-13 03:58:20 UTC (rev 184244)
@@ -1,3 +1,66 @@
+2015-05-12  Dana Burkart
+Dana Burkart  <[email protected]
[email protected]>
+
+        Merge r183954. rdar://problem/20281886
+
+    2015-05-07  Beth Dakin  <[email protected]>
+
+            New force-related DOM events should fire in WK1 views
+            https://bugs.webkit.org/show_bug.cgi?id=144663
+            -and corresponding-
+            rdar://problem/20281886
+
+            Reviewed by Sam Weinig.
+
+            Pass the lastPressureEvent to WebCore.
+            * WebView/WebHTMLView.mm:
+            (-[WebHTMLView _updateMouseoverWithEvent:]):
+            (-[WebHTMLView rightMouseUp:]):
+            (-[WebHTMLView menuForEvent:]):
+            (-[WebHTMLView acceptsFirstMouse:]):
+            (-[WebHTMLView shouldDelayWindowOrderingForEvent:]):
+            (-[WebHTMLView mouseDown:mouseDown:]):
+            (-[WebHTMLView mouseDragged:]):
+            (-[WebHTMLView mouseUp:mouseUp:]):
+
+            New NSRespnder method for pressure changes.
+            (-[WebHTMLView pressureChangeWithEvent:]):
+
+            New BOOL _contentPreventsDefault tracks whether the HitTestResult prevented the
+            default action. Get rid of willHandleMouseDown; now that the gesture recognizer
+            sets delaysPrimaryMouseButtonEvents to NO, we don’t need this.
+            * WebView/WebImmediateActionController.h:
+            * WebView/WebImmediateActionController.mm:
+            (-[WebImmediateActionController _clearImmediateActionState]):
+
+            Set all of the immediateActionStages on EventHandler. This is critical to keep
+            link navigation happening at the right time now that
+            delaysPrimaryMouseButtonEvents is set to NO.
+            (-[WebImmediateActionController performHitTestAtPoint:]):
+            (-[WebImmediateActionController immediateActionRecognizerDidUpdateAnimation:]):
+            (-[WebImmediateActionController immediateActionRecognizerDidCancelAnimation:]):
+            (-[WebImmediateActionController immediateActionRecognizerDidCompleteAnimation:]):
+
+            Use a dummy animation controller if the content prevents default.
+            (-[WebImmediateActionController _defaultAnimationController]):
+            (-[WebImmediateActionController _updateImmediateActionItem]):
+            (-[WebImmediateActionController webView:willHandleMouseDown:]): Deleted.
+
+            Set delaysPrimaryMouseButtonEvents to NO so that we get existing mouse events when
+            we expect to.
+            * WebView/WebView.mm:
+            (-[WebView _commonInitializationWithFrameName:groupName:]):
+
+            Cache the most recent pressure event so that we can send it to WebCore for all of
+            the mouse events.
+            (-[WebView _pressureEvent]):
+            (-[WebView _setPressureEvent:]):
+            * WebView/WebViewData.h:
+            * WebView/WebViewData.mm:
+            (-[WebViewPrivate dealloc]):
+            * WebView/WebViewInternal.h:
+
 2015-04-27  Brent Fulgham  <[email protected]>
 
         [Win] Deactivate WebGL until Windows tests work properly

Modified: branches/safari-601.1.32-branch/Source/WebKit/mac/ChangeLog (184243 => 184244)


--- branches/safari-601.1.32-branch/Source/WebKit/mac/ChangeLog	2015-05-13 03:58:15 UTC (rev 184243)
+++ branches/safari-601.1.32-branch/Source/WebKit/mac/ChangeLog	2015-05-13 03:58:20 UTC (rev 184244)
@@ -1,3 +1,66 @@
+2015-05-12  Dana Burkart
+Dana Burkart  <[email protected]
[email protected]>
+
+        Merge r183954. rdar://problem/20281886
+
+    2015-05-07  Beth Dakin  <[email protected]>
+
+            New force-related DOM events should fire in WK1 views
+            https://bugs.webkit.org/show_bug.cgi?id=144663
+            -and corresponding-
+            rdar://problem/20281886
+
+            Reviewed by Sam Weinig.
+
+            Pass the lastPressureEvent to WebCore.
+            * WebView/WebHTMLView.mm:
+            (-[WebHTMLView _updateMouseoverWithEvent:]):
+            (-[WebHTMLView rightMouseUp:]):
+            (-[WebHTMLView menuForEvent:]):
+            (-[WebHTMLView acceptsFirstMouse:]):
+            (-[WebHTMLView shouldDelayWindowOrderingForEvent:]):
+            (-[WebHTMLView mouseDown:mouseDown:]):
+            (-[WebHTMLView mouseDragged:]):
+            (-[WebHTMLView mouseUp:mouseUp:]):
+
+            New NSRespnder method for pressure changes.
+            (-[WebHTMLView pressureChangeWithEvent:]):
+
+            New BOOL _contentPreventsDefault tracks whether the HitTestResult prevented the
+            default action. Get rid of willHandleMouseDown; now that the gesture recognizer
+            sets delaysPrimaryMouseButtonEvents to NO, we don’t need this.
+            * WebView/WebImmediateActionController.h:
+            * WebView/WebImmediateActionController.mm:
+            (-[WebImmediateActionController _clearImmediateActionState]):
+
+            Set all of the immediateActionStages on EventHandler. This is critical to keep
+            link navigation happening at the right time now that
+            delaysPrimaryMouseButtonEvents is set to NO.
+            (-[WebImmediateActionController performHitTestAtPoint:]):
+            (-[WebImmediateActionController immediateActionRecognizerDidUpdateAnimation:]):
+            (-[WebImmediateActionController immediateActionRecognizerDidCancelAnimation:]):
+            (-[WebImmediateActionController immediateActionRecognizerDidCompleteAnimation:]):
+
+            Use a dummy animation controller if the content prevents default.
+            (-[WebImmediateActionController _defaultAnimationController]):
+            (-[WebImmediateActionController _updateImmediateActionItem]):
+            (-[WebImmediateActionController webView:willHandleMouseDown:]): Deleted.
+
+            Set delaysPrimaryMouseButtonEvents to NO so that we get existing mouse events when
+            we expect to.
+            * WebView/WebView.mm:
+            (-[WebView _commonInitializationWithFrameName:groupName:]):
+
+            Cache the most recent pressure event so that we can send it to WebCore for all of
+            the mouse events.
+            (-[WebView _pressureEvent]):
+            (-[WebView _setPressureEvent:]):
+            * WebView/WebViewData.h:
+            * WebView/WebViewData.mm:
+            (-[WebViewPrivate dealloc]):
+            * WebView/WebViewInternal.h:
+
 2015-04-02  Myles C. Maxfield  <[email protected]>
 
         Introducing the Platform Abstraction Layer (PAL)

Modified: branches/safari-601.1.32-branch/Source/WebKit/mac/WebView/WebHTMLView.mm (184243 => 184244)


--- branches/safari-601.1.32-branch/Source/WebKit/mac/WebView/WebHTMLView.mm	2015-05-13 03:58:15 UTC (rev 184243)
+++ branches/safari-601.1.32-branch/Source/WebKit/mac/WebView/WebHTMLView.mm	2015-05-13 03:58:20 UTC (rev 184244)
@@ -1768,7 +1768,7 @@
             context:[[NSApp currentEvent] context]
             eventNumber:0 clickCount:0 pressure:0];
         if (Frame* lastHitCoreFrame = core([lastHitView _frame]))
-            lastHitCoreFrame->eventHandler().mouseMoved(event);
+            lastHitCoreFrame->eventHandler().mouseMoved(event, [[self _webView] _pressureEvent]);
     }
 
     lastHitView = view;
@@ -1787,9 +1787,9 @@
                 || [[self _webView] _dashboardBehavior:WebDashboardBehaviorAlwaysSendMouseEventsToAllWindows]
 #endif
                 ) {
-                coreFrame->eventHandler().mouseMoved(event);
+                coreFrame->eventHandler().mouseMoved(event, [[self _webView] _pressureEvent]);
             } else
-                coreFrame->eventHandler().passMouseMovedEventToScrollbars(event);
+                coreFrame->eventHandler().passMouseMovedEventToScrollbars(event, [[self _webView] _pressureEvent]);
         }
 
         [view release];
@@ -3303,7 +3303,7 @@
     [super rightMouseUp:event];
 
     if (Frame* coreframe = core([self _frame]))
-        coreframe->eventHandler().mouseUp(event);
+        coreframe->eventHandler().mouseUp(event, [[self _webView] _pressureEvent]);
 }
 
 static void setMenuItemTarget(NSMenuItem* menuItem)
@@ -3348,8 +3348,8 @@
     // Match behavior of other browsers by sending a mousedown event for right clicks.
     _private->handlingMouseDownEvent = YES;
     page->contextMenuController().clearContextMenu();
-    coreFrame->eventHandler().mouseDown(event);
-    BOOL handledEvent = coreFrame->eventHandler().sendContextMenuEvent(PlatformEventFactory::createPlatformMouseEvent(event, page->chrome().platformPageClient()));
+    coreFrame->eventHandler().mouseDown(event, [[self _webView] _pressureEvent]);
+    BOOL handledEvent = coreFrame->eventHandler().sendContextMenuEvent(PlatformEventFactory::createPlatformMouseEvent(event, [[self _webView] _pressureEvent], page->chrome().platformPageClient()));
     _private->handlingMouseDownEvent = NO;
 
     if (!handledEvent)
@@ -3777,7 +3777,7 @@
             if ([hitHTMLView _isSelectionEvent:event]) {
 #if ENABLE(DRAG_SUPPORT)
                 if (Page* page = coreFrame->page())
-                    result = coreFrame->eventHandler().eventMayStartDrag(PlatformEventFactory::createPlatformMouseEvent(event, page->chrome().platformPageClient()));
+                    result = coreFrame->eventHandler().eventMayStartDrag(PlatformEventFactory::createPlatformMouseEvent(event, [[self _webView] _pressureEvent], page->chrome().platformPageClient()));
 #endif
             } else if ([hitHTMLView _isScrollBarEvent:event])
                 result = true;
@@ -3804,7 +3804,7 @@
 #if ENABLE(DRAG_SUPPORT)
             if (Frame* coreFrame = core([hitHTMLView _frame])) {
                 if (Page* page = coreFrame->page())
-                    result = coreFrame->eventHandler().eventMayStartDrag(PlatformEventFactory::createPlatformMouseEvent(event, page->chrome().platformPageClient()));
+                    result = coreFrame->eventHandler().eventMayStartDrag(PlatformEventFactory::createPlatformMouseEvent(event, [[self _webView] _pressureEvent], page->chrome().platformPageClient()));
             }
 #endif
             [hitHTMLView _setMouseDownEvent:nil];
@@ -3841,7 +3841,6 @@
 
 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     [[[self _webView] _actionMenuController] webView:[self _webView] willHandleMouseDown:event];
-    [[[self _webView] _immediateActionController] webView:[self _webView] willHandleMouseDown:event];
 #endif
 
 #if PLATFORM(IOS)
@@ -3872,7 +3871,7 @@
             // Let WebCore get a chance to deal with the event. This will call back to us
             // to start the autoscroll timer if appropriate.
             if (Frame* coreframe = core([self _frame]))
-                coreframe->eventHandler().mouseDown(event);
+                coreframe->eventHandler().mouseDown(event, [[self _webView] _pressureEvent]);
         }
     }
 #pragma clang diagnostic pop
@@ -3925,7 +3924,7 @@
     if (!_private->ignoringMouseDraggedEvents) {
         if (Frame* frame = core([self _frame])) {
             if (Page* page = frame->page())
-                page->mainFrame().eventHandler().mouseDragged(event);
+                page->mainFrame().eventHandler().mouseDragged(event, [[self _webView] _pressureEvent]);
         }
     }
 
@@ -4064,8 +4063,13 @@
 
     [self _stopAutoscrollTimer];
     if (Frame* frame = core([self _frame])) {
-        if (Page* page = frame->page())
+        if (Page* page = frame->page()) {
+#if PLATFORM(IOS)
             page->mainFrame().eventHandler().mouseUp(event);
+#else
+            page->mainFrame().eventHandler().mouseUp(event, [[self _webView] _pressureEvent]);
+#endif
+        }
     }
 #if !PLATFORM(IOS)
     [self _updateMouseoverWithFakeEvent];
@@ -4081,6 +4085,22 @@
 }
 #endif
 
+- (void)pressureChangeWithEvent:(NSEvent *)event
+{
+#if defined(__LP64__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101003
+    NSEvent *lastPressureEvent = [[self _webView] _pressureEvent];
+    if (event.phase != NSEventPhaseChanged && event.phase != NSEventPhaseBegan && event.phase != NSEventPhaseEnded)
+        return;
+
+    RefPtr<Frame> coreFrame = core([self _frame]);
+    if (!coreFrame)
+        return;
+
+    coreFrame->eventHandler().pressureChange(event, lastPressureEvent);
+    [[self _webView] _setPressureEvent:event];
+#endif
+}
+
 #if !PLATFORM(IOS)
 // returning YES from this method is the way we tell AppKit that it is ok for this view
 // to be in the key loop even when "tab to all controls" is not on.

Modified: branches/safari-601.1.32-branch/Source/WebKit/mac/WebView/WebImmediateActionController.h (184243 => 184244)


--- branches/safari-601.1.32-branch/Source/WebKit/mac/WebView/WebImmediateActionController.h	2015-05-13 03:58:15 UTC (rev 184243)
+++ branches/safari-601.1.32-branch/Source/WebKit/mac/WebView/WebImmediateActionController.h	2015-05-13 03:58:20 UTC (rev 184244)
@@ -45,12 +45,12 @@
     RetainPtr<DDActionContext> _currentActionContext;
     BOOL _isShowingTextIndicator;
     BOOL _hasActivatedActionContext;
+    BOOL _contentPreventsDefault;
 }
 
 - (instancetype)initWithWebView:(WebView *)webView recognizer:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer;
 - (void)webViewClosed;
 
-- (void)webView:(WebView *)webView willHandleMouseDown:(NSEvent *)event;
 - (void)webView:(WebView *)webView didHandleScrollWheel:(NSEvent *)event;
 
 - (NSImmediateActionGestureRecognizer *)immediateActionRecognizer;

Modified: branches/safari-601.1.32-branch/Source/WebKit/mac/WebView/WebImmediateActionController.mm (184243 => 184244)


--- branches/safari-601.1.32-branch/Source/WebKit/mac/WebView/WebImmediateActionController.mm	2015-05-13 03:58:15 UTC (rev 184243)
+++ branches/safari-601.1.32-branch/Source/WebKit/mac/WebView/WebImmediateActionController.mm	2015-05-13 03:58:20 UTC (rev 184244)
@@ -64,6 +64,13 @@
 @interface WebImmediateActionController () <QLPreviewMenuItemDelegate>
 @end
 
+@interface WebAnimationController : NSObject <NSImmediateActionAnimationController> {
+}
+@end
+
+@implementation WebAnimationController
+@end
+
 using namespace WebCore;
 
 @implementation WebImmediateActionController
@@ -94,12 +101,6 @@
     _currentActionContext = nil;
 }
 
-- (void)webView:(WebView *)webView willHandleMouseDown:(NSEvent *)event
-{
-    [self _clearImmediateActionState];
-    [_webView _clearTextIndicatorWithAnimation:TextIndicatorDismissalAnimation::FadeOut];
-}
-
 - (void)webView:(WebView *)webView didHandleScrollWheel:(NSEvent *)event
 {
     [_currentQLPreviewMenuItem close];
@@ -136,6 +137,7 @@
     _type = WebImmediateActionNone;
     _currentActionContext = nil;
     _currentQLPreviewMenuItem = nil;
+    _contentPreventsDefault = NO;
 }
 
 - (void)performHitTestAtPoint:(NSPoint)viewPoint
@@ -144,6 +146,10 @@
     if (!coreFrame)
         return;
     _hitTestResult = coreFrame->eventHandler().hitTestResultAtPoint(IntPoint(viewPoint));
+    coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::PerformedHitTest);
+
+    if (Element* element = _hitTestResult.innerElement())
+        _contentPreventsDefault = element->dispatchMouseForceWillBegin();
 }
 
 #pragma mark NSImmediateActionGestureRecognizerDelegate
@@ -188,6 +194,13 @@
     if (immediateActionRecognizer != _immediateActionRecognizer)
         return;
 
+    Frame* coreFrame = core([[[[_webView _selectedOrMainFrame] frameView] documentView] _frame]);
+    if (!coreFrame)
+        return;
+    coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::ActionUpdated);
+    if (_contentPreventsDefault)
+        return;
+
     [_webView _setTextIndicatorAnimationProgress:[immediateActionRecognizer animationProgress]];
 }
 
@@ -196,6 +209,10 @@
     if (immediateActionRecognizer != _immediateActionRecognizer)
         return;
 
+    Frame* coreFrame = core([[[[_webView _selectedOrMainFrame] frameView] documentView] _frame]);
+    if (coreFrame)
+        coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::ActionCancelled);
+
     [_webView _setTextIndicatorAnimationProgress:0];
     [self _clearImmediateActionState];
     [_webView _clearTextIndicatorWithAnimation:TextIndicatorDismissalAnimation::None];
@@ -207,6 +224,11 @@
     if (immediateActionRecognizer != _immediateActionRecognizer)
         return;
 
+    Frame* coreFrame = core([[[[_webView _selectedOrMainFrame] frameView] documentView] _frame]);
+    if (!coreFrame)
+        return;
+    coreFrame->eventHandler().setImmediateActionStage(ImmediateActionStage::ActionCompleted);
+
     [_webView _setTextIndicatorAnimationProgress:1];
     [_webView _setMaintainsInactiveSelection:NO];
 }
@@ -215,6 +237,11 @@
 
 - (id <NSImmediateActionAnimationController>)_defaultAnimationController
 {
+    if (_contentPreventsDefault) {
+        RetainPtr<WebAnimationController> dummyController = [[WebAnimationController alloc] init];
+        return dummyController.get();
+    }
+
     NSURL *url = ""
     NSString *absoluteURLString = [url absoluteString];
     if (url && _hitTestResult.URLElement()) {
@@ -265,6 +292,11 @@
 
     id <NSImmediateActionAnimationController> defaultAnimationController = [self _defaultAnimationController];
 
+    if (_contentPreventsDefault) {
+        [_immediateActionRecognizer setAnimationController:defaultAnimationController];
+        return;
+    }
+
     // Allow clients the opportunity to override the default immediate action.
     id customClientAnimationController = nil;
     if ([[_webView UIDelegate] respondsToSelector:@selector(_webView:immediateActionAnimationControllerForHitTestResult:withType:)]) {

Modified: branches/safari-601.1.32-branch/Source/WebKit/mac/WebView/WebView.mm (184243 => 184244)


--- branches/safari-601.1.32-branch/Source/WebKit/mac/WebView/WebView.mm	2015-05-13 03:58:15 UTC (rev 184243)
+++ branches/safari-601.1.32-branch/Source/WebKit/mac/WebView/WebView.mm	2015-05-13 03:58:20 UTC (rev 184244)
@@ -910,6 +910,7 @@
         RetainPtr<NSImmediateActionGestureRecognizer> recognizer = adoptNS([(NSImmediateActionGestureRecognizer *)[gestureClass alloc] initWithTarget:nil action:NULL]);
         _private->immediateActionController = [[WebImmediateActionController alloc] initWithWebView:self recognizer:recognizer.get()];
         [recognizer setDelegate:_private->immediateActionController];
+        [recognizer setDelaysPrimaryMouseButtonEvents:NO];
     }
 #endif
 
@@ -8601,6 +8602,16 @@
 }
 #endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
 
+- (NSEvent *)_pressureEvent
+{
+    return _private->pressureEvent.get();
+}
+
+- (void)_setPressureEvent:(NSEvent *)event
+{
+    _private->pressureEvent = event;
+}
+
 - (void)_setTextIndicator:(TextIndicator&)textIndicator
 {
     [self _setTextIndicator:textIndicator withLifetime:TextIndicatorLifetime::Permanent];

Modified: branches/safari-601.1.32-branch/Source/WebKit/mac/WebView/WebViewData.h (184243 => 184244)


--- branches/safari-601.1.32-branch/Source/WebKit/mac/WebView/WebViewData.h	2015-05-13 03:58:15 UTC (rev 184243)
+++ branches/safari-601.1.32-branch/Source/WebKit/mac/WebView/WebViewData.h	2015-05-13 03:58:20 UTC (rev 184244)
@@ -175,6 +175,7 @@
     std::unique_ptr<WebCore::TextIndicatorWindow> textIndicatorWindow;
     BOOL hasInitializedLookupObserver;
     RetainPtr<WebWindowVisibilityObserver> windowVisibilityObserver;
+    RetainPtr<NSEvent> pressureEvent;
 #endif // PLATFORM(MAC)
 
     BOOL shouldMaintainInactiveSelection;

Modified: branches/safari-601.1.32-branch/Source/WebKit/mac/WebView/WebViewInternal.h (184243 => 184244)


--- branches/safari-601.1.32-branch/Source/WebKit/mac/WebView/WebViewInternal.h	2015-05-13 03:58:15 UTC (rev 184243)
+++ branches/safari-601.1.32-branch/Source/WebKit/mac/WebView/WebViewInternal.h	2015-05-13 03:58:20 UTC (rev 184244)
@@ -269,6 +269,8 @@
 - (WebActionMenuController *)_actionMenuController;
 - (WebImmediateActionController *)_immediateActionController;
 #endif
+- (NSEvent *)_pressureEvent;
+- (void)_setPressureEvent:(NSEvent *)event;
 #endif
 
 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS) && defined(__cplusplus)

Modified: branches/safari-601.1.32-branch/Tools/ChangeLog (184243 => 184244)


--- branches/safari-601.1.32-branch/Tools/ChangeLog	2015-05-13 03:58:15 UTC (rev 184243)
+++ branches/safari-601.1.32-branch/Tools/ChangeLog	2015-05-13 03:58:20 UTC (rev 184244)
@@ -1,3 +1,23 @@
+2015-05-12  Dana Burkart
+Dana Burkart  <[email protected]
[email protected]>
+
+        Merge r183954. rdar://problem/20281886
+
+    2015-05-07  Beth Dakin  <[email protected]>
+
+            New force-related DOM events should fire in WK1 views
+            https://bugs.webkit.org/show_bug.cgi?id=144663
+            -and corresponding-
+            rdar://problem/20281886
+
+            Reviewed by Sam Weinig.
+
+            PlatformEventFactory::createPlatformMouseEvent() takes the last pressure event
+            now. Just send nil.
+            * TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm:
+            (TestWebKitAPI::buildAndPerformTest):
+
 2015-05-06  Matt Baker  <[email protected]>
 
         Unreviewed, updated my list of email addresses.

Modified: branches/safari-601.1.32-branch/Tools/TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm (184243 => 184244)


--- branches/safari-601.1.32-branch/Tools/TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm	2015-05-13 03:58:15 UTC (rev 184243)
+++ branches/safari-601.1.32-branch/Tools/TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm	2015-05-13 03:58:20 UTC (rev 184244)
@@ -52,7 +52,7 @@
                                       clickCount:0
                                         pressure:0];
     
-    auto pme = WebCore::PlatformEventFactory::createPlatformMouseEvent(event, webView.get());
+    auto pme = WebCore::PlatformEventFactory::createPlatformMouseEvent(event, nil, webView.get());
     
     EXPECT_EQ(expectedButton, pme.button());
     EXPECT_TRUE(!modifierFlags || pme.modifierFlags() & modifierFlags);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to