Title: [161501] trunk/Source/WebCore
Revision
161501
Author
[email protected]
Date
2014-01-08 07:43:52 -0800 (Wed, 08 Jan 2014)

Log Message

Deploy RenderPtr in RenderMathMLOperator::updateFromElement().
<https://webkit.org/b/126628>

Reviewed by Antti Koivisto.

* rendering/mathml/RenderMathMLOperator.cpp:
(WebCore::RenderMathMLOperator::updateFromElement):

    Use RenderPtr/createRenderer for renderer creation.
    Removed an unnecessary null check (text is always created.)
    Also use RenderStyle::createAnonymousStyleWithDisplay()
    helper to shorten down the code a bit.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (161500 => 161501)


--- trunk/Source/WebCore/ChangeLog	2014-01-08 15:24:53 UTC (rev 161500)
+++ trunk/Source/WebCore/ChangeLog	2014-01-08 15:43:52 UTC (rev 161501)
@@ -1,3 +1,18 @@
+2014-01-08  Andreas Kling  <[email protected]>
+
+        Deploy RenderPtr in RenderMathMLOperator::updateFromElement().
+        <https://webkit.org/b/126628>
+
+        Reviewed by Antti Koivisto.
+
+        * rendering/mathml/RenderMathMLOperator.cpp:
+        (WebCore::RenderMathMLOperator::updateFromElement):
+
+            Use RenderPtr/createRenderer for renderer creation.
+            Removed an unnecessary null check (text is always created.)
+            Also use RenderStyle::createAnonymousStyleWithDisplay()
+            helper to shorten down the code a bit.
+
 2014-01-08  Alberto Garcia  <[email protected]>
 
         Fix some compilation warnings

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp (161500 => 161501)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp	2014-01-08 15:24:53 UTC (rev 161500)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp	2014-01-08 15:43:52 UTC (rev 161501)
@@ -172,26 +172,20 @@
     // Since we share a node with our children, destroying our children may set our node's
     // renderer to 0, so we need to restore it.
     element().setRenderer(savedRenderer);
-    
-    auto newStyle = RenderStyle::create();
-    newStyle.get().inheritFrom(&style());
-    newStyle.get().setDisplay(FLEX);
 
-    RenderMathMLBlock* container = new RenderMathMLBlock(element(), std::move(newStyle));
+    RenderPtr<RenderMathMLBlock> container = createRenderer<RenderMathMLBlock>(element(), RenderStyle::createAnonymousStyleWithDisplay(&style(), FLEX));
     // This container doesn't offer any useful information to accessibility.
     container->setIgnoreInAccessibilityTree(true);
     container->initializeStyle();
 
-    addChild(container);
-    RenderText* text;
+    RenderPtr<RenderText> text;
     if (m_operator)
-        text = new RenderText(document(), String(&m_operator, 1));
+        text = createRenderer<RenderText>(document(), String(&m_operator, 1));
     else
-        text = new RenderText(document(), element().textContent().replace(hyphenMinus, minusSign).impl());
+        text = createRenderer<RenderText>(document(), element().textContent().replace(hyphenMinus, minusSign).impl());
 
-    // If we can't figure out the text, leave it blank.
-    if (text)
-        container->addChild(text);
+    container->addChild(text.leakPtr());
+    addChild(container.leakPtr());
 
     updateStyle();
     setNeedsLayoutAndPrefWidthsRecalc();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to