Changeset 225981 in webkit


Ignore:
Timestamp:
Dec 15, 2017 1:12:43 PM (6 years ago)
Author:
Simon Fraser
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:]):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r225980 r225981  
     12017-12-14  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Rotating when zoomed in with fingers down can result in a broken tab
     4        https://bugs.webkit.org/show_bug.cgi?id=180859
     5        rdar://problem/34532817
     6
     7        Reviewed by Tim Horton.
     8
     9        If you zoom in fully, then, with two fingers down, rotate the iPhone and rotate back,
     10        then the tab can get into a broken state where the WKContentView has a non-zero position
     11        which may push it entirely off-screen. The tab never recovers.
     12
     13        This is caused by a bug in UIKit (rdar://problem/36065495) so work around it by always
     14        re-setting the position of the content view after zooming. We initialize contentView.frame
     15        from self.bounds, so setting the position (via "center") to the bounds origin should always be safe.
     16
     17        * UIProcess/API/Cocoa/WKWebView.mm:
     18        (-[WKWebView scrollViewDidEndZooming:withView:atScale:]):
     19
    1202017-12-15  Brady Eidson  <beidson@apple.com>
    221
  • trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm

    r225977 r225981  
    23792379{
    23802380    ASSERT(scrollView == _scrollView);
     2381    // FIXME: remove when rdar://problem/36065495 is fixed.
     2382    // When rotating with two fingers down, UIScrollView can set a bogus content view position.
     2383    // "Center" is top left because we set the anchorPoint to 0,0.
     2384    [_contentView setCenter:self.bounds.origin];
     2385
    23812386    [self _scheduleVisibleContentRectUpdateAfterScrollInView:scrollView];
    23822387    [_contentView didZoomToScale:scale];
Note: See TracChangeset for help on using the changeset viewer.