Snapshots can be misplaced when custom swipe views are offset from the window origin
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Jul 2015 23:03:38 +0000 (23:03 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Jul 2015 23:03:38 +0000 (23:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=146744
<rdar://problem/20942120>

Reviewed by Dean Jackson.

* UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::beginSwipeGesture):
Keep swipeArea in window coordinates; it was already in window coordinates
when using custom swipe views, but not in the non-custom case.

Convert from window coordinates to parent-of-m_swipeLayer coordinates when
determining m_swipeLayer's frame.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@186532 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm

index 8969e6f..57819e0 100644 (file)
@@ -1,3 +1,19 @@
+2015-07-08  Tim Horton  <timothy_horton@apple.com>
+
+        Snapshots can be misplaced when custom swipe views are offset from the window origin
+        https://bugs.webkit.org/show_bug.cgi?id=146744
+        <rdar://problem/20942120>
+
+        Reviewed by Dean Jackson.
+
+        * UIProcess/mac/ViewGestureControllerMac.mm:
+        (WebKit::ViewGestureController::beginSwipeGesture):
+        Keep swipeArea in window coordinates; it was already in window coordinates
+        when using custom swipe views, but not in the non-custom case.
+
+        Convert from window coordinates to parent-of-m_swipeLayer coordinates when
+        determining m_swipeLayer's frame.
+
 2015-07-07  Andy Estes  <aestes@apple.com>
 
         [iOS][WK2] Ignore synthetic clicks in subframes initiated on a previous page
index 7438b7e..38b7e36 100644 (file)
@@ -556,7 +556,7 @@ void ViewGestureController::beginSwipeGesture(WebBackForwardListItem* targetItem
             m_currentSwipeLiveLayers.append(layer);
         }
     } else {
-        swipeArea = FloatRect(FloatPoint(), m_webPageProxy.viewSize());
+        swipeArea = [rootContentLayer convertRect:CGRectMake(0, 0, m_webPageProxy.viewSize().width(), m_webPageProxy.viewSize().height()) toLayer:nil];
         topContentInset = m_webPageProxy.topContentInset();
         m_currentSwipeLiveLayers.append(rootContentLayer);
     }
@@ -579,7 +579,7 @@ void ViewGestureController::beginSwipeGesture(WebBackForwardListItem* targetItem
 
     [m_swipeLayer setBackgroundColor:backgroundColor.get()];
     [m_swipeLayer setAnchorPoint:CGPointZero];
-    [m_swipeLayer setFrame:swipeArea];
+    [m_swipeLayer setFrame:[snapshotLayerParent convertRect:swipeArea fromLayer:nil]];
     [m_swipeLayer setName:@"Gesture Swipe Root Layer"];
     [m_swipeLayer setGeometryFlipped:geometryIsFlippedToRoot];
     [m_swipeLayer setDelegate:[WebActionDisablingCALayerDelegate shared]];
@@ -597,7 +597,6 @@ void ViewGestureController::beginSwipeGesture(WebBackForwardListItem* targetItem
     if (m_webPageProxy.preferences().viewGestureDebuggingEnabled())
         applyDebuggingPropertiesToSwipeViews();
 
-
     CALayer *layerAdjacentToSnapshot = determineLayerAdjacentToSnapshotForParent(direction, snapshotLayerParent);
     if (direction == SwipeDirection::Back)
         [snapshotLayerParent insertSublayer:m_swipeLayer.get() below:layerAdjacentToSnapshot];