summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/mathml/RenderMathMLRoot.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering/mathml/RenderMathMLRoot.h')
-rw-r--r--Source/WebCore/rendering/mathml/RenderMathMLRoot.h87
1 files changed, 48 insertions, 39 deletions
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLRoot.h b/Source/WebCore/rendering/mathml/RenderMathMLRoot.h
index 4d5d731ef..a816e1261 100644
--- a/Source/WebCore/rendering/mathml/RenderMathMLRoot.h
+++ b/Source/WebCore/rendering/mathml/RenderMathMLRoot.h
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved.
+ * Copyright (C) 2016 Igalia S.L.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,54 +24,62 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef RenderMathMLRoot_h
-#define RenderMathMLRoot_h
+#pragma once
#if ENABLE(MATHML)
+#include "MathOperator.h"
#include "RenderMathMLBlock.h"
+#include "RenderMathMLRow.h"
namespace WebCore {
-
-// Render base^(1/index), or sqrt(base) via the derived class RenderMathMLSquareRoot, using radical notation.
-class RenderMathMLRoot : public RenderMathMLBlock {
+
+class MathMLRowElement;
+
+// Render base^(1/index), or sqrt(base) using radical notation.
+class RenderMathMLRoot final : public RenderMathMLRow {
+
public:
- RenderMathMLRoot(Element&, PassRef<RenderStyle>);
- RenderMathMLRoot(Document&, PassRef<RenderStyle>);
-
- virtual LayoutUnit paddingTop() const override;
- virtual LayoutUnit paddingBottom() const override;
- virtual LayoutUnit paddingLeft() const override;
- virtual LayoutUnit paddingRight() const override;
- virtual LayoutUnit paddingBefore() const override;
- virtual LayoutUnit paddingAfter() const override;
- virtual LayoutUnit paddingStart() const override;
- virtual LayoutUnit paddingEnd() const override;
-
- virtual void addChild(RenderObject* newChild, RenderObject* beforeChild = 0) override;
-
-protected:
- virtual void layout() override;
-
- virtual void paint(PaintInfo&, const LayoutPoint&) override;
+ RenderMathMLRoot(MathMLRowElement&, RenderStyle&&);
+ void updateStyle();
private:
- virtual bool isRenderMathMLRoot() const override final { return true; }
- virtual const char* renderName() const override { return "RenderMathMLRoot"; }
-
- // This may return 0 for a non-MathML index (which won't occur in valid MathML).
- RenderBox* index() const;
-
- int m_intrinsicPaddingBefore;
- int m_intrinsicPaddingAfter;
- int m_intrinsicPaddingStart;
- int m_intrinsicPaddingEnd;
- int m_overbarLeftPointShift;
- int m_indexTop;
+ bool isValid() const;
+ RenderBox& getBase() const;
+ RenderBox& getIndex() const;
+ bool isRenderMathMLRoot() const final { return true; }
+ const char* renderName() const final { return "RenderMathMLRoot"; }
+
+ void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final;
+
+ void computePreferredLogicalWidths() final;
+ void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final;
+ void paint(PaintInfo&, const LayoutPoint&) final;
+
+ struct HorizontalParameters {
+ LayoutUnit kernBeforeDegree;
+ LayoutUnit kernAfterDegree;
+ };
+ HorizontalParameters horizontalParameters();
+ struct VerticalParameters {
+ LayoutUnit verticalGap;
+ LayoutUnit ruleThickness;
+ LayoutUnit extraAscender;
+ float degreeBottomRaisePercent;
+ };
+ VerticalParameters verticalParameters();
+
+ MathOperator m_radicalOperator;
+ LayoutUnit m_radicalOperatorTop;
+ LayoutUnit m_baseWidth;
+
+ enum RootType { SquareRoot, RootWithIndex };
+ RootType m_kind;
+ bool isRenderMathMLSquareRoot() const final { return m_kind == SquareRoot; }
};
-
-}
-#endif // ENABLE(MATHML)
+} // namespace WebCore
-#endif // RenderMathMLRoot_h
+SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLRoot, isRenderMathMLRoot())
+
+#endif // ENABLE(MATHML)