Changeset 209967 in webkit
- Timestamp:
- Dec 17, 2016 11:18:12 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 46 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r209964 r209967 1 2016-12-17 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Visual viewports: bottom fixed elements disappear behind the keyboard 4 https://bugs.webkit.org/show_bug.cgi?id=165983 5 <rdar://problem/29409852> 6 7 Reviewed by Simon Fraser. 8 9 Tweaked fixed-caret-position-after-scroll.html to account for the keyboard height, and also added a new layout 10 test, fixed-element-on-bottom-with-keyboard.html, which checks that the layout viewport does not change before 11 and after showing the keyboard, and that scrolling past the end of the document does not bump the layout 12 viewport past document bounds. 13 14 The rest of the changes here involve rebaselining existing tests to account for the height of the web view no 15 longer being equal to the height of the window. 16 17 * editing/caret/ios/absolute-caret-position-after-scroll-expected.txt: 18 * editing/caret/ios/absolute-caret-position-after-scroll.html: 19 * editing/caret/ios/fixed-caret-position-after-scroll-expected.txt: 20 * editing/caret/ios/fixed-caret-position-after-scroll.html: 21 * editing/selection/ios/absolute-selection-after-scroll.html: 22 * editing/selection/ios/fixed-selection-after-scroll.html: 23 * fast/events/ios/keyboard-scrolling-distance-expected.txt: 24 * fast/events/ios/keyboard-should-not-trigger-resize-expected.txt: 25 * fast/events/ios/viewport-zooms-from-element-to-initial-scale-expected.txt: 26 * fast/forms/ios/accessory-bar-navigation-expected.txt: 27 * fast/forms/ios/focus-input-in-fixed-expected.txt: 28 * fast/forms/ios/focus-input-in-iframe-expected.txt: 29 * fast/forms/ios/focus-input-via-button-expected.txt: 30 * fast/forms/ios/focus-input-via-button-no-scaling-expected.txt: 31 * fast/forms/ios/focus-long-textarea-expected.txt: 32 * fast/forms/ios/zoom-after-input-tap-expected.txt: 33 * fast/forms/ios/zoom-after-input-tap-wide-input-expected.txt: 34 * fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor-expected.txt: 35 * fast/viewport/ios/width-is-device-width-expected.txt: 36 * fast/visual-viewport/ios/fixed-element-on-bottom-with-keyboard-expected.txt: Added. 37 * fast/visual-viewport/ios/fixed-element-on-bottom-with-keyboard.html: Added. 38 * fast/visual-viewport/ios/zoomed-focus-in-fixed-expected.txt: 39 * platform/ios-simulator/fast/scrolling/ios/clipping-ancestor-with-accelerated-scrolling-ancestor-expected.txt: 40 * platform/ios-simulator/fast/scrolling/ios/overflow-scrolling-ancestor-clip-expected.txt: 41 * platform/ios-simulator/fast/scrolling/ios/overflow-scrolling-ancestor-clip-size-expected.txt: 42 * platform/ios-simulator/fast/scrolling/ios/scrolling-content-clip-to-viewport-expected.txt: 43 * platform/ios-simulator/fast/scrolling/ios/touch-stacking-expected.txt: 44 * scrollingcoordinator/ios/non-stable-viewport-scroll-expected.txt: 45 * scrollingcoordinator/ios/ui-scrolling-tree-expected.txt: 46 1 47 2016-12-17 Jer Noble <jer.noble@apple.com> 2 48 -
trunk/LayoutTests/editing/caret/ios/absolute-caret-position-after-scroll-expected.txt
r209931 r209967 2 2 3 3 TEST COMPLETE 4 The initial caret rect is: [6 17; 3 15]5 The caret rect after scrolling 1000px down is: [6 17; 3 15]4 The initial caret rect is: [6 21 ; 3 15] 5 The caret rect after scrolling 1000px down is: [6 21 ; 3 15] 6 6 PASS finalCaretRect.top is initialCaretRect.top 7 7 PASS finalCaretRect.left is initialCaretRect.left -
trunk/LayoutTests/editing/caret/ios/absolute-caret-position-after-scroll.html
r209931 r209967 1 <!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] --> 1 2 <html> 2 3 <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> -
trunk/LayoutTests/editing/caret/ios/fixed-caret-position-after-scroll-expected.txt
r209931 r209967 2 2 3 3 TEST COMPLETE 4 The initial caret rect is: [6 17 ; 3 15] 5 The caret rect after scrolling 1000px down is: [6 1017 ; 3 15] 6 PASS finalCaretRect.top - initialCaretRect.top is 1000 4 PASS finalCaretRect.top - initialCaretRect.top is 500 7 5 -
trunk/LayoutTests/editing/caret/ios/fixed-caret-position-after-scroll.html
r209931 r209967 1 <!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] --> 1 2 <html> 2 3 <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> … … 8 9 } 9 10 10 input {11 #input { 11 12 width: 100%; 12 13 height: 50px; … … 27 28 } 28 29 29 function tapInInputScript(tapX, tapY)30 function getInputViewBoundsAfterTappingInInputScript(tapX, tapY) 30 31 { 31 32 return `(function() { 32 33 uiController.didShowKeyboardCallback = function() { 33 34 uiController.doAfterNextStablePresentationUpdate(function() { 34 uiController.uiScriptComplete(JSON.stringify(uiController. textSelectionCaretRect));35 uiController.uiScriptComplete(JSON.stringify(uiController.inputViewBounds)); 35 36 }); 36 37 }; … … 39 40 } 40 41 41 function simulateScrollingScript(distance)42 function getCaretRectAfterScrollToOffsetScript(distance) 42 43 { 43 44 return `(function() { … … 63 64 } 64 65 65 testRunner.runUIScript(tapInInputScript(window.innerWidth / 2, 30), initialCaretRect => { 66 initialCaretRect = JSON.parse(initialCaretRect); 67 window.initialCaretRect = initialCaretRect; 68 debug(`The initial caret rect is: ${toString(initialCaretRect)}`); 69 testRunner.runUIScript(simulateScrollingScript(1000), finalCaretRect => { 70 finalCaretRect = JSON.parse(finalCaretRect); 71 window.finalCaretRect = finalCaretRect; 72 debug(`The caret rect after scrolling 1000px down is: ${toString(finalCaretRect)}`); 73 shouldBe("finalCaretRect.top - initialCaretRect.top", "1000"); 74 testRunner.notifyDone(); 66 testRunner.runUIScript(getInputViewBoundsAfterTappingInInputScript(window.innerWidth / 2, 30), (inputViewBounds) => { 67 window.inputViewBounds = inputViewBounds = JSON.parse(inputViewBounds); 68 testRunner.runUIScript(getCaretRectAfterScrollToOffsetScript(inputViewBounds.height), initialCaretRect => { 69 window.initialCaretRect = initialCaretRect = JSON.parse(initialCaretRect); 70 testRunner.runUIScript(getCaretRectAfterScrollToOffsetScript(inputViewBounds.height + 500), finalCaretRect => { 71 window.finalCaretRect = finalCaretRect = JSON.parse(finalCaretRect); 72 shouldBe("finalCaretRect.top - initialCaretRect.top", "500"); 73 testRunner.notifyDone(); 74 }); 75 75 }); 76 76 }); … … 79 79 </head> 80 80 <body onload=run()> 81 <input ></input>81 <input id="input"></input> 82 82 <script src="../../../resources/js-test-post.js"></script> 83 83 </body> -
trunk/LayoutTests/editing/selection/ios/absolute-selection-after-scroll.html
r209931 r209967 1 <!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] --> 1 2 <html> 2 3 <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> -
trunk/LayoutTests/editing/selection/ios/fixed-selection-after-scroll.html
r209931 r209967 1 <!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] --> 1 2 <html> 2 3 <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> -
trunk/LayoutTests/fast/events/ios/keyboard-scrolling-distance-expected.txt
r204385 r209967 3 3 TEST COMPLETE 4 4 Before pressing the spacebar, window.scrollY = 0 5 After pressing the spacebar, window.scrollY = 3025 After pressing the spacebar, window.scrollY = 291 6 6 -
trunk/LayoutTests/fast/events/ios/keyboard-should-not-trigger-resize-expected.txt
r204385 r209967 3 3 4 4 TEST COMPLETE 5 After showing the keyboard, window.innerHeight = 5 686 After hiding the keyboard, window.innerHeight = 5 685 After showing the keyboard, window.innerHeight = 548 6 After hiding the keyboard, window.innerHeight = 548 7 7 -
trunk/LayoutTests/fast/events/ios/viewport-zooms-from-element-to-initial-scale-expected.txt
r191644 r209967 1 The viewport zoomed to scale: 51 The viewport zoomed to scale: 1.6 -
trunk/LayoutTests/fast/forms/ios/accessory-bar-navigation-expected.txt
r204385 r209967 6 6 tap location { x: 38.000, y: 446.000 } 7 7 scale 0.749 8 visibleRect { left: 0.000, top: 279.552, width: 427.000, height: 7 57.925}8 visibleRect { left: 0.000, top: 279.552, width: 427.000, height: 731.237 } 9 9 After move to second field 10 10 11 11 scale 0.749 12 visibleRect { left: 0.000, top: 700.547, width: 427.000, height: 7 57.925}12 visibleRect { left: 0.000, top: 700.547, width: 427.000, height: 731.237 } 13 13 After move to first field 14 14 15 15 scale 0.749 16 visibleRect { left: 0.000, top: 279.552, width: 427.000, height: 7 57.925}16 visibleRect { left: 0.000, top: 279.552, width: 427.000, height: 731.237 } -
trunk/LayoutTests/fast/forms/ios/focus-input-in-fixed-expected.txt
r204385 r209967 2 2 tap location { x: 40.000, y: 130.000 } 3 3 scale 1.455 4 visibleRect { left: 0.000, top: 44.683, width: 219.979, height: 3 90.462}4 visibleRect { left: 0.000, top: 44.683, width: 219.979, height: 376.713 } -
trunk/LayoutTests/fast/forms/ios/focus-input-in-iframe-expected.txt
r204385 r209967 5 5 tap location { x: 20.000, y: 62.000 } 6 6 scale 1.455 7 visibleRect { left: 0.000, top: 1208.851, width: 219.979, height: 3 90.462}7 visibleRect { left: 0.000, top: 1208.851, width: 219.979, height: 376.713 } -
trunk/LayoutTests/fast/forms/ios/focus-input-via-button-expected.txt
r204385 r209967 5 5 tap location { x: 20.000, y: 62.000 } 6 6 scale 1.455 7 visibleRect { left: 0.000, top: 798.797, width: 219.979, height: 3 90.462}7 visibleRect { left: 0.000, top: 798.797, width: 219.979, height: 376.713 } -
trunk/LayoutTests/fast/forms/ios/focus-input-via-button-no-scaling-expected.txt
r204385 r209967 5 5 tap location { x: 20.000, y: 62.000 } 6 6 scale 0.749 7 visibleRect { left: 0.000, top: 717.227, width: 427.000, height: 7 57.925}7 visibleRect { left: 0.000, top: 717.227, width: 427.000, height: 731.237 } -
trunk/LayoutTests/fast/forms/ios/focus-long-textarea-expected.txt
r204385 r209967 4 4 tap location { x: 38.000, y: 664.000 } 5 5 scale 1.455 6 visibleRect { left: 0.000, top: 506.294, width: 219.979, height: 3 90.462}6 visibleRect { left: 0.000, top: 506.294, width: 219.979, height: 376.713 } -
trunk/LayoutTests/fast/forms/ios/zoom-after-input-tap-expected.txt
r204385 r209967 4 4 tap location { x: 38.000, y: 862.000 } 5 5 scale 1.455 6 visibleRect { left: 0.000, top: 776.799, width: 219.979, height: 3 90.462}6 visibleRect { left: 0.000, top: 776.799, width: 219.979, height: 376.713 } -
trunk/LayoutTests/fast/forms/ios/zoom-after-input-tap-wide-input-expected.txt
r204385 r209967 4 4 tap location { x: 328.000, y: 862.000 } 5 5 scale 1.455 6 visibleRect { left: 122.707, top: 776.803, width: 219.980, height: 3 90.464}6 visibleRect { left: 122.707, top: 776.803, width: 219.980, height: 376.715 } -
trunk/LayoutTests/fast/scrolling/ios/subpixel-overflow-scrolling-with-ancestor-expected.txt
r204552 r209967 1 1 (GraphicsLayer 2 2 (anchor 0.00 0.00) 3 (bounds 320.00 5 68.00)3 (bounds 320.00 548.00) 4 4 (children 1 5 5 (GraphicsLayer 6 (bounds 320.00 5 68.00)6 (bounds 320.00 548.00) 7 7 (contentsOpaque 1) 8 8 (children 1 -
trunk/LayoutTests/fast/viewport/ios/width-is-device-width-expected.txt
r204363 r209967 4 4 maxScale 5.00000 5 5 minScale 1.00000 6 visibleRect {"left":"0.00000","top":"0.00000","width":"320.00000","height":"5 68.00000"}6 visibleRect {"left":"0.00000","top":"0.00000","width":"320.00000","height":"548.00000"} -
trunk/LayoutTests/fast/visual-viewport/ios/zoomed-focus-in-fixed-expected.txt
r209887 r209967 1 Layout viewport: {"top": 659.734375,"right":320,"bottom":1227.734375,"left":0,"width":320,"height":568}2 Visual viewport: {"top": 660,"right":220,"bottom":1051,"left":0,"width":220,"height":391}1 Layout viewport: {"top":746.703125,"right":320,"bottom":1294.703125,"left":0,"width":320,"height":548} 2 Visual viewport: {"top":747,"right":220,"bottom":1124,"left":0,"width":220,"height":377} 3 3 -
trunk/LayoutTests/platform/ios-simulator/fast/scrolling/ios/clipping-ancestor-with-accelerated-scrolling-ancestor-expected.txt
r204363 r209967 1 layer at (0,0) size 320x5 682 RenderView at (0,0) size 320x5 681 layer at (0,0) size 320x548 2 RenderView at (0,0) size 320x548 3 3 layer at (0,0) size 320x316 4 4 RenderBlock {HTML} at (0,0) size 320x316 -
trunk/LayoutTests/platform/ios-simulator/fast/scrolling/ios/overflow-scrolling-ancestor-clip-expected.txt
r204363 r209967 1 1 (GraphicsLayer 2 2 (anchor 0.00 0.00) 3 (bounds 320.00 5 68.00)3 (bounds 320.00 548.00) 4 4 (children 1 5 5 (GraphicsLayer 6 (bounds 320.00 5 68.00)6 (bounds 320.00 548.00) 7 7 (contentsOpaque 1) 8 8 (children 1 -
trunk/LayoutTests/platform/ios-simulator/fast/scrolling/ios/overflow-scrolling-ancestor-clip-size-expected.txt
r204363 r209967 1 1 (GraphicsLayer 2 2 (anchor 0.00 0.00) 3 (bounds 330.00 5 68.00)3 (bounds 330.00 548.00) 4 4 (children 1 5 5 (GraphicsLayer 6 (bounds 330.00 5 68.00)6 (bounds 330.00 548.00) 7 7 (contentsOpaque 1) 8 8 (children 1 -
trunk/LayoutTests/platform/ios-simulator/fast/scrolling/ios/scrolling-content-clip-to-viewport-expected.txt
r204363 r209967 1 1 (GraphicsLayer 2 2 (anchor 0.00 0.00) 3 (bounds 320.00 5 68.00)3 (bounds 320.00 548.00) 4 4 (children 1 5 5 (GraphicsLayer 6 (bounds 320.00 5 68.00)6 (bounds 320.00 548.00) 7 7 (contentsOpaque 1) 8 8 (children 1 -
trunk/LayoutTests/platform/ios-simulator/fast/scrolling/ios/touch-stacking-expected.txt
r204363 r209967 1 layer at (0,0) size 320x5 682 RenderView at (0,0) size 320x5 681 layer at (0,0) size 320x548 2 RenderView at (0,0) size 320x548 3 3 layer at (0,0) size 320x148 layerType: background only 4 4 layer at (0,0) size 100x100 -
trunk/LayoutTests/scrollingcoordinator/ios/non-stable-viewport-scroll-expected.txt
r209409 r209967 3 3 (anchor 0.00 0.00) 4 4 (bounds 320.00 5013.00) 5 (visible rect 0.00, 1000.00 106.67 x 18 9.33)6 (coverage rect 0.00, 1000.00 106.67 x 18 9.33)5 (visible rect 0.00, 1000.00 106.67 x 182.67) 6 (coverage rect 0.00, 1000.00 106.67 x 182.67) 7 7 (intersects coverage rect 1) 8 8 (contentsScale 6.00) … … 11 11 (bounds 320.00 5013.00) 12 12 (contentsOpaque 1) 13 (visible rect 0.00, 1000.00 106.67 x 18 9.33)14 (coverage rect 0.00, 957.33 192.00 x 2 74.67)13 (visible rect 0.00, 1000.00 106.67 x 182.67) 14 (coverage rect 0.00, 957.33 192.00 x 268.00) 15 15 (intersects coverage rect 1) 16 16 (contentsScale 6.00) … … 18 18 (GraphicsLayer 19 19 (position 10.00 0.00) 20 (approximate position 10.00 6 21.34)21 (bounds 100.00 5 68.00)20 (approximate position 10.00 634.67) 21 (bounds 100.00 548.00) 22 22 (usingTiledLayer 1) 23 23 (contentsOpaque 1) 24 24 (drawsContent 1) 25 (visible rect 0.00, 3 78.66 96.67 x 189.33)26 (coverage rect -10.00, 3 35.99 192.00 x 274.67)25 (visible rect 0.00, 365.33 96.67 x 182.67) 26 (coverage rect -10.00, 322.66 192.00 x 268.00) 27 27 (intersects coverage rect 1) 28 28 (contentsScale 6.00) -
trunk/LayoutTests/scrollingcoordinator/ios/ui-scrolling-tree-expected.txt
r209409 r209967 2 2 (scrolling tree 3 3 (frame scrolling node 4 (layout viewport (0,0) width=320 height=5 68)4 (layout viewport (0,0) width=320 height=548) 5 5 (min layoutViewport origin (0,0)) 6 (max layoutViewport origin (988,14 53))6 (max layoutViewport origin (988,1473)) 7 7 (behavior for fixed 0) 8 8 (fixed node 9 9 (fixed constraints 10 (viewport-rect-at-last-layout (0,0) width=320 height=5 68)10 (viewport-rect-at-last-layout (0,0) width=320 height=548) 11 11 (layer-position-at-last-layout (12,10))) 12 12 (layer top left (12,10)))) -
trunk/Source/WebKit2/ChangeLog
r209957 r209967 1 2016-12-17 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Visual viewports: bottom fixed elements disappear behind the keyboard 4 https://bugs.webkit.org/show_bug.cgi?id=165983 5 <rdar://problem/29409852> 6 7 Reviewed by Simon Fraser. 8 9 Accounts for input view bounds in WebPageProxy::computeCustomFixedPositionRect. To do this, we introduce and 10 pass unobscuredContentRectRespectingInputViewBounds along with the regular unobscuredContentRect (which does not 11 respect the obscuring keyboard rect). This unobscuredContentRectRespectingInputViewBounds is then used when 12 computing the origin of the updated layout viewport rect (and also, when we are _not_ below minimum scale), 13 14 Additionally, the size is computed using the (unconstrained) unobscured rect. This is because we previously 15 would use the document-constrained version of the unobscured rect, which caused the layout viewport to shrink 16 when approaching the max scroll extents of the document while the keyboard is up, since the unobscured rect 17 would spill out of the document rect. However, using this unconstrained rect's size also means that if the user 18 rubber-bands out of the document rect, we would end up pushing the layout viewport rect out of the document, 19 with no way of adjusting it back in without the user scrolling to push the layout viewport into back document 20 bounds. To address this, we move the layout rect to be within document bounds after computing its size and 21 location. 22 23 Added a new layout test: fast/visual-viewport/ios/fixed-element-on-bottom-with-keyboard.html, and also tweaked 24 fixed-caret-position-after-scroll.html to cover these changes. 25 26 * Shared/VisibleContentRectUpdateInfo.cpp: 27 (WebKit::operator<<): 28 * Shared/VisibleContentRectUpdateInfo.h: 29 (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo): 30 (WebKit::VisibleContentRectUpdateInfo::unobscuredContentRectRespectingInputViewBounds): 31 * UIProcess/API/Cocoa/WKWebView.mm: 32 (-[WKWebView _updateContentRectsWithState:]): 33 (-[WKWebView _inputViewBounds]): 34 35 Returns the current bounds of the input view. For testing purposes. 36 37 * UIProcess/API/Cocoa/WKWebViewPrivate.h: 38 * UIProcess/WebPageProxy.h: 39 (WebKit::WebPageProxy::unobscuredContentRectRespectingInputViewBounds): 40 * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm: 41 (WebKit::RemoteScrollingCoordinatorProxy::customFixedPositionRect): 42 * UIProcess/ios/WKContentView.h: 43 * UIProcess/ios/WKContentView.mm: 44 (-[WKContentView _computeUnobscuredContentRectRespectingInputViewBounds:unobscuredContentRect:inputViewBounds:scale:]): 45 46 Helper to compute the unobscured rect, accounting for the bounds of the current input view. 47 48 (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]): 49 (-[WKContentView _didCommitLayerTree:]): 50 (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]): Deleted. 51 * UIProcess/ios/WebPageProxyIOS.mm: 52 (WebKit::WebPageProxy::computeCustomFixedPositionRect): 53 * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm: 54 (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree): 55 1 56 2016-12-16 Ryosuke Niwa <rniwa@webkit.org> 2 57 -
trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.cpp
r209845 r209967 110 110 ts.dumpProperty("unobscuredContentRect", info.unobscuredContentRect()); 111 111 ts.dumpProperty("unobscuredRectInScrollViewCoordinates", info.unobscuredRectInScrollViewCoordinates()); 112 ts.dumpProperty("unobscuredContentRectRespectingInputViewBounds", info.unobscuredContentRectRespectingInputViewBounds()); 112 113 ts.dumpProperty("customFixedPositionRect", info.customFixedPositionRect()); 113 114 ts.dumpProperty("obscuredInset", info.obscuredInset()); -
trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.h
r209845 r209967 46 46 47 47 VisibleContentRectUpdateInfo(const WebCore::FloatRect& exposedContentRect, const WebCore::FloatRect& unobscuredContentRect, 48 const WebCore::FloatRect& unobscuredRectInScrollViewCoordinates, const WebCore::FloatRect& customFixedPositionRect,48 const WebCore::FloatRect& unobscuredRectInScrollViewCoordinates, const WebCore::FloatRect& unobscuredContentRectRespectingInputViewBounds, const WebCore::FloatRect& customFixedPositionRect, 49 49 const WebCore::FloatSize& obscuredInset, double scale, bool inStableState, bool isFirstUpdateForNewViewSize, bool isChangingObscuredInsetsInteractively, bool allowShrinkToFit, bool enclosedInScrollableAncestorView, 50 50 MonotonicTime timestamp, double horizontalVelocity, double verticalVelocity, double scaleChangeRate, uint64_t lastLayerTreeTransactionId) … … 52 52 , m_unobscuredContentRect(unobscuredContentRect) 53 53 , m_unobscuredRectInScrollViewCoordinates(unobscuredRectInScrollViewCoordinates) 54 , m_unobscuredContentRectRespectingInputViewBounds(unobscuredContentRectRespectingInputViewBounds) 54 55 , m_customFixedPositionRect(customFixedPositionRect) 55 56 , m_obscuredInset(obscuredInset) … … 71 72 const WebCore::FloatRect& unobscuredContentRect() const { return m_unobscuredContentRect; } 72 73 const WebCore::FloatRect& unobscuredRectInScrollViewCoordinates() const { return m_unobscuredRectInScrollViewCoordinates; } 74 const WebCore::FloatRect& unobscuredContentRectRespectingInputViewBounds() const { return m_unobscuredContentRectRespectingInputViewBounds; } 73 75 const WebCore::FloatRect& customFixedPositionRect() const { return m_customFixedPositionRect; } 74 76 const WebCore::FloatSize obscuredInset() const { return m_obscuredInset; } … … 97 99 WebCore::FloatRect m_unobscuredContentRect; 98 100 WebCore::FloatRect m_unobscuredRectInScrollViewCoordinates; 101 WebCore::FloatRect m_unobscuredContentRectRespectingInputViewBounds; 99 102 WebCore::FloatRect m_customFixedPositionRect; // When visual viewports are enabled, this is the layout viewport. 100 103 WebCore::FloatSize m_obscuredInset; -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
r209931 r209967 2163 2163 unobscuredRectInScrollViewCoordinates:unobscuredRect 2164 2164 obscuredInset:CGSizeMake(_obscuredInsets.left, _obscuredInsets.top) 2165 inputViewBounds:_inputViewBounds 2165 2166 scale:scaleFactor minimumScale:[_scrollView minimumZoomScale] 2166 2167 inStableState:inStableState … … 4753 4754 } 4754 4755 4756 - (CGRect)_inputViewBounds 4757 { 4758 return _inputViewBounds; 4759 } 4760 4755 4761 - (NSArray<NSValue *> *)_uiTextSelectionRects 4756 4762 { -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h
r209931 r209967 292 292 @property (nonatomic, readonly) NSArray<NSValue *> *_uiTextSelectionRects WK_API_AVAILABLE(ios(WK_IOS_TBA)); 293 293 @property (nonatomic, readonly) CGRect _uiTextCaretRect WK_API_AVAILABLE(ios(WK_IOS_TBA)); 294 @property (nonatomic, readonly) CGRect _inputViewBounds WK_API_AVAILABLE(ios(WK_IOS_TBA)); 294 295 295 296 @property (nonatomic, readonly) NSString *_scrollingTreeAsText WK_API_AVAILABLE(ios(WK_IOS_TBA)); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r209931 r209967 469 469 const WebCore::FloatRect& unobscuredContentRect() const { return m_lastVisibleContentRectUpdate.unobscuredContentRect(); } 470 470 bool inStableState() const { return m_lastVisibleContentRectUpdate.inStableState(); } 471 const WebCore::FloatRect& unobscuredContentRectRespectingInputViewBounds() const { return m_lastVisibleContentRectUpdate.unobscuredContentRectRespectingInputViewBounds(); } 471 472 // When visual viewports are enabled, this is the layout viewport rect. 472 473 const WebCore::FloatRect& customFixedPositionRect() const { return m_lastVisibleContentRectUpdate.customFixedPositionRect(); } … … 476 477 477 478 enum class UnobscuredRectConstraint { ConstrainedToDocumentRect, Unconstrained }; 478 WebCore::FloatRect computeCustomFixedPositionRect(const WebCore::FloatRect& unobscuredContentRect, const WebCore::FloatRect& currentCustomFixedPositionRect, double displayedContentScale, UnobscuredRectConstraint = UnobscuredRectConstraint::Unconstrained, bool visualViewportEnabled = false) const;479 WebCore::FloatRect computeCustomFixedPositionRect(const WebCore::FloatRect& unobscuredContentRect, const WebCore::FloatRect& unobscuredContentRectRespectingInputViewBounds, const WebCore::FloatRect& currentCustomFixedPositionRect, double displayedContentScale, UnobscuredRectConstraint = UnobscuredRectConstraint::Unconstrained, bool visualViewportEnabled = false) const; 479 480 480 481 void overflowScrollViewWillStartPanGesture(); -
trunk/Source/WebKit2/UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm
r208748 r209967 95 95 FloatRect RemoteScrollingCoordinatorProxy::customFixedPositionRect() const 96 96 { 97 return m_webPageProxy.computeCustomFixedPositionRect(m_webPageProxy.unobscuredContentRect(), m_webPageProxy. customFixedPositionRect(), m_webPageProxy.displayedContentScale());97 return m_webPageProxy.computeCustomFixedPositionRect(m_webPageProxy.unobscuredContentRect(), m_webPageProxy.unobscuredContentRectRespectingInputViewBounds(), m_webPageProxy.customFixedPositionRect(), m_webPageProxy.displayedContentScale()); 98 98 } 99 99 -
trunk/Source/WebKit2/UIProcess/ios/WKContentView.h
r209867 r209967 72 72 unobscuredRectInScrollViewCoordinates:(CGRect)unobscuredRectInScrollViewCoordinates 73 73 obscuredInset:(CGSize)topInset 74 inputViewBounds:(CGRect)inputViewBounds 74 75 scale:(CGFloat)scale minimumScale:(CGFloat)minimumScale 75 76 inStableState:(BOOL)isStableState -
trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm
r209931 r209967 373 373 } 374 374 375 - (CGRect)_computeUnobscuredContentRectRespectingInputViewBounds:(CGRect)visibleContentRect unobscuredContentRect:(CGRect)unobscuredContentRect inputViewBounds:(CGRect)inputViewBounds scale:(CGFloat)scale 376 { 377 if (inputViewBounds.size.height) 378 unobscuredContentRect.size.height = std::min<float>(unobscuredContentRect.size.height, visibleContentRect.origin.y + (inputViewBounds.origin.y / scale) - unobscuredContentRect.origin.y); 379 return unobscuredContentRect; 380 } 381 375 382 - (void)didUpdateVisibleRect:(CGRect)visibleContentRect 376 383 unobscuredRect:(CGRect)unobscuredContentRect 377 384 unobscuredRectInScrollViewCoordinates:(CGRect)unobscuredRectInScrollViewCoordinates 378 385 obscuredInset:(CGSize)obscuredInset 386 inputViewBounds:(CGRect)inputViewBounds 379 387 scale:(CGFloat)zoomScale minimumScale:(CGFloat)minimumScale 380 388 inStableState:(BOOL)isStableState … … 394 402 395 403 RemoteScrollingCoordinatorProxy* scrollingCoordinator = _page->scrollingCoordinatorProxy(); 396 FloatRect fixedPositionRectForLayout = _page->computeCustomFixedPositionRect(unobscuredContentRect, _page->customFixedPositionRect(), zoomScale, WebPageProxy::UnobscuredRectConstraint::ConstrainedToDocumentRect, scrollingCoordinator->visualViewportEnabled()); 404 405 CGRect unobscuredContentRectRespectingInputViewBounds = [self _computeUnobscuredContentRectRespectingInputViewBounds:visibleContentRect unobscuredContentRect:unobscuredContentRect inputViewBounds:inputViewBounds scale:zoomScale]; 406 FloatRect fixedPositionRectForLayout = _page->computeCustomFixedPositionRect(unobscuredContentRect, unobscuredContentRectRespectingInputViewBounds, _page->customFixedPositionRect(), zoomScale, WebPageProxy::UnobscuredRectConstraint::ConstrainedToDocumentRect, scrollingCoordinator->visualViewportEnabled()); 397 407 398 408 VisibleContentRectUpdateInfo visibleContentRectUpdateInfo( … … 400 410 unobscuredContentRect, 401 411 unobscuredRectInScrollViewCoordinates, 412 unobscuredContentRectRespectingInputViewBounds, 402 413 fixedPositionRectForLayout, 403 414 WebCore::FloatSize(obscuredInset), … … 421 432 _sizeChangedSinceLastVisibleContentRectUpdate = NO; 422 433 423 FloatRect fixedPositionRect = _page->computeCustomFixedPositionRect(_page->unobscuredContentRect(), _page-> customFixedPositionRect(), zoomScale, WebPageProxy::UnobscuredRectConstraint::Unconstrained, scrollingCoordinator->visualViewportEnabled());434 FloatRect fixedPositionRect = _page->computeCustomFixedPositionRect(_page->unobscuredContentRect(), _page->unobscuredContentRectRespectingInputViewBounds(), _page->customFixedPositionRect(), zoomScale, WebPageProxy::UnobscuredRectConstraint::Unconstrained, scrollingCoordinator->visualViewportEnabled()); 424 435 scrollingCoordinator->viewportChangedViaDelegatedScrolling(scrollingCoordinator->rootScrollingNodeID(), fixedPositionRect, zoomScale); 425 436 … … 560 571 if (boundsChanged) { 561 572 // FIXME: factor computeCustomFixedPositionRect() into something that gives us this rect. 562 FloatRect fixedPositionRect = _page->computeCustomFixedPositionRect(_page->unobscuredContentRect(), _page-> customFixedPositionRect(), [[_webView scrollView] zoomScale]);573 FloatRect fixedPositionRect = _page->computeCustomFixedPositionRect(_page->unobscuredContentRect(), _page->unobscuredContentRectRespectingInputViewBounds(), _page->customFixedPositionRect(), [[_webView scrollView] zoomScale]); 563 574 [self updateFixedClippingView:fixedPositionRect]; 564 575 -
trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm
r209867 r209967 221 221 222 222 // FIXME: rename this when visual viewports are the default. 223 WebCore::FloatRect WebPageProxy::computeCustomFixedPositionRect(const FloatRect& unobscuredContentRect, const FloatRect& currentCustomFixedPositionRect, double displayedContentScale, UnobscuredRectConstraint constraint, bool visualViewportEnabled) const223 WebCore::FloatRect WebPageProxy::computeCustomFixedPositionRect(const FloatRect& unobscuredContentRect, const FloatRect& unobscuredContentRectRespectingInputViewBounds, const FloatRect& currentCustomFixedPositionRect, double displayedContentScale, UnobscuredRectConstraint constraint, bool visualViewportEnabled) const 224 224 { 225 225 FloatRect constrainedUnobscuredRect = unobscuredContentRect; … … 233 233 234 234 double minimumScale = m_pageClient.minimumZoomScale(); 235 236 if ( displayedContentScale < minimumScale) {235 bool isBelowMinimumScale = displayedContentScale < minimumScale; 236 if (isBelowMinimumScale) { 237 237 const CGFloat slope = 12; 238 238 CGFloat factor = std::max<CGFloat>(1 - slope * (minimumScale - displayedContentScale), 0); … … 244 244 } 245 245 246 if (visualViewportEnabled) { 247 FloatRect layoutViewportRect = currentCustomFixedPositionRect; 248 249 // The layout viewport is never smaller than m_baseLayoutViewportSize, and never be smaller than the constrainedUnobscuredRect. 250 FloatSize constrainedSize = m_baseLayoutViewportSize; 246 if (!visualViewportEnabled) 247 return FrameView::rectForViewportConstrainedObjects(enclosingLayoutRect(constrainedUnobscuredRect), LayoutSize(documentRect.size()), displayedContentScale, false, StickToViewportBounds); 248 249 FloatRect layoutViewportRect = currentCustomFixedPositionRect; 250 251 // The layout viewport is never smaller than m_baseLayoutViewportSize, and never be smaller than the constrainedUnobscuredRect. 252 FloatSize constrainedSize = m_baseLayoutViewportSize; 253 if (isBelowMinimumScale) 251 254 layoutViewportRect.setSize(constrainedSize.expandedTo(constrainedUnobscuredRect.size())); 252 253 LayoutPoint layoutViewportOrigin = FrameView::computeLayoutViewportOrigin(enclosingLayoutRect(constrainedUnobscuredRect), m_minStableLayoutViewportOrigin, m_maxStableLayoutViewportOrigin, enclosingLayoutRect(layoutViewportRect)); 254 layoutViewportRect.setLocation(layoutViewportOrigin); 255 256 if (layoutViewportRect != currentCustomFixedPositionRect) 257 LOG_WITH_STREAM(VisibleRects, stream << "WebPageProxy::computeCustomFixedPositionRect: new layout viewport " << layoutViewportRect); 258 return layoutViewportRect; 259 } 260 261 return FrameView::rectForViewportConstrainedObjects(enclosingLayoutRect(constrainedUnobscuredRect), LayoutSize(documentRect.size()), displayedContentScale, false, StickToViewportBounds); 255 else 256 layoutViewportRect.setSize(constrainedSize.expandedTo(unobscuredContentRect.size())); 257 258 LayoutPoint layoutViewportOrigin; 259 if (isBelowMinimumScale) 260 layoutViewportOrigin = FrameView::computeLayoutViewportOrigin(enclosingLayoutRect(constrainedUnobscuredRect), m_minStableLayoutViewportOrigin, m_maxStableLayoutViewportOrigin, enclosingLayoutRect(layoutViewportRect)); 261 else 262 layoutViewportOrigin = FrameView::computeLayoutViewportOrigin(enclosingLayoutRect(unobscuredContentRectRespectingInputViewBounds), m_minStableLayoutViewportOrigin, m_maxStableLayoutViewportOrigin, enclosingLayoutRect(layoutViewportRect)); 263 264 if (constraint == UnobscuredRectConstraint::ConstrainedToDocumentRect) { 265 // The max stable layout viewport origin really depends on the size of the layout viewport itself, so we need to adjust the location of the layout viewport one final time to make sure it does not end up out of bounds of the document. 266 // Without this adjustment (and with using the non-constrained unobscuredContentRect's size as the size of the layout viewport) the layout viewport can be pushed past the bounds of the document during rubber-banding, and cannot be pushed 267 // back in until the user scrolls back in the other direction. 268 layoutViewportOrigin.setX(clampTo<float>(layoutViewportOrigin.x(), 0, documentRect.width() - layoutViewportRect.width())); 269 layoutViewportOrigin.setY(clampTo<float>(layoutViewportOrigin.y(), 0, documentRect.height() - layoutViewportRect.height())); 270 } 271 layoutViewportRect.setLocation(layoutViewportOrigin); 272 273 if (layoutViewportRect != currentCustomFixedPositionRect) 274 LOG_WITH_STREAM(VisibleRects, stream << "WebPageProxy::computeCustomFixedPositionRect: new layout viewport " << layoutViewportRect); 275 return layoutViewportRect; 262 276 } 263 277 -
trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm
r209369 r209967 215 215 if (m_webPageProxy.scrollingCoordinatorProxy()->hasFixedOrSticky()) { 216 216 // If we got a new layer for a fixed or sticky node, its position from the WebProcess is probably stale. We need to re-run the "viewport" changed logic to udpate it with our UI-side state. 217 FloatRect customFixedPositionRect = m_webPageProxy.computeCustomFixedPositionRect(m_webPageProxy.unobscuredContentRect(), m_webPageProxy. customFixedPositionRect(), m_webPageProxy.displayedContentScale(), WebPageProxy::UnobscuredRectConstraint::Unconstrained, m_webPageProxy.scrollingCoordinatorProxy()->visualViewportEnabled());217 FloatRect customFixedPositionRect = m_webPageProxy.computeCustomFixedPositionRect(m_webPageProxy.unobscuredContentRect(), m_webPageProxy.unobscuredContentRectRespectingInputViewBounds(), m_webPageProxy.customFixedPositionRect(), m_webPageProxy.displayedContentScale(), WebPageProxy::UnobscuredRectConstraint::Unconstrained, m_webPageProxy.scrollingCoordinatorProxy()->visualViewportEnabled()); 218 218 m_webPageProxy.scrollingCoordinatorProxy()->viewportChangedViaDelegatedScrolling(m_webPageProxy.scrollingCoordinatorProxy()->rootScrollingNodeID(), customFixedPositionRect, m_webPageProxy.displayedContentScale()); 219 219 } -
trunk/Tools/ChangeLog
r209957 r209967 1 2016-12-17 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Visual viewports: bottom fixed elements disappear behind the keyboard 4 https://bugs.webkit.org/show_bug.cgi?id=165983 5 <rdar://problem/29409852> 6 7 Reviewed by Simon Fraser. 8 9 Add support for UIScriptController.inputViewBounds, which UI-side scripts may use to fetch the bounding rect of 10 the keyboard when it is up. 11 12 * DumpRenderTree/ios/UIScriptControllerIOS.mm: 13 (WTR::UIScriptController::inputViewBounds): 14 * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: 15 * TestRunnerShared/UIScriptContext/UIScriptController.cpp: 16 (WTR::UIScriptController::inputViewBounds): 17 * TestRunnerShared/UIScriptContext/UIScriptController.h: 18 * WebKitTestRunner/ios/PlatformWebViewIOS.mm: 19 (WTR::viewRectForWindowRect): 20 21 Previously, we accounted for the status bar height by translating the entire web view down by the height of the 22 status bar. However, we did not shrink the height of the web view itself, which means that for tests which 23 involve scrolling past the end of the document, the bottom strip of the web view is out of bounds of the window. 24 25 (WTR::PlatformWebView::PlatformWebView): 26 (WTR::PlatformWebView::setWindowFrame): 27 * WebKitTestRunner/ios/UIScriptControllerIOS.mm: 28 (WTR::UIScriptController::inputViewBounds): 29 1 30 2016-12-16 Ryosuke Niwa <rniwa@webkit.org> 2 31 -
trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm
r209931 r209967 272 272 } 273 273 274 JSObjectRef UIScriptController::inputViewBounds() const 275 { 276 return nullptr; 277 } 278 274 279 void UIScriptController::removeAllDynamicDictionaries() 275 280 { -
trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
r209931 r209967 207 207 readonly attribute object selectionRangeViewRects; // An array of objects with 'left', 'top', 'width', and 'height' properties. 208 208 readonly attribute object textSelectionCaretRect; // An object with 'left', 'top', 'width', 'height' properties. 209 readonly attribute object inputViewBounds; 209 210 210 211 void insertText(DOMString text, long location, long length); -
trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp
r209931 r209967 317 317 } 318 318 319 JSObjectRef UIScriptController::inputViewBounds() const 320 { 321 return nullptr; 322 } 323 319 324 void UIScriptController::removeAllDynamicDictionaries() 320 325 { -
trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h
r209931 r209967 131 131 JSObjectRef selectionRangeViewRects() const; 132 132 JSObjectRef textSelectionCaretRect() const; 133 JSObjectRef inputViewBounds() const; 133 134 134 135 void insertText(JSStringRef, int location, int length); -
trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm
r209364 r209967 110 110 namespace WTR { 111 111 112 static CGRect viewRectForWindowRect(CGRect windowRect) 112 enum class WebViewSizingMode { 113 Default, 114 HeightRespectsStatusBar 115 }; 116 117 static CGRect viewRectForWindowRect(CGRect windowRect, WebViewSizingMode mode) 113 118 { 114 119 CGFloat statusBarBottom = CGRectGetMaxY([[UIApplication sharedApplication] statusBarFrame]); 115 return CGRectMake(windowRect.origin.x, windowRect.origin.y + statusBarBottom, windowRect.size.width, windowRect.size.height );120 return CGRectMake(windowRect.origin.x, windowRect.origin.y + statusBarBottom, windowRect.size.width, windowRect.size.height - (mode == WebViewSizingMode::HeightRespectsStatusBar ? statusBarBottom : 0)); 116 121 } 117 122 … … 130 135 [viewController release]; 131 136 132 m_view = [[TestRunnerWKWebView alloc] initWithFrame:viewRectForWindowRect(rect ) configuration:configuration];137 m_view = [[TestRunnerWKWebView alloc] initWithFrame:viewRectForWindowRect(rect, WebViewSizingMode::Default) configuration:configuration]; 133 138 134 139 [m_window.rootViewController.view addSubview:m_view]; … … 196 201 { 197 202 [m_window setFrame:CGRectMake(frame.origin.x, frame.origin.y, frame.size.width, frame.size.height)]; 198 [platformView() setFrame:viewRectForWindowRect(CGRectMake(0, 0, frame.size.width, frame.size.height) )];203 [platformView() setFrame:viewRectForWindowRect(CGRectMake(0, 0, frame.size.width, frame.size.height), WebViewSizingMode::HeightRespectsStatusBar)]; 199 204 } 200 205 -
trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm
r209931 r209967 496 496 } 497 497 498 JSObjectRef UIScriptController::inputViewBounds() const 499 { 500 return JSValueToObject(m_context->jsContext(), [JSValue valueWithObject:toNSDictionary(TestController::singleton().mainWebView()->platformView()._inputViewBounds) inContext:[JSContext contextWithJSGlobalContextRef:m_context->jsContext()]].JSValueRef, nullptr); 501 } 502 498 503 void UIScriptController::removeAllDynamicDictionaries() 499 504 {
Note: See TracChangeset
for help on using the changeset viewer.