RenderMathMLOperator.h [plain text]
#pragma once
#if ENABLE(MATHML)
#include "MathMLElement.h"
#include "MathMLOperatorDictionary.h"
#include "MathOperator.h"
#include "RenderMathMLToken.h"
namespace WebCore {
class RenderMathMLOperator final : public RenderMathMLToken {
public:
RenderMathMLOperator(MathMLElement&, RenderStyle&&);
RenderMathMLOperator(Document&, RenderStyle&&, const String& operatorString, MathMLOperatorDictionary::Form, unsigned short flags = 0);
void stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline);
void stretchTo(LayoutUnit width);
LayoutUnit stretchSize() const { return m_isVertical ? m_stretchHeightAboveBaseline + m_stretchDepthBelowBaseline : m_stretchWidth; }
void resetStretchSize();
bool hasOperatorFlag(MathMLOperatorDictionary::Flag flag) const { return m_operatorFlags & flag; }
bool isLargeOperatorInDisplayStyle() const { return !hasOperatorFlag(MathMLOperatorDictionary::Stretchy) && hasOperatorFlag(MathMLOperatorDictionary::LargeOp) && mathMLStyle()->displayStyle(); }
bool shouldMoveLimits() const { return hasOperatorFlag(MathMLOperatorDictionary::MovableLimits) && !mathMLStyle()->displayStyle(); }
bool isVertical() const { return m_isVertical; }
LayoutUnit italicCorrection() const { return m_mathOperator.italicCorrection(); }
void updateTokenContent(const String& operatorString);
void updateTokenContent() final;
void updateOperatorProperties();
void updateFromElement() final;
UChar textContent() const { return m_textContent; }
private:
virtual void setOperatorProperties();
void styleDidChange(StyleDifference, const RenderStyle* oldStyle) final;
void computePreferredLogicalWidths() final;
void layoutBlock(bool relayoutChildren, LayoutUnit pageLogicalHeight = 0) final;
void paint(PaintInfo&, const LayoutPoint&) final;
void setLeadingSpace(LayoutUnit leadingSpace) { m_leadingSpace = leadingSpace; }
void setTrailingSpace(LayoutUnit trailingSpace) { m_trailingSpace = trailingSpace; }
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 { return 0x2061 <= m_textContent && m_textContent <= 0x2064; }
Optional<int> firstLineBaseline() const final;
RenderMathMLOperator* unembellishedOperator() final { return this; }
void rebuildTokenContent(const String& operatorString);
bool shouldAllowStretching() const;
bool useMathOperator() const;
void setOperatorFlagFromAttribute(MathMLOperatorDictionary::Flag, const QualifiedName&);
void setOperatorFlagFromAttributeValue(MathMLOperatorDictionary::Flag, const AtomicString& attributeValue);
void setOperatorPropertiesFromOpDictEntry(const MathMLOperatorDictionary::Entry*);
LayoutUnit verticalStretchedOperatorShift() const;
LayoutUnit m_stretchHeightAboveBaseline;
LayoutUnit m_stretchDepthBelowBaseline;
LayoutUnit m_stretchWidth;
UChar m_textContent;
bool m_isVertical;
MathMLOperatorDictionary::Form m_operatorForm;
unsigned short m_operatorFlags;
LayoutUnit m_leadingSpace;
LayoutUnit m_trailingSpace;
LayoutUnit m_minSize;
LayoutUnit m_maxSize;
MathOperator m_mathOperator;
};
}
SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLOperator, isRenderMathMLOperator())
#endif // ENABLE(MATHML)