Title: [211696] branches/safari-603-branch

Diff

Modified: branches/safari-603-branch/LayoutTests/ChangeLog (211695 => 211696)


--- branches/safari-603-branch/LayoutTests/ChangeLog	2017-02-06 04:03:38 UTC (rev 211695)
+++ branches/safari-603-branch/LayoutTests/ChangeLog	2017-02-06 04:03:42 UTC (rev 211696)
@@ -1,5 +1,20 @@
 2017-02-02  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r211541. rdar://problem/30100286
+
+    2017-02-01  Simon Fraser  <simon.fra...@apple.com>
+
+            [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.
+
+            * fast/visual-viewport/ios/bottom-bar-with-keyboard-expected.txt: Added.
+            * fast/visual-viewport/ios/bottom-bar-with-keyboard.html: Added.
+
+2017-02-02  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r211471. rdar://problem/30270210
 
     2017-01-31  Wenson Hsieh  <wenson_hs...@apple.com>

Added: branches/safari-603-branch/LayoutTests/fast/visual-viewport/ios/bottom-bar-with-keyboard-expected.txt (0 => 211696)


--- branches/safari-603-branch/LayoutTests/fast/visual-viewport/ios/bottom-bar-with-keyboard-expected.txt	                        (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/visual-viewport/ios/bottom-bar-with-keyboard-expected.txt	2017-02-06 04:03:42 UTC (rev 211696)
@@ -0,0 +1,3 @@
+Layout viewport: {"top":0,"right":320,"bottom":548,"left":0,"width":320,"height":548}
+Visual viewport: {"top":375,"right":220,"bottom":548,"left":0,"width":220,"height":173}
+

Added: branches/safari-603-branch/LayoutTests/fast/visual-viewport/ios/bottom-bar-with-keyboard.html (0 => 211696)


--- branches/safari-603-branch/LayoutTests/fast/visual-viewport/ios/bottom-bar-with-keyboard.html	                        (rev 0)
+++ branches/safari-603-branch/LayoutTests/fast/visual-viewport/ios/bottom-bar-with-keyboard.html	2017-02-06 04:03:42 UTC (rev 211696)
@@ -0,0 +1,58 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<head>
+    <meta name="viewport" content="initial-scale=1.0">
+    <style>
+        body {
+            height: 100%;
+        }
+        .fixed {
+            position: fixed;
+            background-color: silver;
+            bottom: 0;
+            padding: 10px;
+        }
+    </style>
+    <script>
+        if (window.testRunner) {
+            testRunner.waitUntilDone();
+            testRunner.dumpAsText();
+        }
+
+        function getFocusInputUIScript(x, y)
+        {
+            return `(function() {
+                uiController.didEndZoomingCallback = function() {
+                    uiController.uiScriptComplete();
+                }
+                
+                uiController.singleTapAtPoint(${x}, ${y}, function() {});
+            })();`;
+        }
+
+        function runTest()
+        {
+            if (!window.testRunner || !testRunner.runUIScript)
+                return;
+
+            var rect = document.getElementById('input').getBoundingClientRect();
+            // singleTapAtPoint takes document coordinates, so add scrollTop to clientRect.top.
+            testRunner.runUIScript(getFocusInputUIScript(rect.left, rect.top + document.scrollingElement.scrollTop), function() {
+                var output = 'Layout viewport: ' + JSON.stringify(internals.layoutViewportRect()) + '\nVisual viewport: ' + JSON.stringify(internals.visualViewportRect()) + '\n';
+                document.getElementById('results').innerText = output;
+
+                testRunner.notifyDone();
+            });
+        }
+
+        window.addEventListener('load', runTest, false);
+    </script>
+</head>
+<body>
+<pre id="results"></pre>
+<div class="fixed">
+    <input id="input" type="text">
+</div>
+</body>
+</html>

Modified: branches/safari-603-branch/Source/WebCore/ChangeLog (211695 => 211696)


--- branches/safari-603-branch/Source/WebCore/ChangeLog	2017-02-06 04:03:38 UTC (rev 211695)
+++ branches/safari-603-branch/Source/WebCore/ChangeLog	2017-02-06 04:03:42 UTC (rev 211696)
@@ -1,5 +1,25 @@
 2017-02-02  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r211541. rdar://problem/30100286
+
+    2017-02-01  Simon Fraser  <simon.fra...@apple.com>
+
+            [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.
+
+            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):
+
+2017-02-02  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r211471. rdar://problem/30270210
 
     2017-01-31  Wenson Hsieh  <wenson_hs...@apple.com>

Modified: branches/safari-603-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp (211695 => 211696)


--- branches/safari-603-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp	2017-02-06 04:03:38 UTC (rev 211695)
+++ branches/safari-603-branch/Source/WebCore/rendering/RenderLayerCompositor.cpp	2017-02-06 04:03:42 UTC (rev 211696)
@@ -2783,6 +2783,7 @@
     if (!viewBounds.intersects(enclosingIntRect(absoluteBounds))) {
         if (viewportConstrainedNotCompositedReason)
             *viewportConstrainedNotCompositedReason = RenderLayer::NotCompositedForBoundsOutOfView;
+        LOG_WITH_STREAM(Compositing, stream << "Layer " << &layer << " bounds " << layerBounds << " outside visible rect " << viewBounds);
         return false;
     }
     

Modified: branches/safari-603-branch/Source/WebKit2/ChangeLog (211695 => 211696)


--- branches/safari-603-branch/Source/WebKit2/ChangeLog	2017-02-06 04:03:38 UTC (rev 211695)
+++ branches/safari-603-branch/Source/WebKit2/ChangeLog	2017-02-06 04:03:42 UTC (rev 211696)
@@ -1,5 +1,30 @@
 2017-02-02  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r211541. rdar://problem/30100286
+
+    2017-02-01  Simon Fraser  <simon.fra...@apple.com>
+
+            [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.
+
+            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.
+
+            Fix by computing a rectangle which is the "allowed" bounds of fixed content, which is permitted
+            to extend outside the document bounds only when rubber-banding, and intersect unobscuredRectInContentCoordinates
+            with that rectangle.
+
+            * UIProcess/API/Cocoa/WKWebView.mm:
+            (-[WKWebView _contentBoundsExtendedForRubberbandingWithScale:]):
+            (-[WKWebView _updateContentRectsWithState:]):
+
+2017-02-02  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r211538. rdar://problem/30229620
 
     2017-02-01  Enrica Casucci  <enr...@apple.com>

Modified: branches/safari-603-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (211695 => 211696)


--- branches/safari-603-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2017-02-06 04:03:38 UTC (rev 211695)
+++ branches/safari-603-branch/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm	2017-02-06 04:03:42 UTC (rev 211696)
@@ -2108,6 +2108,31 @@
         || (contentSize.height + contentInset.top + contentInset.bottom) > boundsSize.height;
 }
 
+- (CGRect)_contentBoundsExtendedForRubberbandingWithScale:(CGFloat)scaleFactor
+{
+    CGPoint contentOffset = [_scrollView contentOffset];
+    CGPoint boundedOffset = contentOffsetBoundedInValidRange(_scrollView.get(), contentOffset);
+
+    CGFloat horiontalRubberbandAmountInContentCoordinates = (contentOffset.x - boundedOffset.x) / scaleFactor;
+    CGFloat verticalRubberbandAmountInContentCoordinates = (contentOffset.y - boundedOffset.y) / scaleFactor;
+
+    CGRect extendedBounds = [_contentView bounds];
+
+    if (horiontalRubberbandAmountInContentCoordinates < 0) {
+        extendedBounds.origin.x += horiontalRubberbandAmountInContentCoordinates;
+        extendedBounds.size.width -= horiontalRubberbandAmountInContentCoordinates;
+    } else if (horiontalRubberbandAmountInContentCoordinates > 0)
+        extendedBounds.size.width += horiontalRubberbandAmountInContentCoordinates;
+
+    if (verticalRubberbandAmountInContentCoordinates < 0) {
+        extendedBounds.origin.y += verticalRubberbandAmountInContentCoordinates;
+        extendedBounds.size.height -= verticalRubberbandAmountInContentCoordinates;
+    } else if (verticalRubberbandAmountInContentCoordinates > 0)
+        extendedBounds.size.height += verticalRubberbandAmountInContentCoordinates;
+
+    return extendedBounds;
+}
+
 - (void)_updateContentRectsWithState:(BOOL)inStableState
 {
     if (![self usesStandardContentView]) {
@@ -2133,11 +2158,12 @@
     if (!_haveSetObscuredInsets)
         computedContentInsetUnadjustedForKeyboard.bottom -= _totalScrollViewBottomInsetAdjustmentForKeyboard;
 
+    CGFloat scaleFactor = contentZoomScale(self);
+
     CGRect unobscuredRect = UIEdgeInsetsInsetRect(fullViewRect, computedContentInsetUnadjustedForKeyboard);
     CGRect unobscuredRectInContentCoordinates = _frozenUnobscuredContentRect ? _frozenUnobscuredContentRect.value() : [self convertRect:unobscuredRect toView:_contentView.get()];
+    unobscuredRectInContentCoordinates = CGRectIntersection(unobscuredRectInContentCoordinates, [self _contentBoundsExtendedForRubberbandingWithScale:scaleFactor]);
 
-    CGFloat scaleFactor = contentZoomScale(self);
-
 #if ENABLE(CSS_SCROLL_SNAP) && ENABLE(ASYNC_SCROLLING)
     if (inStableState) {
         WebKit::RemoteScrollingCoordinatorProxy* coordinator = _page->scrollingCoordinatorProxy();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to