Title: [202441] trunk/Source/WebCore
Revision
202441
Author
[email protected]
Date
2016-06-24 13:17:15 -0700 (Fri, 24 Jun 2016)

Log Message

Use auto* for MathML elements and renderers when possible
https://bugs.webkit.org/show_bug.cgi?id=159090

Patch by Frederic Wang <[email protected]> on 2016-06-24
Reviewed by Alex Christensen.

No new tests, behavior is unchanged.

* mathml/MathMLElement.cpp:
(WebCore::MathMLElement::attributeChanged):
* mathml/MathMLSelectElement.cpp:
(WebCore::MathMLSelectElement::getSelectedActionChildAndIndex):
(WebCore::MathMLSelectElement::getSelectedActionChild):
(WebCore::MathMLSelectElement::getSelectedSemanticsChild):
(WebCore::MathMLSelectElement::updateSelectedChild):
* rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::isValid):
* rendering/mathml/RenderMathMLMenclose.cpp:
(WebCore::RenderMathMLMenclose::layoutBlock):
* rendering/mathml/RenderMathMLRoot.cpp:
(WebCore::RenderMathMLRoot::isValid):
* rendering/mathml/RenderMathMLRow.cpp:
(WebCore::RenderMathMLRow::firstLineBaseline):
(WebCore::RenderMathMLRow::computeLineVerticalStretch):
(WebCore::RenderMathMLRow::computePreferredLogicalWidths):
(WebCore::RenderMathMLRow::layoutRowItems):
* rendering/mathml/RenderMathMLScripts.cpp:
(WebCore::RenderMathMLScripts::unembellishedOperator):
(WebCore::RenderMathMLScripts::getBaseAndScripts):
(WebCore::RenderMathMLScripts::computePreferredLogicalWidths):
(WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded):
(WebCore::RenderMathMLScripts::layoutBlock):
(WebCore::RenderMathMLScripts::firstLineBaseline):
* rendering/mathml/RenderMathMLUnderOver.cpp:
(WebCore::RenderMathMLUnderOver::firstLineBaseline):
(WebCore::RenderMathMLUnderOver::isValid):
(WebCore::RenderMathMLUnderOver::over):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (202440 => 202441)


--- trunk/Source/WebCore/ChangeLog	2016-06-24 20:14:31 UTC (rev 202440)
+++ trunk/Source/WebCore/ChangeLog	2016-06-24 20:17:15 UTC (rev 202441)
@@ -1,3 +1,42 @@
+2016-06-24  Frederic Wang  <[email protected]>
+
+        Use auto* for MathML elements and renderers when possible
+        https://bugs.webkit.org/show_bug.cgi?id=159090
+
+        Reviewed by Alex Christensen.
+
+        No new tests, behavior is unchanged.
+
+        * mathml/MathMLElement.cpp:
+        (WebCore::MathMLElement::attributeChanged):
+        * mathml/MathMLSelectElement.cpp:
+        (WebCore::MathMLSelectElement::getSelectedActionChildAndIndex):
+        (WebCore::MathMLSelectElement::getSelectedActionChild):
+        (WebCore::MathMLSelectElement::getSelectedSemanticsChild):
+        (WebCore::MathMLSelectElement::updateSelectedChild):
+        * rendering/mathml/RenderMathMLFraction.cpp:
+        (WebCore::RenderMathMLFraction::isValid):
+        * rendering/mathml/RenderMathMLMenclose.cpp:
+        (WebCore::RenderMathMLMenclose::layoutBlock):
+        * rendering/mathml/RenderMathMLRoot.cpp:
+        (WebCore::RenderMathMLRoot::isValid):
+        * rendering/mathml/RenderMathMLRow.cpp:
+        (WebCore::RenderMathMLRow::firstLineBaseline):
+        (WebCore::RenderMathMLRow::computeLineVerticalStretch):
+        (WebCore::RenderMathMLRow::computePreferredLogicalWidths):
+        (WebCore::RenderMathMLRow::layoutRowItems):
+        * rendering/mathml/RenderMathMLScripts.cpp:
+        (WebCore::RenderMathMLScripts::unembellishedOperator):
+        (WebCore::RenderMathMLScripts::getBaseAndScripts):
+        (WebCore::RenderMathMLScripts::computePreferredLogicalWidths):
+        (WebCore::RenderMathMLScripts::getScriptMetricsAndLayoutIfNeeded):
+        (WebCore::RenderMathMLScripts::layoutBlock):
+        (WebCore::RenderMathMLScripts::firstLineBaseline):
+        * rendering/mathml/RenderMathMLUnderOver.cpp:
+        (WebCore::RenderMathMLUnderOver::firstLineBaseline):
+        (WebCore::RenderMathMLUnderOver::isValid):
+        (WebCore::RenderMathMLUnderOver::over):
+
 2016-06-24  Joseph Pecoraro  <[email protected]>
 
         Remove unused and static return value from InspectorStyle::populateAllProperties

