⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 187306 in webkit


Ignore:
Timestamp:
Jul 24, 2015, 12:06:01 AM (11 years ago)
Author:
Lucas Forschler
Message:

Merged r187131. rdar://problem/21046961

Location:
branches/safari-601.1-branch/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-601.1-branch/Source/WebKit2/ChangeLog

    r187305 r187306  
     12015-07-24  Lucas Forschler  <lforschler@apple.com>
     2
     3        Merge r187131
     4
     5    2015-07-21  Zalan Bujtas  <zalan@apple.com>
     6
     7            [iOS] Menu drop down such as on nike.com does not stay
     8            https://bugs.webkit.org/show_bug.cgi?id=147047
     9            rdar://problem/21046961
     10
     11            Reviewed by Benjamin Poulain.
     12
     13            This is a workaround for unintended scrolling while scaling.
     14            (Based on Benjamin Poulain's WIP patch for webkit.org/b/136904)
     15
     16            In certain cases when scaling would result in moving the scrollview (which would trigger
     17            a scroll event on WebCore side), zoomRect is called instead of setZoomScale to ensure
     18            that the scroll position stays intact.
     19
     20            * UIProcess/API/Cocoa/WKWebView.mm:
     21            (-[WKWebView _didCommitLayerTree:]):
     22
    1232015-07-24  Lucas Forschler  <lforschler@apple.com>
    224
  • branches/safari-601.1-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r186757 r187306  
    960960    [_scrollView setMaximumZoomScale:layerTreeTransaction.maximumScaleFactor()];
    961961    [_scrollView setZoomEnabled:layerTreeTransaction.allowsUserScaling()];
    962     if (!layerTreeTransaction.scaleWasSetByUIProcess() && ![_scrollView isZooming] && ![_scrollView isZoomBouncing] && ![_scrollView _isAnimatingZoom])
    963         [_scrollView setZoomScale:layerTreeTransaction.pageScaleFactor()];
     962    if (!layerTreeTransaction.scaleWasSetByUIProcess() && ![_scrollView isZooming] && ![_scrollView isZoomBouncing] && ![_scrollView _isAnimatingZoom]) {
     963        float newPageScaleFactor = layerTreeTransaction.pageScaleFactor();
     964
     965        if (!areEssentiallyEqualAsFloat(contentZoomScale(self), newPageScaleFactor)) {
     966            // FIXME: We need to handle stick to bottom.
     967            WebCore::FloatRect oldUnobscuredContentRect = _page->unobscuredContentRect();
     968            if (!oldUnobscuredContentRect.isEmpty() && oldUnobscuredContentRect.y() < 1) {
     969                CGFloat relativeHorizontalPosition = oldUnobscuredContentRect.x() / oldUnobscuredContentRect.width();
     970                CGPoint newTopLeft = [self _adjustedContentOffset: { relativeHorizontalPosition * newContentSize.width, 0 }];
     971                CGSize scrollViewSize = [_scrollView bounds].size;
     972                CGSize rectToZoomSize = CGSizeMake(scrollViewSize.width * newPageScaleFactor, scrollViewSize.height * newPageScaleFactor);
     973                [_scrollView zoomToRect: { newTopLeft, rectToZoomSize } animated:NO];
     974            } else
     975                [_scrollView setZoomScale:newPageScaleFactor];
     976        }
     977    }
    964978
    965979    [self _updateScrollViewBackground];
Note: See TracChangeset for help on using the changeset viewer.