Title: [207743] branches/safari-602-branch

Diff

Modified: branches/safari-602-branch/LayoutTests/ChangeLog (207742 => 207743)


--- branches/safari-602-branch/LayoutTests/ChangeLog	2016-10-24 07:18:25 UTC (rev 207742)
+++ branches/safari-602-branch/LayoutTests/ChangeLog	2016-10-24 07:18:28 UTC (rev 207743)
@@ -1,5 +1,19 @@
 2016-10-20  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r206712. rdar://problem/28216065
+
+    2016-10-01  Simon Fraser  <simon.fra...@apple.com>
+
+            Bad cast when CSS position programmatically changed from -webkit-sticky to fixed
+            https://bugs.webkit.org/show_bug.cgi?id=160826
+
+            Reviewed by Zalan Bujtas.
+
+            * fast/scrolling/sticky-to-fixed-expected.txt: Added.
+            * fast/scrolling/sticky-to-fixed.html: Added.
+
+2016-10-20  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r206449. rdar://problem/28635085
 
     2016-09-27  Dan Bernstein  <m...@apple.com>

Added: branches/safari-602-branch/LayoutTests/fast/scrolling/sticky-to-fixed-expected.txt (0 => 207743)


--- branches/safari-602-branch/LayoutTests/fast/scrolling/sticky-to-fixed-expected.txt	                        (rev 0)
+++ branches/safari-602-branch/LayoutTests/fast/scrolling/sticky-to-fixed-expected.txt	2016-10-24 07:18:28 UTC (rev 207743)
@@ -0,0 +1 @@
+This test should not assert in debug.

Added: branches/safari-602-branch/LayoutTests/fast/scrolling/sticky-to-fixed.html (0 => 207743)


--- branches/safari-602-branch/LayoutTests/fast/scrolling/sticky-to-fixed.html	                        (rev 0)
+++ branches/safari-602-branch/LayoutTests/fast/scrolling/sticky-to-fixed.html	2016-10-24 07:18:28 UTC (rev 207743)
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+body {
+    height: 2000px;
+}
+.masthead {
+    position: -webkit-sticky;
+    width: 200px;
+    height: 100px;
+    background-color: rgba(0, 0, 0, 0.2);
+}
+
+.make-fixed .masthead {
+    position: fixed;
+}
+
+.fixed {
+    position: fixed;
+    width: 100px;
+    height: 100px;
+}
+</style>
+<script>
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+
+    function doTest()
+    {
+        window.setTimeout(function() {
+            document.body.classList.add("make-fixed")
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }, 0);
+    }
+    
+    window.addEventListener('load', doTest, false);
+</script>
+</head>
+<body>
+<div class="masthead">This test should not assert in debug.
+    <div class="fixed">
+    </div>
+</div>
+</body>
+</html>
+

Modified: branches/safari-602-branch/Source/WebCore/ChangeLog (207742 => 207743)


--- branches/safari-602-branch/Source/WebCore/ChangeLog	2016-10-24 07:18:25 UTC (rev 207742)
+++ branches/safari-602-branch/Source/WebCore/ChangeLog	2016-10-24 07:18:28 UTC (rev 207743)
@@ -1,5 +1,30 @@
 2016-10-20  Matthew Hanson  <matthew_han...@apple.com>
 
+        Merge r206712. rdar://problem/28216065
+
+    2016-10-01  Simon Fraser  <simon.fra...@apple.com>
+
+            Bad cast when CSS position programmatically changed from -webkit-sticky to fixed
+            https://bugs.webkit.org/show_bug.cgi?id=160826
+
+            Reviewed by Zalan Bujtas.
+
+            If a scrolling state tree node changed type (e.g. from sticky to fixed), we'd fail
+            to recreate the node so keep a node with the wrong type.
+
+            Fix by destroying the node and making a new one with a new ID in this case. The
+            new ID is necessary to ensure that the scrolling tree is updated.
+
+            Test: fast/scrolling/sticky-to-fixed.html
+
+            * page/scrolling/ScrollingStateTree.cpp:
+            (WebCore::ScrollingStateTree::nodeTypeAndParentMatch):
+            (WebCore::ScrollingStateTree::attachNode):
+            (WebCore::ScrollingStateTree::stateNodeForID):
+            * page/scrolling/ScrollingStateTree.h:
+
+2016-10-20  Matthew Hanson  <matthew_han...@apple.com>
+
         Merge r206706. rdar://problem/28635081
 
     2016-09-30  David Kilzer  <ddkil...@apple.com>

