Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Unified Diff: Source/WebCore/rendering/RenderCounter.cpp

Issue 9371036: Merge 106852 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/css/counters/reparent-table-children-with-counters-crash-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/rendering/RenderCounter.cpp
===================================================================
--- Source/WebCore/rendering/RenderCounter.cpp (revision 107329)
+++ Source/WebCore/rendering/RenderCounter.cpp (working copy)
@@ -301,7 +301,7 @@
// reset node.
// - Non-reset CounterNodes cannot have descendants.
-static bool findPlaceForCounter(RenderObject* counterOwner, const AtomicString& identifier, bool isReset, CounterNode*& parent, CounterNode*& previousSibling)
+static bool findPlaceForCounter(RenderObject* counterOwner, const AtomicString& identifier, bool isReset, RefPtr<CounterNode>& parent, RefPtr<CounterNode>& previousSibling)
{
// We cannot stop searching for counters with the same identifier before we also
// check this renderer, because it may affect the positioning in the tree of our counter.
@@ -346,7 +346,9 @@
if (!isReset || !areRenderersElementsSiblings(currentRenderer, counterOwner)) {
// If the node we are placing is not reset or we have found a counter that is attached
// to an ancestor of the placed counter's owner renderer we know we are a sibling of that node.
- ASSERT(currentCounter->parent() == previousSiblingProtector->parent());
+ if (currentCounter->parent() != previousSiblingProtector->parent())
+ return false;
+
parent = currentCounter->parent();
previousSibling = previousSiblingProtector.get();
return true;
@@ -428,11 +430,11 @@
if (!planCounter(object, identifier, isReset, value) && !alwaysCreateCounter)
return 0;
- CounterNode* newParent = 0;
- CounterNode* newPreviousSibling = 0;
+ RefPtr<CounterNode> newParent = 0;
+ RefPtr<CounterNode> newPreviousSibling = 0;
RefPtr<CounterNode> newNode = CounterNode::create(object, isReset, value);
if (findPlaceForCounter(object, identifier, isReset, newParent, newPreviousSibling))
- newParent->insertAfter(newNode.get(), newPreviousSibling, identifier);
+ newParent->insertAfter(newNode.get(), newPreviousSibling.get(), identifier);
CounterMap* nodeMap;
if (object->m_hasCounterNodeMap)
nodeMap = counterMaps().get(object);
@@ -628,8 +630,8 @@
makeCounterNode(renderer, AtomicString(it->first.get()), false);
continue;
}
- CounterNode* newParent = 0;
- CounterNode* newPreviousSibling;
+ RefPtr<CounterNode> newParent = 0;
+ RefPtr<CounterNode> newPreviousSibling = 0;
findPlaceForCounter(renderer, AtomicString(it->first.get()), node->hasResetType(), newParent, newPreviousSibling);
if (node != counterMap->get(it->first.get()))
@@ -640,7 +642,7 @@
if (parent)
parent->removeChild(node.get());
if (newParent)
- newParent->insertAfter(node.get(), newPreviousSibling, it->first.get());
+ newParent->insertAfter(node.get(), newPreviousSibling.get(), it->first.get());
}
}
« no previous file with comments | « LayoutTests/fast/css/counters/reparent-table-children-with-counters-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698