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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/RenderBlock.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderBlock.cpp
diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp
index 273ebeb3a9aa795ea14b4a94db5de860336095ba..2242a7723c566d9453d851db2d9a17d4cd9724cc 100644
--- a/Source/core/rendering/RenderBlock.cpp
+++ b/Source/core/rendering/RenderBlock.cpp
@@ -4245,31 +4245,42 @@ static bool rangesIntersect(int floatTop, int floatBottom, int objectTop, int ob
return false;
}
+template<>
+bool RenderBlock::FloatIntervalSearchAdapter<RenderBlock::FloatingObject::FloatLeft>::updateOffsetIfNeeded(const FloatingObject* floatingObject) const
+{
+ if (m_renderer->logicalRightForFloat(floatingObject) > m_offset) {
+ m_offset = m_renderer->logicalRightForFloat(floatingObject);
+ return true;
+ }
+ return false;
+}
+
+template<>
+bool RenderBlock::FloatIntervalSearchAdapter<RenderBlock::FloatingObject::FloatRight>::updateOffsetIfNeeded(const FloatingObject* floatingObject) const
+{
+ if (m_renderer->logicalLeftForFloat(floatingObject) < m_offset) {
+ m_offset = m_renderer->logicalLeftForFloat(floatingObject);
+ return true;
+ }
+ return false;
+}
+
template <RenderBlock::FloatingObject::Type FloatTypeValue>
inline void RenderBlock::FloatIntervalSearchAdapter<FloatTypeValue>::collectIfNeeded(const IntervalType& interval) const
{
- const FloatingObject* r = interval.data();
- if (r->type() != FloatTypeValue || !rangesIntersect(interval.low(), interval.high(), m_lowValue, m_highValue))
+ const FloatingObject* floatingObject = interval.data();
+ if (floatingObject->type() != FloatTypeValue || !rangesIntersect(interval.low(), interval.high(), m_lowValue, m_highValue))
return;
// All the objects returned from the tree should be already placed.
- ASSERT(r->isPlaced() && rangesIntersect(m_renderer->pixelSnappedLogicalTopForFloat(r), m_renderer->pixelSnappedLogicalBottomForFloat(r), m_lowValue, m_highValue));
+ ASSERT(floatingObject->isPlaced());
+ ASSERT(rangesIntersect(m_renderer->pixelSnappedLogicalTopForFloat(floatingObject), m_renderer->pixelSnappedLogicalBottomForFloat(floatingObject), m_lowValue, m_highValue));
- if (FloatTypeValue == FloatingObject::FloatLeft
- && m_renderer->logicalRightForFloat(r) > m_offset) {
- m_offset = m_renderer->logicalRightForFloat(r);
- if (m_heightRemaining)
- *m_heightRemaining = m_renderer->logicalBottomForFloat(r) - m_lowValue;
- }
-
- if (FloatTypeValue == FloatingObject::FloatRight
- && m_renderer->logicalLeftForFloat(r) < m_offset) {
- m_offset = m_renderer->logicalLeftForFloat(r);
- if (m_heightRemaining)
- *m_heightRemaining = m_renderer->logicalBottomForFloat(r) - m_lowValue;
- }
+ bool floatIsNewExtreme = updateOffsetIfNeeded(floatingObject);
+ if (floatIsNewExtreme && m_heightRemaining)
+ *m_heightRemaining = m_renderer->logicalBottomForFloat(floatingObject) - m_lowValue;
- m_last = r;
+ m_last = floatingObject;
}
LayoutUnit RenderBlock::textIndentOffset() const
« 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