Modified: branches/safari-602-branch/Source/WebCore/page/scrolling/ScrollingStateTree.cpp (207742 => 207743)


--- branches/safari-602-branch/Source/WebCore/page/scrolling/ScrollingStateTree.cpp	2016-10-24 07:18:25 UTC (rev 207742)
+++ branches/safari-602-branch/Source/WebCore/page/scrolling/ScrollingStateTree.cpp	2016-10-24 07:18:28 UTC (rev 207743)
@@ -83,21 +83,31 @@
     return nullptr;
 }
 
+bool ScrollingStateTree::nodeTypeAndParentMatch(ScrollingStateNode& node, ScrollingNodeType nodeType, ScrollingNodeID parentID) const
+{
+    if (node.nodeType() != nodeType)
+        return false;
+
+    ScrollingStateNode* parent = stateNodeForID(parentID);
+    if (!parent)
+        return true;
+
+    return node.parent() == parent;
+}
+
 ScrollingNodeID ScrollingStateTree::attachNode(ScrollingNodeType nodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID)
 {
     ASSERT(newNodeID);
+
     if (ScrollingStateNode* node = stateNodeForID(newNodeID)) {
-        if (!parentID)
+        if (nodeTypeAndParentMatch(*node, nodeType, parentID))
             return newNodeID;
+        
+        // If the type has changed, we need to destroy and recreate the node with a new ID.
+        if (nodeType != node->nodeType())
+            newNodeID = m_scrollingCoordinator->uniqueScrollLayerID();
 
-        ScrollingStateNode* parent = stateNodeForID(parentID);
-        if (!parent)
-            return newNodeID;
-
-        if (node->parent() == parent)
-            return newNodeID;
-
-        // The node is being re-parented. To do that, we'll remove it, and then re-create a new node.
+        // The node is being re-parented. To do that, we'll remove it, and then create a new node.
         removeNodeAndAllDescendants(node, SubframeNodeRemoval::Orphan);
     }
 
@@ -236,7 +246,7 @@
     m_nodesRemovedSinceLastCommit = WTFMove(nodes);
 }
 
-ScrollingStateNode* ScrollingStateTree::stateNodeForID(ScrollingNodeID scrollLayerID)
+ScrollingStateNode* ScrollingStateTree::stateNodeForID(ScrollingNodeID scrollLayerID) const
 {
     if (!scrollLayerID)
         return 0;

Modified: branches/safari-602-branch/Source/WebCore/page/scrolling/ScrollingStateTree.h (207742 => 207743)


--- branches/safari-602-branch/Source/WebCore/page/scrolling/ScrollingStateTree.h	2016-10-24 07:18:25 UTC (rev 207742)
+++ branches/safari-602-branch/Source/WebCore/page/scrolling/ScrollingStateTree.h	2016-10-24 07:18:28 UTC (rev 207743)
@@ -48,7 +48,7 @@
     WEBCORE_EXPORT ~ScrollingStateTree();
 
     ScrollingStateFrameScrollingNode* rootStateNode() const { return m_rootStateNode.get(); }
-    WEBCORE_EXPORT ScrollingStateNode* stateNodeForID(ScrollingNodeID);
+    WEBCORE_EXPORT ScrollingStateNode* stateNodeForID(ScrollingNodeID) const;
 
     WEBCORE_EXPORT ScrollingNodeID attachNode(ScrollingNodeType, ScrollingNodeID, ScrollingNodeID parentID);
     void detachNode(ScrollingNodeID);
@@ -79,7 +79,9 @@
     void addNode(ScrollingStateNode*);
 
     PassRefPtr<ScrollingStateNode> createNode(ScrollingNodeType, ScrollingNodeID);
-    
+
+    bool nodeTypeAndParentMatch(ScrollingStateNode&, ScrollingNodeType, ScrollingNodeID parentID) const;
+
     enum class SubframeNodeRemoval {
         Delete,
         Orphan
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to