diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/rendering/mathml/RenderMathMLFraction.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/WebCore/rendering/mathml/RenderMathMLFraction.h')
-rw-r--r-- | Source/WebCore/rendering/mathml/RenderMathMLFraction.h | 61 |
1 files changed, 40 insertions, 21 deletions
diff --git a/Source/WebCore/rendering/mathml/RenderMathMLFraction.h b/Source/WebCore/rendering/mathml/RenderMathMLFraction.h index 9c21d9cb9..0ad9dffaa 100644 --- a/Source/WebCore/rendering/mathml/RenderMathMLFraction.h +++ b/Source/WebCore/rendering/mathml/RenderMathMLFraction.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2009 Alex Milowski (alex@milowski.com). All rights reserved. * Copyright (C) 2010 François Sausset (sausset@gmail.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 @@ -24,44 +25,62 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef RenderMathMLFraction_h -#define RenderMathMLFraction_h +#pragma once #if ENABLE(MATHML) -#include "MathMLInlineContainerElement.h" +#include "MathMLFractionElement.h" #include "RenderMathMLBlock.h" namespace WebCore { +class MathMLFractionElement; + class RenderMathMLFraction final : public RenderMathMLBlock { public: - RenderMathMLFraction(MathMLInlineContainerElement&, PassRef<RenderStyle>); + RenderMathMLFraction(MathMLFractionElement&, RenderStyle&&); - MathMLInlineContainerElement& element() { return static_cast<MathMLInlineContainerElement&>(nodeForNonAnonymous()); } - float lineThickness() const { return m_lineThickness; } + float relativeLineThickness() const { return m_defaultLineThickness ? m_lineThickness / m_defaultLineThickness : LayoutUnit(0); } private: - virtual bool isRenderMathMLFraction() const override { return true; } - virtual const char* renderName() const override { return "RenderMathMLFraction"; } + bool isRenderMathMLFraction() const final { return true; } + const char* renderName() const final { return "RenderMathMLFraction"; } + + void computePreferredLogicalWidths() final; + void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final; + std::optional<int> firstLineBaseline() const final; + void paint(PaintInfo&, const LayoutPoint&) final; + RenderMathMLOperator* unembellishedOperator() final; - virtual void addChild(RenderObject* child, RenderObject* beforeChild) override; - virtual void updateFromElement() override; - virtual int firstLineBaseline() const override; - virtual void paint(PaintInfo&, const LayoutPoint&) override; - virtual RenderMathMLOperator* unembellishedOperator() override; - virtual void layout() override; - virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override; + MathMLFractionElement& element() const { return static_cast<MathMLFractionElement&>(nodeForNonAnonymous()); } - void fixChildStyle(RenderObject*); - + bool isStack() const { return !m_lineThickness; } + bool isValid() const; + RenderBox& numerator() const; + RenderBox& denominator() const; + LayoutUnit horizontalOffset(RenderBox&, MathMLFractionElement::FractionAlignment); + void updateLineThickness(); + struct FractionParameters { + LayoutUnit numeratorGapMin; + LayoutUnit denominatorGapMin; + LayoutUnit numeratorMinShiftUp; + LayoutUnit denominatorMinShiftDown; + }; + FractionParameters fractionParameters(); + struct StackParameters { + LayoutUnit gapMin; + LayoutUnit topShiftUp; + LayoutUnit bottomShiftDown; + }; + StackParameters stackParameters(); + + LayoutUnit m_ascent; + LayoutUnit m_defaultLineThickness { 1 }; LayoutUnit m_lineThickness; }; -RENDER_OBJECT_TYPE_CASTS(RenderMathMLFraction, isRenderMathMLFraction()); +} // namespace WebCore -} +SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLFraction, isRenderMathMLFraction()) #endif // ENABLE(MATHML) - -#endif // RenderMathMLFraction_h |