RenderBoxModelObject.h [plain text]
#ifndef RenderBoxModelObject_h
#define RenderBoxModelObject_h
#include "RenderObject.h"
namespace WebCore {
const int PositionTop = -0x7fffffff;
const int PositionBottom = 0x7fffffff;
const int PositionUndefined = 0x80000000;
class RenderBoxModelObject : public RenderObject {
public:
RenderBoxModelObject(Node*);
virtual ~RenderBoxModelObject();
virtual void destroy();
int relativePositionOffsetX() const;
int relativePositionOffsetY() const;
IntSize relativePositionOffset() const { return IntSize(relativePositionOffsetX(), relativePositionOffsetY()); }
virtual int offsetLeft() const;
virtual int offsetTop() const;
virtual int offsetWidth() const = 0;
virtual int offsetHeight() const = 0;
virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
virtual void updateBoxModelInfoFromStyle();
bool hasSelfPaintingLayer() const;
RenderLayer* layer() const { return m_layer; }
virtual bool requiresLayer() const { return isRoot() || isPositioned() || isRelPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || hasMask() || hasReflection() || style()->specifiesColumns(); }
virtual IntRect borderBoundingBox() const = 0;
virtual int paddingTop(bool includeIntrinsicPadding = true) const;
virtual int paddingBottom(bool includeIntrinsicPadding = true) const;
virtual int paddingLeft(bool includeIntrinsicPadding = true) const;
virtual int paddingRight(bool includeIntrinsicPadding = true) const;
virtual int borderTop() const { return style()->borderTopWidth(); }
virtual int borderBottom() const { return style()->borderBottomWidth(); }
virtual int borderLeft() const { return style()->borderLeftWidth(); }
virtual int borderRight() const { return style()->borderRightWidth(); }
virtual int marginTop() const = 0;
virtual int marginBottom() const = 0;
virtual int marginLeft() const = 0;
virtual int marginRight() const = 0;
bool hasHorizontalBordersPaddingOrMargin() const { return hasHorizontalBordersOrPadding() || marginLeft() != 0 || marginRight() != 0; }
bool hasHorizontalBordersOrPadding() const { return borderLeft() != 0 || borderRight() != 0 || paddingLeft() != 0 || paddingRight() != 0; }
virtual int containingBlockWidthForContent() const;
virtual void childBecameNonInline(RenderObject* ) { }
void paintBorder(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, bool begin = true, bool end = true);
bool paintNinePieceImage(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, const NinePieceImage&, CompositeOperator = CompositeSourceOver);
void paintBoxShadow(GraphicsContext*, int tx, int ty, int w, int h, const RenderStyle*, ShadowStyle, bool begin = true, bool end = true);
void paintFillLayerExtended(const PaintInfo&, const Color&, const FillLayer*, int tx, int ty, int width, int height, InlineFlowBox* = 0, CompositeOperator = CompositeSourceOver, RenderObject* backgroundObject = 0);
int verticalPosition(bool firstLine) const;
void destroyLayer();
void highQualityRepaintTimerFired(Timer<RenderBoxModelObject>*);
protected:
void calculateBackgroundImageGeometry(const FillLayer*, int tx, int ty, int w, int h, IntRect& destRect, IntPoint& phase, IntSize& tileSize);
private:
virtual bool isBoxModelObject() const { return true; }
IntSize calculateFillTileSize(const FillLayer*, IntSize scaledSize) const;
friend class RenderView;
RenderLayer* m_layer;
static bool s_wasFloating;
static bool s_hadLayer;
static bool s_layerWasSelfPainting;
};
inline RenderBoxModelObject* toRenderBoxModelObject(RenderObject* object)
{
ASSERT(!object || object->isBoxModelObject());
return static_cast<RenderBoxModelObject*>(object);
}
inline const RenderBoxModelObject* toRenderBoxModelObject(const RenderObject* object)
{
ASSERT(!object || object->isBoxModelObject());
return static_cast<const RenderBoxModelObject*>(object);
}
void toRenderBoxModelObject(const RenderBoxModelObject*);
}
#endif // RenderBoxModelObject_h