RenderMathMLBlock.h [plain text]
#ifndef RenderMathMLBlock_h
#define RenderMathMLBlock_h
#if ENABLE(MATHML)
#include "RenderBlock.h"
#define ENABLE_DEBUG_MATH_LAYOUT 0
namespace WebCore {
class RenderMathMLOperator;
class RenderMathMLBlock : public RenderBlock {
public:
RenderMathMLBlock(Node* container);
virtual bool isChildAllowed(RenderObject*, RenderStyle*) const;
virtual bool isRenderMathMLBlock() const { return true; }
virtual bool isRenderMathMLOperator() const { return false; }
virtual bool isRenderMathMLRow() const { return false; }
virtual bool isRenderMathMLMath() const { return false; }
virtual RenderMathMLOperator* unembellishedOperator() { return 0; }
virtual LayoutUnit paddingTop() const OVERRIDE;
virtual LayoutUnit paddingBottom() const OVERRIDE;
virtual LayoutUnit paddingLeft() const OVERRIDE;
virtual LayoutUnit paddingRight() const OVERRIDE;
virtual LayoutUnit paddingBefore() const OVERRIDE;
virtual LayoutUnit paddingAfter() const OVERRIDE;
virtual LayoutUnit paddingStart() const OVERRIDE;
virtual LayoutUnit paddingEnd() const OVERRIDE;
bool isPreferredLogicalHeightDirty() const { return preferredLogicalWidthsDirty() || m_preferredLogicalHeight < 0; }
LayoutUnit preferredLogicalHeight() const { ASSERT(!isPreferredLogicalHeightDirty()); return m_preferredLogicalHeight; }
static const int preferredLogicalHeightUnset = -1;
void setPreferredLogicalHeight(LayoutUnit logicalHeight) { m_preferredLogicalHeight = logicalHeight; }
virtual void computePreferredLogicalWidths() OVERRIDE;
#if ENABLE(DEBUG_MATH_LAYOUT)
virtual void paint(PaintInfo&, const LayoutPoint&);
#endif
RenderMathMLBlock* createAlmostAnonymousBlock(EDisplay = BLOCK);
protected:
static LayoutUnit getBoxModelObjectHeight(const RenderObject* object)
{
if (object && object->isBoxModelObject()) {
const RenderBoxModelObject* box = toRenderBoxModelObject(object);
return box->offsetHeight();
}
return 0;
}
static LayoutUnit getBoxModelObjectWidth(const RenderObject* object)
{
if (object && object->isBoxModelObject()) {
const RenderBoxModelObject* box = toRenderBoxModelObject(object);
return box->offsetWidth();
}
return 0;
}
private:
virtual const char* renderName() const { return isAnonymous() ? "RenderMathMLBlock (anonymous)" : "RenderMathMLBlock"; }
protected:
void computeChildrenPreferredLogicalHeights();
static LayoutUnit preferredLogicalHeightAfterSizing(RenderObject* child);
int m_intrinsicPaddingBefore;
int m_intrinsicPaddingAfter;
int m_intrinsicPaddingStart;
int m_intrinsicPaddingEnd;
LayoutUnit m_preferredLogicalHeight;
};
inline RenderMathMLBlock* toRenderMathMLBlock(RenderObject* object)
{
ASSERT(!object || object->isRenderMathMLBlock());
return static_cast<RenderMathMLBlock*>(object);
}
inline const RenderMathMLBlock* toRenderMathMLBlock(const RenderObject* object)
{
ASSERT(!object || object->isRenderMathMLBlock());
return static_cast<const RenderMathMLBlock*>(object);
}
void toRenderMathMLBlock(const RenderMathMLBlock*);
}
#endif // ENABLE(MATHML)
#endif // RenderMathMLBlock_h