Skip to content
Permalink
Browse files
2010-12-17 Carol Szabo <carol.szabo@nokia.com>
        Reviewed by Darin Adler.

        A corrupted counter tree is created when renderers are added to the
        tree bypassing RenderObject::addChild
        https://bugs.webkit.org/show_bug.cgi?id=51270

        This patch replaces the hack introduced for fixing bug 43812
        with code that addresses the underlying problem for that bug.
        No new layout tests provided as there is no identified scenario when
        visible behavior would be different, the internal datastructures
        are maintained properly through this fix so the previous hack
        introduced for bug 43812 is now removed. The fact that the
        layout test introduced for 43812 continues to pass is proof that the
        code works.

        * rendering/RenderCounter.cpp:
        (WebCore::findPlaceForCounter):
          Removed hack.
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::addChild):
          Moved call to counter nodes updater to lower level
          functions to avoid bypass.
        * rendering/RenderObjectChildList.cpp:
        (WebCore::RenderObjectChildList::appendChildNode):
        (WebCore::RenderObjectChildList::insertChildNode):
          Changed to update the values of the counters that
          may be inserted in the tree.

Canonical link: https://commits.webkit.org/64634@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@74292 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Carol Szabo committed Dec 17, 2010
1 parent 27eed16 commit 52b791068f576250ac91831596418cd777f33d44
Showing 4 changed files with 32 additions and 6 deletions.
@@ -1,3 +1,33 @@
2010-12-17 Carol Szabo <carol.szabo@nokia.com>

Reviewed by Darin Adler.

A corrupted counter tree is created when renderers are added to the
tree bypassing RenderObject::addChild
https://bugs.webkit.org/show_bug.cgi?id=51270

This patch replaces the hack introduced for fixing bug 43812
with code that addresses the underlying problem for that bug.
No new layout tests provided as there is no identified scenario when
visible behavior would be different, the internal datastructures
are maintained properly through this fix so the previous hack
introduced for bug 43812 is now removed. The fact that the
layout test introduced for 43812 continues to pass is proof that the
code works.

* rendering/RenderCounter.cpp:
(WebCore::findPlaceForCounter):
Removed hack.
* rendering/RenderObject.cpp:
(WebCore::RenderObject::addChild):
Moved call to counter nodes updater to lower level
functions to avoid bypass.
* rendering/RenderObjectChildList.cpp:
(WebCore::RenderObjectChildList::appendChildNode):
(WebCore::RenderObjectChildList::insertChildNode):
Changed to update the values of the counters that
may be inserted in the tree.

2010-12-17 Shimeng (Simon) Wang <swang@google.com>

Reviewed by Steve Block.
@@ -136,11 +136,6 @@ 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.
@@ -315,7 +315,6 @@ 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)
@@ -174,6 +174,7 @@ 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.
@@ -233,6 +234,7 @@ 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.

0 comments on commit 52b7910

Please sign in to comment.