Chromium Code Reviews| Index: Source/core/rendering/RenderBlockFlow.cpp |
| diff --git a/Source/core/rendering/RenderBlockFlow.cpp b/Source/core/rendering/RenderBlockFlow.cpp |
| index 66839618a85298c8590ef4e1c2b757b395da6a24..abac59f257731999c23ff0023179097ff9972a9d 100644 |
| --- a/Source/core/rendering/RenderBlockFlow.cpp |
| +++ b/Source/core/rendering/RenderBlockFlow.cpp |
| @@ -961,10 +961,10 @@ void RenderBlockFlow::rebuildFloatsFromIntruding() |
| for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { |
| FloatingObject* floatingObject = it->get(); |
|
Julien - ping for review
2014/12/01 16:12:47
Ditto.
Sunil Ratnu
2015/03/16 08:06:30
Done.
|
| FloatingObject* oldFloatingObject = floatMap.get(floatingObject->renderer()); |
| - LayoutUnit logicalBottom = logicalBottomForFloat(floatingObject); |
| + LayoutUnit logicalBottom = logicalBottomForFloat(*floatingObject); |
| if (oldFloatingObject) { |
| - LayoutUnit oldLogicalBottom = logicalBottomForFloat(oldFloatingObject); |
| - if (logicalWidthForFloat(floatingObject) != logicalWidthForFloat(oldFloatingObject) || logicalLeftForFloat(floatingObject) != logicalLeftForFloat(oldFloatingObject)) { |
| + LayoutUnit oldLogicalBottom = logicalBottomForFloat(*oldFloatingObject); |
| + if (logicalWidthForFloat(*floatingObject) != logicalWidthForFloat(*oldFloatingObject) || logicalLeftForFloat(*floatingObject) != logicalLeftForFloat(*oldFloatingObject)) { |
| changeLogicalTop = 0; |
| changeLogicalBottom = std::max(changeLogicalBottom, std::max(logicalBottom, oldLogicalBottom)); |
| } else { |
| @@ -972,8 +972,8 @@ void RenderBlockFlow::rebuildFloatsFromIntruding() |
| changeLogicalTop = std::min(changeLogicalTop, std::min(logicalBottom, oldLogicalBottom)); |
| changeLogicalBottom = std::max(changeLogicalBottom, std::max(logicalBottom, oldLogicalBottom)); |
| } |
| - LayoutUnit logicalTop = logicalTopForFloat(floatingObject); |
| - LayoutUnit oldLogicalTop = logicalTopForFloat(oldFloatingObject); |
| + LayoutUnit logicalTop = logicalTopForFloat(*floatingObject); |
| + LayoutUnit oldLogicalTop = logicalTopForFloat(*oldFloatingObject); |
| if (logicalTop != oldLogicalTop) { |
| changeLogicalTop = std::min(changeLogicalTop, std::min(logicalTop, oldLogicalTop)); |
| changeLogicalBottom = std::max(changeLogicalBottom, std::max(logicalTop, oldLogicalTop)); |
| @@ -998,7 +998,7 @@ void RenderBlockFlow::rebuildFloatsFromIntruding() |
| OwnPtr<FloatingObject>& floatingObject = it->value; |
| if (!floatingObject->isDescendant()) { |
| changeLogicalTop = 0; |
| - changeLogicalBottom = std::max(changeLogicalBottom, logicalBottomForFloat(floatingObject.get())); |
| + changeLogicalBottom = std::max(changeLogicalBottom, logicalBottomForFloat(*floatingObject.get())); |
| } |
| } |
| @@ -1776,7 +1776,7 @@ void RenderBlockFlow::addOverflowFromFloats() |
| for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { |
| FloatingObject* floatingObject = it->get(); |
| if (floatingObject->isDescendant()) |
| - addOverflowFromChild(floatingObject->renderer(), LayoutSize(xPositionForFloatIncludingMargin(floatingObject), yPositionForFloatIncludingMargin(floatingObject))); |
| + addOverflowFromChild(floatingObject->renderer(), LayoutSize(xPositionForFloatIncludingMargin(*floatingObject), yPositionForFloatIncludingMargin(*floatingObject))); |
| } |
| } |
| @@ -2052,7 +2052,7 @@ void RenderBlockFlow::invalidatePaintForOverhangingFloats(bool paintAllDescendan |
| // Only issue paint invaldiations for the object if it is overhanging, is not in its own layer, and |
| // is our responsibility to paint (m_shouldPaint is set). When paintAllDescendants is true, the latter |
| // condition is replaced with being a descendant of us. |
| - if (logicalBottomForFloat(floatingObject) > logicalHeight() |
| + if (logicalBottomForFloat(*floatingObject) > logicalHeight() |
| && !floatingObject->renderer()->hasSelfPaintingLayer() |
| && (floatingObject->shouldPaint() || (paintAllDescendants && floatingObject->renderer()->isDescendantOf(this)))) { |
| @@ -2125,8 +2125,8 @@ void RenderBlockFlow::clipOutFloatingObjects(const RenderBlock* rootBlock, const |
| FloatingObjectSetIterator end = floatingObjectSet.end(); |
| for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { |
| FloatingObject* floatingObject = it->get(); |
| - LayoutRect floatBox(offsetFromRootBlock.width() + xPositionForFloatIncludingMargin(floatingObject), |
| - offsetFromRootBlock.height() + yPositionForFloatIncludingMargin(floatingObject), |
| + LayoutRect floatBox(offsetFromRootBlock.width() + xPositionForFloatIncludingMargin(*floatingObject), |
| + offsetFromRootBlock.height() + yPositionForFloatIncludingMargin(*floatingObject), |
| floatingObject->renderer()->width(), floatingObject->renderer()->height()); |
| rootBlock->flipForWritingMode(floatBox); |
| floatBox.move(rootBlockPhysicalPosition.x(), rootBlockPhysicalPosition.y()); |
| @@ -2171,7 +2171,7 @@ void RenderBlockFlow::removeFloatingObjects() |
| m_floatingObjects->clear(); |
| } |
| -LayoutPoint RenderBlockFlow::flipFloatForWritingModeForChild(const FloatingObject* child, const LayoutPoint& point) const |
| +LayoutPoint RenderBlockFlow::flipFloatForWritingModeForChild(const FloatingObject& child, const LayoutPoint& point) const |
| { |
| if (!style()->isFlippedBlocksWritingMode()) |
| return point; |
| @@ -2180,8 +2180,8 @@ LayoutPoint RenderBlockFlow::flipFloatForWritingModeForChild(const FloatingObjec |
| // it's going to get added back in. We hide this complication here so that the calling code looks normal for the unflipped |
| // case. |
| if (isHorizontalWritingMode()) |
| - return LayoutPoint(point.x(), point.y() + height() - child->renderer()->height() - 2 * yPositionForFloatIncludingMargin(child)); |
| - return LayoutPoint(point.x() + width() - child->renderer()->width() - 2 * xPositionForFloatIncludingMargin(child), point.y()); |
| + return LayoutPoint(point.x(), point.y() + height() - child.renderer()->height() - 2 * yPositionForFloatIncludingMargin(child)); |
| + return LayoutPoint(point.x() + width() - child.renderer()->width() - 2 * xPositionForFloatIncludingMargin(child), point.y()); |
| } |
| LayoutUnit RenderBlockFlow::logicalLeftOffsetForPositioningFloat(LayoutUnit logicalTop, LayoutUnit fixedOffset, bool applyTextIndent, LayoutUnit* heightRemaining) const |
| @@ -2220,9 +2220,9 @@ LayoutUnit RenderBlockFlow::adjustLogicalRightOffsetForLine(LayoutUnit offsetFro |
| return right; |
| } |
| -LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject* floatingObject, LayoutUnit logicalTopOffset) const |
| +LayoutPoint RenderBlockFlow::computeLogicalLocationForFloat(const FloatingObject& floatingObject, LayoutUnit logicalTopOffset) const |
| { |
| - RenderBox* childBox = floatingObject->renderer(); |
| + RenderBox* childBox = floatingObject.renderer(); |
| LayoutUnit logicalLeftOffset = logicalLeftOffsetForContent(); // Constant part of left offset. |
| LayoutUnit logicalRightOffset; // Constant part of right offset. |
| logicalRightOffset = logicalRightOffsetForContent(); |
| @@ -2304,7 +2304,7 @@ FloatingObject* RenderBlockFlow::insertFloatingObject(RenderBox& floatBox) |
| floatBox.computeAndSetBlockDirectionMargins(this); |
| } |
| - setLogicalWidthForFloat(newObj.get(), logicalWidthForChild(floatBox) + marginStartForChild(floatBox) + marginEndForChild(floatBox)); |
| + setLogicalWidthForFloat(*(newObj.get()), logicalWidthForChild(floatBox) + marginStartForChild(floatBox) + marginEndForChild(floatBox)); |
| return m_floatingObjects->add(newObj.release()); |
| } |
| @@ -2317,8 +2317,8 @@ void RenderBlockFlow::removeFloatingObject(RenderBox* floatBox) |
| if (it != floatingObjectSet.end()) { |
| FloatingObject* floatingObject = it->get(); |
| if (childrenInline()) { |
| - LayoutUnit logicalTop = logicalTopForFloat(floatingObject); |
| - LayoutUnit logicalBottom = logicalBottomForFloat(floatingObject); |
| + LayoutUnit logicalTop = logicalTopForFloat(*floatingObject); |
| + LayoutUnit logicalBottom = logicalBottomForFloat(*floatingObject); |
| // Fix for https://bugs.webkit.org/show_bug.cgi?id=54995. |
| if (logicalBottom < 0 || logicalBottom < logicalTop || logicalTop == LayoutUnit::max()) { |
| @@ -2352,7 +2352,7 @@ void RenderBlockFlow::removeFloatingObjectsBelow(FloatingObject* lastFloat, int |
| const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); |
| FloatingObject* curr = floatingObjectSet.last().get(); |
| - while (curr != lastFloat && (!curr->isPlaced() || logicalTopForFloat(curr) >= logicalOffset)) { |
| + while (curr != lastFloat && (!curr->isPlaced() || logicalTopForFloat(*curr) >= logicalOffset)) { |
| m_floatingObjects->remove(curr); |
| if (floatingObjectSet.isEmpty()) |
| break; |
| @@ -2393,7 +2393,7 @@ bool RenderBlockFlow::positionNewFloats() |
| // The float cannot start above the top position of the last positioned float. |
| if (lastPlacedFloatingObject) |
| - logicalTop = std::max(logicalTopForFloat(lastPlacedFloatingObject), logicalTop); |
| + logicalTop = std::max(logicalTopForFloat(*lastPlacedFloatingObject), logicalTop); |
| FloatingObjectSetIterator end = floatingObjectSet.end(); |
| // Now walk through the set of unpositioned floats and place them. |
| @@ -2415,9 +2415,9 @@ bool RenderBlockFlow::positionNewFloats() |
| if (childBox->style()->clear() & CRIGHT) |
| logicalTop = std::max(lowestFloatLogicalBottom(FloatingObject::FloatRight), logicalTop); |
| - LayoutPoint floatLogicalLocation = computeLogicalLocationForFloat(floatingObject, logicalTop); |
| + LayoutPoint floatLogicalLocation = computeLogicalLocationForFloat(*floatingObject, logicalTop); |
| - setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x()); |
| + setLogicalLeftForFloat(*floatingObject, floatLogicalLocation.x()); |
| setLogicalLeftForChild(*childBox, floatLogicalLocation.x() + childLogicalLeftMargin); |
| setLogicalTopForChild(*childBox, floatLogicalLocation.y() + marginBeforeForChild(*childBox)); |
| @@ -2447,8 +2447,8 @@ bool RenderBlockFlow::positionNewFloats() |
| if (newLogicalTop != floatLogicalLocation.y()) { |
| floatingObject->setPaginationStrut(newLogicalTop - floatLogicalLocation.y()); |
| - floatLogicalLocation = computeLogicalLocationForFloat(floatingObject, newLogicalTop); |
| - setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x()); |
| + floatLogicalLocation = computeLogicalLocationForFloat(*floatingObject, newLogicalTop); |
| + setLogicalLeftForFloat(*floatingObject, floatLogicalLocation.x()); |
| setLogicalLeftForChild(*childBox, floatLogicalLocation.x() + childLogicalLeftMargin); |
| setLogicalTopForChild(*childBox, floatLogicalLocation.y() + marginBeforeForChild(*childBox)); |
| @@ -2459,9 +2459,9 @@ bool RenderBlockFlow::positionNewFloats() |
| } |
| } |
| - setLogicalTopForFloat(floatingObject, floatLogicalLocation.y()); |
| + setLogicalTopForFloat(*floatingObject, floatLogicalLocation.y()); |
| - setLogicalHeightForFloat(floatingObject, logicalHeightForChild(*childBox) + marginBeforeForChild(*childBox) + marginAfterForChild(*childBox)); |
| + setLogicalHeightForFloat(*floatingObject, logicalHeightForChild(*childBox) + marginBeforeForChild(*childBox) + marginAfterForChild(*childBox)); |
| m_floatingObjects->addPlacedObject(floatingObject); |
| @@ -2481,7 +2481,7 @@ bool RenderBlockFlow::hasOverhangingFloat(RenderBox* renderer) |
| if (it == floatingObjectSet.end()) |
| return false; |
| - return logicalBottomForFloat(it->get()) > logicalHeight(); |
| + return logicalBottomForFloat(*it->get()) > logicalHeight(); |
| } |
| void RenderBlockFlow::addIntrudingFloats(RenderBlockFlow* prev, LayoutUnit logicalLeftOffset, LayoutUnit logicalTopOffset) |
| @@ -2502,7 +2502,7 @@ void RenderBlockFlow::addIntrudingFloats(RenderBlockFlow* prev, LayoutUnit logic |
| FloatingObjectSetIterator prevEnd = prevSet.end(); |
| for (FloatingObjectSetIterator prevIt = prevSet.begin(); prevIt != prevEnd; ++prevIt) { |
| FloatingObject* floatingObject = prevIt->get(); |
| - if (logicalBottomForFloat(floatingObject) > logicalTopOffset) { |
| + if (logicalBottomForFloat(*floatingObject) > logicalTopOffset) { |
| if (!m_floatingObjects || !m_floatingObjects->set().contains(floatingObject)) { |
| // We create the floating object list lazily. |
| if (!m_floatingObjects) |
| @@ -2537,7 +2537,7 @@ void RenderBlockFlow::addOverhangingFloats(RenderBlockFlow* child, bool makeChil |
| FloatingObjectSetIterator childEnd = child->m_floatingObjects->set().end(); |
| for (FloatingObjectSetIterator childIt = child->m_floatingObjects->set().begin(); childIt != childEnd; ++childIt) { |
| FloatingObject* floatingObject = childIt->get(); |
| - LayoutUnit logicalBottomForFloat = std::min(this->logicalBottomForFloat(floatingObject), LayoutUnit::max() - childLogicalTop); |
| + LayoutUnit logicalBottomForFloat = std::min(this->logicalBottomForFloat(*floatingObject), LayoutUnit::max() - childLogicalTop); |
| LayoutUnit logicalBottom = childLogicalTop + logicalBottomForFloat; |
| if (logicalBottom > logicalHeight()) { |
| @@ -2574,7 +2574,7 @@ void RenderBlockFlow::addOverhangingFloats(RenderBlockFlow* child, bool makeChil |
| // Since the float doesn't overhang, it didn't get put into our list. We need to go ahead and add its overflow in to the |
| // child now. |
| if (floatingObject->isDescendant()) |
| - child->addOverflowFromChild(floatingObject->renderer(), LayoutSize(xPositionForFloatIncludingMargin(floatingObject), yPositionForFloatIncludingMargin(floatingObject))); |
| + child->addOverflowFromChild(floatingObject->renderer(), LayoutSize(xPositionForFloatIncludingMargin(*floatingObject), yPositionForFloatIncludingMargin(*floatingObject))); |
| } |
| } |
| } |
| @@ -2597,10 +2597,10 @@ LayoutUnit RenderBlockFlow::nextFloatLogicalBottomBelow(LayoutUnit logicalHeight |
| FloatingObjectSetIterator end = floatingObjectSet.end(); |
| for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { |
| FloatingObject* floatingObject = it->get(); |
| - LayoutUnit floatLogicalBottom = logicalBottomForFloat(floatingObject); |
| + LayoutUnit floatLogicalBottom = logicalBottomForFloat(*floatingObject); |
| ShapeOutsideInfo* shapeOutside = floatingObject->renderer()->shapeOutsideInfo(); |
| if (shapeOutside && (offsetMode == ShapeOutsideFloatShapeOffset)) { |
| - LayoutUnit shapeLogicalBottom = logicalTopForFloat(floatingObject) + marginBeforeForChild(*(floatingObject->renderer())) + shapeOutside->shapeLogicalBottom(); |
| + LayoutUnit shapeLogicalBottom = logicalTopForFloat(*floatingObject) + marginBeforeForChild(*(floatingObject->renderer())) + shapeOutside->shapeLogicalBottom(); |
| // Use the shapeLogicalBottom unless it extends outside of the margin box, in which case it is clipped. |
| if (shapeLogicalBottom < floatLogicalBottom) |
| floatLogicalBottom = shapeLogicalBottom; |
| @@ -2629,9 +2629,9 @@ bool RenderBlockFlow::hitTestFloats(const HitTestRequest& request, HitTestResult |
| --it; |
| FloatingObject* floatingObject = it->get(); |
| if (floatingObject->shouldPaint() && !floatingObject->renderer()->hasSelfPaintingLayer()) { |
| - LayoutUnit xOffset = xPositionForFloatIncludingMargin(floatingObject) - floatingObject->renderer()->x(); |
| - LayoutUnit yOffset = yPositionForFloatIncludingMargin(floatingObject) - floatingObject->renderer()->y(); |
| - LayoutPoint childPoint = flipFloatForWritingModeForChild(floatingObject, adjustedLocation + LayoutSize(xOffset, yOffset)); |
| + LayoutUnit xOffset = xPositionForFloatIncludingMargin(*floatingObject) - floatingObject->renderer()->x(); |
| + LayoutUnit yOffset = yPositionForFloatIncludingMargin(*floatingObject) - floatingObject->renderer()->y(); |
| + LayoutPoint childPoint = flipFloatForWritingModeForChild(*floatingObject, adjustedLocation + LayoutSize(xOffset, yOffset)); |
| if (floatingObject->renderer()->hitTest(request, result, locationInContainer, childPoint)) { |
| updateHitTestResult(result, locationInContainer.point() - toLayoutSize(childPoint)); |
| return true; |