Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: Source/core/rendering/RenderBlock.cpp

Issue 22493015: Attempt to make it more clear what FloatIntervalSearchAdaptor::collectIfNeeded is doing. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4227 matching lines...) Expand 10 before | Expand all | Expand 10 after
4238 if (objectTop < floatTop && objectBottom > floatBottom) 4238 if (objectTop < floatTop && objectBottom > floatBottom)
4239 return true; 4239 return true;
4240 4240
4241 // The bottom of the object overlaps the float 4241 // The bottom of the object overlaps the float
4242 if (objectBottom > objectTop && objectBottom > floatTop && objectBottom <= f loatBottom) 4242 if (objectBottom > objectTop && objectBottom > floatTop && objectBottom <= f loatBottom)
4243 return true; 4243 return true;
4244 4244
4245 return false; 4245 return false;
4246 } 4246 }
4247 4247
4248 template<>
4249 bool RenderBlock::FloatIntervalSearchAdapter<RenderBlock::FloatingObject::FloatL eft>::updateOffsetIfNeeded(const FloatingObject* floatingObject) const
4250 {
4251 if (m_renderer->logicalRightForFloat(floatingObject) > m_offset) {
4252 m_offset = m_renderer->logicalRightForFloat(floatingObject);
4253 return true;
4254 }
4255 return false;
4256 }
4257
4258 template<>
4259 bool RenderBlock::FloatIntervalSearchAdapter<RenderBlock::FloatingObject::FloatR ight>::updateOffsetIfNeeded(const FloatingObject* floatingObject) const
4260 {
4261 if (m_renderer->logicalLeftForFloat(floatingObject) < m_offset) {
4262 m_offset = m_renderer->logicalLeftForFloat(floatingObject);
4263 return true;
4264 }
4265 return false;
4266 }
4267
4248 template <RenderBlock::FloatingObject::Type FloatTypeValue> 4268 template <RenderBlock::FloatingObject::Type FloatTypeValue>
4249 inline void RenderBlock::FloatIntervalSearchAdapter<FloatTypeValue>::collectIfNe eded(const IntervalType& interval) const 4269 inline void RenderBlock::FloatIntervalSearchAdapter<FloatTypeValue>::collectIfNe eded(const IntervalType& interval) const
4250 { 4270 {
4251 const FloatingObject* r = interval.data(); 4271 const FloatingObject* floatingObject = interval.data();
4252 if (r->type() != FloatTypeValue || !rangesIntersect(interval.low(), interval .high(), m_lowValue, m_highValue)) 4272 if (floatingObject->type() != FloatTypeValue || !rangesIntersect(interval.lo w(), interval.high(), m_lowValue, m_highValue))
4253 return; 4273 return;
4254 4274
4255 // All the objects returned from the tree should be already placed. 4275 // All the objects returned from the tree should be already placed.
4256 ASSERT(r->isPlaced() && rangesIntersect(m_renderer->pixelSnappedLogicalTopFo rFloat(r), m_renderer->pixelSnappedLogicalBottomForFloat(r), m_lowValue, m_highV alue)); 4276 ASSERT(floatingObject->isPlaced());
4277 ASSERT(rangesIntersect(m_renderer->pixelSnappedLogicalTopForFloat(floatingOb ject), m_renderer->pixelSnappedLogicalBottomForFloat(floatingObject), m_lowValue , m_highValue));
4257 4278
4258 if (FloatTypeValue == FloatingObject::FloatLeft 4279 bool floatIsNewExtreme = updateOffsetIfNeeded(floatingObject);
4259 && m_renderer->logicalRightForFloat(r) > m_offset) { 4280 if (floatIsNewExtreme && m_heightRemaining)
4260 m_offset = m_renderer->logicalRightForFloat(r); 4281 *m_heightRemaining = m_renderer->logicalBottomForFloat(floatingObject) - m_lowValue;
4261 if (m_heightRemaining)
4262 *m_heightRemaining = m_renderer->logicalBottomForFloat(r) - m_lowVal ue;
4263 }
4264 4282
4265 if (FloatTypeValue == FloatingObject::FloatRight 4283 m_last = floatingObject;
4266 && m_renderer->logicalLeftForFloat(r) < m_offset) {
4267 m_offset = m_renderer->logicalLeftForFloat(r);
4268 if (m_heightRemaining)
4269 *m_heightRemaining = m_renderer->logicalBottomForFloat(r) - m_lowVal ue;
4270 }
4271
4272 m_last = r;
4273 } 4284 }
4274 4285
4275 LayoutUnit RenderBlock::textIndentOffset() const 4286 LayoutUnit RenderBlock::textIndentOffset() const
4276 { 4287 {
4277 LayoutUnit cw = 0; 4288 LayoutUnit cw = 0;
4278 RenderView* renderView = 0; 4289 RenderView* renderView = 0;
4279 if (style()->textIndent().isPercent()) 4290 if (style()->textIndent().isPercent())
4280 cw = containingBlock()->availableLogicalWidth(); 4291 cw = containingBlock()->availableLogicalWidth();
4281 else if (style()->textIndent().isViewportPercentage()) 4292 else if (style()->textIndent().isViewportPercentage())
4282 renderView = view(); 4293 renderView = view();
(...skipping 3868 matching lines...) Expand 10 before | Expand all | Expand 10 after
8151 8162
8152 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl oatingObject* floatingObject) 8163 String ValueToString<RenderBlock::FloatingObject*>::string(const RenderBlock::Fl oatingObject* floatingObject)
8153 { 8164 {
8154 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped MaxY()); 8165 return String::format("%p (%dx%d %dx%d)", floatingObject, floatingObject->fr ameRect().pixelSnappedX(), floatingObject->frameRect().pixelSnappedY(), floating Object->frameRect().pixelSnappedMaxX(), floatingObject->frameRect().pixelSnapped MaxY());
8155 } 8166 }
8156 8167
8157 8168
8158 #endif 8169 #endif
8159 8170
8160 } // namespace WebCore 8171 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698