Title: [108415] trunk
Revision
108415
Author
[email protected]
Date
2012-02-21 16:34:19 -0800 (Tue, 21 Feb 2012)

Log Message

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

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: trunk/LayoutTests/ChangeLog (108414 => 108415)


--- trunk/LayoutTests/ChangeLog	2012-02-22 00:32:33 UTC (rev 108414)
+++ trunk/LayoutTests/ChangeLog	2012-02-22 00:34:19 UTC (rev 108415)
@@ -1,3 +1,13 @@
+2012-02-21  Adam Klein  <[email protected]>
+
+        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-21  Tom Sepez  <[email protected]>
 
         equalIgnoringNullity() only comparing half the bytes for equality

Added: trunk/LayoutTests/fast/dom/title-directionality-removeChild-expected.txt (0 => 108415)


--- trunk/LayoutTests/fast/dom/title-directionality-removeChild-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/title-directionality-removeChild-expected.txt	2012-02-22 00:34:19 UTC (rev 108415)
@@ -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: trunk/LayoutTests/fast/dom/title-directionality-removeChild-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/dom/title-directionality-removeChild.html (0 => 108415)


--- trunk/LayoutTests/fast/dom/title-directionality-removeChild.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/title-directionality-removeChild.html	2012-02-22 00:34:19 UTC (rev 108415)
@@ -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: trunk/LayoutTests/fast/dom/title-directionality-removeChild.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (108414 => 108415)


--- trunk/Source/WebCore/ChangeLog	2012-02-22 00:32:33 UTC (rev 108414)
+++ trunk/Source/WebCore/ChangeLog	2012-02-22 00:34:19 UTC (rev 108415)
@@ -1,3 +1,20 @@
+2012-02-21  Adam Klein  <[email protected]>
+
+        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-21  Luke Macpherson   <[email protected]>
 
         Implement many instances of HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE in CSSStyleApplyProperty.

Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (108414 => 108415)


--- trunk/Source/WebCore/dom/ContainerNode.cpp	2012-02-22 00:32:33 UTC (rev 108414)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp	2012-02-22 00:34:19 UTC (rev 108415)
@@ -478,13 +478,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
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to