Title: [168234] trunk/Source/WebKit2
Revision
168234
Author
timothy_hor...@apple.com
Date
2014-05-03 18:55:18 -0700 (Sat, 03 May 2014)

Log Message

[iOS] REGRESSION (WebKit2): Page isn't clipped properly during back/forward swipe
https://bugs.webkit.org/show_bug.cgi?id=132538
<rdar://problem/16266027>

Reviewed by Simon Fraser.

* UIProcess/ios/ViewGestureControllerIOS.mm:
(WebKit::ViewGestureController::beginSwipeGesture):
(WebKit::ViewGestureController::endSwipeGesture):
* UIProcess/mac/ViewGestureController.h:
Add a clipping layer above the live swipe layer, which explicitly clips to bounds.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (168233 => 168234)


--- trunk/Source/WebKit2/ChangeLog	2014-05-04 01:48:37 UTC (rev 168233)
+++ trunk/Source/WebKit2/ChangeLog	2014-05-04 01:55:18 UTC (rev 168234)
@@ -1,3 +1,17 @@
+2014-05-03  Tim Horton  <timothy_hor...@apple.com>
+
+        [iOS] REGRESSION (WebKit2): Page isn't clipped properly during back/forward swipe
+        https://bugs.webkit.org/show_bug.cgi?id=132538
+        <rdar://problem/16266027>
+
+        Reviewed by Simon Fraser.
+
+        * UIProcess/ios/ViewGestureControllerIOS.mm:
+        (WebKit::ViewGestureController::beginSwipeGesture):
+        (WebKit::ViewGestureController::endSwipeGesture):
+        * UIProcess/mac/ViewGestureController.h:
+        Add a clipping layer above the live swipe layer, which explicitly clips to bounds.
+
 2014-05-02  Pratik Solanki  <psola...@apple.com>
 
         Shortcircuit shouldUseCredentialStorage callback

Modified: trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm (168233 => 168234)


--- trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm	2014-05-04 01:48:37 UTC (rev 168233)
+++ trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm	2014-05-04 01:55:18 UTC (rev 168234)
@@ -151,8 +151,10 @@
 
     WebKit::WebBackForwardListItem* targetItem = direction == SwipeDirection::Left ? m_webPageProxy.backForwardList().backItem() : m_webPageProxy.backForwardList().forwardItem();
 
+    CGRect liveSwipeViewFrame = [m_liveSwipeView frame];
+
     RetainPtr<UIViewController> snapshotViewController = adoptNS([[UIViewController alloc] init]);
-    m_snapshotView = adoptNS([[UIView alloc] initWithFrame:[m_liveSwipeView frame]]);
+    m_snapshotView = adoptNS([[UIView alloc] initWithFrame:liveSwipeViewFrame]);
 
     ViewSnapshotStore::Snapshot snapshot;
     if (ViewSnapshotStore::shared().getSnapshot(targetItem, snapshot)) {
@@ -170,13 +172,16 @@
     [m_snapshotView layer].contentsScale = m_liveSwipeView.window.screen.scale;
     [snapshotViewController setView:m_snapshotView.get()];
 
-    m_transitionContainerView = adoptNS([[UIView alloc] initWithFrame:[m_liveSwipeView frame]]);
+    m_transitionContainerView = adoptNS([[UIView alloc] initWithFrame:liveSwipeViewFrame]);
+    m_liveSwipeViewClippingView = adoptNS([[UIView alloc] initWithFrame:liveSwipeViewFrame]);
+    [m_liveSwipeViewClippingView setClipsToBounds:YES];
 
     [m_liveSwipeView.superview insertSubview:m_transitionContainerView.get() belowSubview:m_liveSwipeView];
-    [m_transitionContainerView addSubview:m_liveSwipeView];
+    [m_liveSwipeViewClippingView addSubview:m_liveSwipeView];
+    [m_transitionContainerView addSubview:m_liveSwipeViewClippingView.get()];
 
     RetainPtr<UIViewController> targettedViewController = adoptNS([[UIViewController alloc] init]);
-    [targettedViewController setView:m_liveSwipeView];
+    [targettedViewController setView:m_liveSwipeViewClippingView.get()];
 
     UINavigationControllerOperation transitionOperation = direction == SwipeDirection::Left ? UINavigationControllerOperationPop : UINavigationControllerOperationPush;
     RetainPtr<_UINavigationParallaxTransition> animationController = adoptNS([[_UINavigationParallaxTransition alloc] initWithCurrentOperation:transitionOperation]);
@@ -185,8 +190,8 @@
     [transitionContext _setFromViewController:targettedViewController.get()];
     [transitionContext _setToViewController:snapshotViewController.get()];
     [transitionContext _setContainerView:m_transitionContainerView.get()];
-    [transitionContext _setFromStartFrame:[m_liveSwipeView frame]];
-    [transitionContext _setToEndFrame:[m_liveSwipeView frame]];
+    [transitionContext _setFromStartFrame:liveSwipeViewFrame];
+    [transitionContext _setToEndFrame:liveSwipeViewFrame];
     [transitionContext _setToStartFrame:CGRectZero];
     [transitionContext _setFromEndFrame:CGRectZero];
     [transitionContext _setAnimator:animationController.get()];
@@ -216,6 +221,8 @@
     
     [[m_transitionContainerView superview] insertSubview:m_snapshotView.get() aboveSubview:m_transitionContainerView.get()];
     [[m_transitionContainerView superview] insertSubview:m_liveSwipeView aboveSubview:m_transitionContainerView.get()];
+    [m_liveSwipeViewClippingView removeFromSuperview];
+    m_liveSwipeViewClippingView = nullptr;
     [m_transitionContainerView removeFromSuperview];
     m_transitionContainerView = nullptr;
     

Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h (168233 => 168234)


--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h	2014-05-04 01:48:37 UTC (rev 168233)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h	2014-05-04 01:55:18 UTC (rev 168234)
@@ -178,6 +178,7 @@
     bool m_shouldIgnorePinnedState;
 #else    
     UIView *m_liveSwipeView;
+    RetainPtr<UIView> m_liveSwipeViewClippingView;
     RetainPtr<UIView> m_snapshotView;
     RetainPtr<UIView> m_transitionContainerView;
     RetainPtr<WKSwipeTransitionController> m_swipeInteractiveTransitionDelegate;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to