diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2016-04-10 09:28:39 +0000 |
commit | 32761a6cee1d0dee366b885b7b9c777e67885688 (patch) | |
tree | d6bec92bebfb216f4126356e55518842c2f476a1 /Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp | |
parent | a4e969f4965059196ca948db781e52f7cfebf19e (diff) | |
download | WebKitGtk-tarball-32761a6cee1d0dee366b885b7b9c777e67885688.tar.gz |
webkitgtk-2.4.11webkitgtk-2.4.11
Diffstat (limited to 'Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp')
-rw-r--r-- | Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp | 61 |
1 files changed, 13 insertions, 48 deletions
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp b/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp index b0c34c0a1..34af852db 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp +++ b/Source/WebCore/rendering/mathml/RenderMathMLUnderOver.cpp @@ -29,25 +29,22 @@ #include "RenderMathMLUnderOver.h" -#include "MathMLElement.h" #include "MathMLNames.h" -#include "RenderIterator.h" -#include "RenderMathMLOperator.h" namespace WebCore { using namespace MathMLNames; -RenderMathMLUnderOver::RenderMathMLUnderOver(Element& element, Ref<RenderStyle>&& style) - : RenderMathMLBlock(element, WTFMove(style)) +RenderMathMLUnderOver::RenderMathMLUnderOver(Element& element, PassRef<RenderStyle> style) + : RenderMathMLBlock(element, std::move(style)) { // Determine what kind of under/over expression we have by element name - if (element.hasTagName(MathMLNames::munderTag)) + if (element.hasLocalName(MathMLNames::munderTag)) m_kind = Under; - else if (element.hasTagName(MathMLNames::moverTag)) + else if (element.hasLocalName(MathMLNames::moverTag)) m_kind = Over; else { - ASSERT(element.hasTagName(MathMLNames::munderoverTag)); + ASSERT(element.hasLocalName(MathMLNames::munderoverTag)); m_kind = UnderOver; } } @@ -55,54 +52,22 @@ RenderMathMLUnderOver::RenderMathMLUnderOver(Element& element, Ref<RenderStyle>& RenderMathMLOperator* RenderMathMLUnderOver::unembellishedOperator() { RenderObject* base = firstChild(); - if (!is<RenderMathMLBlock>(base)) - return nullptr; - return downcast<RenderMathMLBlock>(*base).unembellishedOperator(); + if (!base || !base->isRenderMathMLBlock()) + return 0; + return toRenderMathMLBlock(base)->unembellishedOperator(); } -Optional<int> RenderMathMLUnderOver::firstLineBaseline() const +int RenderMathMLUnderOver::firstLineBaseline() const { RenderBox* base = firstChildBox(); if (!base) - return Optional<int>(); - Optional<int> baseline = base->firstLineBaseline(); - if (baseline) - baseline.value() += static_cast<int>(base->logicalTop()); + return -1; + LayoutUnit baseline = base->firstLineBaseline(); + if (baseline != -1) + baseline += base->logicalTop(); return baseline; } -void RenderMathMLUnderOver::layout() -{ - LayoutUnit stretchWidth = 0; - Vector<RenderMathMLOperator*, 2> renderOperators; - - for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { - if (child->needsLayout()) { - if (is<RenderMathMLBlock>(child)) { - if (auto renderOperator = downcast<RenderMathMLBlock>(*child).unembellishedOperator()) { - if (!renderOperator->isVertical()) { - renderOperator->resetStretchSize(); - renderOperators.append(renderOperator); - } - } - } - - downcast<RenderElement>(*child).layout(); - } - - // Skipping the embellished op does not work for nested structures like - // <munder><mover><mo>_</mo>...</mover> <mo>_</mo></munder>. - if (is<RenderBox>(*child)) - stretchWidth = std::max<LayoutUnit>(stretchWidth, downcast<RenderBox>(*child).logicalWidth()); - } - - // Set the sizes of (possibly embellished) stretchy operator children. - for (auto& renderOperator : renderOperators) - renderOperator->stretchTo(stretchWidth); - - RenderMathMLBlock::layout(); -} - } #endif // ENABLE(MATHML) |