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(Node*, 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 LayoutUnit baselinePosition(FontBaseline, bool firstLine, LineDirectionMode, LinePositionMode = PositionOnContainingLine) const;
protected:
virtual void computePreferredLogicalWidths() OVERRIDE;
PassRefPtr<RenderStyle> createStackableStyle(int lineHeight, int maxHeightForRenderer, int topRelative);
RenderBlock* createGlyph(UChar glyph, int lineHeight, int maxHeightForRenderer = 0, int charRelative = 0, int topRelative = 0);
private:
virtual const char* renderName() const { return isAnonymous() ? "RenderMathMLOperator (anonymous)" : "RenderMathMLOperator"; }
int glyphHeightForCharacter(UChar);
int lineHeightForCharacter(UChar);
int m_stretchHeight;
bool m_isStacked;
UChar m_operator;
};
inline RenderMathMLOperator* toRenderMathMLOperator(RenderMathMLBlock* block)
{
ASSERT(!block || block->isRenderMathMLOperator());
return static_cast<RenderMathMLOperator*>(block);
}
inline const RenderMathMLOperator* toRenderMathMLOperator(const RenderMathMLBlock* block)
{
ASSERT(!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