Diff
Modified: trunk/LayoutTests/ChangeLog (216046 => 216047)
--- trunk/LayoutTests/ChangeLog 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/LayoutTests/ChangeLog 2017-05-02 00:08:23 UTC (rev 216047)
@@ -1,3 +1,27 @@
+2017-05-01 Timothy Horton <[email protected]>
+
+ Expose viewport-fit instead of clip-to-safe-area
+ https://bugs.webkit.org/show_bug.cgi?id=171503
+ <rdar://problem/31918249>
+
+ Reviewed by Simon Fraser.
+
+ * TestExpectations:
+ * fast/css/variables/constants/ios/safe-area-inset-set-expected.html:
+ * fast/css/variables/constants/ios/safe-area-inset-set.html:
+ * fast/viewport/ios/viewport-fit-auto-expected.txt: Added.
+ * fast/viewport/ios/viewport-fit-auto.html: Added.
+ * fast/viewport/ios/viewport-fit-contain-expected.txt: Added.
+ * fast/viewport/ios/viewport-fit-contain.html: Added.
+ * fast/viewport/ios/viewport-fit-cover-expected.txt: Added.
+ * fast/viewport/ios/viewport-fit-cover.html: Added.
+ * tiled-drawing/ios/viewport-clip-to-safe-area-no-gets-margin-tiles-expected.txt: Removed.
+ * tiled-drawing/ios/viewport-clip-to-safe-area-no-gets-margin-tiles.html: Removed.
+ * tiled-drawing/ios/viewport-clip-to-safe-area-yes-gets-no-margin-tiles-expected.txt: Removed.
+ * tiled-drawing/ios/viewport-clip-to-safe-area-yes-gets-no-margin-tiles.html: Removed.
+ Remove clip-to-safe-area tests and add some viewport-fit tests. Also, adjust
+ safe-area-inset-set to use the new UIScriptController setSafeAreaInset method.
+
2017-05-01 Chris Dumez <[email protected]>
Documents created using DOMParser.parseFromString should inherit their context document's origin / URL
Modified: trunk/LayoutTests/fast/css/variables/constants/ios/safe-area-inset-set-expected.html (216046 => 216047)
--- trunk/LayoutTests/fast/css/variables/constants/ios/safe-area-inset-set-expected.html 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/LayoutTests/fast/css/variables/constants/ios/safe-area-inset-set-expected.html 2017-05-02 00:08:23 UTC (rev 216047)
@@ -1,24 +1,28 @@
-<style>
-#a {
- position: absolute;
- left: 100px;
- top: 200px;
- width: 100px;
- height: 100px;
- background-color: green;
-}
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<head>
+ <meta name="viewport" content="initial-scale=1, viewport-fit=cover">
+ <style>
+ #a {
+ position: absolute;
+ left: 25px;
+ top: 50px;
+ width: 100px;
+ height: 100px;
+ background-color: green;
+ }
-#b {
- position: absolute;
- left: 300px;
- top: 250px;
- width: 100px;
- height: 100px;
- background-color: blue;
-}
-</style>
+ #b {
+ position: absolute;
+ left: 75px;
+ top: 100px;
+ width: 100px;
+ height: 100px;
+ background-color: blue;
+ }
+ </style>
+</head>
<body>
-<div id="a"></div>
-<div id="b"></div>
-<p>The boxes should be at 100, 200 and 300, 250.</p>
-
+ <div id="a"></div>
+ <div id="b"></div>
+ <p>The boxes should be at 25, 50 and 75, 100.</p>
+</body>
\ No newline at end of file
Modified: trunk/LayoutTests/fast/css/variables/constants/ios/safe-area-inset-set.html (216046 => 216047)
--- trunk/LayoutTests/fast/css/variables/constants/ios/safe-area-inset-set.html 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/LayoutTests/fast/css/variables/constants/ios/safe-area-inset-set.html 2017-05-02 00:08:23 UTC (rev 216047)
@@ -1,43 +1,50 @@
-<style>
-#a {
- position: absolute;
- left: constant(safe-area-inset-right);
- top: constant(safe-area-inset-top);
- width: 100px;
- height: 100px;
- background-color: green;
-}
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<head>
+ <meta name="viewport" content="initial-scale=1, viewport-fit=cover">
+ <style>
+ #a {
+ position: absolute;
+ left: constant(safe-area-inset-right);
+ top: constant(safe-area-inset-top);
+ width: 100px;
+ height: 100px;
+ background-color: green;
+ }
-#b {
- position: absolute;
- left: constant(safe-area-inset-bottom);
- top: constant(safe-area-inset-left);
- width: 100px;
- height: 100px;
- background-color: blue;
-}
-</style>
-<script>
-function getUIScript()
-{
- return `
- (function() {
- uiController.setObscuredInsets(200, 100, 300, 250);
- uiController.doAfterVisibleContentRectUpdate(function () {
- uiController.uiScriptComplete();
- });
- })();`
-}
+ #b {
+ position: absolute;
+ left: constant(safe-area-inset-bottom);
+ top: constant(safe-area-inset-left);
+ width: 100px;
+ height: 100px;
+ background-color: blue;
+ }
+ </style>
+ <script>
+ function getUIScript()
+ {
+ return `
+ (function() {
+ uiController.setSafeAreaInsets(50, 25, 75, 100);
+ uiController.doAfterVisibleContentRectUpdate(function () {
+ uiController.uiScriptComplete();
+ });
+ })();`
+ }
-if (window.testRunner) {
- testRunner.waitUntilDone();
- testRunner.runUIScript(getUIScript(), function(result) {
- testRunner.notifyDone();
- });
-}
-</script>
+ if (window.testRunner) {
+ testRunner.waitUntilDone();
+ window._onload_ = function () {
+ testRunner.runUIScript(getUIScript(), function(result) {
+ testRunner.notifyDone();
+ });
+ }
+ }
+ </script>
+</head>
<body>
-<div id="a"></div>
-<div id="b"></div>
-<p>The boxes should be at 100, 200 and 300, 250.</p>
+ <div id="a"></div>
+ <div id="b"></div>
+ <p>The boxes should be at 25, 50 and 75, 100.</p>
+</body>
Added: trunk/LayoutTests/fast/viewport/ios/viewport-fit-auto-expected.txt (0 => 216047)
--- trunk/LayoutTests/fast/viewport/ios/viewport-fit-auto-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/viewport-fit-auto-expected.txt 2017-05-02 00:08:23 UTC (rev 216047)
@@ -0,0 +1,8 @@
+Viewport: initial-scale=1, viewport-fit=auto
+
+Window Size: 260 x 508
+
+scale 1.00000
+maxScale 5.00000
+minScale 1.00000
+visibleRect {"left":"-40.00000","top":"-10.00000","width":"320.00000","height":"548.00000"}
Added: trunk/LayoutTests/fast/viewport/ios/viewport-fit-auto.html (0 => 216047)
--- trunk/LayoutTests/fast/viewport/ios/viewport-fit-auto.html (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/viewport-fit-auto.html 2017-05-02 00:08:23 UTC (rev 216047)
@@ -0,0 +1,35 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<head>
+ <meta name="viewport" content="initial-scale=1, viewport-fit=auto">
+ <script src=""
+ <script>
+ function getSafeAreaUIScript()
+ {
+ return `
+ (function() {
+ uiController.setSafeAreaInsets(10, 20, 30, 40);
+ uiController.doAfterVisibleContentRectUpdate(function () {
+ uiController.uiScriptComplete();
+ })
+ })();`
+ }
+
+ function doTest()
+ {
+ testRunner.runUIScript(getSafeAreaUIScript(), function(result) {
+ document.getElementById('windowSize').textContent = window.innerWidth + " x " + window.innerHeight;
+ runTest();
+ });
+ }
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+
+<body>
+<p>Viewport: <span id="viewport"></span></p>
+<p>Window Size: <span id="windowSize"></span></p>
+<div id="result"></div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/viewport/ios/viewport-fit-contain-expected.txt (0 => 216047)
--- trunk/LayoutTests/fast/viewport/ios/viewport-fit-contain-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/viewport-fit-contain-expected.txt 2017-05-02 00:08:23 UTC (rev 216047)
@@ -0,0 +1,8 @@
+Viewport: initial-scale=1, viewport-fit=contain
+
+Window Size: 260 x 508
+
+scale 1.00000
+maxScale 5.00000
+minScale 1.00000
+visibleRect {"left":"-40.00000","top":"-10.00000","width":"320.00000","height":"548.00000"}
Added: trunk/LayoutTests/fast/viewport/ios/viewport-fit-contain.html (0 => 216047)
--- trunk/LayoutTests/fast/viewport/ios/viewport-fit-contain.html (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/viewport-fit-contain.html 2017-05-02 00:08:23 UTC (rev 216047)
@@ -0,0 +1,35 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<head>
+ <meta name="viewport" content="initial-scale=1, viewport-fit=contain">
+ <script src=""
+ <script>
+ function getSafeAreaUIScript()
+ {
+ return `
+ (function() {
+ uiController.setSafeAreaInsets(10, 20, 30, 40);
+ uiController.doAfterVisibleContentRectUpdate(function () {
+ uiController.uiScriptComplete();
+ })
+ })();`
+ }
+
+ function doTest()
+ {
+ testRunner.runUIScript(getSafeAreaUIScript(), function(result) {
+ document.getElementById('windowSize').textContent = window.innerWidth + " x " + window.innerHeight;
+ runTest();
+ });
+ }
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+
+<body>
+<p>Viewport: <span id="viewport"></span></p>
+<p>Window Size: <span id="windowSize"></span></p>
+<div id="result"></div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/viewport/ios/viewport-fit-cover-expected.txt (0 => 216047)
--- trunk/LayoutTests/fast/viewport/ios/viewport-fit-cover-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/viewport-fit-cover-expected.txt 2017-05-02 00:08:23 UTC (rev 216047)
@@ -0,0 +1,8 @@
+Viewport: initial-scale=1, viewport-fit=cover
+
+Window Size: 320 x 548
+
+scale 1.00000
+maxScale 5.00000
+minScale 1.00000
+visibleRect {"left":"0.00000","top":"0.00000","width":"320.00000","height":"548.00000"}
Added: trunk/LayoutTests/fast/viewport/ios/viewport-fit-cover.html (0 => 216047)
--- trunk/LayoutTests/fast/viewport/ios/viewport-fit-cover.html (rev 0)
+++ trunk/LayoutTests/fast/viewport/ios/viewport-fit-cover.html 2017-05-02 00:08:23 UTC (rev 216047)
@@ -0,0 +1,35 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<head>
+ <meta name="viewport" content="initial-scale=1, viewport-fit=cover">
+ <script src=""
+ <script>
+ function getSafeAreaUIScript()
+ {
+ return `
+ (function() {
+ uiController.setSafeAreaInsets(10, 20, 30, 40);
+ uiController.doAfterVisibleContentRectUpdate(function () {
+ uiController.uiScriptComplete();
+ })
+ })();`
+ }
+
+ function doTest()
+ {
+ testRunner.runUIScript(getSafeAreaUIScript(), function(result) {
+ document.getElementById('windowSize').textContent = window.innerWidth + " x " + window.innerHeight;
+ runTest();
+ });
+ }
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+
+<body>
+<p>Viewport: <span id="viewport"></span></p>
+<p>Window Size: <span id="windowSize"></span></p>
+<div id="result"></div>
+</body>
+</html>
Modified: trunk/LayoutTests/platform/ios-wk2/TestExpectations (216046 => 216047)
--- trunk/LayoutTests/platform/ios-wk2/TestExpectations 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/LayoutTests/platform/ios-wk2/TestExpectations 2017-05-02 00:08:23 UTC (rev 216047)
@@ -14,7 +14,6 @@
scrollingcoordinator/ios [ Pass ]
tiled-drawing/ios [ Pass ]
editing/selection/character-granularity-rect.html [ Pass ]
-fast/css/variables/constants/ios [ Pass ]
fast/media/mq-inverted-colors-live-update.html [ Pass ]
fast/media/mq-inverted-colors-live-update-in-subframes.html [ Pass ]
@@ -24,6 +23,11 @@
fast/visual-viewport/rubberbanding-viewport-rects.html [ Pass ]
fast/visual-viewport/rubberbanding-viewport-rects-header-footer.html [ Pass ]
+# Pending SDK changes, re-skip these tests that are un-skipped above.
+fast/viewport/ios/viewport-fit-contain.html [ Skip ]
+fast/viewport/ios/viewport-fit-cover.html [ Skip ]
+fast/viewport/ios/viewport-fit-auto.html [ Skip ]
+
#//////////////////////////////////////////////////////////////////////////////////////////
# End platform-specific directories.
#//////////////////////////////////////////////////////////////////////////////////////////
Deleted: trunk/LayoutTests/tiled-drawing/ios/viewport-clip-to-safe-area-no-gets-margin-tiles-expected.txt (216046 => 216047)
--- trunk/LayoutTests/tiled-drawing/ios/viewport-clip-to-safe-area-no-gets-margin-tiles-expected.txt 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/LayoutTests/tiled-drawing/ios/viewport-clip-to-safe-area-no-gets-margin-tiles-expected.txt 2017-05-02 00:08:23 UTC (rev 216047)
@@ -1,23 +0,0 @@
-(GraphicsLayer
- (anchor 0.00 0.00)
- (bounds 320.00 548.00)
- (visible rect 0.00, 0.00 280.00 x 538.00)
- (coverage rect -40.00, -10.00 320.00 x 548.00)
- (intersects coverage rect 1)
- (contentsScale 2.00)
- (children 1
- (GraphicsLayer
- (bounds 320.00 548.00)
- (contentsOpaque 1)
- (visible rect 0.00, 0.00 280.00 x 538.00)
- (coverage rect -40.00, -10.00 576.00 x 804.00)
- (intersects coverage rect 1)
- (contentsScale 2.00)
- (tile cache coverage -512, -512 1344 x 1572)
- (tile size 512 x 548)
- (top left tile -1, -1 tiles grid 3 x 3)
- (in window 1)
- )
- )
-)
-
Deleted: trunk/LayoutTests/tiled-drawing/ios/viewport-clip-to-safe-area-no-gets-margin-tiles.html (216046 => 216047)
--- trunk/LayoutTests/tiled-drawing/ios/viewport-clip-to-safe-area-no-gets-margin-tiles.html 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/LayoutTests/tiled-drawing/ios/viewport-clip-to-safe-area-no-gets-margin-tiles.html 2017-05-02 00:08:23 UTC (rev 216047)
@@ -1,43 +0,0 @@
-<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
-
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1, clip-to-safe-area=no">
- <script>
- function getUIScript()
- {
- return `
- (function() {
- uiController.setObscuredInsets(10, 20, 30, 40);
- uiController.immediateScrollToOffset(-40, -10);
- uiController.doAfterVisibleContentRectUpdate(function () {
- uiController.uiScriptComplete();
- })
- })();`
- }
-
- if (window.testRunner) {
- testRunner.dumpAsText();
- testRunner.waitUntilDone();
- }
-
- function doTest()
- {
- testRunner.runUIScript(getUIScript(), function(result) {
- if (window.internals) {
- document.getElementById('layers').innerText = internals.layerTreeAsText(document,
- internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS | internals.LAYER_TREE_INCLUDES_TILE_CACHES);
- }
-
- if (window.testRunner)
- testRunner.notifyDone();
- });
- }
- window.addEventListener('load', doTest, false);
- </script>
-</head>
-
-<body>
-<pre id="layers">Layer tree goes here</p>
-</body>
-</html>
Deleted: trunk/LayoutTests/tiled-drawing/ios/viewport-clip-to-safe-area-yes-gets-no-margin-tiles-expected.txt (216046 => 216047)
--- trunk/LayoutTests/tiled-drawing/ios/viewport-clip-to-safe-area-yes-gets-no-margin-tiles-expected.txt 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/LayoutTests/tiled-drawing/ios/viewport-clip-to-safe-area-yes-gets-no-margin-tiles-expected.txt 2017-05-02 00:08:23 UTC (rev 216047)
@@ -1,23 +0,0 @@
-(GraphicsLayer
- (anchor 0.00 0.00)
- (bounds 320.00 548.00)
- (visible rect 0.00, 0.00 280.00 x 538.00)
- (coverage rect 0.00, 0.00 280.00 x 538.00)
- (intersects coverage rect 1)
- (contentsScale 2.00)
- (children 1
- (GraphicsLayer
- (bounds 320.00 548.00)
- (contentsOpaque 1)
- (visible rect 0.00, 0.00 280.00 x 538.00)
- (coverage rect 0.00, 0.00 280.00 x 538.00)
- (intersects coverage rect 1)
- (contentsScale 2.00)
- (tile cache coverage 0, 0 320 x 548)
- (tile size 512 x 548)
- (top left tile 0, 0 tiles grid 1 x 1)
- (in window 1)
- )
- )
-)
-
Deleted: trunk/LayoutTests/tiled-drawing/ios/viewport-clip-to-safe-area-yes-gets-no-margin-tiles.html (216046 => 216047)
--- trunk/LayoutTests/tiled-drawing/ios/viewport-clip-to-safe-area-yes-gets-no-margin-tiles.html 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/LayoutTests/tiled-drawing/ios/viewport-clip-to-safe-area-yes-gets-no-margin-tiles.html 2017-05-02 00:08:23 UTC (rev 216047)
@@ -1,43 +0,0 @@
-<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
-
-<html>
-<head>
- <meta name="viewport" content="initial-scale=1, clip-to-safe-area=yes">
- <script>
- function getUIScript()
- {
- return `
- (function() {
- uiController.setObscuredInsets(10, 20, 30, 40);
- uiController.immediateScrollToOffset(-40, -10);
- uiController.doAfterVisibleContentRectUpdate(function () {
- uiController.uiScriptComplete();
- })
- })();`
- }
-
- if (window.testRunner) {
- testRunner.dumpAsText();
- testRunner.waitUntilDone();
- }
-
- function doTest()
- {
- testRunner.runUIScript(getUIScript(), function(result) {
- if (window.internals) {
- document.getElementById('layers').innerText = internals.layerTreeAsText(document,
- internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS | internals.LAYER_TREE_INCLUDES_TILE_CACHES);
- }
-
- if (window.testRunner)
- testRunner.notifyDone();
- });
- }
- window.addEventListener('load', doTest, false);
- </script>
-</head>
-
-<body>
-<pre id="layers">Layer tree goes here</p>
-</body>
-</html>
Modified: trunk/Source/WebCore/ChangeLog (216046 => 216047)
--- trunk/Source/WebCore/ChangeLog 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebCore/ChangeLog 2017-05-02 00:08:23 UTC (rev 216047)
@@ -1,3 +1,64 @@
+2017-05-01 Timothy Horton <[email protected]>
+
+ Expose viewport-fit instead of clip-to-safe-area
+ https://bugs.webkit.org/show_bug.cgi?id=171503
+ <rdar://problem/31918249>
+
+ Reviewed by Simon Fraser.
+
+ Tests: fast/viewport/ios/viewport-fit-auto.html
+ fast/viewport/ios/viewport-fit-contain.html
+ fast/viewport/ios/viewport-fit-cover.html
+
+ * dom/ConstantPropertyMap.cpp:
+ (WebCore::ConstantPropertyMap::buildValues):
+ (WebCore::ConstantPropertyMap::updateConstantsForUnobscuredSafeAreaInsets):
+ (WebCore::ConstantPropertyMap::didChangeSafeAreaInsets):
+ (WebCore::ConstantPropertyMap::updateConstantsForObscuredInsets): Deleted.
+ (WebCore::ConstantPropertyMap::didChangeObscuredInsets): Deleted.
+ * dom/ConstantPropertyMap.h:
+ Retrieve the safe area insets from page, instead of assuming that we should
+ just expose the entire obscured inset. Also, do some renames.
+
+ * dom/ViewportArguments.cpp:
+ (WebCore::ViewportArguments::resolve):
+ (WebCore::parseViewportFitValue):
+ (WebCore::setViewportFeature):
+ * dom/ViewportArguments.h:
+ (WebCore::ViewportArguments::operator==):
+ * page/ChromeClient.h:
+ * page/FrameView.cpp:
+ (WebCore::FrameView::enableSpeculativeTilingIfNeeded):
+ (WebCore::FrameView::calculateExtendedBackgroundMode):
+ (WebCore::FrameView::setClipToSafeArea): Deleted.
+ * page/FrameView.h:
+ * page/ViewportConfiguration.cpp:
+ (WebCore::ViewportConfiguration::updateConfiguration):
+ (WebCore::operator<<):
+ (WebCore::ViewportConfiguration::description):
+ (WebCore::ViewportConfiguration::dump):
+ * page/ViewportConfiguration.h:
+ (WebCore::ViewportConfiguration::avoidsUnsafeArea):
+ (WebCore::ViewportConfiguration::Parameters::Parameters):
+ (WebCore::ViewportConfiguration::clipToSafeArea): Deleted.
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::updateRootContentLayerClipping):
+ * rendering/RenderObject.cpp:
+ (WebCore::RenderObject::repaintUsingContainer):
+ Un-do changes to support clip-to-safe-area, and instead implement
+ a new viewport-fit argument in the viewport meta tag, which takes
+ "auto", "contain", and "cover". "auto" and "contain" cause web content
+ to lay out excluding the safe area inset from the layout size, while
+ "cover" causes web content to expand into the unsafe area.
+
+ * page/Page.cpp:
+ (WebCore::Page::setUnobscuredSafeAreaInsets):
+ (WebCore::Page::setObscuredInsets): Deleted.
+ * page/Page.h:
+ (WebCore::Page::setObscuredInsets):
+ (WebCore::Page::unobscuredSafeAreaInsets):
+ Keep safe area and obscured insets separately.
+
2017-05-01 Chris Dumez <[email protected]>
Documents created using DOMParser.parseFromString should inherit their context document's origin / URL
Modified: trunk/Source/WebCore/dom/ConstantPropertyMap.cpp (216046 => 216047)
--- trunk/Source/WebCore/dom/ConstantPropertyMap.cpp 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebCore/dom/ConstantPropertyMap.cpp 2017-05-02 00:08:23 UTC (rev 216047)
@@ -82,7 +82,7 @@
{
m_values = Values { };
- updateConstantsForObscuredInsets();
+ updateConstantsForSafeAreaInsets();
}
static Ref<CSSVariableData> variableDataForPositivePixelLength(float lengthInPx)
@@ -97,18 +97,18 @@
return CSSVariableData::create(tokenRange, false);
}
-void ConstantPropertyMap::updateConstantsForObscuredInsets()
+void ConstantPropertyMap::updateConstantsForSafeAreaInsets()
{
- FloatBoxExtent obscuredInsets = m_document.page() ? m_document.page()->obscuredInsets() : FloatBoxExtent();
- setValueForProperty(ConstantProperty::SafeAreaInsetTop, variableDataForPositivePixelLength(obscuredInsets.top()));
- setValueForProperty(ConstantProperty::SafeAreaInsetRight, variableDataForPositivePixelLength(obscuredInsets.right()));
- setValueForProperty(ConstantProperty::SafeAreaInsetBottom, variableDataForPositivePixelLength(obscuredInsets.bottom()));
- setValueForProperty(ConstantProperty::SafeAreaInsetLeft, variableDataForPositivePixelLength(obscuredInsets.left()));
+ FloatBoxExtent unobscuredSafeAreaInsets = m_document.page() ? m_document.page()->unobscuredSafeAreaInsets() : FloatBoxExtent();
+ setValueForProperty(ConstantProperty::SafeAreaInsetTop, variableDataForPositivePixelLength(unobscuredSafeAreaInsets.top()));
+ setValueForProperty(ConstantProperty::SafeAreaInsetRight, variableDataForPositivePixelLength(unobscuredSafeAreaInsets.right()));
+ setValueForProperty(ConstantProperty::SafeAreaInsetBottom, variableDataForPositivePixelLength(unobscuredSafeAreaInsets.bottom()));
+ setValueForProperty(ConstantProperty::SafeAreaInsetLeft, variableDataForPositivePixelLength(unobscuredSafeAreaInsets.left()));
}
-void ConstantPropertyMap::didChangeObscuredInsets()
+void ConstantPropertyMap::didChangeSafeAreaInsets()
{
- updateConstantsForObscuredInsets();
+ updateConstantsForSafeAreaInsets();
m_document.invalidateMatchedPropertiesCacheAndForceStyleRecalc();
}
Modified: trunk/Source/WebCore/dom/ConstantPropertyMap.h (216046 => 216047)
--- trunk/Source/WebCore/dom/ConstantPropertyMap.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebCore/dom/ConstantPropertyMap.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -51,7 +51,7 @@
typedef HashMap<AtomicString, Ref<CSSCustomPropertyValue>> Values;
const Values& values() const;
- void didChangeObscuredInsets();
+ void didChangeSafeAreaInsets();
private:
void buildValues();
@@ -59,7 +59,7 @@
const AtomicString& nameForProperty(ConstantProperty) const;
void setValueForProperty(ConstantProperty, Ref<CSSVariableData>&&);
- void updateConstantsForObscuredInsets();
+ void updateConstantsForSafeAreaInsets();
std::optional<Values> m_values;
Modified: trunk/Source/WebCore/dom/ViewportArguments.cpp (216046 => 216047)
--- trunk/Source/WebCore/dom/ViewportArguments.cpp 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebCore/dom/ViewportArguments.cpp 2017-05-02 00:08:23 UTC (rev 216047)
@@ -246,7 +246,7 @@
result.userScalable = userZoom;
result.orientation = orientation;
result.shrinkToFit = shrinkToFit;
- result.clipToSafeArea = clipToSafeArea;
+ result.viewportFit = viewportFit;
return result;
}
@@ -381,6 +381,20 @@
return std::abs(numericPrefix(document, key, value)) >= 1;
}
+static ViewportFit parseViewportFitValue(Document& document, StringView key, StringView value)
+{
+ if (equalLettersIgnoringASCIICase(value, "auto"))
+ return ViewportFit::Auto;
+ if (equalLettersIgnoringASCIICase(value, "contain"))
+ return ViewportFit::Contain;
+ if (equalLettersIgnoringASCIICase(value, "cover"))
+ return ViewportFit::Cover;
+
+ reportViewportWarning(document, UnrecognizedViewportArgumentValueError, value, key);
+
+ return ViewportFit::Auto;
+}
+
void setViewportFeature(ViewportArguments& arguments, Document& document, StringView key, StringView value)
{
if (equalLettersIgnoringASCIICase(key, "width"))
@@ -403,8 +417,8 @@
#endif
else if (equalLettersIgnoringASCIICase(key, "shrink-to-fit"))
arguments.shrinkToFit = findBooleanValue(document, key, value);
- else if (equalLettersIgnoringASCIICase(key, "clip-to-safe-area"))
- arguments.clipToSafeArea = findBooleanValue(document, key, value);
+ else if (equalLettersIgnoringASCIICase(key, "viewport-fit"))
+ arguments.viewportFit = parseViewportFitValue(document, key, value);
else
reportViewportWarning(document, UnrecognizedViewportArgumentKeyError, key);
}
Modified: trunk/Source/WebCore/dom/ViewportArguments.h (216046 => 216047)
--- trunk/Source/WebCore/dom/ViewportArguments.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebCore/dom/ViewportArguments.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -41,6 +41,12 @@
MaximumScaleTooLargeError
};
+enum class ViewportFit {
+ Auto,
+ Contain,
+ Cover
+};
+
struct ViewportAttributes {
FloatSize layoutSize;
@@ -51,7 +57,8 @@
float userScalable;
float orientation;
float shrinkToFit;
- bool clipToSafeArea;
+
+ ViewportFit viewportFit;
};
struct ViewportArguments {
@@ -95,7 +102,7 @@
float userZoom { ValueAuto };
float orientation { ValueAuto };
float shrinkToFit { ValueAuto };
- bool clipToSafeArea { true };
+ ViewportFit viewportFit { ViewportFit::Auto };
bool widthWasExplicit { false };
bool operator==(const ViewportArguments& other) const
@@ -114,7 +121,7 @@
&& userZoom == other.userZoom
&& orientation == other.orientation
&& shrinkToFit == other.shrinkToFit
- && clipToSafeArea == other.clipToSafeArea
+ && viewportFit == other.viewportFit
&& widthWasExplicit == other.widthWasExplicit;
}
Modified: trunk/Source/WebCore/page/ChromeClient.h (216046 => 216047)
--- trunk/Source/WebCore/page/ChromeClient.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebCore/page/ChromeClient.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -468,8 +468,6 @@
virtual void reportProcessCPUTime(Seconds, ActivityStateForCPUSampling) { }
virtual RefPtr<Icon> createIconForFiles(const Vector<String>& /* filenames */) = 0;
- virtual void didChangeClipToSafeArea(bool) { }
-
protected:
virtual ~ChromeClient() { }
};
Modified: trunk/Source/WebCore/page/FrameView.cpp (216046 => 216047)
--- trunk/Source/WebCore/page/FrameView.cpp 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebCore/page/FrameView.cpp 2017-05-02 00:08:23 UTC (rev 216047)
@@ -2931,10 +2931,6 @@
m_speculativeTilingEnabled = true;
return;
}
- if (!m_clipToSafeArea) {
- m_speculativeTilingEnabled = true;
- return;
- }
if (!shouldEnableSpeculativeTilingDuringLoading(*this))
return;
@@ -3262,9 +3258,6 @@
FrameView::ExtendedBackgroundMode FrameView::calculateExtendedBackgroundMode() const
{
- if (!m_clipToSafeArea)
- return ExtendedBackgroundModeAll;
-
#if PLATFORM(IOS)
// <rdar://problem/16201373>
return ExtendedBackgroundModeNone;
@@ -3351,30 +3344,6 @@
return snappedIntRect(extendedRect);
}
-void FrameView::setClipToSafeArea(bool clipToSafeArea)
-{
- if (!frame().isMainFrame())
- return;
-
- if (m_clipToSafeArea == clipToSafeArea)
- return;
-
- m_clipToSafeArea = clipToSafeArea;
-
- if (Page* page = frame().page())
- page->chrome().client().didChangeClipToSafeArea(clipToSafeArea);
-
- updateExtendBackgroundIfNecessary();
- adjustTiledBackingCoverage();
-
- RenderView* renderView = this->renderView();
- if (!renderView)
- return;
-
- RenderLayerCompositor& compositor = renderView->compositor();
- compositor.updateRootContentLayerClipping();
-}
-
bool FrameView::shouldUpdateWhileOffscreen() const
{
return m_shouldUpdateWhileOffscreen;
Modified: trunk/Source/WebCore/page/FrameView.h (216046 => 216047)
--- trunk/Source/WebCore/page/FrameView.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebCore/page/FrameView.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -213,9 +213,6 @@
bool hasExtendedBackgroundRectForPainting() const;
IntRect extendedBackgroundRectForPainting() const;
- bool clipToSafeArea() const { return m_clipToSafeArea; }
- WEBCORE_EXPORT void setClipToSafeArea(bool);
-
bool shouldUpdateWhileOffscreen() const;
WEBCORE_EXPORT void setShouldUpdateWhileOffscreen(bool);
bool shouldUpdate() const;
@@ -816,8 +813,6 @@
bool m_needsDeferredScrollbarsUpdate { false };
- bool m_clipToSafeArea { true };
-
RefPtr<ContainerNode> m_maintainScrollPositionAnchor;
// Renderer to hold our custom scroll corner.
Modified: trunk/Source/WebCore/page/Page.cpp (216046 => 216047)
--- trunk/Source/WebCore/page/Page.cpp 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebCore/page/Page.cpp 2017-05-02 00:08:23 UTC (rev 216047)
@@ -2354,17 +2354,17 @@
LOG(Layout, "hasMediaQueriesAffectedByAccessibilitySettingsChange, enqueueing style recalc");
}
-void Page::setObscuredInsets(const FloatBoxExtent& insets)
+void Page::setUnobscuredSafeAreaInsets(const FloatBoxExtent& insets)
{
- if (m_obscuredInsets == insets)
+ if (m_unobscuredSafeAreaInsets == insets)
return;
- m_obscuredInsets = insets;
+ m_unobscuredSafeAreaInsets = insets;
for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
if (!frame->document())
continue;
- frame->document()->constantProperties().didChangeObscuredInsets();
+ frame->document()->constantProperties().didChangeSafeAreaInsets();
}
}
Modified: trunk/Source/WebCore/page/Page.h (216046 => 216047)
--- trunk/Source/WebCore/page/Page.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebCore/page/Page.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -331,8 +331,11 @@
WEBCORE_EXPORT void setTopContentInset(float);
const FloatBoxExtent& obscuredInsets() const { return m_obscuredInsets; }
- WEBCORE_EXPORT void setObscuredInsets(const FloatBoxExtent&);
+ void setObscuredInsets(const FloatBoxExtent& obscuredInsets) { m_obscuredInsets = obscuredInsets; }
+ const FloatBoxExtent& unobscuredSafeAreaInsets() const { return m_unobscuredSafeAreaInsets; }
+ WEBCORE_EXPORT void setUnobscuredSafeAreaInsets(const FloatBoxExtent&);
+
#if PLATFORM(IOS)
bool enclosedInScrollableAncestorView() const { return m_enclosedInScrollableAncestorView; }
void setEnclosedInScrollableAncestorView(bool f) { m_enclosedInScrollableAncestorView = f; }
@@ -696,6 +699,7 @@
float m_topContentInset;
FloatBoxExtent m_obscuredInsets;
+ FloatBoxExtent m_unobscuredSafeAreaInsets;
#if PLATFORM(IOS)
bool m_enclosedInScrollableAncestorView { false };
Modified: trunk/Source/WebCore/page/ViewportConfiguration.cpp (216046 => 216047)
--- trunk/Source/WebCore/page/ViewportConfiguration.cpp 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebCore/page/ViewportConfiguration.cpp 2017-05-02 00:08:23 UTC (rev 216047)
@@ -337,8 +337,7 @@
if (booleanViewportArgumentIsSet(m_viewportArguments.shrinkToFit))
m_configuration.allowsShrinkToFit = m_viewportArguments.shrinkToFit != 0.;
- if (booleanViewportArgumentIsSet(m_viewportArguments.clipToSafeArea))
- m_configuration.clipToSafeArea = m_viewportArguments.clipToSafeArea;
+ m_configuration.avoidsUnsafeArea = m_viewportArguments.viewportFit != ViewportFit::Cover;
}
double ViewportConfiguration::viewportArgumentsLength(double length) const
@@ -442,7 +441,7 @@
ts.dumpProperty("maximumScale", parameters.maximumScale);
ts.dumpProperty("allowsUserScaling", parameters.allowsUserScaling);
ts.dumpProperty("allowsShrinkToFit", parameters.allowsShrinkToFit);
- ts.dumpProperty("clipToSafeArea", parameters.clipToSafeArea);
+ ts.dumpProperty("avoidsUnsafeArea", parameters.avoidsUnsafeArea);
return ts;
}
@@ -476,7 +475,7 @@
ts.dumpProperty("computed layout size", layoutSize());
ts.dumpProperty("ignoring horizontal scaling constraints", shouldIgnoreHorizontalScalingConstraints() ? "true" : "false");
ts.dumpProperty("ignoring vertical scaling constraints", shouldIgnoreVerticalScalingConstraints() ? "true" : "false");
- ts.dumpProperty("clip to safe area", clipToSafeArea() ? "true" : "false");
+ ts.dumpProperty("avoids unsafe area", avoidsUnsafeArea() ? "true" : "false");
ts.endGroup();
Modified: trunk/Source/WebCore/page/ViewportConfiguration.h (216046 => 216047)
--- trunk/Source/WebCore/page/ViewportConfiguration.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebCore/page/ViewportConfiguration.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -42,33 +42,18 @@
public:
// FIXME: unify with ViewportArguments.
struct Parameters {
- Parameters()
- : width(0)
- , height(0)
- , initialScale(0)
- , minimumScale(0)
- , maximumScale(0)
- , allowsUserScaling(false)
- , allowsShrinkToFit(false)
- , clipToSafeArea(true)
- , widthIsSet(false)
- , heightIsSet(false)
- , initialScaleIsSet(false)
- {
- }
+ double width { 0 };
+ double height { 0 };
+ double initialScale { 0 };
+ double minimumScale { 0 };
+ double maximumScale { 0 };
+ bool allowsUserScaling { false };
+ bool allowsShrinkToFit { false };
+ bool avoidsUnsafeArea { true };
- double width;
- double height;
- double initialScale;
- double minimumScale;
- double maximumScale;
- bool allowsUserScaling;
- bool allowsShrinkToFit;
- bool clipToSafeArea;
-
- bool widthIsSet;
- bool heightIsSet;
- bool initialScaleIsSet;
+ bool widthIsSet { false };
+ bool heightIsSet { false };
+ bool initialScaleIsSet { false };
};
WEBCORE_EXPORT ViewportConfiguration();
@@ -97,7 +82,7 @@
WEBCORE_EXPORT bool allowsUserScaling() const;
WEBCORE_EXPORT bool allowsUserScalingIgnoringAlwaysScalable() const;
bool allowsShrinkToFit() const;
- bool clipToSafeArea() const { return m_configuration.clipToSafeArea; }
+ bool avoidsUnsafeArea() const { return m_configuration.avoidsUnsafeArea; }
WEBCORE_EXPORT static Parameters webpageParameters();
WEBCORE_EXPORT static Parameters textDocumentParameters();
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (216046 => 216047)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2017-05-02 00:08:23 UTC (rev 216047)
@@ -978,7 +978,7 @@
void RenderLayerCompositor::updateRootContentLayerClipping()
{
- m_rootContentLayer->setMasksToBounds(!m_renderView.settings().backgroundShouldExtendBeyondPage() && m_renderView.frameView().clipToSafeArea());
+ m_rootContentLayer->setMasksToBounds(!m_renderView.settings().backgroundShouldExtendBeyondPage());
}
bool RenderLayerCompositor::updateBacking(RenderLayer& layer, CompositingChangeRepaint shouldRepaint, BackingRequired backingRequired)
Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (216046 => 216047)
--- trunk/Source/WebCore/rendering/RenderObject.cpp 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp 2017-05-02 00:08:23 UTC (rev 216047)
@@ -897,9 +897,6 @@
view.repaintViewRectangle(rect);
return;
}
-
- if (!view.frameView().clipToSafeArea())
- shouldClipToLayer = false;
}
if (view().usesCompositing()) {
Modified: trunk/Source/WebKit2/ChangeLog (216046 => 216047)
--- trunk/Source/WebKit2/ChangeLog 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/ChangeLog 2017-05-02 00:08:23 UTC (rev 216047)
@@ -1,3 +1,93 @@
+2017-05-01 Timothy Horton <[email protected]>
+
+ Expose viewport-fit instead of clip-to-safe-area
+ https://bugs.webkit.org/show_bug.cgi?id=171503
+ <rdar://problem/31918249>
+
+ Reviewed by Simon Fraser.
+
+ * Shared/VisibleContentRectUpdateInfo.cpp:
+ (WebKit::VisibleContentRectUpdateInfo::encode):
+ (WebKit::VisibleContentRectUpdateInfo::decode):
+ (WebKit::operator<<):
+ * Shared/VisibleContentRectUpdateInfo.h:
+ (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
+ (WebKit::VisibleContentRectUpdateInfo::unobscuredSafeAreaInsets):
+ (WebKit::operator==):
+ Plumb the safe area insets down from the UI process to the Web Content
+ process inside the visible content rect update, alongside the obscured
+ insets.
+
+ * Shared/mac/RemoteLayerTreeTransaction.h:
+ (WebKit::RemoteLayerTreeTransaction::avoidsUnsafeArea):
+ (WebKit::RemoteLayerTreeTransaction::setAvoidsUnsafeArea):
+ * Shared/mac/RemoteLayerTreeTransaction.mm:
+ (WebKit::RemoteLayerTreeTransaction::encode):
+ (WebKit::RemoteLayerTreeTransaction::decode):
+ (WebKit::RemoteLayerTreeTransaction::description):
+ * UIProcess/PageClient.h:
+ * UIProcess/ios/PageClientImplIOS.h:
+ * UIProcess/ios/PageClientImplIOS.mm:
+ (WebKit::PageClientImpl::didChangeAvoidsUnsafeArea):
+ (WebKit::PageClientImpl::didChangeClipToSafeArea): Deleted.
+ * UIProcess/ios/WebPageProxyIOS.mm:
+ (WebKit::WebPageProxy::didCommitLayerTree):
+ * UIProcess/mac/PageClientImpl.h:
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::didChangeClipToSafeArea): Deleted.
+ * WebProcess/WebCoreSupport/WebChromeClient.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::willCommitLayerTree):
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::viewportConfigurationChanged):
+ (WebKit::WebPage::updateVisibleContentRects):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::resetState):
+ (WebKit::WebPageProxy::setAvoidsUnsafeArea):
+ (WebKit::WebPageProxy::setClipToSafeArea): Deleted.
+ * UIProcess/WebPageProxy.h:
+ (WebKit::WebPageProxy::avoidsUnsafeArea):
+ (WebKit::WebPageProxy::clipToSafeArea): Deleted.
+ * UIProcess/WebPageProxy.messages.in:
+ Plumb the effective value of viewport-fit (whether or not to avoid
+ the safe area for layout purposes) from the Web Content process
+ to the UI process inside the layer tree transaction.
+ Also, remove clip-to-safe-area plumbing.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _initializeWithConfiguration:]):
+ (-[WKWebView _computedContentInset]):
+ (-[WKWebView _computedUnobscuredSafeAreaInset]):
+ (-[WKWebView _updateVisibleContentRects]):
+ (-[WKWebView _updateScrollViewInsetAdjustmentBehavior]):
+ (-[WKWebView _safeAreaShouldAffectObscuredInsets]):
+ (-[WKWebView _unobscuredSafeAreaInsets]):
+ (-[WKWebView _setUnobscuredSafeAreaInsets:]):
+ (-[WKWebView _contentMayDrawInObscuredInsets]): Deleted.
+ * UIProcess/API/Cocoa/WKWebViewInternal.h:
+ * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+ Make use of the effective value of viewport-fit to decide whether to
+ take the safe area into account when computing the obscured insets,
+ and expose this to clients (in the case that they need to know
+ because they push their own obscured insets down). Also expose a
+ safe area inset setter for that case as well.
+
+ * UIProcess/ios/WKContentView.h:
+ * UIProcess/ios/WKContentView.mm:
+ (-[WKContentView updateFixedClippingView:]):
+ (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
+ Remove a piece of the clip-to-safe-area implementation, and plumb
+ safe area insets into the visible content rect update info.
+
+ * UIProcess/ios/WKScrollView.h:
+ * UIProcess/ios/WKScrollView.mm:
+ (-[WKScrollView initWithFrame:]):
+ (-[WKScrollView _contentInsetAdjustmentBehaviorWasExternallyOverridden]):
+ (-[WKScrollView _setContentInsetAdjustmentBehavior:]):
+ (-[WKScrollView _setContentInsetAdjustmentBehaviorInternal:]):
+ Keep track of whether the client has ever touched the content inset adjustment
+ behavior; if they have, we won't manage it ourselves.
+
2017-05-01 Brady Eidson <[email protected]>
Update names in WKURLSchemeHandler/WKURLSchemeHandlerTask APIs.
Modified: trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.cpp (216046 => 216047)
--- trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.cpp 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.cpp 2017-05-02 00:08:23 UTC (rev 216047)
@@ -41,6 +41,7 @@
encoder << m_unobscuredRectInScrollViewCoordinates;
encoder << m_customFixedPositionRect;
encoder << m_obscuredInsets;
+ encoder << m_unobscuredSafeAreaInsets;
encoder << m_lastLayerTreeTransactionID;
encoder << m_scale;
encoder << m_timestamp;
@@ -66,6 +67,8 @@
return false;
if (!decoder.decode(result.m_obscuredInsets))
return false;
+ if (!decoder.decode(result.m_unobscuredSafeAreaInsets))
+ return false;
if (!decoder.decode(result.m_lastLayerTreeTransactionID))
return false;
if (!decoder.decode(result.m_scale))
@@ -113,6 +116,7 @@
ts.dumpProperty("unobscuredContentRectRespectingInputViewBounds", info.unobscuredContentRectRespectingInputViewBounds());
ts.dumpProperty("customFixedPositionRect", info.customFixedPositionRect());
ts.dumpProperty("obscuredInsets", info.obscuredInsets());
+ ts.dumpProperty("unobscuredSafeAreaInsets", info.unobscuredSafeAreaInsets());
ts.dumpProperty("scale", info.scale());
ts.dumpProperty("inStableState", info.inStableState());
Modified: trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.h (216046 => 216047)
--- trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/Shared/VisibleContentRectUpdateInfo.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -45,10 +45,7 @@
public:
VisibleContentRectUpdateInfo() = default;
- VisibleContentRectUpdateInfo(const WebCore::FloatRect& exposedContentRect, const WebCore::FloatRect& unobscuredContentRect,
- const WebCore::FloatRect& unobscuredRectInScrollViewCoordinates, const WebCore::FloatRect& unobscuredContentRectRespectingInputViewBounds, const WebCore::FloatRect& customFixedPositionRect,
- const WebCore::FloatBoxExtent& obscuredInsets, double scale, bool inStableState, bool isFirstUpdateForNewViewSize, bool isChangingObscuredInsetsInteractively, bool allowShrinkToFit, bool enclosedInScrollableAncestorView,
- MonotonicTime timestamp, double horizontalVelocity, double verticalVelocity, double scaleChangeRate, uint64_t lastLayerTreeTransactionId)
+ VisibleContentRectUpdateInfo(const WebCore::FloatRect& exposedContentRect, const WebCore::FloatRect& unobscuredContentRect, const WebCore::FloatRect& unobscuredRectInScrollViewCoordinates, const WebCore::FloatRect& unobscuredContentRectRespectingInputViewBounds, const WebCore::FloatRect& customFixedPositionRect, const WebCore::FloatBoxExtent& obscuredInsets, const WebCore::FloatBoxExtent& unobscuredSafeAreaInsets, double scale, bool inStableState, bool isFirstUpdateForNewViewSize, bool isChangingObscuredInsetsInteractively, bool allowShrinkToFit, bool enclosedInScrollableAncestorView, MonotonicTime timestamp, double horizontalVelocity, double verticalVelocity, double scaleChangeRate, uint64_t lastLayerTreeTransactionId)
: m_exposedContentRect(exposedContentRect)
, m_unobscuredContentRect(unobscuredContentRect)
, m_unobscuredRectInScrollViewCoordinates(unobscuredRectInScrollViewCoordinates)
@@ -55,6 +52,7 @@
, m_unobscuredContentRectRespectingInputViewBounds(unobscuredContentRectRespectingInputViewBounds)
, m_customFixedPositionRect(customFixedPositionRect)
, m_obscuredInsets(obscuredInsets)
+ , m_unobscuredSafeAreaInsets(unobscuredSafeAreaInsets)
, m_lastLayerTreeTransactionID(lastLayerTreeTransactionId)
, m_scale(scale)
, m_timestamp(timestamp)
@@ -75,6 +73,7 @@
const WebCore::FloatRect& unobscuredContentRectRespectingInputViewBounds() const { return m_unobscuredContentRectRespectingInputViewBounds; }
const WebCore::FloatRect& customFixedPositionRect() const { return m_customFixedPositionRect; }
const WebCore::FloatBoxExtent& obscuredInsets() const { return m_obscuredInsets; }
+ const WebCore::FloatBoxExtent& unobscuredSafeAreaInsets() const { return m_unobscuredSafeAreaInsets; }
double scale() const { return m_scale; }
bool inStableState() const { return m_inStableState; }
@@ -102,6 +101,7 @@
WebCore::FloatRect m_unobscuredContentRectRespectingInputViewBounds;
WebCore::FloatRect m_customFixedPositionRect; // When visual viewports are enabled, this is the layout viewport.
WebCore::FloatBoxExtent m_obscuredInsets;
+ WebCore::FloatBoxExtent m_unobscuredSafeAreaInsets;
uint64_t m_lastLayerTreeTransactionID { 0 };
double m_scale { -1 };
MonotonicTime m_timestamp;
@@ -123,6 +123,7 @@
&& a.unobscuredContentRect() == b.unobscuredContentRect()
&& a.customFixedPositionRect() == b.customFixedPositionRect()
&& a.obscuredInsets() == b.obscuredInsets()
+ && a.unobscuredSafeAreaInsets() == b.unobscuredSafeAreaInsets()
&& a.horizontalVelocity() == b.horizontalVelocity()
&& a.verticalVelocity() == b.verticalVelocity()
&& a.scaleChangeRate() == b.scaleChangeRate()
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (216046 => 216047)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -255,6 +255,9 @@
bool allowsUserScaling() const { return m_allowsUserScaling; }
void setAllowsUserScaling(bool allowsUserScaling) { m_allowsUserScaling = allowsUserScaling; }
+ bool avoidsUnsafeArea() const { return m_avoidsUnsafeArea; }
+ void setAvoidsUnsafeArea(bool avoidsUnsafeArea) { m_avoidsUnsafeArea = avoidsUnsafeArea; }
+
uint64_t transactionID() const { return m_transactionID; }
void setTransactionID(uint64_t transactionID) { m_transactionID = transactionID; }
@@ -296,6 +299,7 @@
WebCore::LayoutMilestones m_newlyReachedLayoutMilestones { 0 };
bool m_scaleWasSetByUIProcess { false };
bool m_allowsUserScaling { false };
+ bool m_avoidsUnsafeArea { true };
bool m_viewportMetaTagWidthWasExplicit { false };
bool m_viewportMetaTagCameFromImageDocument { false };
bool m_isInStableState { false };
Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (216046 => 216047)
--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm 2017-05-02 00:08:23 UTC (rev 216047)
@@ -550,6 +550,8 @@
encoder << m_scaleWasSetByUIProcess;
encoder << m_allowsUserScaling;
+ encoder << m_avoidsUnsafeArea;
+
encoder << m_viewportMetaTagWidthWasExplicit;
encoder << m_viewportMetaTagCameFromImageDocument;
@@ -656,6 +658,9 @@
if (!decoder.decode(result.m_allowsUserScaling))
return false;
+ if (!decoder.decode(result.m_avoidsUnsafeArea))
+ return false;
+
if (!decoder.decode(result.m_viewportMetaTagWidthWasExplicit))
return false;
@@ -878,6 +883,8 @@
ts.dumpProperty("viewportMetaTagWidth", m_viewportMetaTagWidth);
ts.dumpProperty("viewportMetaTagWidthWasExplicit", m_viewportMetaTagWidthWasExplicit);
ts.dumpProperty("viewportMetaTagCameFromImageDocument", m_viewportMetaTagCameFromImageDocument);
+ ts.dumpProperty("allowsUserScaling", m_allowsUserScaling);
+ ts.dumpProperty("avoidsUnsafeArea", m_avoidsUnsafeArea);
ts.dumpProperty("isInStableState", m_isInStableState);
ts.dumpProperty("renderTreeSize", m_renderTreeSize);
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (216046 => 216047)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2017-05-02 00:08:23 UTC (rev 216047)
@@ -242,6 +242,9 @@
BOOL _haveSetObscuredInsets;
BOOL _isChangingObscuredInsetsInteractively;
+ UIEdgeInsets _unobscuredSafeAreaInsets;
+ BOOL _haveSetUnobscuredSafeAreaInsets;
+
UIInterfaceOrientation _interfaceOrientationOverride;
BOOL _overridesInterfaceOrientation;
@@ -501,12 +504,9 @@
_scrollView = adoptNS([[WKScrollView alloc] initWithFrame:bounds]);
[_scrollView setInternalDelegate:self];
[_scrollView setBouncesZoom:YES];
+
+ [self _updateScrollViewInsetAdjustmentBehavior];
-#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
- if ([_scrollView _contentInsetAdjustmentBehavior] == UIScrollViewContentInsetAdjustmentAutomatic)
- [_scrollView _setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentAlways];
-#endif
-
[self addSubview:_scrollView.get()];
static uint32_t programSDKVersion = dyld_get_program_sdk_version();
@@ -1349,16 +1349,31 @@
UIEdgeInsets insets = [_scrollView contentInset];
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
- UIEdgeInsets systemInsets = [_scrollView _systemContentInset];
- insets.top += systemInsets.top;
- insets.bottom += systemInsets.bottom;
- insets.left += systemInsets.left;
- insets.right += systemInsets.right;
+ if (self._safeAreaShouldAffectObscuredInsets) {
+ UIEdgeInsets systemInsets = [_scrollView _systemContentInset];
+ insets.top += systemInsets.top;
+ insets.bottom += systemInsets.bottom;
+ insets.left += systemInsets.left;
+ insets.right += systemInsets.right;
+ }
#endif
return insets;
}
+- (UIEdgeInsets)_computedUnobscuredSafeAreaInset
+{
+ if (_haveSetUnobscuredSafeAreaInsets)
+ return _unobscuredSafeAreaInsets;
+
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+ if (!self._safeAreaShouldAffectObscuredInsets)
+ return self.safeAreaInsets;
+#endif
+
+ return UIEdgeInsetsZero;
+}
+
- (void)_processDidExit
{
[self _hidePasswordView];
@@ -2410,6 +2425,7 @@
unobscuredRect:unobscuredRectInContentCoordinates
unobscuredRectInScrollViewCoordinates:unobscuredRect
obscuredInsets:_obscuredInsets
+ unobscuredSafeAreaInsets:[self _computedUnobscuredSafeAreaInset]
inputViewBounds:_inputViewBounds
scale:scaleFactor minimumScale:[_scrollView minimumZoomScale]
inStableState:inStableState
@@ -2609,6 +2625,14 @@
return _passwordView.get();
}
+- (void)_updateScrollViewInsetAdjustmentBehavior
+{
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+ if (![_scrollView _contentInsetAdjustmentBehaviorWasExternallyOverridden])
+ [_scrollView _setContentInsetAdjustmentBehaviorInternal:self._safeAreaShouldAffectObscuredInsets ? UIScrollViewContentInsetAdjustmentAlways : UIScrollViewContentInsetAdjustmentNever];
+#endif
+}
+
#endif // PLATFORM(IOS)
#pragma mark OS X-specific methods
@@ -4273,9 +4297,11 @@
return _page->isShowingNavigationGestureSnapshot();
}
-- (BOOL)_contentMayDrawInObscuredInsets
+- (BOOL)_safeAreaShouldAffectObscuredInsets
{
- return !_page->clipToSafeArea();
+ if (!_page)
+ return YES;
+ return _page->avoidsUnsafeArea();
}
- (_WKLayoutMode)_layoutMode
@@ -4478,6 +4504,28 @@
[self _scheduleVisibleContentRectUpdate];
}
+- (UIEdgeInsets)_unobscuredSafeAreaInsets
+{
+ return _unobscuredSafeAreaInsets;
+}
+
+- (void)_setUnobscuredSafeAreaInsets:(UIEdgeInsets)unobscuredSafeAreaInsets
+{
+ ASSERT(unobscuredSafeAreaInsets.top >= 0);
+ ASSERT(unobscuredSafeAreaInsets.left >= 0);
+ ASSERT(unobscuredSafeAreaInsets.bottom >= 0);
+ ASSERT(unobscuredSafeAreaInsets.right >= 0);
+
+ _haveSetUnobscuredSafeAreaInsets = YES;
+
+ if (UIEdgeInsetsEqualToEdgeInsets(_unobscuredSafeAreaInsets, unobscuredSafeAreaInsets))
+ return;
+
+ _unobscuredSafeAreaInsets = unobscuredSafeAreaInsets;
+
+ [self _scheduleVisibleContentRectUpdate];
+}
+
- (void)_setInterfaceOrientationOverride:(UIInterfaceOrientation)interfaceOrientation
{
if (!_overridesInterfaceOrientation)
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (216046 => 216047)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -119,6 +119,8 @@
- (void)_showPasswordViewWithDocumentName:(NSString *)documentName passwordHandler:(void (^)(NSString *))passwordHandler;
- (void)_hidePasswordView;
+- (void)_updateScrollViewInsetAdjustmentBehavior;
+
@property (nonatomic, readonly) WKPasswordView *_passwordView;
@property (nonatomic, readonly) BOOL _isBackground;
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (216046 => 216047)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -155,7 +155,8 @@
// Define the inset of the scrollview unusable by the web page.
@property (nonatomic, setter=_setObscuredInsets:) UIEdgeInsets _obscuredInsets;
-@property (nonatomic, readonly) BOOL _contentMayDrawInObscuredInsets;
+@property (nonatomic, setter=_setUnobscuredSafeAreaInsets:) UIEdgeInsets _unobscuredSafeAreaInsets WK_API_AVAILABLE(ios(WK_IOS_TBA));
+@property (nonatomic, readonly) BOOL _safeAreaShouldAffectObscuredInsets WK_API_AVAILABLE(ios(WK_IOS_TBA));
// Override the interface orientation. Clients using _beginAnimatedResizeWithUpdates: must update the interface orientation
// in the update block.
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h (216046 => 216047)
--- trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -146,7 +146,7 @@
WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override { return WebCore::UserInterfaceLayoutDirection::LTR; }
- void didChangeClipToSafeArea(bool) override { }
+ void didChangeAvoidsUnsafeArea(bool) override { }
// Members of PageClientImpl class
GtkWidget* m_viewWidget;
Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (216046 => 216047)
--- trunk/Source/WebKit2/UIProcess/PageClient.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -388,7 +388,7 @@
virtual void didChangeDataInteractionCaretRect(const WebCore::IntRect& previousCaretRect, const WebCore::IntRect& caretRect) = 0;
#endif
- virtual void didChangeClipToSafeArea(bool clipToSafeArea) = 0;
+ virtual void didChangeAvoidsUnsafeArea(bool avoidsUnsafeArea) = 0;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (216046 => 216047)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2017-05-02 00:08:23 UTC (rev 216047)
@@ -5469,7 +5469,7 @@
requestPointerUnlock();
#endif
- m_clipToSafeArea = true;
+ m_avoidsUnsafeArea = true;
}
void WebPageProxy::resetStateAfterProcessExited()
@@ -6896,11 +6896,14 @@
iterator->value->stopTask(*this, resourceIdentifier);
}
-void WebPageProxy::setClipToSafeArea(bool clipToSafeArea)
+void WebPageProxy::setAvoidsUnsafeArea(bool avoidsUnsafeArea)
{
- m_clipToSafeArea = clipToSafeArea;
+ if (m_avoidsUnsafeArea == avoidsUnsafeArea)
+ return;
- m_pageClient.didChangeClipToSafeArea(clipToSafeArea);
+ m_avoidsUnsafeArea = avoidsUnsafeArea;
+
+ m_pageClient.didChangeAvoidsUnsafeArea(avoidsUnsafeArea);
}
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (216046 => 216047)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -1202,8 +1202,8 @@
void createSandboxExtensionsIfNeeded(const Vector<String>& files, SandboxExtension::Handle& fileReadHandle, SandboxExtension::HandleArray& fileUploadHandles);
#endif
- void setClipToSafeArea(bool);
- bool clipToSafeArea() const { return m_clipToSafeArea; }
+ void setAvoidsUnsafeArea(bool);
+ bool avoidsUnsafeArea() const { return m_avoidsUnsafeArea; }
private:
WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&);
@@ -1995,7 +1995,7 @@
bool m_isUsingHighPerformanceWebGL { false };
- bool m_clipToSafeArea { true };
+ bool m_avoidsUnsafeArea { true };
WeakPtrFactory<WebPageProxy> m_weakPtrFactory;
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (216046 => 216047)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in 2017-05-02 00:08:23 UTC (rev 216047)
@@ -494,6 +494,4 @@
StartURLSchemeTask(uint64_t loaderIdentifier, uint64_t resourceIdentifier, WebCore::ResourceRequest request)
StopURLSchemeTask(uint64_t loaderIdentifier, uint64_t resourceIdentifier)
-
- SetClipToSafeArea(bool clipToSafeArea)
}
Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (216046 => 216047)
--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -198,7 +198,7 @@
void handleActiveNowPlayingSessionInfoResponse(bool hasActiveSession, const String& title, double duration, double elapsedTime) override;
- void didChangeClipToSafeArea(bool clipToSafeArea) override;
+ void didChangeAvoidsUnsafeArea(bool avoidsUnsafeArea) override;
#if USE(QUICK_LOOK)
void requestPasswordForQuickLookDocument(const String& fileName, std::function<void(const String&)>&&) override;
Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (216046 => 216047)
--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm 2017-05-02 00:08:23 UTC (rev 216047)
@@ -821,8 +821,9 @@
}
#endif
-void PageClientImpl::didChangeClipToSafeArea(bool clipToSafeArea)
+void PageClientImpl::didChangeAvoidsUnsafeArea(bool avoidsUnsafeArea)
{
+ [m_webView _updateScrollViewInsetAdjustmentBehavior];
[m_webView _scheduleVisibleContentRectUpdate];
}
Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.h (216046 => 216047)
--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -71,6 +71,7 @@
unobscuredRect:(CGRect)unobscuredRect
unobscuredRectInScrollViewCoordinates:(CGRect)unobscuredRectInScrollViewCoordinates
obscuredInsets:(UIEdgeInsets)obscuredInsets
+ unobscuredSafeAreaInsets:(UIEdgeInsets)unobscuredSafeAreaInsets
inputViewBounds:(CGRect)inputViewBounds
scale:(CGFloat)scale minimumScale:(CGFloat)minimumScale
inStableState:(BOOL)isStableState
Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm (216046 => 216047)
--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm 2017-05-02 00:08:23 UTC (rev 216047)
@@ -360,7 +360,6 @@
[_fixedClippingView setCenter:clippingBounds.location()]; // Not really the center since we set an anchor point.
[_fixedClippingView setBounds:clippingBounds];
- [_fixedClippingView layer].masksToBounds = _page->clipToSafeArea();
}
- (void)_didExitStableState
@@ -386,6 +385,7 @@
unobscuredRect:(CGRect)unobscuredContentRect
unobscuredRectInScrollViewCoordinates:(CGRect)unobscuredRectInScrollViewCoordinates
obscuredInsets:(UIEdgeInsets)obscuredInsets
+ unobscuredSafeAreaInsets:(UIEdgeInsets)unobscuredSafeAreaInsets
inputViewBounds:(CGRect)inputViewBounds
scale:(CGFloat)zoomScale minimumScale:(CGFloat)minimumScale
inStableState:(BOOL)isStableState
@@ -415,6 +415,7 @@
unobscuredContentRectRespectingInputViewBounds,
fixedPositionRectForLayout,
WebCore::FloatBoxExtent(obscuredInsets.top, obscuredInsets.right, obscuredInsets.bottom, obscuredInsets.left),
+ WebCore::FloatBoxExtent(unobscuredSafeAreaInsets.top, unobscuredSafeAreaInsets.right, unobscuredSafeAreaInsets.bottom, unobscuredSafeAreaInsets.left),
zoomScale,
isStableState,
_sizeChangedSinceLastVisibleContentRectUpdate,
Modified: trunk/Source/WebKit2/UIProcess/ios/WKScrollView.h (216046 => 216047)
--- trunk/Source/WebKit2/UIProcess/ios/WKScrollView.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/UIProcess/ios/WKScrollView.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -35,6 +35,11 @@
- (void)_setContentSizePreservingContentOffsetDuringRubberband:(CGSize)contentSize;
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+@property (nonatomic, assign, readonly) BOOL _contentInsetAdjustmentBehaviorWasExternallyOverridden;
+- (void)_setContentInsetAdjustmentBehaviorInternal:(UIScrollViewContentInsetAdjustmentBehavior)insetAdjustmentBehavior;
+#endif
+
@end
#endif // PLATFORM(IOS)
Modified: trunk/Source/WebKit2/UIProcess/ios/WKScrollView.mm (216046 => 216047)
--- trunk/Source/WebKit2/UIProcess/ios/WKScrollView.mm 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/UIProcess/ios/WKScrollView.mm 2017-05-02 00:08:23 UTC (rev 216047)
@@ -114,6 +114,10 @@
@implementation WKScrollView {
WeakObjCPtr<id <UIScrollViewDelegate>> _externalDelegate;
WKScrollViewDelegateForwarder *_delegateForwarder;
+
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+ BOOL _contentInsetAdjustmentBehaviorWasExternallyOverridden;
+#endif
}
- (id)initWithFrame:(CGRect)frame
@@ -125,6 +129,10 @@
self.alwaysBounceVertical = YES;
self.directionalLockEnabled = YES;
+
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+ _contentInsetAdjustmentBehaviorWasExternallyOverridden = (self._contentInsetAdjustmentBehavior != UIScrollViewContentInsetAdjustmentAutomatic);
+#endif
return self;
}
@@ -227,6 +235,34 @@
[_internalDelegate _scheduleVisibleContentRectUpdate];
}
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+
+- (BOOL)_contentInsetAdjustmentBehaviorWasExternallyOverridden
+{
+ return _contentInsetAdjustmentBehaviorWasExternallyOverridden;
+}
+
+- (void)_setContentInsetAdjustmentBehavior:(UIScrollViewContentInsetAdjustmentBehavior)insetAdjustmentBehavior
+{
+ _contentInsetAdjustmentBehaviorWasExternallyOverridden = YES;
+
+ if ([self _contentInsetAdjustmentBehavior] == insetAdjustmentBehavior)
+ return;
+
+ [super _setContentInsetAdjustmentBehavior:insetAdjustmentBehavior];
+ [_internalDelegate _scheduleVisibleContentRectUpdate];
+}
+
+- (void)_setContentInsetAdjustmentBehaviorInternal:(UIScrollViewContentInsetAdjustmentBehavior)insetAdjustmentBehavior
+{
+ if ([self _contentInsetAdjustmentBehavior] == insetAdjustmentBehavior)
+ return;
+
+ [super _setContentInsetAdjustmentBehavior:insetAdjustmentBehavior];
+}
+
+#endif
+
// Fetch top/left rubberband amounts (as negative values).
- (CGSize)_currentTopLeftRubberbandAmount
{
Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (216046 => 216047)
--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm 2017-05-02 00:08:23 UTC (rev 216047)
@@ -391,6 +391,7 @@
void WebPageProxy::didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction& layerTreeTransaction)
{
m_pageExtendedBackgroundColor = layerTreeTransaction.pageExtendedBackgroundColor();
+ setAvoidsUnsafeArea(layerTreeTransaction.avoidsUnsafeArea());
if (!m_hasReceivedLayerTreeTransactionAfterDidCommitLoad) {
if (layerTreeTransaction.transactionID() >= m_firstLayerTreeTransactionIdAfterDidCommitLoad) {
Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (216046 => 216047)
--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -255,7 +255,7 @@
void didRestoreScrollPosition() override;
bool windowIsFrontWindowUnderMouse(const NativeWebMouseEvent&) override;
- void didChangeClipToSafeArea(bool clipToSafeArea) override { }
+ void didChangeAvoidsUnsafeArea(bool avoidsUnsafeArea) override { }
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (216046 => 216047)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp 2017-05-02 00:08:23 UTC (rev 216047)
@@ -1227,9 +1227,4 @@
m_page.findController().didInvalidateDocumentMarkerRects();
}
-void WebChromeClient::didChangeClipToSafeArea(bool clipToSafeArea)
-{
- m_page.send(Messages::WebPageProxy::SetClipToSafeArea(clipToSafeArea));
-}
-
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (216046 => 216047)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -342,8 +342,6 @@
void didInvalidateDocumentMarkerRects() final;
- void didChangeClipToSafeArea(bool) final;
-
String m_cachedToolTip;
mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame;
mutable bool m_cachedMainFrameHasHorizontalScrollbar { false };
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (216046 => 216047)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2017-05-02 00:08:23 UTC (rev 216047)
@@ -3406,6 +3406,7 @@
layerTransaction.setViewportMetaTagWidth(m_viewportConfiguration.viewportArguments().width);
layerTransaction.setViewportMetaTagWidthWasExplicit(m_viewportConfiguration.viewportArguments().widthWasExplicit);
layerTransaction.setViewportMetaTagCameFromImageDocument(m_viewportConfiguration.viewportArguments().type == ViewportArguments::ImageDocument);
+ layerTransaction.setAvoidsUnsafeArea(m_viewportConfiguration.avoidsUnsafeArea());
layerTransaction.setIsInStableState(m_isInStableState);
layerTransaction.setAllowsUserScaling(allowsUserScaling());
#endif
Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (216046 => 216047)
--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2017-05-02 00:08:23 UTC (rev 216047)
@@ -3045,8 +3045,6 @@
updateViewportSizeForCSSViewportUnits();
FrameView& frameView = *mainFrameView();
- frameView.setClipToSafeArea(m_viewportConfiguration.clipToSafeArea());
-
IntPoint scrollPosition = frameView.scrollPosition();
if (!m_hasReceivedVisibleContentRectsAfterDidCommitLoad) {
FloatSize minimumLayoutSizeInScrollViewCoordinates = m_viewportConfiguration.minimumLayoutSize();
@@ -3197,6 +3195,7 @@
frameView.setUnobscuredContentSize(visibleContentRectUpdateInfo.unobscuredContentRect().size());
m_page->setObscuredInsets(visibleContentRectUpdateInfo.obscuredInsets());
+ m_page->setUnobscuredSafeAreaInsets(visibleContentRectUpdateInfo.unobscuredSafeAreaInsets());
m_page->setEnclosedInScrollableAncestorView(visibleContentRectUpdateInfo.enclosedInScrollableAncestorView());
double horizontalVelocity = visibleContentRectUpdateInfo.horizontalVelocity();
Modified: trunk/Tools/ChangeLog (216046 => 216047)
--- trunk/Tools/ChangeLog 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Tools/ChangeLog 2017-05-02 00:08:23 UTC (rev 216047)
@@ -1,3 +1,31 @@
+2017-05-01 Timothy Horton <[email protected]>
+
+ Expose viewport-fit instead of clip-to-safe-area
+ https://bugs.webkit.org/show_bug.cgi?id=171503
+ <rdar://problem/31918249>
+
+ Reviewed by Simon Fraser.
+
+ * DumpRenderTree/ios/UIScriptControllerIOS.mm:
+ (WTR::UIScriptController::setSafeAreaInsets):
+ (WTR::UIScriptController::setObscuredInsets): Deleted.
+ * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+ * TestRunnerShared/UIScriptContext/UIScriptController.cpp:
+ (WTR::UIScriptController::setSafeAreaInsets):
+ (WTR::UIScriptController::setObscuredInsets): Deleted.
+ * TestRunnerShared/UIScriptContext/UIScriptController.h:
+ * WebKitTestRunner/cocoa/TestRunnerWKWebView.h:
+ * WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
+ (-[TestRunnerWKWebView setOverrideSafeAreaInsets:]):
+ (-[TestRunnerWKWebView _safeAreaInsetsForFrame:inSuperview:]):
+ * WebKitTestRunner/ios/TestControllerIOS.mm:
+ (WTR::TestController::platformResetStateToConsistentValues):
+ * WebKitTestRunner/ios/UIKitSPI.h:
+ * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+ (WTR::UIScriptController::setSafeAreaInsets):
+ (WTR::UIScriptController::setObscuredInsets): Deleted.
+ Expose a safe area inset setter instead of obscured insets.
+
2017-05-01 Wenson Hsieh <[email protected]>
Unreviewed, fix the build on a new internal SDK
Modified: trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm (216046 => 216047)
--- trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm 2017-05-02 00:08:23 UTC (rev 216047)
@@ -316,7 +316,7 @@
{
}
-void UIScriptController::setObscuredInsets(double, double, double, double)
+void UIScriptController::setSafeAreaInsets(double, double, double, double)
{
}
Modified: trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl (216046 => 216047)
--- trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl 2017-05-02 00:08:23 UTC (rev 216047)
@@ -233,5 +233,5 @@
void overridePreference(DOMString preference, DOMString value);
- void setObscuredInsets(double top, double right, double bottom, double left);
+ void setSafeAreaInsets(double top, double right, double bottom, double left);
};
Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp (216046 => 216047)
--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp 2017-05-02 00:08:23 UTC (rev 216047)
@@ -399,7 +399,7 @@
return nullptr;
}
-void UIScriptController::setObscuredInsets(double top, double right, double bottom, double left)
+void UIScriptController::setSafeAreaInsets(double top, double right, double bottom, double left)
{
}
Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h (216046 => 216047)
--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -156,7 +156,7 @@
void removeViewFromWindow(JSValueRef);
void addViewToWindow(JSValueRef);
- void setObscuredInsets(double top, double right, double bottom, double left);
+ void setSafeAreaInsets(double top, double right, double bottom, double left);
private:
UIScriptController(UIScriptContext&);
Modified: trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h (216046 => 216047)
--- trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -45,6 +45,8 @@
- (void)zoomToScale:(double)scale animated:(BOOL)animated completionHandler:(void (^)(void))completionHandler;
- (void)accessibilityRetrieveSpeakSelectionContentWithCompletionHandler:(void (^)(void))completionHandler;
+@property (nonatomic, assign) UIEdgeInsets overrideSafeAreaInsets;
+
#endif
@property (nonatomic, retain, setter=_setStableStateOverride:) NSNumber *_stableStateOverride;
Modified: trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm (216046 => 216047)
--- trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm 2017-05-02 00:08:23 UTC (rev 216047)
@@ -26,6 +26,7 @@
#import "config.h"
#import "TestRunnerWKWebView.h"
+#import "UIKitSPI.h"
#import "WebKitTestRunnerDraggingInfo.h"
#import <wtf/Assertions.h>
#import <wtf/RetainPtr.h>
@@ -203,8 +204,21 @@
[self _accessibilityRetrieveSpeakSelectionContent];
}
+- (void)setOverrideSafeAreaInsets:(UIEdgeInsets)insets
+{
+ _overrideSafeAreaInsets = insets;
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+ [self _updateSafeAreaInsets];
#endif
+}
+- (UIEdgeInsets)_safeAreaInsetsForFrame:(CGRect)frame inSuperview:(UIView *)view
+{
+ return _overrideSafeAreaInsets;
+}
+
+#endif
+
@end
#endif // WK_API_ENABLED
Modified: trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm (216046 => 216047)
--- trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm 2017-05-02 00:08:23 UTC (rev 216047)
@@ -87,8 +87,7 @@
[scrollView setZoomScale:1 animated:NO];
[scrollView setContentOffset:CGPointZero];
- scrollView.contentInset = UIEdgeInsetsZero;
- webView->platformView()._obscuredInsets = UIEdgeInsetsZero;
+ webView->platformView().overrideSafeAreaInsets = UIEdgeInsetsZero;
}
}
Modified: trunk/Tools/WebKitTestRunner/ios/UIKitSPI.h (216046 => 216047)
--- trunk/Tools/WebKitTestRunner/ios/UIKitSPI.h 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Tools/WebKitTestRunner/ios/UIKitSPI.h 2017-05-02 00:08:23 UTC (rev 216047)
@@ -67,6 +67,12 @@
#endif // USE(APPLE_INTERNAL_SDK)
+#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000
+@interface UIView ()
+- (void)_updateSafeAreaInsets;
+@end
+#endif
+
#endif // PLATFORM(IOS)
#endif // UIKitSPI_h
Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (216046 => 216047)
--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm 2017-05-02 00:02:16 UTC (rev 216046)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm 2017-05-02 00:08:23 UTC (rev 216047)
@@ -668,12 +668,11 @@
webView.didEndScrollingCallback = nil;
}
-void UIScriptController::setObscuredInsets(double top, double right, double bottom, double left)
+void UIScriptController::setSafeAreaInsets(double top, double right, double bottom, double left)
{
UIEdgeInsets insets = UIEdgeInsetsMake(top, left, bottom, right);
TestRunnerWKWebView *webView = TestController::singleton().mainWebView()->platformView();
- webView.scrollView.contentInset = insets;
- webView._obscuredInsets = insets;
+ webView.overrideSafeAreaInsets = insets;
}
}