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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 #if ENABLE(ASSERT) | 81 #if ENABLE(ASSERT) |
82 bool isInPlacedTree() const { return m_isInPlacedTree; } | 82 bool isInPlacedTree() const { return m_isInPlacedTree; } |
83 void setIsInPlacedTree(bool value) { m_isInPlacedTree = value; } | 83 void setIsInPlacedTree(bool value) { m_isInPlacedTree = value; } |
84 #endif | 84 #endif |
85 | 85 |
86 bool shouldPaint() const { return m_shouldPaint; } | 86 bool shouldPaint() const { return m_shouldPaint; } |
87 void setShouldPaint(bool shouldPaint) { m_shouldPaint = shouldPaint; } | 87 void setShouldPaint(bool shouldPaint) { m_shouldPaint = shouldPaint; } |
88 bool isDescendant() const { return m_isDescendant; } | 88 bool isDescendant() const { return m_isDescendant; } |
89 void setIsDescendant(bool isDescendant) { m_isDescendant = isDescendant; } | 89 void setIsDescendant(bool isDescendant) { m_isDescendant = isDescendant; } |
| 90 bool isLowestNonOverhangingFloatInChild() const { return m_isLowestNonOverha
ngingFloatInChild; } |
| 91 void setIsLowestNonOverhangingFloatInChild(bool isLowestNonOverhangingFloatI
nChild) { m_isLowestNonOverhangingFloatInChild = isLowestNonOverhangingFloatInCh
ild; } |
90 | 92 |
91 // FIXME: Callers of these methods are dangerous and should be whitelisted e
xplicitly or removed. | 93 // FIXME: Callers of these methods are dangerous and should be whitelisted e
xplicitly or removed. |
92 RootInlineBox* originatingLine() const { return m_originatingLine; } | 94 RootInlineBox* originatingLine() const { return m_originatingLine; } |
93 void setOriginatingLine(RootInlineBox* line) { m_originatingLine = line; } | 95 void setOriginatingLine(RootInlineBox* line) { m_originatingLine = line; } |
94 | 96 |
95 private: | 97 private: |
96 explicit FloatingObject(LayoutBox*); | 98 explicit FloatingObject(LayoutBox*); |
97 FloatingObject(LayoutBox*, Type, const LayoutRect&, bool shouldPaint, bool i
sDescendant); | 99 FloatingObject(LayoutBox*, Type, const LayoutRect&, bool shouldPaint, bool i
sDescendant, bool isLowestNonOverhangingFloatInChild); |
98 | 100 |
99 LayoutBox* m_layoutObject; | 101 LayoutBox* m_layoutObject; |
100 RootInlineBox* m_originatingLine; | 102 RootInlineBox* m_originatingLine; |
101 LayoutRect m_frameRect; | 103 LayoutRect m_frameRect; |
102 int m_paginationStrut; // FIXME: Is this class size-sensitive? Does this nee
d 32-bits? | 104 int m_paginationStrut; // FIXME: Is this class size-sensitive? Does this nee
d 32-bits? |
103 | 105 |
104 unsigned m_type : 2; // Type (left or right aligned) | 106 unsigned m_type : 2; // Type (left or right aligned) |
105 unsigned m_shouldPaint : 1; | 107 unsigned m_shouldPaint : 1; |
106 unsigned m_isDescendant : 1; | 108 unsigned m_isDescendant : 1; |
107 unsigned m_isPlaced : 1; | 109 unsigned m_isPlaced : 1; |
| 110 unsigned m_isLowestNonOverhangingFloatInChild : 1; |
108 #if ENABLE(ASSERT) | 111 #if ENABLE(ASSERT) |
109 unsigned m_isInPlacedTree : 1; | 112 unsigned m_isInPlacedTree : 1; |
110 #endif | 113 #endif |
111 }; | 114 }; |
112 | 115 |
113 struct FloatingObjectHashFunctions { | 116 struct FloatingObjectHashFunctions { |
114 static unsigned hash(FloatingObject* key) { return DefaultHash<LayoutBox*>::
Hash::hash(key->layoutObject()); } | 117 static unsigned hash(FloatingObject* key) { return DefaultHash<LayoutBox*>::
Hash::hash(key->layoutObject()); } |
115 static unsigned hash(const OwnPtr<FloatingObject>& key) { return hash(key.ge
t()); } | 118 static unsigned hash(const OwnPtr<FloatingObject>& key) { return hash(key.ge
t()); } |
116 static unsigned hash(const PassOwnPtr<FloatingObject>& key) { return hash(ke
y.get()); } | 119 static unsigned hash(const PassOwnPtr<FloatingObject>& key) { return hash(ke
y.get()); } |
117 static bool equal(OwnPtr<FloatingObject>& a, FloatingObject* b) { return a->
layoutObject() == b->layoutObject(); } | 120 static bool equal(OwnPtr<FloatingObject>& a, FloatingObject* b) { return a->
layoutObject() == b->layoutObject(); } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 const FloatingObjectSet& set() const { return m_set; } | 154 const FloatingObjectSet& set() const { return m_set; } |
152 void clearLineBoxTreePointers(); | 155 void clearLineBoxTreePointers(); |
153 | 156 |
154 LayoutUnit logicalLeftOffset(LayoutUnit fixedOffset, LayoutUnit logicalTop,
LayoutUnit logicalHeight); | 157 LayoutUnit logicalLeftOffset(LayoutUnit fixedOffset, LayoutUnit logicalTop,
LayoutUnit logicalHeight); |
155 LayoutUnit logicalRightOffset(LayoutUnit fixedOffset, LayoutUnit logicalTop,
LayoutUnit logicalHeight); | 158 LayoutUnit logicalRightOffset(LayoutUnit fixedOffset, LayoutUnit logicalTop,
LayoutUnit logicalHeight); |
156 | 159 |
157 LayoutUnit logicalLeftOffsetForPositioningFloat(LayoutUnit fixedOffset, Layo
utUnit logicalTop, LayoutUnit* heightRemaining); | 160 LayoutUnit logicalLeftOffsetForPositioningFloat(LayoutUnit fixedOffset, Layo
utUnit logicalTop, LayoutUnit* heightRemaining); |
158 LayoutUnit logicalRightOffsetForPositioningFloat(LayoutUnit fixedOffset, Lay
outUnit logicalTop, LayoutUnit* heightRemaining); | 161 LayoutUnit logicalRightOffsetForPositioningFloat(LayoutUnit fixedOffset, Lay
outUnit logicalTop, LayoutUnit* heightRemaining); |
159 | 162 |
160 LayoutUnit lowestFloatLogicalBottom(FloatingObject::Type); | 163 LayoutUnit lowestFloatLogicalBottom(FloatingObject::Type); |
| 164 FloatingObject* lowestFloatingObject() const; |
161 | 165 |
162 private: | 166 private: |
163 bool hasLowestFloatLogicalBottomCached(bool isHorizontal, FloatingObject::Ty
pe floatType) const; | 167 bool hasLowestFloatLogicalBottomCached(bool isHorizontal, FloatingObject::Ty
pe floatType) const; |
164 LayoutUnit getCachedlowestFloatLogicalBottom(FloatingObject::Type floatType)
const; | 168 LayoutUnit getCachedlowestFloatLogicalBottom(FloatingObject::Type floatType)
const; |
165 void setCachedLowestFloatLogicalBottom(bool isHorizontal, FloatingObject::Ty
pe floatType, LayoutUnit value); | 169 void setCachedLowestFloatLogicalBottom(bool isHorizontal, FloatingObject::Ty
pe floatType, FloatingObject*); |
166 void markLowestFloatLogicalBottomCacheAsDirty(); | 170 void markLowestFloatLogicalBottomCacheAsDirty(); |
167 | 171 |
168 void computePlacedFloatsTree(); | 172 void computePlacedFloatsTree(); |
169 const FloatingObjectTree& placedFloatsTree() | 173 const FloatingObjectTree& placedFloatsTree() |
170 { | 174 { |
171 if (!m_placedFloatsTree.isInitialized()) | 175 if (!m_placedFloatsTree.isInitialized()) |
172 computePlacedFloatsTree(); | 176 computePlacedFloatsTree(); |
173 return m_placedFloatsTree; | 177 return m_placedFloatsTree; |
174 } | 178 } |
175 void increaseObjectsCount(FloatingObject::Type); | 179 void increaseObjectsCount(FloatingObject::Type); |
176 void decreaseObjectsCount(FloatingObject::Type); | 180 void decreaseObjectsCount(FloatingObject::Type); |
177 FloatingObjectInterval intervalForFloatingObject(FloatingObject*); | 181 FloatingObjectInterval intervalForFloatingObject(FloatingObject*); |
178 | 182 |
179 FloatingObjectSet m_set; | 183 FloatingObjectSet m_set; |
180 FloatingObjectTree m_placedFloatsTree; | 184 FloatingObjectTree m_placedFloatsTree; |
181 unsigned m_leftObjectsCount; | 185 unsigned m_leftObjectsCount; |
182 unsigned m_rightObjectsCount; | 186 unsigned m_rightObjectsCount; |
183 bool m_horizontalWritingMode; | 187 bool m_horizontalWritingMode; |
184 const LayoutBlockFlow* m_layoutObject; | 188 const LayoutBlockFlow* m_layoutObject; |
185 | 189 |
186 struct FloatBottomCachedValue { | 190 struct FloatBottomCachedValue { |
187 FloatBottomCachedValue(); | 191 FloatBottomCachedValue(); |
188 LayoutUnit value; | 192 FloatingObject* floatingObject; |
189 bool dirty; | 193 bool dirty; |
190 }; | 194 }; |
191 FloatBottomCachedValue m_lowestFloatBottomCache[2]; | 195 FloatBottomCachedValue m_lowestFloatBottomCache[2]; |
192 bool m_cachedHorizontalWritingMode; | 196 bool m_cachedHorizontalWritingMode; |
193 }; | 197 }; |
194 | 198 |
195 #ifndef NDEBUG | 199 #ifndef NDEBUG |
196 // These structures are used by PODIntervalTree for debugging purposes. | 200 // These structures are used by PODIntervalTree for debugging purposes. |
197 template <> struct ValueToString<int> { | 201 template <> struct ValueToString<int> { |
198 static String string(const int value); | 202 static String string(const int value); |
199 }; | 203 }; |
200 template<> struct ValueToString<FloatingObject*> { | 204 template<> struct ValueToString<FloatingObject*> { |
201 static String string(const FloatingObject*); | 205 static String string(const FloatingObject*); |
202 }; | 206 }; |
203 #endif | 207 #endif |
204 | 208 |
205 } // namespace blink | 209 } // namespace blink |
206 | 210 |
207 #endif // FloatingObjects_h | 211 #endif // FloatingObjects_h |
OLD | NEW |