Modified: trunk/Source/WebCore/ChangeLog (161490 => 161491)
--- trunk/Source/WebCore/ChangeLog 2014-01-08 08:45:19 UTC (rev 161490)
+++ trunk/Source/WebCore/ChangeLog 2014-01-08 09:47:59 UTC (rev 161491)
@@ -1,3 +1,21 @@
+2014-01-08 Andreas Kling <[email protected]>
+
+ createMathMLOperator() should return RenderPtr.
+ <https://webkit.org/b/126622>
+
+ Reviewed by Antti Koivisto.
+
+ * rendering/mathml/RenderMathMLFenced.h:
+ * rendering/mathml/RenderMathMLFenced.cpp:
+ (WebCore::RenderMathMLFenced::createMathMLOperator):
+
+ Make this return a RenderPtr<RenderMathMLOperator>.
+
+ (WebCore::RenderMathMLFenced::makeFences):
+ (WebCore::RenderMathMLFenced::addChild):
+
+ Updated for the new createMathMLOperator() signature.
+
2014-01-07 Antti Koivisto <[email protected]>
REGRESSION (r161195): Acid2 regression tests frequently fail
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp (161490 => 161491)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp 2014-01-08 08:45:19 UTC (rev 161490)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp 2014-01-08 09:47:59 UTC (rev 161491)
@@ -82,14 +82,14 @@
makeFences();
}
-RenderMathMLOperator* RenderMathMLFenced::createMathMLOperator(UChar uChar, RenderMathMLOperator::OperatorType operatorType)
+RenderPtr<RenderMathMLOperator> RenderMathMLFenced::createMathMLOperator(UChar uChar, RenderMathMLOperator::OperatorType operatorType)
{
auto newStyle = RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX);
newStyle.get().setFlexDirection(FlowColumn);
newStyle.get().setMarginEnd(Length((operatorType == RenderMathMLOperator::Fence ? gFenceMarginEms : gSeparatorMarginEndEms) * style().fontSize(), Fixed));
if (operatorType == RenderMathMLOperator::Fence)
newStyle.get().setMarginStart(Length(gFenceMarginEms * style().fontSize(), Fixed));
- RenderMathMLOperator* newOperator = new RenderMathMLOperator(element(), std::move(newStyle), uChar);
+ RenderPtr<RenderMathMLOperator> newOperator = createRenderer<RenderMathMLOperator>(element(), std::move(newStyle), uChar);
newOperator->setOperatorType(operatorType);
newOperator->initializeStyle();
return newOperator;
@@ -97,11 +97,15 @@
void RenderMathMLFenced::makeFences()
{
- RenderMathMLOperator* openFence = createMathMLOperator(m_open, RenderMathMLOperator::Fence);
- RenderMathMLRow::addChild(openFence, firstChild());
- m_closeFenceRenderer = createMathMLOperator(m_close, RenderMathMLOperator::Fence);
- RenderMathMLRow::addChild(m_closeFenceRenderer);
- openFence->updateFromElement();
+ RenderPtr<RenderMathMLOperator> openFence = createMathMLOperator(m_open, RenderMathMLOperator::Fence);
+ RenderMathMLOperator* openFencePtr = openFence.get();
+ RenderMathMLRow::addChild(openFence.leakPtr(), firstChild());
+
+ RenderPtr<RenderMathMLOperator> closeFence = createMathMLOperator(m_close, RenderMathMLOperator::Fence);
+ m_closeFenceRenderer = closeFence.get();
+ RenderMathMLRow::addChild(closeFence.leakPtr());
+
+ openFencePtr->updateFromElement();
m_closeFenceRenderer->updateFromElement();
}
@@ -114,7 +118,7 @@
// FIXME: Adding or removing a child should possibly cause all later separators to shift places if they're different,
// as later child positions change by +1 or -1.
- RenderMathMLOperator* separatorRenderer = nullptr;
+ RenderPtr<RenderMathMLOperator> separatorRenderer;
if (m_separators.get()) {
unsigned int count = 0;
for (Node* position = child->node(); position; position = position->previousSibling()) {
@@ -144,11 +148,11 @@
// Adding |x| before an existing |y| e.g. in element (y) - first insert our new child |x|, then its separator, to get (x, y).
RenderMathMLRow::addChild(child, beforeChild);
if (separatorRenderer)
- RenderMathMLRow::addChild(separatorRenderer, beforeChild);
+ RenderMathMLRow::addChild(separatorRenderer.leakPtr(), beforeChild);
} else {
// Adding |y| at the end of an existing element e.g. (x) - insert the separator first before the closing fence, then |y|, to get (x, y).
if (separatorRenderer)
- RenderMathMLRow::addChild(separatorRenderer, m_closeFenceRenderer);
+ RenderMathMLRow::addChild(separatorRenderer.leakPtr(), m_closeFenceRenderer);
RenderMathMLRow::addChild(child, m_closeFenceRenderer);
}
}
Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.h (161490 => 161491)
--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.h 2014-01-08 08:45:19 UTC (rev 161490)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFenced.h 2014-01-08 09:47:59 UTC (rev 161491)
@@ -47,7 +47,7 @@
virtual void updateFromElement() OVERRIDE;
- RenderMathMLOperator* createMathMLOperator(UChar, RenderMathMLOperator::OperatorType);
+ RenderPtr<RenderMathMLOperator> createMathMLOperator(UChar, RenderMathMLOperator::OperatorType);
void makeFences();
UChar m_open;