Modified: trunk/Source/WebCore/mathml/MathMLElement.cpp (202440 => 202441)


--- trunk/Source/WebCore/mathml/MathMLElement.cpp	2016-06-24 20:14:31 UTC (rev 202440)
+++ trunk/Source/WebCore/mathml/MathMLElement.cpp	2016-06-24 20:17:15 UTC (rev 202441)
@@ -298,7 +298,7 @@
 void MathMLElement::attributeChanged(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& newValue, AttributeModificationReason reason)
 {
     if (isSemanticAnnotation() && (name == MathMLNames::srcAttr || name == MathMLNames::encodingAttr)) {
-        Element* parent = parentElement();
+        auto* parent = parentElement();
         if (is<MathMLElement>(parent) && parent->hasTagName(semanticsTag))
             downcast<MathMLElement>(*parent).updateSelectedChild();
     }

Modified: trunk/Source/WebCore/mathml/MathMLSelectElement.cpp (202440 => 202441)


--- trunk/Source/WebCore/mathml/MathMLSelectElement.cpp	2016-06-24 20:14:31 UTC (rev 202440)
+++ trunk/Source/WebCore/mathml/MathMLSelectElement.cpp	2016-06-24 20:17:15 UTC (rev 202441)
@@ -118,7 +118,7 @@
     int selection = fastGetAttribute(MathMLNames::selectionAttr).toInt();
     int i;
     for (i = 1; i < selection; i++) {
-        Element* nextChild = selectedChild->nextElementSibling();
+        auto* nextChild = selectedChild->nextElementSibling();
         if (!nextChild)
             break;
         selectedChild = nextChild;
@@ -131,7 +131,7 @@
 {
     ASSERT(hasTagName(mactionTag));
 
-    Element* child = firstElementChild();
+    auto* child = firstElementChild();
     if (!child)
         return child;
 
@@ -155,7 +155,7 @@
 {
     ASSERT(hasTagName(semanticsTag));
 
-    Element* child = firstElementChild();
+    auto* child = firstElementChild();
     if (!child)
         return nullptr;
 
@@ -197,7 +197,7 @@
 
 void MathMLSelectElement::updateSelectedChild()
 {
-    Element* newSelectedChild = hasTagName(mactionTag) ? getSelectedActionChild() : getSelectedSemanticsChild();
+    auto* newSelectedChild = hasTagName(mactionTag) ? getSelectedActionChild() : getSelectedSemanticsChild();
 
     if (m_selectedChild == newSelectedChild)
         return;

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp (202440 => 202441)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp	2016-06-24 20:14:31 UTC (rev 202440)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp	2016-06-24 20:17:15 UTC (rev 202441)
@@ -71,7 +71,7 @@
 {
     // Verify whether the list of children is valid:
     // <mfrac> numerator denominator </mfrac>
-    RenderBox* child = firstChildBox();
+    auto* child = firstChildBox();
     if (!child)
         return false;
     child = child->nextSiblingBox();

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.cpp (202440 => 202441)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.cpp	2016-06-24 20:14:31 UTC (rev 202440)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLMenclose.cpp	2016-06-24 20:17:15 UTC (rev 202441)
@@ -178,7 +178,7 @@
     m_ascent = topSpace + contentAscent;
     LayoutUnit descent = contentDescent + bottomSpace;
     LayoutPoint contentLocation(leftSpace, m_ascent - contentAscent);
-    for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox())
+    for (auto* child = firstChildBox(); child; child = child->nextSiblingBox())
         child->setLocation(child->location() + contentLocation);
 
     setLogicalHeight(m_ascent + descent);

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp (202440 => 202441)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp	2016-06-24 20:14:31 UTC (rev 202440)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp	2016-06-24 20:17:15 UTC (rev 202441)
@@ -64,7 +64,7 @@
         return true;
 
     ASSERT(m_kind == RootWithIndex);
-    RenderBox* child = firstChildBox();
+    auto* child = firstChildBox();
     if (!child)
         return false;
     child = child->nextSiblingBox();

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp (202440 => 202441)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp	2016-06-24 20:14:31 UTC (rev 202440)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLRow.cpp	2016-06-24 20:17:15 UTC (rev 202441)
@@ -63,7 +63,7 @@
 
 Optional<int> RenderMathMLRow::firstLineBaseline() const
 {
-    RenderBox* baselineChild = firstChildBox();
+    auto* baselineChild = firstChildBox();
     if (!baselineChild)
         return Optional<int>();
 
@@ -72,7 +72,7 @@
 
 void RenderMathMLRow::computeLineVerticalStretch(LayoutUnit& ascent, LayoutUnit& descent)
 {
-    for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
+    for (auto* child = firstChildBox(); child; child = child->nextSiblingBox()) {
         if (is<RenderMathMLBlock>(child)) {
             auto* renderOperator = downcast<RenderMathMLBlock>(child)->unembellishedOperator();
             if (renderOperator && renderOperator->hasOperatorFlag(MathMLOperatorDictionary::Stretchy))
@@ -102,7 +102,7 @@
     m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = 0;
 
     LayoutUnit preferredWidth = 0;
-    for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox())
+    for (auto* child = firstChildBox(); child; child = child->nextSiblingBox())
         preferredWidth += child->maxPreferredLogicalWidth() + child->marginLogicalWidth();
 
     m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = preferredWidth + borderAndPaddingLogicalWidth();
@@ -115,7 +115,7 @@
     // We first stretch the vertical operators.
     // For inline formulas, we can then calculate the logical width.
     LayoutUnit width = borderAndPaddingStart();
-    for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
+    for (auto* child = firstChildBox(); child; child = child->nextSiblingBox()) {
         if (child->isOutOfFlowPositioned())
             continue;
 
@@ -138,7 +138,7 @@
     LayoutUnit maxAscent = 0, maxDescent = 0; // Used baseline alignment.
     LayoutUnit horizontalOffset = borderAndPaddingStart();
     bool shouldFlipHorizontal = !style().isLeftToRightDirection();
-    for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
+    for (auto* child = firstChildBox(); child; child = child->nextSiblingBox()) {
         if (child->isOutOfFlowPositioned()) {
             child->containingBlock()->insertPositionedObject(*child);
             continue;
@@ -168,7 +168,7 @@
     if (shouldFlipHorizontal && centerBlockOffset > 0)
         centerBlockOffset = -centerBlockOffset;
 
-    for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) {
+    for (auto* child = firstChildBox(); child; child = child->nextSiblingBox()) {
         LayoutUnit ascent = ascentForChild(*child);
         LayoutUnit startOffset = maxAscent - ascent;
         child->setLocation(child->location() + LayoutPoint(centerBlockOffset, startOffset));

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp (202440 => 202441)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp	2016-06-24 20:14:31 UTC (rev 202440)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp	2016-06-24 20:17:15 UTC (rev 202441)
@@ -61,7 +61,7 @@
 
 RenderMathMLOperator* RenderMathMLScripts::unembellishedOperator()
 {
-    RenderBox* base = firstChildBox();
+    auto base = firstChildBox();
     if (!is<RenderMathMLBlock>(base))
         return nullptr;
     return downcast<RenderMathMLBlock>(base)->unembellishedOperator();
@@ -93,7 +93,7 @@
         firstPostScript = base->nextSiblingBox();
         if (!firstPostScript || isPrescriptDelimiter(*firstPostScript))
             return false;
-        RenderBox* superScript = firstPostScript->nextSiblingBox();
+        auto superScript = firstPostScript->nextSiblingBox();
         return superScript && !isPrescriptDelimiter(*superScript) && !superScript->nextSiblingBox();
     }
     case Multiscripts: {
@@ -118,7 +118,7 @@
         //   b) That the list of prescripts can be grouped into pairs of subscript/superscript.
         //   c) That there is at most one <mprescripts/>.
         bool numberOfScriptIsEven = true;
-        for (RenderBox* script = base->nextSiblingBox(); script; script = script->nextSiblingBox()) {
+        for (auto script = base->nextSiblingBox(); script; script = script->nextSiblingBox()) {
             if (isPrescriptDelimiter(*script)) {
                 // This is a <mprescripts/>. Let's check 2a) and 2c).
                 if (!numberOfScriptIsEven || firstPreScript)
@@ -179,7 +179,7 @@
     case SubSup:
     case Multiscripts: {
         RenderBox* supScript;
-        for (RenderBox* subScript = firstPreScript; subScript; subScript = supScript->nextSiblingBox()) {
+        for (auto* subScript = firstPreScript; subScript; subScript = supScript->nextSiblingBox()) {
             supScript = subScript->nextSiblingBox();
             ASSERT(supScript);
             LayoutUnit subSupPairWidth = std::max(subScript->maxPreferredLogicalWidth(), supScript->maxPreferredLogicalWidth());
@@ -186,7 +186,7 @@
             m_maxPreferredLogicalWidth += subSupPairWidth + space;
         }
         m_maxPreferredLogicalWidth += base->maxPreferredLogicalWidth();
-        for (RenderBox* subScript = firstPostScript; subScript && !isPrescriptDelimiter(*subScript); subScript = supScript->nextSiblingBox()) {
+        for (auto* subScript = firstPostScript; subScript && !isPrescriptDelimiter(*subScript); subScript = supScript->nextSiblingBox()) {
             supScript = subScript->nextSiblingBox();
             ASSERT(supScript);
             LayoutUnit subSupPairWidth = std::max(std::max(LayoutUnit(0), subScript->maxPreferredLogicalWidth() - baseItalicCorrection), supScript->maxPreferredLogicalWidth());
@@ -266,7 +266,7 @@
     case SubSup:
     case Multiscripts: {
         RenderBox* supScript;
-        for (RenderBox* subScript = script; subScript && !isPrescriptDelimiter(*subScript); subScript = supScript->nextSiblingBox()) {
+        for (auto* subScript = script; subScript && !isPrescriptDelimiter(*subScript); subScript = supScript->nextSiblingBox()) {
             supScript = subScript->nextSiblingBox();
             ASSERT(supScript);
             subScript->layoutIfNeeded();
@@ -368,7 +368,7 @@
 
         // Calculate the logical width.
         LayoutUnit logicalWidth = 0;
-        for (RenderBox* subScript = firstPreScript; subScript; subScript = supScript->nextSiblingBox()) {
+        for (auto* subScript = firstPreScript; subScript; subScript = supScript->nextSiblingBox()) {
             supScript = subScript->nextSiblingBox();
             ASSERT(supScript);
             LayoutUnit subSupPairWidth = std::max(subScript->logicalWidth(), supScript->logicalWidth());
@@ -375,7 +375,7 @@
             logicalWidth += subSupPairWidth + space;
         }
         logicalWidth += base->logicalWidth();
-        for (RenderBox* subScript = firstPostScript; subScript && !isPrescriptDelimiter(*subScript); subScript = supScript->nextSiblingBox()) {
+        for (auto* subScript = firstPostScript; subScript && !isPrescriptDelimiter(*subScript); subScript = supScript->nextSiblingBox()) {
             supScript = subScript->nextSiblingBox();
             ASSERT(supScript);
             LayoutUnit subSupPairWidth = std::max(std::max(LayoutUnit(0), subScript->logicalWidth() - baseItalicCorrection), supScript->logicalWidth());
@@ -383,7 +383,7 @@
         }
         setLogicalWidth(logicalWidth);
 
-        for (RenderBox* subScript = firstPreScript; subScript; subScript = supScript->nextSiblingBox()) {
+        for (auto* subScript = firstPreScript; subScript; subScript = supScript->nextSiblingBox()) {
             supScript = subScript->nextSiblingBox();
             ASSERT(supScript);
             LayoutUnit subSupPairWidth = std::max(subScript->logicalWidth(), supScript->logicalWidth());
@@ -398,7 +398,7 @@
         LayoutPoint baseLocation(mirrorIfNeeded(horizontalOffset, *base), ascent - baseAscent);
         base->setLocation(baseLocation);
         horizontalOffset += base->logicalWidth();
-        for (RenderBox* subScript = firstPostScript; subScript && !isPrescriptDelimiter(*subScript); subScript = supScript->nextSiblingBox()) {
+        for (auto* subScript = firstPostScript; subScript && !isPrescriptDelimiter(*subScript); subScript = supScript->nextSiblingBox()) {
             supScript = subScript->nextSiblingBox();
             ASSERT(supScript);
             LayoutUnit subAscent = ascentForChild(*subScript);
@@ -420,7 +420,7 @@
 Optional<int> RenderMathMLScripts::firstLineBaseline() const
 {
     ASSERT(!needsLayout());
-    RenderBox* base = firstChildBox();
+    auto* base = firstChildBox();
     if (!base)
         return Optional<int>();
     return Optional<int>(static_cast<int>(lroundf(ascentForChild(*base) + base->logicalTop())));

Modified: trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp (202440 => 202441)


--- trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp	2016-06-24 20:14:31 UTC (rev 202440)
+++ trunk/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp	2016-06-24 20:17:15 UTC (rev 202441)
@@ -63,7 +63,7 @@
 
 Optional<int> RenderMathMLUnderOver::firstLineBaseline() const
 {
-    RenderBox* base = firstChildBox();
+    auto* base = firstChildBox();
     if (!base)
         return Optional<int>();
 
@@ -105,7 +105,7 @@
     // <munder> base under </munder>
     // <mover> base over </mover>
     // <munderover> base under over </munderover>
-    RenderBox* child = firstChildBox();
+    auto* child = firstChildBox();
     if (!child)
         return false;
     child = child->nextSiblingBox();
@@ -141,7 +141,7 @@
 {
     ASSERT(isValid());
     ASSERT(m_scriptType == Over || m_scriptType == UnderOver);
-    RenderBox* secondChild = firstChildBox()->nextSiblingBox();
+    auto* secondChild = firstChildBox()->nextSiblingBox();
     return m_scriptType == Over ? *secondChild : *secondChild->nextSiblingBox();
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to