RenderMathMLOperator.h [plain text]
#pragma once
#if ENABLE(MATHML)
#include "MathMLOperatorDictionary.h"
#include "MathOperator.h"
#include "RenderMathMLToken.h"
namespace WebCore {
class MathMLOperatorElement;
class RenderMathMLOperator : public RenderMathMLToken {
public:
RenderMathMLOperator(MathMLOperatorElement&, RenderStyle&&);
RenderMathMLOperator(Document&, RenderStyle&&);
MathMLOperatorElement& element() const;
void stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline);
void stretchTo(LayoutUnit width);
LayoutUnit stretchSize() const { return isVertical() ? m_stretchHeightAboveBaseline + m_stretchDepthBelowBaseline : m_stretchWidth; }
void resetStretchSize();
virtual bool hasOperatorFlag(MathMLOperatorDictionary::Flag) const;
bool isLargeOperatorInDisplayStyle() const { return !hasOperatorFlag(MathMLOperatorDictionary::Stretchy) && hasOperatorFlag(MathMLOperatorDictionary::LargeOp) && mathMLStyle().displayStyle(); }
bool shouldMoveLimits() const { return hasOperatorFlag(MathMLOperatorDictionary::MovableLimits) && !mathMLStyle().displayStyle(); }
virtual bool isVertical() const;
LayoutUnit italicCorrection() const { return m_mathOperator.italicCorrection(); }
void updateTokenContent() final;
void updateFromElement() final;
virtual UChar32 textContent() const;
bool isStretchy() const { return textContent() && hasOperatorFlag(MathMLOperatorDictionary::Stretchy); }
protected:
virtual void updateMathOperator();
virtual LayoutUnit leadingSpace() const;
virtual LayoutUnit trailingSpace() const;
virtual LayoutUnit minSize() const;
virtual LayoutUnit maxSize() const;
virtual bool useMathOperator() const;
private:
void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final;
void computePreferredLogicalWidths() final;
void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final;
void paint(PaintInfo&, const LayoutPoint&) final;
const char* renderName() const final { return isAnonymous() ? "RenderMathMLOperator (anonymous)" : "RenderMathMLOperator"; }
void paintChildren(PaintInfo& forSelf, const LayoutPoint&, PaintInfo& forChild, bool usePrintRect) final;
bool isRenderMathMLOperator() const final { return true; }
bool isInvisibleOperator() const;
std::optional<int> firstLineBaseline() const final;
RenderMathMLOperator* unembellishedOperator() final { return this; }
LayoutUnit verticalStretchedOperatorShift() const;
LayoutUnit m_stretchHeightAboveBaseline { 0 };
LayoutUnit m_stretchDepthBelowBaseline { 0 };
LayoutUnit m_stretchWidth;
MathOperator m_mathOperator;
};
}
SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLOperator, isRenderMathMLOperator())
#endif // ENABLE(MATHML)