2014-01-06 Gurpreet Kaur <k.gurpreet@samsung.com>
+ RenderInline::clone() should return RenderPtr.
+ <https://webkit.org/b/126514>
+
+ Reviewed by Antti Koivisto.
+
+ * rendering/RenderInline.h:
+ * rendering/RenderInline.cpp:
+ (WebCore::RenderInline::clone):
+
+ Tweaked to return RenderPtr<RenderInline>.
+
+ (WebCore::RenderInline::splitInlines):
+
+ Store cloned RenderInlines in RenderPtrs. Use leakPtr() to sink
+ them into ownership-taking APIs that still use raw pointers.
+
+2014-01-06 Andreas Kling <akling@apple.com>
+
<hr> appears gray instead of green because of color attribute is defined followed by noshade attribute
https://bugs.webkit.org/show_bug.cgi?id=17674
newChild->setNeedsLayoutAndPrefWidthsRecalc();
}
-RenderInline* RenderInline::clone() const
+RenderPtr<RenderInline> RenderInline::clone() const
{
- RenderInline* cloneInline = new RenderInline(*element(), style());
+ RenderPtr<RenderInline> cloneInline = createRenderer<RenderInline>(*element(), style());
cloneInline->initializeStyle();
cloneInline->setFlowThreadState(flowThreadState());
return cloneInline;
RenderObject* beforeChild, RenderBoxModelObject* oldCont)
{
// Create a clone of this inline.
- RenderInline* cloneInline = clone();
+ RenderPtr<RenderInline> cloneInline = clone();
cloneInline->setContinuation(oldCont);
#if ENABLE(FULLSCREEN_API)
}
// Hook |clone| up as the continuation of the middle block.
- middleBlock->setContinuation(cloneInline);
+ middleBlock->setContinuation(cloneInline.get());
// We have been reparented and are now under the fromBlock. We need
// to walk up our inline parent chain until we hit the containing block.
ASSERT(curr->isRenderInline());
if (splitDepth < cMaxSplitDepth) {
// Create a new clone.
- RenderInline* cloneChild = cloneInline;
+ RenderPtr<RenderInline> cloneChild = std::move(cloneInline);
cloneInline = toRenderInline(curr)->clone();
// Insert our child clone as the first child.
- cloneInline->addChildIgnoringContinuation(cloneChild, 0);
+ cloneInline->addChildIgnoringContinuation(cloneChild.leakPtr(), 0);
// Hook the clone up as a continuation of |curr|.
RenderInline* inlineCurr = toRenderInline(curr);
oldCont = inlineCurr->continuation();
- inlineCurr->setContinuation(cloneInline);
+ inlineCurr->setContinuation(cloneInline.get());
cloneInline->setContinuation(oldCont);
// Now we need to take all of the children starting from the first child
}
// Now we are at the block level. We need to put the clone into the toBlock.
- toBlock->insertChildInternal(cloneInline, nullptr, NotifyChildren);
+ toBlock->insertChildInternal(cloneInline.leakPtr(), nullptr, NotifyChildren);
// Now take all the children after currChild and remove them from the fromBlock
// and put them in the toBlock.