Changeset 199259 in webkit


Ignore:
Timestamp:
Apr 8, 2016 6:18:46 PM (8 years ago)
Author:
Simon Fraser
Message:

[iOS WK2] WKWebViews should consult ancestor UIScrollViews to determine tiling area
https://bugs.webkit.org/show_bug.cgi?id=156429
rdar://problem/25455111

Reviewed by Tim Horton.

When a WKWebView is expanded to full size, then embedded in UIScrollView, it would
create huge tiles that cover the entire view area (since it considered itself non-scrollable).

Fix to always use 512x512 tiles in this configuration, and to adjust the tile coverage
for the area exposed through the enclosing UIScrollView.

Source/WebCore:

  • loader/HistoryController.cpp:

(WebCore::HistoryController::saveScrollPositionAndViewStateToItem): setObscuredInset()
moved from FrameView to Page.

  • page/FrameView.cpp:

(WebCore::FrameView::adjustTiledBackingScrollability): If we're clipped by an ancestor scrollView,
just assume we're scrollable on both axes.

  • page/Page.h:

(WebCore::Page::obscuredInset):
(WebCore::Page::setObscuredInset):
(WebCore::Page::enclosedInScrollView):
(WebCore::Page::setEnclosedInScrollView):

  • platform/ScrollView.h:

(WebCore::ScrollView::platformObscuredInset): Deleted.
(WebCore::ScrollView::platformSetObscuredInset): Deleted.

Source/WebKit2:

  • Shared/VisibleContentRectUpdateInfo.cpp: Add enclosedInScrollView(), which is used to

trigger normal-sized tiles.
(WebKit::VisibleContentRectUpdateInfo::encode):
(WebKit::VisibleContentRectUpdateInfo::decode):

  • Shared/VisibleContentRectUpdateInfo.h:

(WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
(WebKit::VisibleContentRectUpdateInfo::enclosedInScrollView):
(WebKit::operator==):

  • UIProcess/API/Cocoa/WKWebView.mm:

(-[WKWebView _didInvokeUIScrollViewDelegateCallback]): Pass our scrollView.
(-[WKWebView _didFinishScrolling]):
(-[WKWebView scrollViewDidScroll:]):
(-[WKWebView scrollViewDidZoom:]):
(-[WKWebView scrollViewDidEndZooming:withView:atScale:]):
(-[WKWebView _scrollViewDidInterruptDecelerating:]):
(-[WKWebView _visibleRectInEnclosingScrollView:]):
(-[WKWebView _visibleContentRect]): Compute the exposed part of the content relative
to the WKWebView, then intersect with the exposed part via any ancestor UIScrollView.
(-[WKWebView _didScroll]): This is called by UIKit when some ancestor UIScrollView scrolls.
However, we don't get all the UIScrollView delegate callbacks, so have to use a timer to
trigger a call to -_updateVisibleContentRects when we're in a stable state.
(-[WKWebView _enclosingScrollerScrollingEnded:]):
(-[WKWebView _frameOrBoundsChanged]):
(-[WKWebView _updateVisibleContentRects]):
(-[WKWebView _updateVisibleContentRectAfterScrollInView:]): Get the stable state from the
scroll view that the user is interacting with.
(-[WKWebView _updateContentRectsWithState:]):

  • UIProcess/API/Cocoa/WKWebViewInternal.h:
  • UIProcess/WebPageProxy.h: Rather than pass a bazillion arguments through updateVisibleContentRects(), just

pass the VisibleContentRectUpdateInfo struct.

  • UIProcess/ios/WKContentView.h:
  • UIProcess/ios/WKContentView.mm:

(-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollView:]):
(-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:]): Deleted.

  • UIProcess/ios/WebPageProxyIOS.mm:

(WebKit::WebPageProxy::updateVisibleContentRects):

  • UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:

(WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
(WebKit::RemoteLayerTreeDrawingAreaProxy::indicatorLocation):

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::updatePreferences):

  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::updateVisibleContentRects):

