OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 21 matching lines...) Expand all Loading... |
32 public: | 32 public: |
33 RenderBoxModelObject(Node*); | 33 RenderBoxModelObject(Node*); |
34 virtual ~RenderBoxModelObject(); | 34 virtual ~RenderBoxModelObject(); |
35 | 35 |
36 virtual void destroy(); | 36 virtual void destroy(); |
37 | 37 |
38 int relativePositionOffsetX() const; | 38 int relativePositionOffsetX() const; |
39 int relativePositionOffsetY() const; | 39 int relativePositionOffsetY() const; |
40 IntSize relativePositionOffset() const { return IntSize(relativePositionOffs
etX(), relativePositionOffsetY()); } | 40 IntSize relativePositionOffset() const { return IntSize(relativePositionOffs
etX(), relativePositionOffsetY()); } |
41 | 41 |
| 42 // IE extensions. Used to calculate offsetWidth/Height. Overridden by inlin
es (RenderFlow) |
| 43 // to return the remaining width on a given line (and the height of a single
line). |
| 44 virtual int offsetLeft() const; |
| 45 virtual int offsetTop() const; |
| 46 virtual int offsetWidth() const = 0; |
| 47 virtual int offsetHeight() const = 0; |
| 48 |
42 virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); | 49 virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); |
43 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); | 50 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); |
44 virtual void updateBoxModelInfoFromStyle(); | 51 virtual void updateBoxModelInfoFromStyle(); |
45 | 52 |
46 RenderLayer* layer() const { return m_layer; } | 53 RenderLayer* layer() const { return m_layer; } |
47 virtual bool requiresLayer() const { return isRoot() || isPositioned() || is
RelPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || has
Mask() || hasReflection(); } | 54 virtual bool requiresLayer() const { return isRoot() || isPositioned() || is
RelPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || has
Mask() || hasReflection(); } |
48 | 55 |
| 56 // This will work on inlines to return the bounding box of all of the lines'
border boxes. |
| 57 virtual IntRect borderBoundingBox() const = 0; |
| 58 |
| 59 // Virtual since table cells override |
| 60 virtual int paddingTop(bool includeIntrinsicPadding = true) const; |
| 61 virtual int paddingBottom(bool includeIntrinsicPadding = true) const; |
| 62 virtual int paddingLeft(bool includeIntrinsicPadding = true) const; |
| 63 virtual int paddingRight(bool includeIntrinsicPadding = true) const; |
| 64 |
| 65 virtual int borderTop() const { return style()->borderTopWidth(); } |
| 66 virtual int borderBottom() const { return style()->borderBottomWidth(); } |
| 67 virtual int borderLeft() const { return style()->borderLeftWidth(); } |
| 68 virtual int borderRight() const { return style()->borderRightWidth(); } |
| 69 |
| 70 virtual int marginTop() const = 0; |
| 71 virtual int marginBottom() const = 0; |
| 72 virtual int marginLeft() const = 0; |
| 73 virtual int marginRight() const = 0; |
| 74 |
| 75 bool hasHorizontalBordersPaddingOrMargin() const { return hasHorizontalBorde
rsOrPadding() || marginLeft() != 0 || marginRight() != 0; } |
| 76 bool hasHorizontalBordersOrPadding() const { return borderLeft() != 0 || bor
derRight() != 0 || paddingLeft() != 0 || paddingRight() != 0; } |
| 77 |
| 78 virtual void childBecameNonInline(RenderObject* /*child*/) { } |
| 79 |
| 80 virtual void paintFillLayerExtended(const PaintInfo&, const Color&, const Fi
llLayer*, int clipY, int clipHeight, |
| 81 int tx, int ty, int width, int height, I
nlineFlowBox* = 0, CompositeOperator = CompositeSourceOver); |
| 82 |
| 83 protected: |
| 84 void calculateBackgroundImageGeometry(const FillLayer*, int tx, int ty, int
w, int h, IntRect& destRect, IntPoint& phase, IntSize& tileSize); |
| 85 IntSize calculateBackgroundSize(const FillLayer*, int scaledWidth, int scale
dHeight) const; |
| 86 |
49 private: | 87 private: |
50 virtual bool isBoxModelObject() const { return true; } | 88 virtual bool isBoxModelObject() const { return true; } |
51 | |
52 friend class RenderView; | 89 friend class RenderView; |
53 | 90 |
54 RenderLayer* m_layer; | 91 RenderLayer* m_layer; |
55 | 92 |
56 // Used to store state between styleWillChange and styleDidChange | 93 // Used to store state between styleWillChange and styleDidChange |
57 static bool s_wasFloating; | 94 static bool s_wasFloating; |
58 }; | 95 }; |
59 | 96 |
60 inline RenderBoxModelObject* toRenderBoxModelObject(RenderObject* o) | 97 inline RenderBoxModelObject* toRenderBoxModelObject(RenderObject* o) |
61 { | 98 { |
62 ASSERT(!o || o->isBoxModelObject()); | 99 ASSERT(!o || o->isBoxModelObject()); |
63 return static_cast<RenderBoxModelObject*>(o); | 100 return static_cast<RenderBoxModelObject*>(o); |
64 } | 101 } |
65 | 102 |
66 inline const RenderBoxModelObject* toRenderBoxModelObject(const RenderObject* o) | 103 inline const RenderBoxModelObject* toRenderBoxModelObject(const RenderObject* o) |
67 { | 104 { |
68 ASSERT(!o || o->isBoxModelObject()); | 105 ASSERT(!o || o->isBoxModelObject()); |
69 return static_cast<const RenderBoxModelObject*>(o); | 106 return static_cast<const RenderBoxModelObject*>(o); |
70 } | 107 } |
71 | 108 |
72 // This will catch anyone doing an unnecessary cast. | 109 // This will catch anyone doing an unnecessary cast. |
73 void toRenderBoxModelObject(const RenderBox*); | 110 void toRenderBoxModelObject(const RenderBox*); |
74 | 111 |
75 } // namespace WebCore | 112 } // namespace WebCore |
76 | 113 |
77 #endif // RenderBoxModelObject_h | 114 #endif // RenderBoxModelObject_h |
OLD | NEW |