Title: [187306] branches/safari-601.1-branch/Source/WebKit2
Revision
187306
Author
[email protected]
Date
2015-07-24 00:06:01 -0700 (Fri, 24 Jul 2015)

Log Message

Merged r187131.  rdar://problem/21046961

Modified Paths

Diff

Modified: branches/safari-601.1-branch/Source/WebKit2/ChangeLog (187305 => 187306)


--- branches/safari-601.1-branch/Source/WebKit2/ChangeLog	2015-07-24 07:03:46 UTC (rev 187305)
+++ branches/safari-601.1-branch/Source/WebKit2/ChangeLog	2015-07-24 07:06:01 UTC (rev 187306)
@@ -1,5 +1,27 @@
 2015-07-24  Lucas Forschler  <[email protected]>
 
+        Merge r187131
+
+    2015-07-21  Zalan Bujtas  <[email protected]>
+
+            [iOS] Menu drop down such as on nike.com does not stay
+            https://bugs.webkit.org/show_bug.cgi?id=147047
+            rdar://problem/21046961
+
+            Reviewed by Benjamin Poulain.
+
+            This is a workaround for unintended scrolling while scaling.
+            (Based on Benjamin Poulain's WIP patch for webkit.org/b/136904)
+
+            In certain cases when scaling would result in moving the scrollview (which would trigger
+            a scroll event on WebCore side), zoomRect is called instead of setZoomScale to ensure
+            that the scroll position stays intact.
+
+            * UIProcess/API/Cocoa/WKWebView.mm:
+            (-[WKWebView _didCommitLayerTree:]):
+
+2015-07-24  Lucas Forschler  <[email protected]>
+
         Merge r187136
 
     2015-07-21  Daniel Bates  <[email protected]>

Modified: branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (187305 => 187306)


--- branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-07-24 07:03:46 UTC (rev 187305)
+++ branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2015-07-24 07:06:01 UTC (rev 187306)
@@ -959,9 +959,23 @@
     [_scrollView setMinimumZoomScale:layerTreeTransaction.minimumScaleFactor()];
     [_scrollView setMaximumZoomScale:layerTreeTransaction.maximumScaleFactor()];
     [_scrollView setZoomEnabled:layerTreeTransaction.allowsUserScaling()];
-    if (!layerTreeTransaction.scaleWasSetByUIProcess() && ![_scrollView isZooming] && ![_scrollView isZoomBouncing] && ![_scrollView _isAnimatingZoom])
-        [_scrollView setZoomScale:layerTreeTransaction.pageScaleFactor()];
+    if (!layerTreeTransaction.scaleWasSetByUIProcess() && ![_scrollView isZooming] && ![_scrollView isZoomBouncing] && ![_scrollView _isAnimatingZoom]) {
+        float newPageScaleFactor = layerTreeTransaction.pageScaleFactor();
 
+        if (!areEssentiallyEqualAsFloat(contentZoomScale(self), newPageScaleFactor)) {
+            // FIXME: We need to handle stick to bottom.
+            WebCore::FloatRect oldUnobscuredContentRect = _page->unobscuredContentRect();
+            if (!oldUnobscuredContentRect.isEmpty() && oldUnobscuredContentRect.y() < 1) {
+                CGFloat relativeHorizontalPosition = oldUnobscuredContentRect.x() / oldUnobscuredContentRect.width();
+                CGPoint newTopLeft = [self _adjustedContentOffset: { relativeHorizontalPosition * newContentSize.width, 0 }];
+                CGSize scrollViewSize = [_scrollView bounds].size;
+                CGSize rectToZoomSize = CGSizeMake(scrollViewSize.width * newPageScaleFactor, scrollViewSize.height * newPageScaleFactor);
+                [_scrollView zoomToRect: { newTopLeft, rectToZoomSize } animated:NO];
+            } else
+                [_scrollView setZoomScale:newPageScaleFactor];
+        }
+    }
+
     [self _updateScrollViewBackground];
 
     if (_gestureController)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to