2010-12-30 Justin Schuh <jschuh@chromium.org>
authorjschuh@chromium.org <jschuh@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Dec 2010 00:50:59 +0000 (00:50 +0000)
committerjschuh@chromium.org <jschuh@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 31 Dec 2010 00:50:59 +0000 (00:50 +0000)
        Reviewed by James Robinson.

        Reverting r74292 because it introduced a crash with ruby text.
        https://bugs.webkit.org/show_bug.cgi?id=51637

        Test: fast/css/counters/counter-ruby-text-cleared.html

        * rendering/RenderCounter.cpp:
        (WebCore::findPlaceForCounter):
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::addChild):
        * rendering/RenderObjectChildList.cpp:
        (WebCore::RenderObjectChildList::appendChildNode):
        (WebCore::RenderObjectChildList::insertChildNode):
2010-12-30  Justin Schuh  <jschuh@chromium.org>

        Reviewed by James Robinson.

        Check for crash when deleting ruby text with counters.
        https://bugs.webkit.org/show_bug.cgi?id=51637

        * fast/css/counters/counter-ruby-text-cleared-expected.txt: Added.
        * fast/css/counters/counter-ruby-text-cleared.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@74816 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/css/counters/counter-ruby-text-cleared-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/counters/counter-ruby-text-cleared.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderCounter.cpp
WebCore/rendering/RenderObject.cpp
WebCore/rendering/RenderObjectChildList.cpp

index 5ed1658..ca5c83c 100644 (file)
@@ -1,3 +1,13 @@
+2010-12-30  Justin Schuh  <jschuh@chromium.org>
+
+        Reviewed by James Robinson.
+
+        Check for crash when deleting ruby text with counters.
+        https://bugs.webkit.org/show_bug.cgi?id=51637
+
+        * fast/css/counters/counter-ruby-text-cleared-expected.txt: Added.
+        * fast/css/counters/counter-ruby-text-cleared.html: Added.
+
 2010-12-30  Mihai Parparita  <mihaip@chromium.org>
 
         Unreviewed Chromium baseline update.
diff --git a/LayoutTests/fast/css/counters/counter-ruby-text-cleared-expected.txt b/LayoutTests/fast/css/counters/counter-ruby-text-cleared-expected.txt
new file mode 100644 (file)
index 0000000..ae78d1c
--- /dev/null
@@ -0,0 +1 @@
+PASS: Clearing ruby text with counters does not crash.
diff --git a/LayoutTests/fast/css/counters/counter-ruby-text-cleared.html b/LayoutTests/fast/css/counters/counter-ruby-text-cleared.html
new file mode 100644 (file)
index 0000000..3f89e81
--- /dev/null
@@ -0,0 +1,12 @@
+<style>* {counter-increment: x;}</style>\r
+<script>\r
+    window.onload = function() {\r
+        if (window.layoutTestController)\r
+            layoutTestController.dumpAsText();\r
+        document.body.innerHTML = "PASS: Clearing ruby text with counters does not crash.";\r
+    }\r
+</script>\r
+<ruby>\r
+    <rt></rt>\r
+    <div></div>\r
+</ruby>\r
index 800d0b7..c1f19bd 100644 (file)
@@ -1,3 +1,20 @@
+2010-12-30  Justin Schuh  <jschuh@chromium.org>
+
+        Reviewed by James Robinson.
+
+        Reverting r74292 because it introduced a crash with ruby text.
+        https://bugs.webkit.org/show_bug.cgi?id=51637
+
+        Test: fast/css/counters/counter-ruby-text-cleared.html
+
+        * rendering/RenderCounter.cpp:
+        (WebCore::findPlaceForCounter):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::addChild):
+        * rendering/RenderObjectChildList.cpp:
+        (WebCore::RenderObjectChildList::appendChildNode):
+        (WebCore::RenderObjectChildList::insertChildNode):
+
 2010-12-30  Darin Adler  <darin@apple.com>
 
         Reviewed by David Kilzer.
index 7e10440..57c54f8 100644 (file)
@@ -136,6 +136,11 @@ static bool findPlaceForCounter(RenderObject* counterOwner, const AtomicString&
     RenderObject* currentRenderer = counterOwner->previousInPreOrder();
     previousSibling = 0;
     while (currentRenderer) {
+        // A sibling without a parent means that the counter node tree was not constructed correctly so we stop 
+        // traversing. In the future RenderCounter should handle RenderObjects that are not connected to the 
+        // render tree at counter node creation. See bug 43812. 
+        if (previousSibling && !previousSibling->parent())
+            return false;
         CounterNode* currentCounter = makeCounterNode(currentRenderer, identifier, false);
         if (searchEndRenderer == currentRenderer) {
             // We may be at the end of our search.
index d27a780..c7c81f9 100644 (file)
@@ -315,6 +315,7 @@ void RenderObject::addChild(RenderObject* newChild, RenderObject* beforeChild)
         // Just add it...
         children->insertChildNode(this, newChild, beforeChild);
     }
+    RenderCounter::rendererSubtreeAttached(newChild); 
     if (newChild->isText() && newChild->style()->textTransform() == CAPITALIZE) {
         RefPtr<StringImpl> textToTransform = toRenderText(newChild)->originalText();
         if (textToTransform)
index fed5a2e..c7c8e44 100644 (file)
@@ -174,7 +174,6 @@ void RenderObjectChildList::appendChildNode(RenderObject* owner, RenderObject* n
             owner->dirtyLinesFromChangedChild(newChild);
     }
 
-    RenderCounter::rendererSubtreeAttached(newChild);
     newChild->setNeedsLayoutAndPrefWidthsRecalc(); // Goes up the containing block hierarchy.
     if (!owner->normalChildNeedsLayout())
         owner->setChildNeedsLayout(true); // We may supply the static position for an absolute positioned child.
@@ -234,7 +233,6 @@ void RenderObjectChildList::insertChildNode(RenderObject* owner, RenderObject* c
             owner->dirtyLinesFromChangedChild(child);
     }
 
-    RenderCounter::rendererSubtreeAttached(child);
     child->setNeedsLayoutAndPrefWidthsRecalc();
     if (!owner->normalChildNeedsLayout())
         owner->setChildNeedsLayout(true); // We may supply the static position for an absolute positioned child.