Location:
trunk/Source
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r199258 r199259  
     12016-04-08  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] WKWebViews should consult ancestor UIScrollViews to determine tiling area
     4        https://bugs.webkit.org/show_bug.cgi?id=156429
     5        rdar://problem/25455111
     6
     7        Reviewed by Tim Horton.
     8
     9        When a WKWebView is expanded to full size, then embedded in UIScrollView, it would
     10        create huge tiles that cover the entire view area (since it considered itself non-scrollable).
     11
     12        Fix to always use 512x512 tiles in this configuration, and to adjust the tile coverage
     13        for the area exposed through the enclosing UIScrollView.
     14
     15        * loader/HistoryController.cpp:
     16        (WebCore::HistoryController::saveScrollPositionAndViewStateToItem): setObscuredInset()
     17        moved from FrameView to Page.
     18        * page/FrameView.cpp:
     19        (WebCore::FrameView::adjustTiledBackingScrollability): If we're clipped by an ancestor scrollView,
     20        just assume we're scrollable on both axes.
     21        * page/Page.h:
     22        (WebCore::Page::obscuredInset):
     23        (WebCore::Page::setObscuredInset):
     24        (WebCore::Page::enclosedInScrollView):
     25        (WebCore::Page::setEnclosedInScrollView):
     26        * platform/ScrollView.h:
     27        (WebCore::ScrollView::platformObscuredInset): Deleted.
     28        (WebCore::ScrollView::platformSetObscuredInset): Deleted.
     29
    1302016-04-08  Joseph Pecoraro  <pecoraro@apple.com>
    231
  • trunk/Source/WebCore/loader/HistoryController.cpp

    r199233 r199259  
    8080    else
    8181        item->setScrollPosition(frameView->scrollPosition());
     82
    8283#if PLATFORM(IOS)
    8384    item->setExposedContentRect(frameView->exposedContentRect());
    8485    item->setUnobscuredContentRect(frameView->unobscuredContentRect());
    85     item->setObscuredInset(frameView->platformObscuredInset());
    8686#endif
    8787
    8888    Page* page = m_frame.page();
    89     if (page && m_frame.isMainFrame())
     89    if (page && m_frame.isMainFrame()) {
    9090        item->setPageScaleFactor(page->pageScaleFactor() / page->viewScaleFactor());
     91#if PLATFORM(IOS)
     92        item->setObscuredInset(page->obscuredInset());
     93#endif
     94    }
    9195
    9296    // FIXME: It would be great to work out a way to put this code in WebCore instead of calling through to the client.
  • trunk/Source/WebCore/page/FrameView.cpp

    r199200 r199259  
    24862486    bool clippedByAncestorView = static_cast<bool>(m_viewExposedRect);
    24872487
     2488#if PLATFORM(IOS)
     2489    if (Page* page = frame().page())
     2490        clippedByAncestorView |= page->enclosedInScrollView();
     2491#endif
     2492
    24882493    if (delegatesScrolling()) {
    24892494        IntSize documentSize = contentsSize();
  • trunk/Source/WebCore/page/Page.h

    r198929 r199259  
    294294    float topContentInset() const { return m_topContentInset; }
    295295    WEBCORE_EXPORT void setTopContentInset(float);
     296
     297#if PLATFORM(IOS)
     298    FloatSize obscuredInset() const { return m_obscuredInset; }
     299    void setObscuredInset(FloatSize inset) { m_obscuredInset = inset; }
    296300   
     301    bool enclosedInScrollView() const { return m_enclosedInScrollView; }
     302    void setEnclosedInScrollView(bool f) { m_enclosedInScrollView = f; }
     303#endif
     304
    297305#if ENABLE(IOS_TEXT_AUTOSIZING)
    298306    float textAutosizingWidth() const { return m_textAutosizingWidth; }
     
    600608
    601609    float m_topContentInset;
    602    
     610
     611#if PLATFORM(IOS)
     612    // This is only used for history scroll position restoration.
     613    FloatSize m_obscuredInset;
     614    bool m_enclosedInScrollView { false };
     615#endif
     616
    603617#if ENABLE(IOS_TEXT_AUTOSIZING)
    604618    float m_textAutosizingWidth;
  • trunk/Source/WebCore/platform/ScrollView.h

    r199233 r199259  
    379379    WEBCORE_EXPORT void scrollOffsetChangedViaPlatformWidget(const ScrollOffset& oldOffset, const ScrollOffset& newOffset);
    380380
    381 #if PLATFORM(IOS)
    382     FloatSize platformObscuredInset() const { return m_obscuredInset; }
    383     void platformSetObscuredInset(FloatSize inset) { m_obscuredInset = inset; }
    384 #endif
    385 
    386381protected:
    387382    ScrollView();
     
    459454    FloatSize m_unobscuredContentSize;
    460455    // This is only used for history scroll position restoration.
    461     FloatSize m_obscuredInset;
    462456#else
    463457    IntRect m_fixedVisibleContentRect;
  • trunk/Source/WebKit2/ChangeLog

    r199258 r199259  
     12016-04-08  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] WKWebViews should consult ancestor UIScrollViews to determine tiling area
     4        https://bugs.webkit.org/show_bug.cgi?id=156429
     5        rdar://problem/25455111
     6
     7        Reviewed by Tim Horton.
     8
     9        When a WKWebView is expanded to full size, then embedded in UIScrollView, it would
     10        create huge tiles that cover the entire view area (since it considered itself non-scrollable).
     11
     12        Fix to always use 512x512 tiles in this configuration, and to adjust the tile coverage
     13        for the area exposed through the enclosing UIScrollView.
     14
     15        * Shared/VisibleContentRectUpdateInfo.cpp: Add enclosedInScrollView(), which is used to
     16        trigger normal-sized tiles.
     17        (WebKit::VisibleContentRectUpdateInfo::encode):
     18        (WebKit::VisibleContentRectUpdateInfo::decode):
     19        * Shared/VisibleContentRectUpdateInfo.h:
     20        (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
     21        (WebKit::VisibleContentRectUpdateInfo::enclosedInScrollView):
     22        (WebKit::operator==):
     23        * UIProcess/API/Cocoa/WKWebView.mm:
     24        (-[WKWebView _didInvokeUIScrollViewDelegateCallback]): Pass our scrollView.
     25        (-[WKWebView _didFinishScrolling]):
     26        (-[WKWebView scrollViewDidScroll:]):
     27        (-[WKWebView scrollViewDidZoom:]):
     28        (-[WKWebView scrollViewDidEndZooming:withView:atScale:]):
     29        (-[WKWebView _scrollViewDidInterruptDecelerating:]):
     30        (-[WKWebView _visibleRectInEnclosingScrollView:]):
     31        (-[WKWebView _visibleContentRect]): Compute the exposed part of the content relative
     32        to the WKWebView, then intersect with the exposed part via any ancestor UIScrollView.
     33        (-[WKWebView _didScroll]): This is called by UIKit when some ancestor UIScrollView scrolls.
     34        However, we don't get all the UIScrollView delegate callbacks, so have to use a timer to
     35        trigger a call to -_updateVisibleContentRects when we're in a stable state.
     36        (-[WKWebView _enclosingScrollerScrollingEnded:]):
     37        (-[WKWebView _frameOrBoundsChanged]):
     38        (-[WKWebView _updateVisibleContentRects]):
     39        (-[WKWebView _updateVisibleContentRectAfterScrollInView:]): Get the stable state from the
     40        scroll view that the user is interacting with.
     41        (-[WKWebView _updateContentRectsWithState:]):
     42        * UIProcess/API/Cocoa/WKWebViewInternal.h:
     43        * UIProcess/WebPageProxy.h: Rather than pass a bazillion arguments through updateVisibleContentRects(), just
     44        pass the VisibleContentRectUpdateInfo struct.
     45        * UIProcess/ios/WKContentView.h:
     46        * UIProcess/ios/WKContentView.mm:
     47        (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollView:]):
     48        (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:]): Deleted.
     49        * UIProcess/ios/WebPageProxyIOS.mm:
     50        (WebKit::WebPageProxy::updateVisibleContentRects):
     51        * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
     52        (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy):
     53        (WebKit::RemoteLayerTreeDrawingAreaProxy::indicatorLocation):
     54        * WebProcess/WebPage/WebPage.cpp:
     55        (WebKit::WebPage::updatePreferences):
     56        * WebProcess/WebPage/ios/WebPageIOS.mm:
     57        (WebKit::WebPage::updateVisibleContentRects):
     58
    1592016-04-08  Joseph Pecoraro  <pecoraro@apple.com>
    260
     
    80138        * UIProcess/ios/WKContentView.mm:
    81139        (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:]):
     140        Make the VisibleContentRectUpdateInfo here and pass it down.
    82141        (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:]): Deleted.
    83142        * UIProcess/ios/WebPageProxyIOS.mm:
     
    86145        * WebProcess/WebPage/ios/WebPageIOS.mm:
    87146        (WebKit::WebPage::restorePageState):
    88         (WebKit::WebPage::updateVisibleContentRects):
     147        (WebKit::WebPage::updateVisibleContentRects): setObscuredInset() moved from FrameView to Page.
     148        Also call setEnclosedInScrollView() on Page.
    89149
    901502016-04-08  Brady Eidson  <beidson@apple.com>
  • trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.cpp

    r199233 r199259  
    4747    encoder << m_isChangingObscuredInsetsInteractively;
    4848    encoder << m_allowShrinkToFit;
     49    encoder << m_enclosedInScrollView;
    4950}
    5051
     
    7980    if (!decoder.decode(result.m_allowShrinkToFit))
    8081        return false;
     82    if (!decoder.decode(result.m_enclosedInScrollView))
     83        return false;
    8184
    8285    return true;
  • trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.h

    r199233 r199259  
    4242    VisibleContentRectUpdateInfo(const WebCore::FloatRect& exposedContentRect, const WebCore::FloatRect& unobscuredContentRect,
    4343        const WebCore::FloatRect& unobscuredRectInScrollViewCoordinates, const WebCore::FloatRect& customFixedPositionRect,
    44         const WebCore::FloatSize& obscuredInset, double scale, bool inStableState, bool isChangingObscuredInsetsInteractively, bool allowShrinkToFit,
     44        const WebCore::FloatSize& obscuredInset, double scale, bool inStableState, bool isChangingObscuredInsetsInteractively, bool allowShrinkToFit, bool enclosedInScrollView,
    4545        double timestamp, double horizontalVelocity, double verticalVelocity, double scaleChangeRate, uint64_t lastLayerTreeTransactionId)
    4646        : m_exposedContentRect(exposedContentRect)
     
    5858        , m_isChangingObscuredInsetsInteractively(isChangingObscuredInsetsInteractively)
    5959        , m_allowShrinkToFit(allowShrinkToFit)
     60        , m_enclosedInScrollView(enclosedInScrollView)
    6061    {
    6162    }
     
    7172    bool isChangingObscuredInsetsInteractively() const { return m_isChangingObscuredInsetsInteractively; }
    7273    bool allowShrinkToFit() const { return m_allowShrinkToFit; }
     74    bool enclosedInScrollView() const { return m_enclosedInScrollView; }
    7375
    7476    double timestamp() const { return m_timestamp; }
     
    9799    bool m_isChangingObscuredInsetsInteractively { false };
    98100    bool m_allowShrinkToFit { false };
     101    bool m_enclosedInScrollView { false };
    99102};
    100103
     
    111114        && a.scaleChangeRate() == b.scaleChangeRate()
    112115        && a.inStableState() == b.inStableState()
    113         && a.allowShrinkToFit() == b.allowShrinkToFit();
     116        && a.allowShrinkToFit() == b.allowShrinkToFit()
     117        && a.enclosedInScrollView() == b.enclosedInScrollView();
    114118}
    115119
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r199233 r199259  
    241241    RetainPtr<UIView> _customContentFixedOverlayView;
    242242
     243    RetainPtr<NSTimer> _enclosingScrollViewScrollTimer;
     244    BOOL _didScrollSinceLastTimerFire;
     245
    243246    WebCore::Color _scrollViewBackgroundColor;
    244247
     
    10071010    if (_hadDelayedUpdateVisibleContentRects) {
    10081011        _hadDelayedUpdateVisibleContentRects = NO;
    1009         [self _updateVisibleContentRects];
     1012        [self _updateVisibleContentRectAfterScrollInView:_scrollView.get()];
    10101013    }
    10111014}
     
    17511754        return;
    17521755
    1753     [self _updateVisibleContentRects];
     1756    [self _updateVisibleContentRectAfterScrollInView:_scrollView.get()];
    17541757    [_contentView didFinishScrolling];
    17551758}
     
    18051808        [_customContentView scrollViewDidScroll:(UIScrollView *)scrollView];
    18061809
    1807     [self _updateVisibleContentRects];
     1810    [self _updateVisibleContentRectAfterScrollInView:scrollView];
    18081811   
    18091812    if (WebKit::RemoteLayerTreeScrollingPerformanceData* scrollPerfData = _page->scrollingPerformanceData())
     
    18141817{
    18151818    [self _updateScrollViewBackground];
    1816     [self _updateVisibleContentRects];
     1819    [self _updateVisibleContentRectAfterScrollInView:scrollView];
    18171820}
    18181821
     
    18201823{
    18211824    ASSERT(scrollView == _scrollView);
    1822     [self _updateVisibleContentRects];
     1825    [self _updateVisibleContentRectAfterScrollInView:scrollView];
    18231826    [_contentView didZoomToScale:scale];
    18241827}
     
    18351838
    18361839    [_contentView didInterruptScrolling];
     1840    [self _updateVisibleContentRectAfterScrollInView:scrollView];
     1841}
     1842
     1843- (CGRect)_visibleRectInEnclosingScrollView:(UIScrollView *)enclosingScrollView
     1844{
     1845    if (!enclosingScrollView)
     1846        return self.bounds;
     1847
     1848    CGRect exposedRect = [enclosingScrollView convertRect:enclosingScrollView.bounds toView:self];
     1849    return CGRectIntersectsRect(exposedRect, self.bounds) ? CGRectIntersection(exposedRect, self.bounds) : CGRectZero;
     1850}
     1851
     1852- (CGRect)_visibleContentRect
     1853{
     1854    CGRect visibleRectInContentCoordinates = _frozenVisibleContentRect ? _frozenVisibleContentRect.value() : [self convertRect:self.bounds toView:_contentView.get()];
     1855   
     1856    if (UIScrollView *enclosingScroller = [self _scroller]) {
     1857        CGRect viewVisibleRect = [self _visibleRectInEnclosingScrollView:enclosingScroller];
     1858        CGRect viewVisibleContentRect = [self convertRect:viewVisibleRect toView:_contentView.get()];
     1859        visibleRectInContentCoordinates = CGRectIntersection(visibleRectInContentCoordinates, viewVisibleContentRect);
     1860    }
     1861
     1862    return visibleRectInContentCoordinates;
     1863}
     1864
     1865// Called when some ancestor UIScrollView scrolls.
     1866- (void)_didScroll
     1867{
     1868    [self _updateVisibleContentRectAfterScrollInView:[self _scroller]];
     1869
     1870    const NSTimeInterval ScrollingEndedTimerInterval = 0.032;
     1871    if (!_enclosingScrollViewScrollTimer) {
     1872        _enclosingScrollViewScrollTimer = adoptNS([[NSTimer alloc] initWithFireDate:[NSDate dateWithTimeIntervalSinceNow:ScrollingEndedTimerInterval]
     1873            interval:0 target:self selector:@selector(_enclosingScrollerScrollingEnded:) userInfo:nil repeats:YES]);
     1874        [[NSRunLoop mainRunLoop] addTimer:_enclosingScrollViewScrollTimer.get() forMode:NSDefaultRunLoopMode];
     1875    }
     1876    _didScrollSinceLastTimerFire = YES;
     1877}
     1878
     1879- (void)_enclosingScrollerScrollingEnded:(NSTimer *)timer
     1880{
     1881    if (_didScrollSinceLastTimerFire) {
     1882        _didScrollSinceLastTimerFire = NO;
     1883        return;
     1884    }
     1885
    18371886    [self _updateVisibleContentRects];
     1887    [_enclosingScrollViewScrollTimer invalidate];
     1888    _enclosingScrollViewScrollTimer = nil;
    18381889}
    18391890
     
    18481899        if (!_overridesMaximumUnobscuredSize)
    18491900            _page->setMaximumUnobscuredSize(WebCore::FloatSize(bounds.size));
    1850         if (WebKit::DrawingAreaProxy* drawingArea = _page->drawingArea())
     1901        if (auto drawingArea = _page->drawingArea())
    18511902            drawingArea->setSize(WebCore::IntSize(bounds.size), WebCore::IntSize(), WebCore::IntSize());
    18521903    }
     
    18781929- (void)_updateVisibleContentRects
    18791930{
     1931    // For visible rect updates not associated with a spefic UIScrollView, just consider our own scroller.
     1932    [self _updateVisibleContentRectAfterScrollInView:_scrollView.get()];
     1933}
     1934
     1935- (void)_updateVisibleContentRectAfterScrollInView:(UIScrollView *)scrollView
     1936{
     1937    BOOL isStableState = !([scrollView isDragging] || [scrollView isDecelerating] || [scrollView isZooming] || [scrollView _isAnimatingZoom] || [scrollView _isScrollingToTop]);
     1938
     1939    if (isStableState && scrollView == _scrollView.get())
     1940        isStableState = !_isChangingObscuredInsetsInteractively;
     1941   
     1942    if (isStableState && scrollView == _scrollView.get())
     1943        isStableState = ![self _scrollViewIsRubberBanding];
     1944
     1945    // FIXME: this can be made static after we stop supporting iOS 8.x.
     1946    if (isStableState && [scrollView respondsToSelector:@selector(_isInterruptingDeceleration)])
     1947        isStableState = ![scrollView performSelector:@selector(_isInterruptingDeceleration)];
     1948
     1949    [self _updateContentRectsWithState:isStableState];
     1950}
     1951
     1952- (void)_updateContentRectsWithState:(BOOL)inStableState
     1953{
    18801954    if (![self usesStandardContentView]) {
    18811955        [_customContentView web_computedContentInsetDidChange];
     
    18951969
    18961970    CGRect fullViewRect = self.bounds;
    1897     CGRect visibleRectInContentCoordinates = _frozenVisibleContentRect ? _frozenVisibleContentRect.value() : [self convertRect:fullViewRect toView:_contentView.get()];
     1971    CGRect visibleRectInContentCoordinates = [self _visibleContentRect];
    18981972
    18991973    UIEdgeInsets computedContentInsetUnadjustedForKeyboard = [self _computedContentInset];
     
    19061980    CGFloat scaleFactor = contentZoomScale(self);
    19071981
    1908     BOOL isStableState = !(_isChangingObscuredInsetsInteractively || [_scrollView isDragging] || [_scrollView isDecelerating] || [_scrollView isZooming] || [_scrollView _isAnimatingZoom] || [_scrollView _isScrollingToTop] || [self _scrollViewIsRubberBanding]);
    1909 
    1910     // FIXME: this can be made static after we stop supporting iOS 8.x.
    1911     if (isStableState && [_scrollView respondsToSelector:@selector(_isInterruptingDeceleration)])
    1912         isStableState = ![_scrollView performSelector:@selector(_isInterruptingDeceleration)];
    1913 
    19141982#if ENABLE(CSS_SCROLL_SNAP) && ENABLE(ASYNC_SCROLLING)
    1915     if (isStableState) {
     1983    if (inStableState) {
    19161984        WebKit::RemoteScrollingCoordinatorProxy* coordinator = _page->scrollingCoordinatorProxy();
    19171985        if (coordinator && coordinator->hasActiveSnapPoint()) {
    1918             CGRect fullViewRect = self.bounds;
    19191986            CGRect unobscuredRect = UIEdgeInsetsInsetRect(fullViewRect, computedContentInsetUnadjustedForKeyboard);
    19201987           
     
    19372004        obscuredInset:CGSizeMake(_obscuredInsets.left, _obscuredInsets.top)
    19382005        scale:scaleFactor minimumScale:[_scrollView minimumZoomScale]
    1939         inStableState:isStableState
    1940         isChangingObscuredInsetsInteractively:_isChangingObscuredInsetsInteractively];
     2006        inStableState:inStableState
     2007        isChangingObscuredInsetsInteractively:_isChangingObscuredInsetsInteractively
     2008        enclosedInScrollView:[self _scroller] != nil];
    19412009}
    19422010
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h

    r199233 r199259  
    100100
    101101- (void)_updateVisibleContentRects;
     102- (void)_updateVisibleContentRectAfterScrollInView:(UIScrollView *)scrollView;
     103- (void)_updateContentRectsWithState:(BOOL)inStableState;
    102104
    103105- (void)_didFinishLoadForMainFrame;
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.h

    r199233 r199259  
    453453    const WebCore::FloatRect& unobscuredContentRect() const { return m_lastVisibleContentRectUpdate.unobscuredContentRect(); }
    454454
    455     void updateVisibleContentRects(const WebCore::FloatRect& exposedRect, const WebCore::FloatRect& unobscuredRect, const WebCore::FloatRect& unobscuredRectInScrollViewCoordinates, const WebCore::FloatRect& customFixedPositionRect, const WebCore::FloatSize& obscuredInset, double scale, bool inStableState, bool isChangingObscuredInsetsInteractively, bool allowShrinkToFit, double timestamp, double horizontalVelocity, double verticalVelocity, double scaleChangeRate);
     455    void updateVisibleContentRects(const VisibleContentRectUpdateInfo&);
    456456    void resendLastVisibleContentRects();
    457457
  • trunk/Source/WebKit2/UIProcess/ios/WKContentView.h

    r199233 r199259  
    7171    obscuredInset:(CGSize)topInset
    7272    scale:(CGFloat)scale minimumScale:(CGFloat)minimumScale
    73     inStableState:(BOOL)isStableState isChangingObscuredInsetsInteractively:(BOOL)isChangingObscuredInsetsInteractively;
     73    inStableState:(BOOL)isStableState
     74    isChangingObscuredInsetsInteractively:(BOOL)isChangingObscuredInsetsInteractively
     75    enclosedInScrollView:(BOOL)enclosedInScrollView;
    7476
    7577- (void)didFinishScrolling;
  • trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm

    r199233 r199259  
    357357
    358358- (void)didUpdateVisibleRect:(CGRect)visibleRect unobscuredRect:(CGRect)unobscuredRect unobscuredRectInScrollViewCoordinates:(CGRect)unobscuredRectInScrollViewCoordinates
    359     obscuredInset:(CGSize)obscuredInset scale:(CGFloat)zoomScale minimumScale:(CGFloat)minimumScale inStableState:(BOOL)isStableState isChangingObscuredInsetsInteractively:(BOOL)isChangingObscuredInsetsInteractively
    360 {
     359    obscuredInset:(CGSize)obscuredInset scale:(CGFloat)zoomScale minimumScale:(CGFloat)minimumScale inStableState:(BOOL)isStableState isChangingObscuredInsetsInteractively:(BOOL)isChangingObscuredInsetsInteractively enclosedInScrollView:(BOOL)enclosedInScrollView
     360{
     361    auto drawingArea = _page->drawingArea();
     362    if (!drawingArea)
     363        return;
     364
    361365    double timestamp = monotonicallyIncreasingTime();
    362366    HistoricalVelocityData::VelocityData velocityData;
     
    367371
    368372    FloatRect fixedPositionRectForLayout = _page->computeCustomFixedPositionRect(unobscuredRect, zoomScale, WebPageProxy::UnobscuredRectConstraint::ConstrainedToDocumentRect);
    369     _page->updateVisibleContentRects(visibleRect, unobscuredRect, unobscuredRectInScrollViewCoordinates, fixedPositionRectForLayout, WebCore::FloatSize(obscuredInset),
    370         zoomScale, isStableState, isChangingObscuredInsetsInteractively, _webView._allowsViewportShrinkToFit, timestamp, velocityData.horizontalVelocity, velocityData.verticalVelocity, velocityData.scaleChangeRate);
     373
     374    VisibleContentRectUpdateInfo visibleContentRectUpdateInfo(
     375        visibleRect,
     376        unobscuredRect,
     377        unobscuredRectInScrollViewCoordinates,
     378        fixedPositionRectForLayout,
     379        WebCore::FloatSize(obscuredInset),
     380        zoomScale,
     381        isStableState,
     382        isChangingObscuredInsetsInteractively,
     383        _webView._allowsViewportShrinkToFit,
     384        enclosedInScrollView,
     385        timestamp,
     386        velocityData.horizontalVelocity,
     387        velocityData.verticalVelocity,
     388        velocityData.scaleChangeRate,
     389        downcast<RemoteLayerTreeDrawingAreaProxy>(*drawingArea).lastCommittedLayerTreeTransactionID());
     390
     391    _page->updateVisibleContentRects(visibleContentRectUpdateInfo);
    371392
    372393    RemoteScrollingCoordinatorProxy* scrollingCoordinator = _page->scrollingCoordinatorProxy();
     
    374395    scrollingCoordinator->viewportChangedViaDelegatedScrolling(scrollingCoordinator->rootScrollingNodeID(), fixedPositionRect, zoomScale);
    375396
    376     if (auto drawingArea = _page->drawingArea())
    377         drawingArea->updateDebugIndicator();
    378        
     397    drawingArea->updateDebugIndicator();
     398   
    379399    [self updateFixedClippingView:fixedPositionRect];
    380400}
  • trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm

    r199233 r199259  
    183183}
    184184
    185 void WebPageProxy::updateVisibleContentRects(const WebCore::FloatRect& exposedRect, const WebCore::FloatRect& unobscuredRect, const WebCore::FloatRect& unobscuredRectInScrollViewCoordinates, const WebCore::FloatRect& customFixedPositionRect, const WebCore::FloatSize& obscuredInset, double scale, bool inStableState, bool isChangingObscuredInsetsInteractively, bool allowShrinkToFit, double timestamp, double horizontalVelocity, double verticalVelocity, double scaleChangeRate)
     185void WebPageProxy::updateVisibleContentRects(const VisibleContentRectUpdateInfo& visibleContentRectUpdate)
    186186{
    187187    if (!isValid())
    188188        return;
    189189
    190     VisibleContentRectUpdateInfo visibleContentRectUpdateInfo(exposedRect, unobscuredRect, unobscuredRectInScrollViewCoordinates, customFixedPositionRect, obscuredInset, scale, inStableState, isChangingObscuredInsetsInteractively, allowShrinkToFit, timestamp, horizontalVelocity, verticalVelocity, scaleChangeRate, downcast<RemoteLayerTreeDrawingAreaProxy>(*drawingArea()).lastCommittedLayerTreeTransactionID());
    191 
    192     if (visibleContentRectUpdateInfo == m_lastVisibleContentRectUpdate)
    193         return;
    194 
    195     m_lastVisibleContentRectUpdate = visibleContentRectUpdateInfo;
    196     m_process->send(Messages::ViewUpdateDispatcher::VisibleContentRectUpdate(m_pageID, visibleContentRectUpdateInfo), 0);
     190    if (visibleContentRectUpdate == m_lastVisibleContentRectUpdate)
     191        return;
     192
     193    m_lastVisibleContentRectUpdate = visibleContentRectUpdate;
     194    m_process->send(Messages::ViewUpdateDispatcher::VisibleContentRectUpdate(m_pageID, visibleContentRectUpdate), 0);
    197195}
    198196
  • trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm

    r199111 r199259  
    260260#if PLATFORM(IOS)
    261261        FloatPoint tiledMapLocation = m_webPageProxy.unobscuredContentRect().location();
     262        tiledMapLocation = tiledMapLocation.expandedTo(m_webPageProxy.exposedContentRect().location() + FloatSize(0, 60));
     263
    262264        float absoluteInset = indicatorInset / m_webPageProxy.displayedContentScale();
    263265        tiledMapLocation += FloatSize(absoluteInset, absoluteInset);
  • trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

    r199233 r199259  
    29652965
    29662966    frameView.setUnobscuredContentSize(visibleContentRectUpdateInfo.unobscuredContentRect().size());
    2967     frameView.platformSetObscuredInset(visibleContentRectUpdateInfo.obscuredInset());
     2967    m_page->setObscuredInset(visibleContentRectUpdateInfo.obscuredInset());
     2968    m_page->setEnclosedInScrollView(visibleContentRectUpdateInfo.enclosedInScrollView());
    29682969
    29692970    double horizontalVelocity = visibleContentRectUpdateInfo.horizontalVelocity();
Note: See TracChangeset for help on using the changeset viewer.