Title: [122023] releases/WebKitGTK/webkit-1.8
Revision
122023
Author
mrobin...@webkit.org
Date
2012-07-06 13:19:51 -0700 (Fri, 06 Jul 2012)

Log Message

Merge 108415 - ContainerNode::childrenChanged must be called immediately after removing children
https://bugs.webkit.org/show_bug.cgi?id=79162

Patch by Adam Klein <ad...@chromium.org> on 2012-02-21
Reviewed by Ryosuke Niwa.

Source/WebCore:

In r108152, a call to childrenChanged() was erroneously moved
below the call to child->removedFromDocument(). This breaks, at the
least, the behavior of the <title> element. This patch corrects the
mistake and adds a test.

Test: fast/dom/title-directionality-removeChild.html

* dom/ContainerNode.cpp:
(WebCore::ContainerNode::removeChild):

LayoutTests:

* fast/dom/title-directionality-removeChild-expected.txt: Added.
* fast/dom/title-directionality-removeChild.html: Added.

Modified Paths

Added Paths

Diff

Modified: releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog (122022 => 122023)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog	2012-07-06 20:19:43 UTC (rev 122022)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/ChangeLog	2012-07-06 20:19:51 UTC (rev 122023)
@@ -1,3 +1,13 @@
+2012-02-21  Adam Klein  <ad...@chromium.org>
+
+        ContainerNode::childrenChanged must be called immediately after removing children
+        https://bugs.webkit.org/show_bug.cgi?id=79162
+
+        Reviewed by Ryosuke Niwa.
+
+        * fast/dom/title-directionality-removeChild-expected.txt: Added.
+        * fast/dom/title-directionality-removeChild.html: Added.
+
 2012-02-17  Adam Klein  <ad...@chromium.org>
 
         Avoid inconsistency in Node::inDocument due to DOMSubtreeModified dispatch

Added: releases/WebKitGTK/webkit-1.8/LayoutTests/fast/dom/title-directionality-removeChild-expected.txt (0 => 122023)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/fast/dom/title-directionality-removeChild-expected.txt	                        (rev 0)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/fast/dom/title-directionality-removeChild-expected.txt	2012-07-06 20:19:51 UTC (rev 122023)
@@ -0,0 +1,6 @@
+
+<html><title>foo</title></html> should have title direction "ltr". PASS
+<html><title dir=rtl>foo</title></html> should have title direction "rtl". PASS
+<html dir=rtl><title>foo</title></html> should have title direction "rtl". PASS
+<html dir=rtl><title dir=ltr>foo</title></html> should have title direction "ltr". PASS
+
Property changes on: releases/WebKitGTK/webkit-1.8/LayoutTests/fast/dom/title-directionality-removeChild-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: releases/WebKitGTK/webkit-1.8/LayoutTests/fast/dom/title-directionality-removeChild.html (0 => 122023)


--- releases/WebKitGTK/webkit-1.8/LayoutTests/fast/dom/title-directionality-removeChild.html	                        (rev 0)
+++ releases/WebKitGTK/webkit-1.8/LayoutTests/fast/dom/title-directionality-removeChild.html	2012-07-06 20:19:51 UTC (rev 122023)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>page title</title>
+</head>
+<body>
+<iframe id=iframe></iframe>
+<script>
+var iframe = document.getElementById('iframe');
+
+function assertDirection(label, expectedDirection, html)
+{
+    var doc = iframe.contentDocument;
+    doc.removeChild(doc.documentElement);
+    doc.open();
+    doc.write(html);
+    doc.close();
+
+    var dir = window.layoutTestController ? layoutTestController.titleTextDirection : 'layoutTestController unavailable';
+    var status = html + ' should have title direction "' + expectedDirection + '". ';
+    if (dir == expectedDirection) {
+        status += 'PASS';
+    } else {
+        status += 'FAIL (got: "' + dir + '")';
+    }
+    var div = document.createElement('div');
+    div.innerText = status;
+    document.body.appendChild(div);
+}
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+assertDirection('normal doc', 'ltr',
+                '<html><title>foo</title></html>');
+assertDirection('title dir=rtl', 'rtl',
+                '<html><title dir=rtl>foo</title></html>');
+assertDirection('html dir=rtl', 'rtl',
+                '<html dir=rtl><title>foo</title></html>');
+assertDirection('html dir=rtl, title dir=ltr', 'ltr',
+                '<html dir=rtl><title dir=ltr>foo</title></html>');
+</script>
+</body>
+</html>
Property changes on: releases/WebKitGTK/webkit-1.8/LayoutTests/fast/dom/title-directionality-removeChild.html
___________________________________________________________________

Added: svn:eol-style

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog (122022 => 122023)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog	2012-07-06 20:19:43 UTC (rev 122022)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/ChangeLog	2012-07-06 20:19:51 UTC (rev 122023)
@@ -1,3 +1,20 @@
+2012-02-21  Adam Klein  <ad...@chromium.org>
+
+        ContainerNode::childrenChanged must be called immediately after removing children
+        https://bugs.webkit.org/show_bug.cgi?id=79162
+
+        Reviewed by Ryosuke Niwa.
+
+        In r108152, a call to childrenChanged() was erroneously moved
+        below the call to child->removedFromDocument(). This breaks, at the
+        least, the behavior of the <title> element. This patch corrects the
+        mistake and adds a test.
+
+        Test: fast/dom/title-directionality-removeChild.html
+
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::removeChild):
+
 2012-02-17  Adam Klein  <ad...@chromium.org>
 
         Avoid inconsistency in Node::inDocument due to DOMSubtreeModified dispatch

Modified: releases/WebKitGTK/webkit-1.8/Source/WebCore/dom/ContainerNode.cpp (122022 => 122023)


--- releases/WebKitGTK/webkit-1.8/Source/WebCore/dom/ContainerNode.cpp	2012-07-06 20:19:43 UTC (rev 122022)
+++ releases/WebKitGTK/webkit-1.8/Source/WebCore/dom/ContainerNode.cpp	2012-07-06 20:19:51 UTC (rev 122023)
@@ -475,13 +475,13 @@
     Node* next = child->nextSibling();
     removeBetween(prev, next, child.get());
 
+    childrenChanged(false, prev, next, -1);
+
     if (child->inDocument())
         child->removedFromDocument();
     else
         child->removedFromTree(true);
 
-    // Dispatch post-removal mutation events
-    childrenChanged(false, prev, next, -1);
     dispatchSubtreeModifiedEvent();
 
     return child;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to