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 |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU Library General Public License | 14 * You should have received a copy of the GNU Library General Public License |
15 * along with this library; see the file COPYING.LIB. If not, write to | 15 * along with this library; see the file COPYING.LIB. If not, write to |
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
18 * | 18 * |
19 */ | 19 */ |
20 | 20 |
21 #ifndef RenderBoxModelObject_h | 21 #ifndef RenderBoxModelObject_h |
22 #define RenderBoxModelObject_h | 22 #define RenderBoxModelObject_h |
23 | 23 |
24 #include "RenderObject.h" | 24 #include "RenderObject.h" |
25 | 25 |
26 namespace WebCore { | 26 namespace WebCore { |
27 | 27 |
28 // This class is the base for all objects that adhere to the CSS box model as de
scribed | |
29 // at http://www.w3.org/TR/CSS21/box.html | |
30 | |
31 class RenderBoxModelObject : public RenderObject { | 28 class RenderBoxModelObject : public RenderObject { |
32 public: | 29 public: |
33 RenderBoxModelObject(Node*); | 30 RenderBoxModelObject(Node*); |
34 virtual ~RenderBoxModelObject(); | 31 virtual ~RenderBoxModelObject(); |
35 | |
36 virtual void destroy(); | |
37 | |
38 int relativePositionOffsetX() const; | |
39 int relativePositionOffsetY() const; | |
40 IntSize relativePositionOffset() const { return IntSize(relativePositionOffs
etX(), relativePositionOffsetY()); } | |
41 | |
42 virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle); | |
43 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); | |
44 virtual void updateBoxModelInfoFromStyle(); | |
45 | |
46 RenderLayer* layer() const { return m_layer; } | |
47 virtual bool requiresLayer() const { return isRoot() || isPositioned() || is
RelPositioned() || isTransparent() || hasOverflowClip() || hasTransform() || has
Mask() || hasReflection(); } | |
48 | |
49 private: | |
50 virtual bool isBoxModelObject() const { return true; } | |
51 | |
52 friend class RenderView; | |
53 | |
54 RenderLayer* m_layer; | |
55 | |
56 // Used to store state between styleWillChange and styleDidChange | |
57 static bool s_wasFloating; | |
58 }; | 32 }; |
59 | 33 |
60 inline RenderBoxModelObject* toRenderBoxModelObject(RenderObject* o) | |
61 { | |
62 ASSERT(!o || o->isBoxModelObject()); | |
63 return static_cast<RenderBoxModelObject*>(o); | |
64 } | |
65 | |
66 inline const RenderBoxModelObject* toRenderBoxModelObject(const RenderObject* o) | |
67 { | |
68 ASSERT(!o || o->isBoxModelObject()); | |
69 return static_cast<const RenderBoxModelObject*>(o); | |
70 } | |
71 | |
72 // This will catch anyone doing an unnecessary cast. | |
73 void toRenderBoxModelObject(const RenderBox*); | |
74 | |
75 } // namespace WebCore | 34 } // namespace WebCore |
76 | 35 |
77 #endif // RenderBoxModelObject_h | 36 #endif // RenderBoxModelObject_h |
OLD | NEW |