- Revision
- 182799
- Author
- [email protected]
- Date
- 2015-04-14 10:25:31 -0700 (Tue, 14 Apr 2015)
Log Message
[iOS WK2] Interactive elements of developer.apple.com are broken
https://bugs.webkit.org/show_bug.cgi?id=143692
Source/WebCore:
rdar://problem/19320087
Reviewed by Sam Weinig.
When a composited RenderLayer had nodes in the scrolling tree by virtue of
both position and overflow:scroll, and one of those reasons disappeared,
we'd fail to remove the corresponding node from the scrolling tree. This
could leave an overflow:scroll element behaving as if it were position:fixed.
Fix by having RenderLayerCompositor::updateScrollCoordinationForThisFrame()
detach the layer on a per-role basis.
Test: platform/ios-simulator-wk2/scrolling/remove-scrolling-role.html
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::detachFromScrollingCoordinatorForRole):
* rendering/RenderLayerBacking.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::detachScrollCoordinatedLayerForRole):
(WebCore::RenderLayerCompositor::detachScrollCoordinatedLayer): Just moved.
(WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer): Call detachScrollCoordinatedLayerForRole()
if the layer doesn't have the relevant scrolling reasons.
* rendering/RenderLayerCompositor.h:
LayoutTests:
Reviewed by Sam Weinig.
* platform/ios-simulator-wk2/scrolling/remove-scrolling-role-expected.txt: Added.
* platform/ios-simulator-wk2/scrolling/remove-scrolling-role.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (182798 => 182799)
--- trunk/LayoutTests/ChangeLog 2015-04-14 17:07:11 UTC (rev 182798)
+++ trunk/LayoutTests/ChangeLog 2015-04-14 17:25:31 UTC (rev 182799)
@@ -1,3 +1,13 @@
+2015-04-13 Simon Fraser <[email protected]>
+
+ [iOS WK2] Interactive elements of developer.apple.com are broken
+ https://bugs.webkit.org/show_bug.cgi?id=143692
+
+ Reviewed by Sam Weinig.
+
+ * platform/ios-simulator-wk2/scrolling/remove-scrolling-role-expected.txt: Added.
+ * platform/ios-simulator-wk2/scrolling/remove-scrolling-role.html: Added.
+
2015-04-14 Commit Queue <[email protected]>
Unreviewed, rolling out r182794.
Added: trunk/LayoutTests/platform/ios-simulator-wk2/scrolling/remove-scrolling-role-expected.txt (0 => 182799)
--- trunk/LayoutTests/platform/ios-simulator-wk2/scrolling/remove-scrolling-role-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/scrolling/remove-scrolling-role-expected.txt 2015-04-14 17:25:31 UTC (rev 182799)
@@ -0,0 +1,12 @@
+(Frame scrolling node
+ (scrollable area size 800 600)
+ (contents size 800 2513)
+ (children 1
+ (Overflow scrolling node
+ (scrollable area size 300 400)
+ (contents size 300 2000)
+ (scrolled contents layer 22)
+ )
+ )
+)
+
Added: trunk/LayoutTests/platform/ios-simulator-wk2/scrolling/remove-scrolling-role.html (0 => 182799)
--- trunk/LayoutTests/platform/ios-simulator-wk2/scrolling/remove-scrolling-role.html (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/scrolling/remove-scrolling-role.html 2015-04-14 17:25:31 UTC (rev 182799)
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+ <style>
+ body {
+ margin: 0;
+ height: 2500px;
+ }
+
+ #fixed {
+ position: fixed;
+ left: 10px;
+ top: 10px;
+ -webkit-overflow-scrolling: touch;
+ height: 400px;
+ width: 300px;
+ overflow: auto;
+ border: 4px solid black;
+ }
+
+ #fixed.changed {
+ position: absolute;
+ border: 4px solid green;
+ }
+
+ .content {
+ height: 2000px;
+ background-color: silver;
+ }
+
+ </style>
+ <script>
+ if (window.testRunner) {
+ testRunner.waitUntilDone();
+ testRunner.dumpAsText();
+ }
+
+ function doTest()
+ {
+ window.setTimeout(function() {
+ document.getElementById('fixed').classList.add('changed');
+
+ if (window.internals)
+ document.getElementById('results').innerText = internals.scrollingStateTreeAsText();
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+
+ }, 0);
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+<body>
+ <pre id="results"></pre>
+ <div id="fixed">
+ <div class="content">
+ </div>
+ </div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (182798 => 182799)
--- trunk/Source/WebCore/ChangeLog 2015-04-14 17:07:11 UTC (rev 182798)
+++ trunk/Source/WebCore/ChangeLog 2015-04-14 17:25:31 UTC (rev 182799)
@@ -1,3 +1,31 @@
+2015-04-13 Simon Fraser <[email protected]>
+
+ [iOS WK2] Interactive elements of developer.apple.com are broken
+ https://bugs.webkit.org/show_bug.cgi?id=143692
+ rdar://problem/19320087
+
+ Reviewed by Sam Weinig.
+
+ When a composited RenderLayer had nodes in the scrolling tree by virtue of
+ both position and overflow:scroll, and one of those reasons disappeared,
+ we'd fail to remove the corresponding node from the scrolling tree. This
+ could leave an overflow:scroll element behaving as if it were position:fixed.
+
+ Fix by having RenderLayerCompositor::updateScrollCoordinationForThisFrame()
+ detach the layer on a per-role basis.
+
+ Test: platform/ios-simulator-wk2/scrolling/remove-scrolling-role.html
+
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::detachFromScrollingCoordinatorForRole):
+ * rendering/RenderLayerBacking.h:
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::detachScrollCoordinatedLayerForRole):
+ (WebCore::RenderLayerCompositor::detachScrollCoordinatedLayer): Just moved.
+ (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer): Call detachScrollCoordinatedLayerForRole()
+ if the layer doesn't have the relevant scrolling reasons.
+ * rendering/RenderLayerCompositor.h:
+
2015-04-14 Commit Queue <[email protected]>
Unreviewed, rolling out r182794.
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (182798 => 182799)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2015-04-14 17:07:11 UTC (rev 182798)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2015-04-14 17:25:31 UTC (rev 182799)
@@ -1570,6 +1570,20 @@
m_viewportConstrainedNodeID = 0;
}
+void RenderLayerBacking::detachFromScrollingCoordinatorForRole(ScrollingNodeType role)
+{
+ ScrollingNodeID nodeID = scrollingNodeIDForRole(role);
+ if (!nodeID)
+ return;
+
+ ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer);
+ if (!scrollingCoordinator)
+ return;
+
+ scrollingCoordinator->detachFromStateTree(nodeID);
+ setScrollingNodeIDForRole(0, role);
+}
+
GraphicsLayerPaintingPhase RenderLayerBacking::paintingPhaseForPrimaryLayer() const
{
unsigned phase = 0;
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (182798 => 182799)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.h 2015-04-14 17:07:11 UTC (rev 182798)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h 2015-04-14 17:25:31 UTC (rev 182799)
@@ -108,6 +108,7 @@
GraphicsLayer* scrollingContentsLayer() const { return m_scrollingContentsLayer.get(); }
void detachFromScrollingCoordinator();
+ void detachFromScrollingCoordinatorForRole(ScrollingNodeType);
ScrollingNodeID scrollingNodeIDForRole(ScrollingNodeType nodeType) const
{
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (182798 => 182799)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2015-04-14 17:07:11 UTC (rev 182798)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2015-04-14 17:25:31 UTC (rev 182799)
@@ -3813,6 +3813,33 @@
return nodeID;
}
+void RenderLayerCompositor::detachScrollCoordinatedLayerForRole(RenderLayer& layer, ScrollingNodeType role)
+{
+ RenderLayerBacking* backing = layer.backing();
+ if (!backing)
+ return;
+
+ if (ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(role))
+ m_scrollingNodeToLayerMap.remove(nodeID);
+
+ backing->detachFromScrollingCoordinatorForRole(role);
+}
+
+void RenderLayerCompositor::detachScrollCoordinatedLayer(RenderLayer& layer)
+{
+ RenderLayerBacking* backing = layer.backing();
+ if (!backing)
+ return;
+
+ if (ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(FrameScrollingNode))
+ m_scrollingNodeToLayerMap.remove(nodeID);
+
+ if (ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(FixedNode))
+ m_scrollingNodeToLayerMap.remove(nodeID);
+
+ backing->detachFromScrollingCoordinator();
+}
+
void RenderLayerCompositor::updateScrollCoordinationForThisFrame(ScrollingNodeID parentNodeID)
{
ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator();
@@ -3883,7 +3910,8 @@
}
parentNodeID = nodeID;
- }
+ } else
+ detachScrollCoordinatedLayerForRole(layer, FixedNode);
if (reasons & Scrolling) {
if (isRootLayer)
@@ -3908,24 +3936,10 @@
#endif
scrollingCoordinator->updateOverflowScrollingNode(nodeID, backing->scrollingLayer(), backing->scrollingContentsLayer(), &scrollingGeometry);
}
- }
+ } else
+ detachScrollCoordinatedLayerForRole(layer, OverflowScrollingNode);
}
-void RenderLayerCompositor::detachScrollCoordinatedLayer(RenderLayer& layer)
-{
- RenderLayerBacking* backing = layer.backing();
- if (!backing)
- return;
-
- if (ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(FrameScrollingNode))
- m_scrollingNodeToLayerMap.remove(nodeID);
-
- if (ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(FixedNode))
- m_scrollingNodeToLayerMap.remove(nodeID);
-
- backing->detachFromScrollingCoordinator();
-}
-
ScrollableArea* RenderLayerCompositor::scrollableAreaForScrollLayerID(ScrollingNodeID nodeID) const
{
if (!nodeID)
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (182798 => 182799)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2015-04-14 17:07:11 UTC (rev 182798)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2015-04-14 17:25:31 UTC (rev 182799)
@@ -434,6 +434,7 @@
ScrollingNodeID attachScrollingNode(RenderLayer&, ScrollingNodeType, ScrollingNodeID parentNodeID);
void updateScrollCoordinatedLayer(RenderLayer&, ScrollCoordinationReasons);
void detachScrollCoordinatedLayer(RenderLayer&);
+ void detachScrollCoordinatedLayerForRole(RenderLayer&, ScrollingNodeType);
void reattachSubframeScrollLayers();
FixedPositionViewportConstraints computeFixedViewportConstraints(RenderLayer&) const;