Changeset 155065 in webkit
- Timestamp:
- Sep 4, 2013 2:35:56 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r155060 r155065 1 2013-09-04 Bem Jones-Bey <bjonesbe@adobe.com> 2 3 FloatingObjects should manage cleaning it's line box tree pointers itself 4 https://bugs.webkit.org/show_bug.cgi?id=120692 5 6 Reviewed by David Hyatt. 7 8 This is another step in properly encapsulating FloatingObjects. 9 Instead of having RenderBlock walk and clear the line box tree 10 pointers, create a method for the behavior, and have RenderBlock call 11 that. 12 13 In addtion, add a proper destructor to FloatingObjects, so that 14 RenderBlock does not have to explicitly delete the set in 15 FloatingObjects. 16 17 And as a bonus, fix the ordering of an if to avoid the expensive 18 descendantChild check. 19 20 This is a port of a Blink patch by Eric Seidel. 21 22 No new tests, no behavior change. 23 24 * rendering/RenderBlock.cpp: 25 (WebCore::RenderBlock::~RenderBlock): 26 (WebCore::RenderBlock::deleteLineBoxTree): 27 (WebCore::RenderBlock::repaintOverhangingFloats): 28 (WebCore::RenderBlock::FloatingObjects::~FloatingObjects): 29 (WebCore::RenderBlock::FloatingObjects::clearLineBoxTreePointers): 30 (WebCore::RenderBlock::FloatingObjects::clear): 31 * rendering/RenderBlock.h: 32 1 33 2013-09-04 Tim Horton <timothy_horton@apple.com> 2 34 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r155050 r155065 228 228 RenderBlock::~RenderBlock() 229 229 { 230 if (m_floatingObjects)231 deleteAllValues(m_floatingObjects->set());232 233 230 if (hasColumns()) 234 231 gColumnInfoMap->take(this); 235 236 232 if (gPercentHeightDescendantsMap) 237 233 removeBlockFromDescendantAndContainerMaps(this, gPercentHeightDescendantsMap, gPercentHeightContainerMap); … … 989 985 void RenderBlock::deleteLineBoxTree() 990 986 { 991 if (containsFloats()) { 992 // Clear references to originating lines, since the lines are being deleted 993 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); 994 FloatingObjectSetIterator end = floatingObjectSet.end(); 995 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { 996 ASSERT(!((*it)->originatingLine()) || &(*it)->originatingLine()->renderer() == this); 997 (*it)->setOriginatingLine(0); 998 } 999 } 987 if (containsFloats()) 988 m_floatingObjects->clearLineBoxTreePointers(); 1000 989 m_lineBoxes.deleteLineBoxTree(renderArena()); 1001 990 … … 3043 3032 // is our responsibility to paint (m_shouldPaint is set). When paintAllDescendants is true, the latter 3044 3033 // condition is replaced with being a descendant of us. 3045 if (r->logicalBottom(isHorizontalWritingMode()) > logicalHeight() && ((paintAllDescendants && r->renderer()->isDescendantOf(this)) || r->shouldPaint()) && !r->renderer()->hasSelfPaintingLayer()) { 3034 if (r->logicalBottom(isHorizontalWritingMode()) > logicalHeight() 3035 && !r->renderer()->hasSelfPaintingLayer() 3036 && (r->shouldPaint() || (paintAllDescendants && r->renderer()->isDescendantOf(this)))) { 3046 3037 r->renderer()->repaint(); 3047 3038 r->renderer()->repaintOverhangingFloats(false); … … 8238 8229 } 8239 8230 8231 RenderBlock::FloatingObjects::~FloatingObjects() 8232 { 8233 // FIXME: m_set should use OwnPtr instead. 8234 deleteAllValues(m_set); 8235 } 8236 8237 void RenderBlock::FloatingObjects::clearLineBoxTreePointers() 8238 { 8239 // Clear references to originating lines, since the lines are being deleted 8240 FloatingObjectSetIterator end = m_set.end(); 8241 for (FloatingObjectSetIterator it = m_set.begin(); it != end; ++it) { 8242 ASSERT(!((*it)->originatingLine()) || &((*it)->originatingLine()->renderer()) == m_renderer); 8243 (*it)->setOriginatingLine(0); 8244 } 8245 } 8246 8240 8247 void RenderBlock::createFloatingObjects() 8241 8248 { … … 8245 8252 inline void RenderBlock::FloatingObjects::clear() 8246 8253 { 8254 // FIXME: This should call deleteAllValues, except RenderBlock::clearFloats 8255 // like to play fast and loose with ownership of these pointers. 8256 // If we move to OwnPtr that will fix this ownership oddness. 8247 8257 m_set.clear(); 8248 8258 m_placedFloatsTree.clear(); -
trunk/Source/WebCore/rendering/RenderBlock.h
r155050 r155065 1252 1252 WTF_MAKE_NONCOPYABLE(FloatingObjects); WTF_MAKE_FAST_ALLOCATED; 1253 1253 public: 1254 ~FloatingObjects(); 1255 1254 1256 void clear(); 1255 1257 void add(FloatingObject*); … … 1267 1269 return m_placedFloatsTree; 1268 1270 } 1271 void clearLineBoxTreePointers(); 1269 1272 private: 1270 1273 FloatingObjects(const RenderBlock*, bool horizontalWritingMode);
Note: See TracChangeset
for help on using the changeset viewer.