Chromium Code Reviews| Index: Source/core/layout/FloatingObjects.cpp |
| diff --git a/Source/core/layout/FloatingObjects.cpp b/Source/core/layout/FloatingObjects.cpp |
| index 1a8166162bb0215deae347c793fb8bed01627001..d543e5a282a5dee2ed1f221e6447d57912628561 100644 |
| --- a/Source/core/layout/FloatingObjects.cpp |
| +++ b/Source/core/layout/FloatingObjects.cpp |
| @@ -212,9 +212,9 @@ LayoutUnit FloatingObjects::lowestFloatLogicalBottom(FloatingObject::Type floatT |
| LayoutUnit lowestFloatBottomLeft = 0; |
| LayoutUnit lowestFloatBottomRight = 0; |
| for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { |
| - FloatingObject* floatingObject = it->get(); |
| - if (floatingObject->isPlaced()) { |
| - FloatingObject::Type curType = floatingObject->type(); |
| + FloatingObject& floatingObject = *it->get(); |
|
Julien - ping for review
2015/03/18 01:36:07
It seems like this could be a const FloatingObject
Sunil Ratnu
2015/06/04 08:40:46
Done.
|
| + if (floatingObject.isPlaced()) { |
| + FloatingObject::Type curType = floatingObject.type(); |
| LayoutUnit curFloatLogicalBottom = m_renderer->logicalBottomForFloat(floatingObject); |
| if (curType & FloatingObject::FloatLeft) |
| lowestFloatBottomLeft = std::max(lowestFloatBottomLeft, curFloatLogicalBottom); |
| @@ -227,8 +227,8 @@ LayoutUnit FloatingObjects::lowestFloatLogicalBottom(FloatingObject::Type floatT |
| setCachedLowestFloatLogicalBottom(isInHorizontalWritingMode, FloatingObject::FloatRight, lowestFloatBottomRight); |
| } else { |
| for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { |
| - FloatingObject* floatingObject = it->get(); |
| - if (floatingObject->isPlaced() && floatingObject->type() == floatType) |
| + FloatingObject& floatingObject = *it->get(); |
|
Julien - ping for review
2015/03/18 01:36:07
Ditto.
Sunil Ratnu
2015/06/04 08:40:46
Done.
|
| + if (floatingObject.isPlaced() && floatingObject.type() == floatType) |
| lowestFloatBottom = std::max(lowestFloatBottom, m_renderer->logicalBottomForFloat(floatingObject)); |
| } |
| setCachedLowestFloatLogicalBottom(isInHorizontalWritingMode, floatType, lowestFloatBottom); |
| @@ -363,9 +363,9 @@ void FloatingObjects::computePlacedFloatsTree() |
| FloatingObjectSetIterator it = m_set.begin(); |
| FloatingObjectSetIterator end = m_set.end(); |
| for (; it != end; ++it) { |
| - FloatingObject* floatingObject = it->get(); |
| - if (floatingObject->isPlaced()) |
| - m_placedFloatsTree.add(intervalForFloatingObject(floatingObject)); |
| + FloatingObject& floatingObject = *it->get(); |
| + if (floatingObject.isPlaced()) |
| + m_placedFloatsTree.add(intervalForFloatingObject(&floatingObject)); |
|
Julien - ping for review
2015/03/18 01:36:07
It seems like intervalForFloatingObject should tak
Sunil Ratnu
2015/06/04 08:40:46
Done.
|
| } |
| } |
| @@ -438,7 +438,7 @@ inline static bool rangesIntersect(int floatTop, int floatBottom, int objectTop, |
| template<> |
| inline bool ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded(const FloatingObject& floatingObject) |
| { |
| - LayoutUnit logicalRight = m_renderer->logicalRightForFloat(&floatingObject); |
| + LayoutUnit logicalRight = m_renderer->logicalRightForFloat(floatingObject); |
| if (logicalRight > m_offset) { |
| m_offset = logicalRight; |
| return true; |
| @@ -449,7 +449,7 @@ inline bool ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatLeft>:: |
| template<> |
| inline bool ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded(const FloatingObject& floatingObject) |
| { |
| - LayoutUnit logicalLeft = m_renderer->logicalLeftForFloat(&floatingObject); |
| + LayoutUnit logicalLeft = m_renderer->logicalLeftForFloat(floatingObject); |
| if (logicalLeft < m_offset) { |
| m_offset = logicalLeft; |
| return true; |
| @@ -460,30 +460,30 @@ inline bool ComputeFloatOffsetForFloatLayoutAdapter<FloatingObject::FloatRight>: |
| template <FloatingObject::Type FloatTypeValue> |
| LayoutUnit ComputeFloatOffsetForFloatLayoutAdapter<FloatTypeValue>::heightRemaining() const |
| { |
| - return this->m_outermostFloat ? this->m_renderer->logicalBottomForFloat(this->m_outermostFloat) - this->m_lineTop : LayoutUnit(1); |
| + return this->m_outermostFloat ? this->m_renderer->logicalBottomForFloat(*(this->m_outermostFloat)) - this->m_lineTop : LayoutUnit(1); |
| } |
| template <FloatingObject::Type FloatTypeValue> |
| inline void ComputeFloatOffsetAdapter<FloatTypeValue>::collectIfNeeded(const IntervalType& interval) |
| { |
| - const FloatingObject* floatingObject = interval.data(); |
| - if (floatingObject->type() != FloatTypeValue || !rangesIntersect(interval.low(), interval.high(), m_lineTop, m_lineBottom)) |
| + const FloatingObject& floatingObject = *(interval.data()); |
| + if (floatingObject.type() != FloatTypeValue || !rangesIntersect(interval.low(), interval.high(), m_lineTop, m_lineBottom)) |
| return; |
| // Make sure the float hasn't changed since it was added to the placed floats tree. |
| - ASSERT(floatingObject->isPlaced()); |
| + ASSERT(floatingObject.isPlaced()); |
| ASSERT(interval.low() == m_renderer->pixelSnappedLogicalTopForFloat(floatingObject)); |
| ASSERT(interval.high() == m_renderer->pixelSnappedLogicalBottomForFloat(floatingObject)); |
| - bool floatIsNewExtreme = updateOffsetIfNeeded(*floatingObject); |
| + bool floatIsNewExtreme = updateOffsetIfNeeded(floatingObject); |
| if (floatIsNewExtreme) |
| - m_outermostFloat = floatingObject; |
| + m_outermostFloat = &floatingObject; |
| } |
| template<> |
| inline bool ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::updateOffsetIfNeeded(const FloatingObject& floatingObject) |
| { |
| - LayoutUnit logicalRight = m_renderer->logicalRightForFloat(&floatingObject); |
| + LayoutUnit logicalRight = m_renderer->logicalRightForFloat(floatingObject); |
| if (ShapeOutsideInfo* shapeOutside = floatingObject.layoutObject()->shapeOutsideInfo()) { |
| ShapeOutsideDeltas shapeDeltas = shapeOutside->computeDeltasForContainingBlockLine(*m_renderer, floatingObject, m_lineTop, m_lineBottom - m_lineTop); |
| if (!shapeDeltas.lineOverlapsShape()) |
| @@ -502,7 +502,7 @@ inline bool ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatLeft>::u |
| template<> |
| inline bool ComputeFloatOffsetForLineLayoutAdapter<FloatingObject::FloatRight>::updateOffsetIfNeeded(const FloatingObject& floatingObject) |
| { |
| - LayoutUnit logicalLeft = m_renderer->logicalLeftForFloat(&floatingObject); |
| + LayoutUnit logicalLeft = m_renderer->logicalLeftForFloat(floatingObject); |
| if (ShapeOutsideInfo* shapeOutside = floatingObject.layoutObject()->shapeOutsideInfo()) { |
| ShapeOutsideDeltas shapeDeltas = shapeOutside->computeDeltasForContainingBlockLine(*m_renderer, floatingObject, m_lineTop, m_lineBottom - m_lineTop); |
| if (!shapeDeltas.lineOverlapsShape()) |