Chromium Code Reviews| Index: Source/core/rendering/RenderBlockFlow.cpp |
| diff --git a/Source/core/rendering/RenderBlockFlow.cpp b/Source/core/rendering/RenderBlockFlow.cpp |
| index 55be9e9fe8ba4a7b2baa29fe8362ce55903936a1..6448eb7fd11cf9f84c8198ba2d7bcbccdfd141e5 100644 |
| --- a/Source/core/rendering/RenderBlockFlow.cpp |
| +++ b/Source/core/rendering/RenderBlockFlow.cpp |
| @@ -509,12 +509,12 @@ void RenderBlockFlow::determineLogicalLeftPositionForChild(RenderBox* child) |
| startPosition -= verticalScrollbarWidth(); |
| LayoutUnit totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + availableLogicalWidth(); |
| - LayoutUnit childMarginStart = marginStartForChild(child); |
| + LayoutUnit childMarginStart = marginStartForChild(*child); |
|
Julien - ping for review
2014/11/26 18:52:35
It seems like the function could also use a refere
|
| LayoutUnit newPosition = startPosition + childMarginStart; |
| LayoutUnit positionToAvoidFloats; |
| if (child->avoidsFloats() && containsFloats() && !flowThreadContainingBlock()) |
| - positionToAvoidFloats = startOffsetForLine(logicalTopForChild(child), false, logicalHeightForChild(child)); |
| + positionToAvoidFloats = startOffsetForLine(logicalTopForChild(*child), false, logicalHeightForChild(*child)); |
| // If the child has an offset from the content edge to avoid floats then use that, otherwise let any negative |
| // margin pull it back over the content edge or any positive margin push it out. |
| @@ -525,7 +525,7 @@ void RenderBlockFlow::determineLogicalLeftPositionForChild(RenderBox* child) |
| else if (positionToAvoidFloats > initialStartPosition) |
| newPosition = std::max(newPosition, positionToAvoidFloats); |
| - setLogicalLeftForChild(child, style()->isLeftToRightDirection() ? newPosition : totalAvailableLogicalWidth - newPosition - logicalWidthForChild(child)); |
| + setLogicalLeftForChild(child, style()->isLeftToRightDirection() ? newPosition : totalAvailableLogicalWidth - newPosition - logicalWidthForChild(*child)); |
| } |
| void RenderBlockFlow::setLogicalLeftForChild(RenderBox* child, LayoutUnit logicalLeft) |
| @@ -562,7 +562,7 @@ void RenderBlockFlow::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, |
| // Cache our old rect so that we can dirty the proper paint invalidation rects if the child moves. |
| LayoutRect oldRect = child->frameRect(); |
| - LayoutUnit oldLogicalTop = logicalTopForChild(child); |
| + LayoutUnit oldLogicalTop = logicalTopForChild(*child); |
|
Julien - ping for review
2014/11/26 18:52:35
Same comment.
|
| // Go ahead and position the child as though it didn't collapse with the top. |
| setLogicalTopForChild(child, logicalTopEstimate); |
| @@ -660,9 +660,9 @@ void RenderBlockFlow::layoutBlockChild(RenderBox* child, MarginInfo& marginInfo, |
| LayoutSize childOffset = child->location() - oldRect.location(); |
| // Update our height now that the child has been placed in the correct position. |
| - setLogicalHeight(logicalHeight() + logicalHeightForChild(child)); |
| + setLogicalHeight(logicalHeight() + logicalHeightForChild(*child)); |
| if (mustSeparateMarginAfterForChild(child)) { |
| - setLogicalHeight(logicalHeight() + marginAfterForChild(child)); |
| + setLogicalHeight(logicalHeight() + marginAfterForChild(*child)); |
| marginInfo.clearMargin(); |
| } |
| // If the child has overhanging floats that intrude into following siblings (or possibly out |
| @@ -873,7 +873,7 @@ LayoutUnit RenderBlockFlow::adjustForUnsplittableChild(RenderBox* child, LayoutU |
| || (checkPageBreaks && child->style()->pageBreakInside() == PBAVOID); |
| if (!isUnsplittable) |
| return logicalOffset; |
| - LayoutUnit childLogicalHeight = logicalHeightForChild(child) + (includeMargins ? marginBeforeForChild(child) + marginAfterForChild(child) : LayoutUnit()); |
| + LayoutUnit childLogicalHeight = logicalHeightForChild(*child) + (includeMargins ? marginBeforeForChild(*child) + marginAfterForChild(*child) : LayoutUnit()); |
| LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); |
| updateMinimumPageHeight(logicalOffset, childLogicalHeight); |
| if (!pageLogicalHeight || childLogicalHeight > pageLogicalHeight) |
| @@ -1045,7 +1045,7 @@ void RenderBlockFlow::layoutBlockChildren(bool relayoutChildren, SubtreeLayoutSc |
| if (childToExclude == child) |
| continue; // Skip this child, since it will be positioned by the specialized subclass (fieldsets and ruby runs). |
| - updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, child); |
| + updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, *child); |
| if (child->isOutOfFlowPositioned()) { |
| child->containingBlock()->insertPositionedObject(child); |
| @@ -1138,8 +1138,8 @@ RenderBlockFlow::MarginValues RenderBlockFlow::marginValuesForChild(RenderBox* c |
| } else { |
| // The child is perpendicular to us, which means its margins don't collapse but are on the |
| // "logical left/right" sides of the child box. We can just return the raw margin in this case. |
| - beforeMargin = marginBeforeForChild(child); |
| - afterMargin = marginAfterForChild(child); |
| + beforeMargin = marginBeforeForChild(*child); |
| + afterMargin = marginAfterForChild(*child); |
|
Julien - ping for review
2014/11/26 18:52:35
Ditto.
|
| } |
| // Resolve uncollapsing margins into their positive/negative buckets. |
| @@ -1270,7 +1270,7 @@ LayoutUnit RenderBlockFlow::collapseMargins(RenderBox* child, MarginInfo& margin |
| // and just add the child margin to the container height. This will correctly position |
| // the child inside the container. |
| LayoutUnit separateMargin = !marginInfo.canCollapseWithMarginBefore() ? marginInfo.margin() : LayoutUnit(0); |
| - setLogicalHeight(logicalHeight() + separateMargin + marginBeforeForChild(child)); |
| + setLogicalHeight(logicalHeight() + separateMargin + marginBeforeForChild(*child)); |
|
Julien - ping for review
2014/11/26 18:52:35
Ditto.
|
| logicalTop = logicalHeight(); |
| } else if (!marginInfo.discardMargin() && (!marginInfo.atBeforeSideOfBlock() |
| || (!marginInfo.canCollapseMarginBeforeWithChildren() |
| @@ -1445,7 +1445,7 @@ void RenderBlockFlow::marginBeforeEstimateForChild(RenderBox* child, LayoutUnit& |
| return; |
| } |
| - LayoutUnit beforeChildMargin = marginBeforeForChild(child); |
| + LayoutUnit beforeChildMargin = marginBeforeForChild(*child); |
| positiveMarginBefore = std::max(positiveMarginBefore, beforeChildMargin); |
| negativeMarginBefore = std::max(negativeMarginBefore, -beforeChildMargin); |
| @@ -1482,7 +1482,7 @@ void RenderBlockFlow::marginBeforeEstimateForChild(RenderBox* child, LayoutUnit& |
| // If we have a 'clear' value but also have a margin we may not actually require clearance to move past any floats. |
| // If that's the case we want to be sure we estimate the correct position including margins after any floats rather |
| // than use 'clearance' later which could give us the wrong position. |
| - if (grandchildBox->style()->clear() != CNONE && childBlockFlow->marginBeforeForChild(grandchildBox) == 0) |
| + if (grandchildBox->style()->clear() != CNONE && childBlockFlow->marginBeforeForChild(*grandchildBox) == 0) |
| return; |
| // Collapse the margin of the grandchild box with our own to produce an estimate. |
| @@ -1887,7 +1887,7 @@ LayoutUnit RenderBlockFlow::getClearDelta(RenderBox* child, LayoutUnit logicalTo |
| if (!result && child->avoidsFloats()) { |
| LayoutUnit newLogicalTop = logicalTop; |
| while (true) { |
| - LayoutUnit availableLogicalWidthAtNewLogicalTopOffset = availableLogicalWidthForLine(newLogicalTop, false, logicalHeightForChild(child)); |
| + LayoutUnit availableLogicalWidthAtNewLogicalTopOffset = availableLogicalWidthForLine(newLogicalTop, false, logicalHeightForChild(*child)); |
| if (availableLogicalWidthAtNewLogicalTopOffset == availableLogicalWidthForContent()) |
| return newLogicalTop - logicalTop; |
| @@ -2303,7 +2303,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()); |
| } |
| @@ -2408,7 +2408,7 @@ bool RenderBlockFlow::positionNewFloats() |
| // FIXME Investigate if this can be removed. crbug.com/370006 |
| childBox->setMayNeedPaintInvalidation(true); |
| - LayoutUnit childLogicalLeftMargin = style()->isLeftToRightDirection() ? marginStartForChild(childBox) : marginEndForChild(childBox); |
| + LayoutUnit childLogicalLeftMargin = style()->isLeftToRightDirection() ? marginStartForChild(*childBox) : marginEndForChild(*childBox); |
| if (childBox->style()->clear() & CLEFT) |
| logicalTop = std::max(lowestFloatLogicalBottom(FloatingObject::FloatLeft), logicalTop); |
| if (childBox->style()->clear() & CRIGHT) |
| @@ -2419,7 +2419,7 @@ bool RenderBlockFlow::positionNewFloats() |
| setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x()); |
| setLogicalLeftForChild(childBox, floatLogicalLocation.x() + childLogicalLeftMargin); |
| - setLogicalTopForChild(childBox, floatLogicalLocation.y() + marginBeforeForChild(childBox)); |
| + setLogicalTopForChild(childBox, floatLogicalLocation.y() + marginBeforeForChild(*childBox)); |
| SubtreeLayoutScope layoutScope(*childBox); |
| LayoutState* layoutState = view()->layoutState(); |
| @@ -2450,7 +2450,7 @@ bool RenderBlockFlow::positionNewFloats() |
| setLogicalLeftForFloat(floatingObject, floatLogicalLocation.x()); |
| setLogicalLeftForChild(childBox, floatLogicalLocation.x() + childLogicalLeftMargin); |
| - setLogicalTopForChild(childBox, floatLogicalLocation.y() + marginBeforeForChild(childBox)); |
| + setLogicalTopForChild(childBox, floatLogicalLocation.y() + marginBeforeForChild(*childBox)); |
| if (childBox->isRenderBlock()) |
| childBox->setChildNeedsLayout(MarkOnlyThis); |
| @@ -2460,12 +2460,12 @@ bool RenderBlockFlow::positionNewFloats() |
| setLogicalTopForFloat(floatingObject, floatLogicalLocation.y()); |
| - setLogicalHeightForFloat(floatingObject, logicalHeightForChild(childBox) + marginBeforeForChild(childBox) + marginAfterForChild(childBox)); |
| + setLogicalHeightForFloat(floatingObject, logicalHeightForChild(*childBox) + marginBeforeForChild(*childBox) + marginAfterForChild(*childBox)); |
| m_floatingObjects->addPlacedObject(floatingObject); |
| if (ShapeOutsideInfo* shapeOutside = childBox->shapeOutsideInfo()) |
| - shapeOutside->setReferenceBoxLogicalSize(logicalSizeForChild(childBox)); |
| + shapeOutside->setReferenceBoxLogicalSize(logicalSizeForChild(*childBox)); |
| } |
| return true; |
| } |
| @@ -2599,7 +2599,7 @@ LayoutUnit RenderBlockFlow::nextFloatLogicalBottomBelow(LayoutUnit logicalHeight |
| 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; |