RenderMathMLOperator.h [plain text]
#ifndef RenderMathMLOperator_h
#define RenderMathMLOperator_h
#if ENABLE(MATHML)
#include "RenderMathMLBlock.h"
#include <wtf/unicode/CharacterNames.h>
namespace WebCore {
class RenderMathMLOperator : public RenderMathMLBlock {
public:
RenderMathMLOperator(Element*);
RenderMathMLOperator(Element*, UChar operatorChar);
virtual bool isRenderMathMLOperator() const { return true; }
virtual bool isChildAllowed(RenderObject*, RenderStyle*) const;
virtual void updateFromElement() OVERRIDE;
virtual RenderMathMLOperator* unembellishedOperator() OVERRIDE { return this; }
void stretchToHeight(int pixelHeight);
virtual int firstLineBoxBaseline() const OVERRIDE;
enum OperatorType { Default, Separator, Fence };
void setOperatorType(OperatorType type) { m_operatorType = type; }
OperatorType operatorType() const { return m_operatorType; }
protected:
virtual void computePreferredLogicalWidths() OVERRIDE;
PassRefPtr<RenderStyle> createStackableStyle(int maxHeightForRenderer);
RenderBlock* createGlyph(UChar glyph, int maxHeightForRenderer, int charRelative);
private:
virtual const char* renderName() const { return isAnonymous() ? "RenderMathMLOperator (anonymous)" : "RenderMathMLOperator"; }
int glyphHeightForCharacter(UChar);
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE;
int m_stretchHeight;
bool m_isStacked;
UChar m_operator;
OperatorType m_operatorType;
};
inline RenderMathMLOperator* toRenderMathMLOperator(RenderMathMLBlock* block)
{
ASSERT_WITH_SECURITY_IMPLICATION(!block || block->isRenderMathMLOperator());
return static_cast<RenderMathMLOperator*>(block);
}
inline const RenderMathMLOperator* toRenderMathMLOperator(const RenderMathMLBlock* block)
{
ASSERT_WITH_SECURITY_IMPLICATION(!block || block->isRenderMathMLOperator());
return static_cast<const RenderMathMLOperator*>(block);
}
void toRenderMathMLOperator(const RenderMathMLOperator*);
inline UChar convertHyphenMinusToMinusSign(UChar glyph)
{
if (glyph == hyphenMinus)
return minusSign;
return glyph;
}
}
#endif // ENABLE(MATHML)
#endif // RenderMathMLOperator_h