OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void setFrameRect(const LayoutRect& frameRect) { ASSERT(!isInPlacedTree());
m_frameRect = frameRect; } | 77 void setFrameRect(const LayoutRect& frameRect) { ASSERT(!isInPlacedTree());
m_frameRect = frameRect; } |
78 | 78 |
79 int paginationStrut() const { return m_paginationStrut; } | 79 int paginationStrut() const { return m_paginationStrut; } |
80 void setPaginationStrut(int strut) { m_paginationStrut = strut; } | 80 void setPaginationStrut(int strut) { m_paginationStrut = strut; } |
81 | 81 |
82 #ifndef NDEBUG | 82 #ifndef NDEBUG |
83 bool isInPlacedTree() const { return m_isInPlacedTree; } | 83 bool isInPlacedTree() const { return m_isInPlacedTree; } |
84 void setIsInPlacedTree(bool value) { m_isInPlacedTree = value; } | 84 void setIsInPlacedTree(bool value) { m_isInPlacedTree = value; } |
85 #endif | 85 #endif |
86 | 86 |
| 87 bool isOverhangingOrIntruding() const { return m_isOverhangingOrIntruding; } |
| 88 void setIsOverhangingOrIntruding(bool value) { m_isOverhangingOrIntruding =
value; } |
| 89 |
87 bool shouldPaint() const { return m_shouldPaint; } | 90 bool shouldPaint() const { return m_shouldPaint; } |
88 void setShouldPaint(bool shouldPaint) { m_shouldPaint = shouldPaint; } | 91 void setShouldPaint(bool shouldPaint) { m_shouldPaint = shouldPaint; } |
89 bool isDescendant() const { return m_isDescendant; } | 92 bool isDescendant() const { return m_isDescendant; } |
90 void setIsDescendant(bool isDescendant) { m_isDescendant = isDescendant; } | 93 void setIsDescendant(bool isDescendant) { m_isDescendant = isDescendant; } |
91 | 94 |
92 // FIXME: Callers of these methods are dangerous and should be whitelisted e
xplicitly or removed. | 95 // FIXME: Callers of these methods are dangerous and should be whitelisted e
xplicitly or removed. |
93 RootInlineBox* originatingLine() const { return m_originatingLine; } | 96 RootInlineBox* originatingLine() const { return m_originatingLine; } |
94 void setOriginatingLine(RootInlineBox* line) { m_originatingLine = line; } | 97 void setOriginatingLine(RootInlineBox* line) { m_originatingLine = line; } |
95 | 98 |
96 private: | 99 private: |
97 explicit FloatingObject(RenderBox*); | 100 explicit FloatingObject(RenderBox*); |
98 FloatingObject(RenderBox*, Type, const LayoutRect&, bool shouldPaint, bool i
sDescendant); | 101 FloatingObject(RenderBox*, Type, const LayoutRect&, bool shouldPaint, bool i
sDescendant); |
99 | 102 |
100 RenderBox* m_renderer; | 103 RenderBox* m_renderer; |
101 RootInlineBox* m_originatingLine; | 104 RootInlineBox* m_originatingLine; |
102 LayoutRect m_frameRect; | 105 LayoutRect m_frameRect; |
103 int m_paginationStrut; // FIXME: Is this class size-sensitive? Does this nee
d 32-bits? | 106 int m_paginationStrut; // FIXME: Is this class size-sensitive? Does this nee
d 32-bits? |
104 | 107 |
105 unsigned m_type : 2; // Type (left or right aligned) | 108 unsigned m_type : 2; // Type (left or right aligned) |
106 unsigned m_shouldPaint : 1; | 109 unsigned m_shouldPaint : 1; |
107 unsigned m_isDescendant : 1; | 110 unsigned m_isDescendant : 1; |
108 unsigned m_isPlaced : 1; | 111 unsigned m_isPlaced : 1; |
109 #ifndef NDEBUG | 112 #ifndef NDEBUG |
110 unsigned m_isInPlacedTree : 1; | 113 unsigned m_isInPlacedTree : 1; |
111 #endif | 114 #endif |
| 115 unsigned m_isOverhangingOrIntruding : 1; |
112 }; | 116 }; |
113 | 117 |
114 struct FloatingObjectHashFunctions { | 118 struct FloatingObjectHashFunctions { |
115 static unsigned hash(FloatingObject* key) { return DefaultHash<RenderBox*>::
Hash::hash(key->renderer()); } | 119 static unsigned hash(FloatingObject* key) { return DefaultHash<RenderBox*>::
Hash::hash(key->renderer()); } |
116 static bool equal(FloatingObject* a, FloatingObject* b) { return a->renderer
() == b->renderer(); } | 120 static bool equal(FloatingObject* a, FloatingObject* b) { return a->renderer
() == b->renderer(); } |
117 static const bool safeToCompareToEmptyOrDeleted = true; | 121 static const bool safeToCompareToEmptyOrDeleted = true; |
118 }; | 122 }; |
119 struct FloatingObjectHashTranslator { | 123 struct FloatingObjectHashTranslator { |
120 static unsigned hash(RenderBox* key) { return DefaultHash<RenderBox*>::Hash:
:hash(key); } | 124 static unsigned hash(RenderBox* key) { return DefaultHash<RenderBox*>::Hash:
:hash(key); } |
121 static bool equal(FloatingObject* a, RenderBox* b) { return a->renderer() ==
b; } | 125 static bool equal(FloatingObject* a, RenderBox* b) { return a->renderer() ==
b; } |
122 }; | 126 }; |
123 typedef ListHashSet<FloatingObject*, 4, FloatingObjectHashFunctions> FloatingObj
ectSet; | 127 typedef ListHashSet<FloatingObject*, 4, FloatingObjectHashFunctions> FloatingObj
ectSet; |
124 typedef FloatingObjectSet::const_iterator FloatingObjectSetIterator; | 128 typedef FloatingObjectSet::const_iterator FloatingObjectSetIterator; |
125 typedef PODInterval<int, FloatingObject*> FloatingObjectInterval; | 129 typedef PODInterval<int, FloatingObject*> FloatingObjectInterval; |
126 typedef PODIntervalTree<int, FloatingObject*> FloatingObjectTree; | 130 typedef PODIntervalTree<int, FloatingObject*> FloatingObjectTree; |
127 typedef PODFreeListArena<PODRedBlackTree<FloatingObjectInterval>::Node> Interval
Arena; | 131 typedef PODFreeListArena<PODRedBlackTree<FloatingObjectInterval>::Node> Interval
Arena; |
128 typedef HashMap<RenderBox*, FloatingObject*> RendererToFloatInfoMap; | 132 typedef HashMap<RenderBox*, FloatingObject*> RendererToFloatInfoMap; |
129 | 133 |
130 class FloatingObjects { | 134 class FloatingObjects { |
131 WTF_MAKE_NONCOPYABLE(FloatingObjects); WTF_MAKE_FAST_ALLOCATED; | 135 WTF_MAKE_NONCOPYABLE(FloatingObjects); WTF_MAKE_FAST_ALLOCATED; |
132 public: | 136 public: |
133 FloatingObjects(const RenderBlockFlow*, bool horizontalWritingMode); | 137 FloatingObjects(const RenderBlockFlow*, bool horizontalWritingMode); |
134 ~FloatingObjects(); | 138 ~FloatingObjects(); |
135 | 139 |
136 void clear(); | 140 void clear(); |
| 141 void clearOverhangingAndIntrudingFloats(); |
137 void moveAllToFloatInfoMap(RendererToFloatInfoMap&); | 142 void moveAllToFloatInfoMap(RendererToFloatInfoMap&); |
138 FloatingObject* add(PassOwnPtr<FloatingObject>); | 143 FloatingObject* add(PassOwnPtr<FloatingObject>); |
| 144 FloatingObject* addOverhangingOrIntrudingFloat(PassOwnPtr<FloatingObject>); |
139 void remove(FloatingObject*); | 145 void remove(FloatingObject*); |
140 void addPlacedObject(FloatingObject*); | 146 void addPlacedObject(FloatingObject*); |
141 void removePlacedObject(FloatingObject*); | 147 void removePlacedObject(FloatingObject*); |
142 void setHorizontalWritingMode(bool b = true) { m_horizontalWritingMode = b;
} | 148 void setHorizontalWritingMode(bool b = true) { m_horizontalWritingMode = b;
} |
143 | 149 |
144 bool hasLeftObjects() const { return m_leftObjectsCount > 0; } | 150 bool hasLeftObjects() const { return m_leftObjectsCount > 0; } |
145 bool hasRightObjects() const { return m_rightObjectsCount > 0; } | 151 bool hasRightObjects() const { return m_rightObjectsCount > 0; } |
146 const FloatingObjectSet& set() const { return m_set; } | 152 const FloatingObjectSet& set() const { return m_set; } |
147 void clearLineBoxTreePointers(); | 153 void clearLineBoxTreePointers(); |
148 | 154 |
(...skipping 16 matching lines...) Expand all Loading... |
165 { | 171 { |
166 if (!m_placedFloatsTree.isInitialized()) | 172 if (!m_placedFloatsTree.isInitialized()) |
167 computePlacedFloatsTree(); | 173 computePlacedFloatsTree(); |
168 return m_placedFloatsTree; | 174 return m_placedFloatsTree; |
169 } | 175 } |
170 void increaseObjectsCount(FloatingObject::Type); | 176 void increaseObjectsCount(FloatingObject::Type); |
171 void decreaseObjectsCount(FloatingObject::Type); | 177 void decreaseObjectsCount(FloatingObject::Type); |
172 FloatingObjectInterval intervalForFloatingObject(FloatingObject*); | 178 FloatingObjectInterval intervalForFloatingObject(FloatingObject*); |
173 | 179 |
174 FloatingObjectSet m_set; | 180 FloatingObjectSet m_set; |
| 181 FloatingObjectSet m_overhangingOrIntrudingSet; |
175 FloatingObjectTree m_placedFloatsTree; | 182 FloatingObjectTree m_placedFloatsTree; |
176 unsigned m_leftObjectsCount; | 183 unsigned m_leftObjectsCount; |
177 unsigned m_rightObjectsCount; | 184 unsigned m_rightObjectsCount; |
178 bool m_horizontalWritingMode; | 185 bool m_horizontalWritingMode; |
179 const RenderBlockFlow* m_renderer; | 186 const RenderBlockFlow* m_renderer; |
180 | 187 |
181 struct FloatBottomCachedValue { | 188 struct FloatBottomCachedValue { |
182 FloatBottomCachedValue(); | 189 FloatBottomCachedValue(); |
183 LayoutUnit value; | 190 LayoutUnit value; |
184 bool dirty; | 191 bool dirty; |
185 }; | 192 }; |
186 FloatBottomCachedValue m_lowestFloatBottomCache[2]; | 193 FloatBottomCachedValue m_lowestFloatBottomCache[2]; |
187 bool m_cachedHorizontalWritingMode; | 194 bool m_cachedHorizontalWritingMode; |
188 }; | 195 }; |
189 | 196 |
190 #ifndef NDEBUG | 197 #ifndef NDEBUG |
191 // These structures are used by PODIntervalTree for debugging purposes. | 198 // These structures are used by PODIntervalTree for debugging purposes. |
192 template <> struct ValueToString<int> { | 199 template <> struct ValueToString<int> { |
193 static String string(const int value); | 200 static String string(const int value); |
194 }; | 201 }; |
195 template<> struct ValueToString<FloatingObject*> { | 202 template<> struct ValueToString<FloatingObject*> { |
196 static String string(const FloatingObject*); | 203 static String string(const FloatingObject*); |
197 }; | 204 }; |
198 #endif | 205 #endif |
199 | 206 |
200 } // namespace WebCore | 207 } // namespace WebCore |
201 | 208 |
202 #endif // FloatingObjects_h | 209 #endif // FloatingObjects_h |
OLD | NEW |