MathML internals - use createXXX() function naming, ASSERT()s
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 Feb 2012 04:28:26 +0000 (04:28 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 Feb 2012 04:28:26 +0000 (04:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=78384

Patch by David Barton <dbarton@mathscribe.com> on 2012-02-10
Reviewed by Eric Seidel.

Standard RefPtr function naming uses "createXXX" instead of "makeXXX".
I also added a couple of ASSERT()s.

No new tests.

* rendering/mathml/RenderMathMLBlock.cpp:
(WebCore::RenderMathMLBlock::createBlockStyle):
* rendering/mathml/RenderMathMLBlock.h:
(RenderMathMLBlock):
* rendering/mathml/RenderMathMLFenced.cpp:
(WebCore::RenderMathMLFenced::createOperatorStyle):
(WebCore::RenderMathMLFenced::makeFences):
(WebCore::RenderMathMLFenced::addChild):
* rendering/mathml/RenderMathMLFenced.h:
(RenderMathMLFenced):
* rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::addChild):
* rendering/mathml/RenderMathMLRoot.cpp:
(WebCore::RenderMathMLRoot::addChild):
* rendering/mathml/RenderMathMLSubSup.cpp:
(WebCore::RenderMathMLSubSup::RenderMathMLSubSup):
* rendering/mathml/RenderMathMLUnderOver.cpp:
(WebCore::RenderMathMLUnderOver::RenderMathMLUnderOver):
(WebCore::RenderMathMLUnderOver::addChild):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107473 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/mathml/RenderMathMLBlock.cpp
Source/WebCore/rendering/mathml/RenderMathMLBlock.h
Source/WebCore/rendering/mathml/RenderMathMLFenced.cpp
Source/WebCore/rendering/mathml/RenderMathMLFenced.h
Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp
Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp
Source/WebCore/rendering/mathml/RenderMathMLSubSup.cpp
Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp

index 24eddb8..3380fcf 100644 (file)
@@ -1,3 +1,35 @@
+2012-02-10  David Barton  <dbarton@mathscribe.com>
+
+        MathML internals - use createXXX() function naming, ASSERT()s
+        https://bugs.webkit.org/show_bug.cgi?id=78384
+
+        Reviewed by Eric Seidel.
+
+        Standard RefPtr function naming uses "createXXX" instead of "makeXXX".
+        I also added a couple of ASSERT()s.
+
+        No new tests.
+
+        * rendering/mathml/RenderMathMLBlock.cpp:
+        (WebCore::RenderMathMLBlock::createBlockStyle):
+        * rendering/mathml/RenderMathMLBlock.h:
+        (RenderMathMLBlock):
+        * rendering/mathml/RenderMathMLFenced.cpp:
+        (WebCore::RenderMathMLFenced::createOperatorStyle):
+        (WebCore::RenderMathMLFenced::makeFences):
+        (WebCore::RenderMathMLFenced::addChild):
+        * rendering/mathml/RenderMathMLFenced.h:
+        (RenderMathMLFenced):
+        * rendering/mathml/RenderMathMLFraction.cpp:
+        (WebCore::RenderMathMLFraction::addChild):
+        * rendering/mathml/RenderMathMLRoot.cpp:
+        (WebCore::RenderMathMLRoot::addChild):
+        * rendering/mathml/RenderMathMLSubSup.cpp:
+        (WebCore::RenderMathMLSubSup::RenderMathMLSubSup):
+        * rendering/mathml/RenderMathMLUnderOver.cpp:
+        (WebCore::RenderMathMLUnderOver::RenderMathMLUnderOver):
+        (WebCore::RenderMathMLUnderOver::addChild):
+
 2012-02-10  Dan Bernstein  <mitz@apple.com>
 
         Non-threaded scrolling build fix.
index c470fe9..24170a8 100644 (file)
@@ -49,7 +49,7 @@ bool RenderMathMLBlock::isChildAllowed(RenderObject* child, RenderStyle*) const
     return child->node() && child->node()->nodeType() == Node::ELEMENT_NODE;
 }
 
-PassRefPtr<RenderStyle> RenderMathMLBlock::makeBlockStyle()
+PassRefPtr<RenderStyle> RenderMathMLBlock::createBlockStyle()
 {
     RefPtr<RenderStyle> newStyle = RenderStyle::create();
     newStyle->inheritFrom(style());
index 4d8184b..e556459 100644 (file)
@@ -70,7 +70,7 @@ protected:
         
         return 0;
     }
-    virtual PassRefPtr<RenderStyle> makeBlockStyle();
+    virtual PassRefPtr<RenderStyle> createBlockStyle();
 
 private:
     virtual const char* renderName() const { return isAnonymous() ? "RenderMathMLBlock (anonymous)" : "RenderMathMLBlock"; }
index 05d947a..c2f67ea 100644 (file)
@@ -80,7 +80,7 @@ void RenderMathMLFenced::updateFromElement()
         makeFences();
 }
 
