Title: [225981] trunk/Source/WebKit
Revision
225981
Author
[email protected]
Date
2017-12-15 13:12:43 -0800 (Fri, 15 Dec 2017)

Log Message

Rotating when zoomed in with fingers down can result in a broken tab
https://bugs.webkit.org/show_bug.cgi?id=180859
rdar://problem/34532817

Reviewed by Tim Horton.

If you zoom in fully, then, with two fingers down, rotate the iPhone and rotate back,
then the tab can get into a broken state where the WKContentView has a non-zero position
which may push it entirely off-screen. The tab never recovers.

This is caused by a bug in UIKit (rdar://problem/36065495) so work around it by always
re-setting the position of the content view after zooming. We initialize contentView.frame
from self.bounds, so setting the position (via "center") to the bounds origin should always be safe.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView scrollViewDidEndZooming:withView:atScale:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (225980 => 225981)


--- trunk/Source/WebKit/ChangeLog	2017-12-15 21:11:52 UTC (rev 225980)
+++ trunk/Source/WebKit/ChangeLog	2017-12-15 21:12:43 UTC (rev 225981)
@@ -1,3 +1,22 @@
+2017-12-14  Simon Fraser  <[email protected]>
+
+        Rotating when zoomed in with fingers down can result in a broken tab
+        https://bugs.webkit.org/show_bug.cgi?id=180859
+        rdar://problem/34532817
+
+        Reviewed by Tim Horton.
+
+        If you zoom in fully, then, with two fingers down, rotate the iPhone and rotate back,
+        then the tab can get into a broken state where the WKContentView has a non-zero position
+        which may push it entirely off-screen. The tab never recovers.
+
+        This is caused by a bug in UIKit (rdar://problem/36065495) so work around it by always
+        re-setting the position of the content view after zooming. We initialize contentView.frame
+        from self.bounds, so setting the position (via "center") to the bounds origin should always be safe.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView scrollViewDidEndZooming:withView:atScale:]):
+
 2017-12-15  Brady Eidson  <[email protected]>
 
         API test WebKit.WebsiteDataStoreCustomPaths is failing

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (225980 => 225981)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2017-12-15 21:11:52 UTC (rev 225980)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2017-12-15 21:12:43 UTC (rev 225981)
@@ -2378,6 +2378,11 @@
 - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(CGFloat)scale
 {
     ASSERT(scrollView == _scrollView);
+    // FIXME: remove when rdar://problem/36065495 is fixed.
+    // When rotating with two fingers down, UIScrollView can set a bogus content view position.
+    // "Center" is top left because we set the anchorPoint to 0,0.
+    [_contentView setCenter:self.bounds.origin];
+
     [self _scheduleVisibleContentRectUpdateAfterScrollInView:scrollView];
     [_contentView didZoomToScale:scale];
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to