Changeset 211541 in webkit


Ignore:
Timestamp:
Feb 1, 2017 5:12:53 PM (7 years ago)
Author:
Simon Fraser
Message:

[iOS WK2] With visual viewports, a fixed bottom bar can be clipped out when the keyboard is visible
https://bugs.webkit.org/show_bug.cgi?id=167710
rdar://problem/30100286

Reviewed by Wenson Hsieh.
Source/WebCore:

Add a bit of logging to show when RLC decides to not composite a fixed element which
is out of bounds.

Test: fast/visual-viewport/ios/bottom-bar-with-keyboard.html

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::requiresCompositingForPosition):

Source/WebKit2:

The unobscuredRectInContentCoordinates passed to -didUpdateVisibleRect:... could project outside
of the bounds of the document, which is OK when rubber-banding, but not when we're in a stable state,
because that can cause fixed elements to get pushed outside the doc. This happened when the keyboard
triggered bottom content insets on the scroll view.

LayoutTests:

  • fast/visual-viewport/ios/bottom-bar-with-keyboard-expected.txt: Added.
  • fast/visual-viewport/ios/bottom-bar-with-keyboard.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r211536 r211541  
     12017-02-01  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] With visual viewports, a fixed bottom bar can be clipped out when the keyboard is visible
     4        https://bugs.webkit.org/show_bug.cgi?id=167710
     5        rdar://problem/30100286
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        * fast/visual-viewport/ios/bottom-bar-with-keyboard-expected.txt: Added.
     10        * fast/visual-viewport/ios/bottom-bar-with-keyboard.html: Added.
     11
    1122017-02-01  Ryan Haddad  <ryanhaddad@apple.com>
    213
  • trunk/Source/WebCore/ChangeLog

    r211540 r211541  
     12017-02-01  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] With visual viewports, a fixed bottom bar can be clipped out when the keyboard is visible
     4        https://bugs.webkit.org/show_bug.cgi?id=167710
     5        rdar://problem/30100286
     6
     7        Reviewed by Wenson Hsieh.
     8       
     9        Add a bit of logging to show when RLC decides to not composite a fixed element which
     10        is out of bounds.
     11
     12        Test: fast/visual-viewport/ios/bottom-bar-with-keyboard.html
     13
     14        * rendering/RenderLayerCompositor.cpp:
     15        (WebCore::RenderLayerCompositor::requiresCompositingForPosition):
     16
    1172017-02-01  Eric Carlson  <eric.carlson@apple.com>
    218
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r211387 r211541  
    27522752        if (viewportConstrainedNotCompositedReason)
    27532753            *viewportConstrainedNotCompositedReason = RenderLayer::NotCompositedForBoundsOutOfView;
     2754        LOG_WITH_STREAM(Compositing, stream << "Layer " << &layer << " bounds " << layerBounds << " outside visible rect " << viewBounds);
    27542755        return false;
    27552756    }
  • trunk/Source/WebKit2/ChangeLog

    r211538 r211541  
     12017-02-01  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] With visual viewports, a fixed bottom bar can be clipped out when the keyboard is visible
     4        https://bugs.webkit.org/show_bug.cgi?id=167710
     5        rdar://problem/30100286
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        The unobscuredRectInContentCoordinates passed to -didUpdateVisibleRect:... could project outside
     10        of the bounds of the document, which is OK when rubber-banding, but not when we're in a stable state,
     11        because that can cause fixed elements to get pushed outside the doc. This happened when the keyboard
     12        triggered bottom content insets on the scroll view.
     13
     14        Fix by computing a rectangle which is the "allowed" bounds of fixed content, which is permitted
     15        to extend outside the document bounds only when rubber-banding, and intersect unobscuredRectInContentCoordinates
     16        with that rectangle.
     17
     18        * UIProcess/API/Cocoa/WKWebView.mm:
     19        (-[WKWebView _contentBoundsExtendedForRubberbandingWithScale:]):
     20        (-[WKWebView _updateContentRectsWithState:]):
     21
    1222017-02-01  Enrica Casucci  <enrica@apple.com>
    223
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r211476 r211541  
    20882088}
    20892089
     2090- (CGRect)_contentBoundsExtendedForRubberbandingWithScale:(CGFloat)scaleFactor
     2091{
     2092    CGPoint contentOffset = [_scrollView contentOffset];
     2093    CGPoint boundedOffset = contentOffsetBoundedInValidRange(_scrollView.get(), contentOffset);
     2094
     2095    CGFloat horiontalRubberbandAmountInContentCoordinates = (contentOffset.x - boundedOffset.x) / scaleFactor;
     2096    CGFloat verticalRubberbandAmountInContentCoordinates = (contentOffset.y - boundedOffset.y) / scaleFactor;
     2097
     2098    CGRect extendedBounds = [_contentView bounds];
     2099
     2100    if (horiontalRubberbandAmountInContentCoordinates < 0) {
     2101        extendedBounds.origin.x += horiontalRubberbandAmountInContentCoordinates;
     2102        extendedBounds.size.width -= horiontalRubberbandAmountInContentCoordinates;
     2103    } else if (horiontalRubberbandAmountInContentCoordinates > 0)
     2104        extendedBounds.size.width += horiontalRubberbandAmountInContentCoordinates;
     2105
     2106    if (verticalRubberbandAmountInContentCoordinates < 0) {
     2107        extendedBounds.origin.y += verticalRubberbandAmountInContentCoordinates;
     2108        extendedBounds.size.height -= verticalRubberbandAmountInContentCoordinates;
     2109    } else if (verticalRubberbandAmountInContentCoordinates > 0)
     2110        extendedBounds.size.height += verticalRubberbandAmountInContentCoordinates;
     2111
     2112    return extendedBounds;
     2113}
     2114
    20902115- (void)_updateContentRectsWithState:(BOOL)inStableState
    20912116{
     
    21142139        computedContentInsetUnadjustedForKeyboard.bottom -= _totalScrollViewBottomInsetAdjustmentForKeyboard;
    21152140
     2141    CGFloat scaleFactor = contentZoomScale(self);
     2142
    21162143    CGRect unobscuredRect = UIEdgeInsetsInsetRect(fullViewRect, computedContentInsetUnadjustedForKeyboard);
    21172144    CGRect unobscuredRectInContentCoordinates = _frozenUnobscuredContentRect ? _frozenUnobscuredContentRect.value() : [self convertRect:unobscuredRect toView:_contentView.get()];
    2118 
    2119     CGFloat scaleFactor = contentZoomScale(self);
     2145    unobscuredRectInContentCoordinates = CGRectIntersection(unobscuredRectInContentCoordinates, [self _contentBoundsExtendedForRubberbandingWithScale:scaleFactor]);
    21202146
    21212147#if ENABLE(CSS_SCROLL_SNAP) && ENABLE(ASYNC_SCROLLING)
Note: See TracChangeset for help on using the changeset viewer.