Title: [138303] trunk
Revision
138303
Author
[email protected]
Date
2012-12-20 14:38:43 -0800 (Thu, 20 Dec 2012)

Log Message

REGRESSION(r133820?): SimplifyMarkupTest API test asserts
https://bugs.webkit.org/show_bug.cgi?id=105370

Reviewed by Simon Fraser.

Source/WebCore:

The bug was caused by SimplifyMarkupCommand::doApply calling removeNodePreservingChildren on nodes
that have already been removed. We normally check this condition in pruneSubsequentAncestorsToRemove
but we weren't checking it when there were no ancestor to remove because we early exited in that case.

Fixed the bug by doing the early exit for when the node's parent had already been removed first.

Test: TestWebKitAPI/Tests/mac/SimplifyMarkup.mm

* editing/SimplifyMarkupCommand.cpp:
(WebCore::SimplifyMarkupCommand::doApply):
(WebCore::SimplifyMarkupCommand::pruneSubsequentAncestorsToRemove): Also removed an unused variable
nodeAfterHighestAncestorToRemove.

Tools:

Re-enable the test.

* TestWebKitAPI/Tests/mac/SimplifyMarkup.mm:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (138302 => 138303)


--- trunk/Source/WebCore/ChangeLog	2012-12-20 22:35:20 UTC (rev 138302)
+++ trunk/Source/WebCore/ChangeLog	2012-12-20 22:38:43 UTC (rev 138303)
@@ -1,3 +1,23 @@
+2012-12-20  Ryosuke Niwa  <[email protected]>
+
+        REGRESSION(r133820?): SimplifyMarkupTest API test asserts
+        https://bugs.webkit.org/show_bug.cgi?id=105370
+
+        Reviewed by Simon Fraser.
+
+        The bug was caused by SimplifyMarkupCommand::doApply calling removeNodePreservingChildren on nodes
+        that have already been removed. We normally check this condition in pruneSubsequentAncestorsToRemove
+        but we weren't checking it when there were no ancestor to remove because we early exited in that case.
+
+        Fixed the bug by doing the early exit for when the node's parent had already been removed first.
+
+        Test: TestWebKitAPI/Tests/mac/SimplifyMarkup.mm
+
+        * editing/SimplifyMarkupCommand.cpp:
+        (WebCore::SimplifyMarkupCommand::doApply):
+        (WebCore::SimplifyMarkupCommand::pruneSubsequentAncestorsToRemove): Also removed an unused variable
+        nodeAfterHighestAncestorToRemove.
+
 2012-12-20  Antti Koivisto  <[email protected]>
 
         Font description not synchronized correctly on orientation affecting property changes

Modified: trunk/Source/WebCore/editing/SimplifyMarkupCommand.cpp (138302 => 138303)


--- trunk/Source/WebCore/editing/SimplifyMarkupCommand.cpp	2012-12-20 22:35:20 UTC (rev 138302)
+++ trunk/Source/WebCore/editing/SimplifyMarkupCommand.cpp	2012-12-20 22:38:43 UTC (rev 138303)
@@ -105,15 +105,13 @@
         ASSERT(nodesToRemove[pastLastNodeToRemove]->firstChild() == nodesToRemove[pastLastNodeToRemove]->lastChild());
     }
 
-    if (pastLastNodeToRemove == startNodeIndex + 1)
-        return 0;
-
     Node* highestAncestorToRemove = nodesToRemove[pastLastNodeToRemove - 1].get();
-
-    RefPtr<Node> nodeAfterHighestAncestorToRemove = highestAncestorToRemove->nextSibling();
     RefPtr<ContainerNode> parent = highestAncestorToRemove->parentNode();
     if (!parent) // Parent has already been removed.
         return -1;
+    
+    if (pastLastNodeToRemove == startNodeIndex + 1)
+        return 0;
 
     removeNode(nodesToRemove[startNodeIndex], AssumeContentIsAlwaysEditable);
     insertNodeBefore(nodesToRemove[startNodeIndex], highestAncestorToRemove, AssumeContentIsAlwaysEditable);

Modified: trunk/Tools/ChangeLog (138302 => 138303)


--- trunk/Tools/ChangeLog	2012-12-20 22:35:20 UTC (rev 138302)
+++ trunk/Tools/ChangeLog	2012-12-20 22:38:43 UTC (rev 138303)
@@ -1,3 +1,15 @@
+2012-12-20  Ryosuke Niwa  <[email protected]>
+
+        REGRESSION(r133820?): SimplifyMarkupTest API test asserts
+        https://bugs.webkit.org/show_bug.cgi?id=105370
+
+        Reviewed by Simon Fraser.
+
+        Re-enable the test.
+
+        * TestWebKitAPI/Tests/mac/SimplifyMarkup.mm:
+        (TestWebKitAPI::TEST):
+
 2012-12-20  Nico Weber  <[email protected]>
 
         chromium nrwt: Pick the newest binary found in DEFAULT_BUILD_DIRECTORIES, not the first

Modified: trunk/Tools/TestWebKitAPI/Tests/mac/SimplifyMarkup.mm (138302 => 138303)


--- trunk/Tools/TestWebKitAPI/Tests/mac/SimplifyMarkup.mm	2012-12-20 22:35:20 UTC (rev 138302)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/SimplifyMarkup.mm	2012-12-20 22:38:43 UTC (rev 138303)
@@ -47,7 +47,7 @@
 
 namespace TestWebKitAPI {
 
-TEST(WebKit1, DISABLED_SimplifyMarkupTest)
+TEST(WebKit1, SimplifyMarkupTest)
 {
     RetainPtr<WebView> webView1(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
     RetainPtr<WebView> webView2(AdoptNS, [[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to