-PassRefPtr<RenderStyle> RenderMathMLFenced::makeOperatorStyle()
+PassRefPtr<RenderStyle> RenderMathMLFenced::createOperatorStyle()
 {
     RefPtr<RenderStyle> newStyle = RenderStyle::create();
     newStyle->inheritFrom(style());
@@ -92,10 +92,10 @@ PassRefPtr<RenderStyle> RenderMathMLFenced::makeOperatorStyle()
 void RenderMathMLFenced::makeFences()
 {
     RenderObject* openFence = new (renderArena()) RenderMathMLOperator(node(), m_open);
-    openFence->setStyle(makeOperatorStyle());
+    openFence->setStyle(createOperatorStyle());
     RenderBlock::addChild(openFence, firstChild());
     RenderObject* closeFence = new (renderArena()) RenderMathMLOperator(node(), m_close);
-    closeFence->setStyle(makeOperatorStyle());
+    closeFence->setStyle(createOperatorStyle());
     RenderBlock::addChild(closeFence);
 }
 
@@ -122,7 +122,7 @@ void RenderMathMLFenced::addChild(RenderObject* child, RenderObject*)
                 separator = (*m_separators.get())[count - 2];
                 
             RenderObject* separatorObj = new (renderArena()) RenderMathMLOperator(node(), separator);
-            separatorObj->setStyle(makeOperatorStyle());
+            separatorObj->setStyle(createOperatorStyle());
             RenderBlock::addChild(separatorObj, lastChild());
         }
     }
index 65ae0c1..b2bca99 100644 (file)
@@ -41,7 +41,7 @@ public:
 private:
     virtual const char* renderName() const { return "RenderMathMLFenced"; }
 
-    PassRefPtr<RenderStyle> makeOperatorStyle();
+    PassRefPtr<RenderStyle> createOperatorStyle();
     void makeFences();
     
     UChar m_open;
index 49163b2..d30161a 100644 (file)
@@ -101,7 +101,7 @@ void RenderMathMLFraction::updateFromElement()
 void RenderMathMLFraction::addChild(RenderObject* child, RenderObject* beforeChild)
 {
     RenderBlock* row = new (renderArena()) RenderMathMLBlock(node());
-    RefPtr<RenderStyle> rowStyle = makeBlockStyle();
+    RefPtr<RenderStyle> rowStyle = createBlockStyle();
     
     rowStyle->setTextAlign(CENTER);
     Length pad(static_cast<int>(rowStyle->fontSize() * gHorizontalPad), Fixed);
index eeda9ee..07e8ff9 100644 (file)
@@ -74,7 +74,7 @@ void RenderMathMLRoot::addChild(RenderObject* child, RenderObject* )
     if (isEmpty()) {
         // Add a block for the index
         RenderBlock* block = new (renderArena()) RenderBlock(node());
-        RefPtr<RenderStyle> indexStyle = makeBlockStyle();
+        RefPtr<RenderStyle> indexStyle = createBlockStyle();
         indexStyle->setDisplay(INLINE_BLOCK);
         block->setStyle(indexStyle.release());
         RenderBlock::addChild(block);
@@ -82,7 +82,7 @@ void RenderMathMLRoot::addChild(RenderObject* child, RenderObject* )
         // FIXME: the wrapping does not seem to be needed anymore.
         // this is the base, so wrap it so we can pad it
         block = new (renderArena()) RenderBlock(node());
-        RefPtr<RenderStyle> baseStyle = makeBlockStyle();
+        RefPtr<RenderStyle> baseStyle = createBlockStyle();
         baseStyle->setDisplay(INLINE_BLOCK);
         baseStyle->setPaddingLeft(Length(5 * gRadicalWidth , Percent));
         block->setStyle(baseStyle.release());
index 839baed..4f7b972 100644 (file)
@@ -43,15 +43,15 @@ RenderMathMLSubSup::RenderMathMLSubSup(Element* element)
     : RenderMathMLBlock(element)
     , m_scripts(0)
 {
-    // Determine what kind of under/over expression we have by element name
+    // Determine what kind of sub/sup expression we have by element name
     if (element->hasLocalName(MathMLNames::msubTag))
         m_kind = Sub;
     else if (element->hasLocalName(MathMLNames::msupTag))
         m_kind = Sup;
-    else if (element->hasLocalName(MathMLNames::msubsupTag))
-        m_kind = SubSup;
-    else 
+    else {
+        ASSERT(element->hasLocalName(MathMLNames::msubsupTag));
         m_kind = SubSup;
+    }
 }
 
 void RenderMathMLSubSup::addChild(RenderObject* child, RenderObject* beforeChild)
index 0d7a919..1ba1eda 100644 (file)
@@ -42,22 +42,20 @@ RenderMathMLUnderOver::RenderMathMLUnderOver(Element* element)
     : RenderMathMLBlock(element)
 {
     // Determine what kind of under/over expression we have by element name
-    
     if (element->hasLocalName(MathMLNames::munderTag))
         m_kind = Under;
     else if (element->hasLocalName(MathMLNames::moverTag))
         m_kind = Over;
-    else if (element->hasLocalName(MathMLNames::munderoverTag))
+    else {
+        ASSERT(element->hasLocalName(MathMLNames::munderoverTag));
         m_kind = UnderOver;
-    else 
-        m_kind = Under;
-    
+    }
 }
 
 void RenderMathMLUnderOver::addChild(RenderObject* child, RenderObject* beforeChild)
 {    
     RenderMathMLBlock* row = new (renderArena()) RenderMathMLBlock(node());
-    RefPtr<RenderStyle> rowStyle = makeBlockStyle();
+    RefPtr<RenderStyle> rowStyle = createBlockStyle();
     row->setStyle(rowStyle.release());
     row->setIsAnonymous(true);