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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 1656743002: Removing more implicit LayoutUnit construction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
Index: third_party/WebKit/Source/core/layout/LayoutBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
index e263b1cc7ae2ec3ea8dab6283352c64863316498..5732603d2e78a3e5524e14fcaf20a587c6566c02 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -451,12 +451,12 @@ LayoutUnit LayoutBox::scrollHeight() const
LayoutUnit LayoutBox::scrollLeft() const
{
- return hasOverflowClip() ? layer()->scrollableArea()->scrollXOffset() : 0;
+ return hasOverflowClip() ? LayoutUnit(layer()->scrollableArea()->scrollXOffset()) : LayoutUnit();
}
LayoutUnit LayoutBox::scrollTop() const
{
- return hasOverflowClip() ? layer()->scrollableArea()->scrollYOffset() : 0;
+ return hasOverflowClip() ? LayoutUnit(layer()->scrollableArea()->scrollYOffset()) : LayoutUnit();
}
int LayoutBox::pixelSnappedScrollWidth() const
@@ -612,17 +612,17 @@ LayoutUnit LayoutBox::constrainContentBoxLogicalHeightByMinMax(LayoutUnit logica
const ComputedStyle& styleToUse = styleRef();
if (!styleToUse.logicalMaxHeight().isMaxSizeNone()) {
if (styleToUse.logicalMaxHeight().hasPercent() && styleToUse.logicalHeight().hasPercent()) {
- LayoutUnit availableLogicalHeight = logicalHeight / styleToUse.logicalHeight().value() * 100;
+ LayoutUnit availableLogicalHeight(logicalHeight / styleToUse.logicalHeight().value() * 100);
logicalHeight = std::min(logicalHeight, valueForLength(styleToUse.logicalMaxHeight(), availableLogicalHeight));
} else {
- LayoutUnit maxHeight = computeContentLogicalHeight(MaxSize, styleToUse.logicalMaxHeight(), LayoutUnit(-1));
+ LayoutUnit maxHeight(computeContentLogicalHeight(MaxSize, styleToUse.logicalMaxHeight(), LayoutUnit(-1)));
if (maxHeight != -1)
logicalHeight = std::min(logicalHeight, maxHeight);
}
}
if (styleToUse.logicalMinHeight().hasPercent() && styleToUse.logicalHeight().hasPercent()) {
- LayoutUnit availableLogicalHeight = logicalHeight / styleToUse.logicalHeight().value() * 100;
+ LayoutUnit availableLogicalHeight(logicalHeight / styleToUse.logicalHeight().value() * 100);
logicalHeight = std::max(logicalHeight, valueForLength(styleToUse.logicalMinHeight(), availableLogicalHeight));
} else {
logicalHeight = std::max(logicalHeight, computeContentLogicalHeight(MinSize, styleToUse.logicalMinHeight(), intrinsicContentHeight));
@@ -1145,34 +1145,38 @@ void LayoutBox::clearExtraInlineAndBlockOffests()
gExtraBlockOffsetMap->remove(this);
}
-LayoutUnit LayoutBox::adjustBorderBoxLogicalWidthForBoxSizing(LayoutUnit width) const
+LayoutUnit LayoutBox::adjustBorderBoxLogicalWidthForBoxSizing(float width) const
{
LayoutUnit bordersPlusPadding = borderAndPaddingLogicalWidth();
+ LayoutUnit result(width);
if (style()->boxSizing() == CONTENT_BOX)
- return width + bordersPlusPadding;
- return std::max(width, bordersPlusPadding);
+ return result + bordersPlusPadding;
+ return std::max(result, bordersPlusPadding);
}
-LayoutUnit LayoutBox::adjustBorderBoxLogicalHeightForBoxSizing(LayoutUnit height) const
+LayoutUnit LayoutBox::adjustBorderBoxLogicalHeightForBoxSizing(float height) const
{
LayoutUnit bordersPlusPadding = borderAndPaddingLogicalHeight();
+ LayoutUnit result(height);
if (style()->boxSizing() == CONTENT_BOX)
- return height + bordersPlusPadding;
- return std::max(height, bordersPlusPadding);
+ return result + bordersPlusPadding;
+ return std::max(result, bordersPlusPadding);
}
-LayoutUnit LayoutBox::adjustContentBoxLogicalWidthForBoxSizing(LayoutUnit width) const
+LayoutUnit LayoutBox::adjustContentBoxLogicalWidthForBoxSizing(float width) const
{
+ LayoutUnit result(width);
if (style()->boxSizing() == BORDER_BOX)
- width -= borderAndPaddingLogicalWidth();
- return std::max(LayoutUnit(), width);
+ result -= borderAndPaddingLogicalWidth();
+ return std::max(LayoutUnit(), result);
}
-LayoutUnit LayoutBox::adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit height) const
+LayoutUnit LayoutBox::adjustContentBoxLogicalHeightForBoxSizing(float height) const
{
+ LayoutUnit result(height);
if (style()->boxSizing() == BORDER_BOX)
- height -= borderAndPaddingLogicalHeight();
- return std::max(LayoutUnit(), height);
+ result -= borderAndPaddingLogicalHeight();
+ return std::max(LayoutUnit(), result);
}
// Hit Testing
@@ -1533,21 +1537,21 @@ LayoutRect LayoutBox::clipRect(const LayoutPoint& location) const
if (!style()->clipLeft().isAuto()) {
LayoutUnit c = valueForLength(style()->clipLeft(), borderBoxRect.width());
- clipRect.move(c, 0);
- clipRect.contract(c, 0);
+ clipRect.move(c, LayoutUnit());
+ clipRect.contract(c, LayoutUnit());
}
if (!style()->clipRight().isAuto())
- clipRect.contract(size().width() - valueForLength(style()->clipRight(), size().width()), 0);
+ clipRect.contract(size().width() - valueForLength(style()->clipRight(), size().width()), LayoutUnit());
if (!style()->clipTop().isAuto()) {
LayoutUnit c = valueForLength(style()->clipTop(), borderBoxRect.height());
- clipRect.move(0, c);
- clipRect.contract(0, c);
+ clipRect.move(LayoutUnit(), c);
+ clipRect.contract(LayoutUnit(), c);
}
if (!style()->clipBottom().isAuto())
- clipRect.contract(0, size().height() - valueForLength(style()->clipBottom(), size().height()));
+ clipRect.contract(LayoutUnit(), size().height() - valueForLength(style()->clipBottom(), size().height()));
return clipRect;
}
@@ -1640,9 +1644,9 @@ LayoutUnit LayoutBox::perpendicularContainingBlockLogicalHeight() const
// FIXME: For now just support fixed heights. Eventually should support percentage heights as well.
if (!logicalHeightLength.isFixed()) {
- LayoutUnit fillFallbackExtent = containingBlockStyle.isHorizontalWritingMode()
+ LayoutUnit fillFallbackExtent = LayoutUnit(containingBlockStyle.isHorizontalWritingMode()
? view()->frameView()->visibleContentSize().height()
- : view()->frameView()->visibleContentSize().width();
+ : view()->frameView()->visibleContentSize().width());
LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeight(ExcludeMarginBorderPadding);
if (fillAvailableExtent == -1)
return fillFallbackExtent;
@@ -1650,7 +1654,7 @@ LayoutUnit LayoutBox::perpendicularContainingBlockLogicalHeight() const
}
// Use the content box logical height as specified by the style.
- return cb->adjustContentBoxLogicalHeightForBoxSizing(logicalHeightLength.value());
+ return cb->adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit(logicalHeightLength.value()));
}
void LayoutBox::mapLocalToAncestor(const LayoutBoxModelObject* ancestor, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed, const PaintInvalidationState* paintInvalidationState) const
@@ -2087,13 +2091,13 @@ void LayoutBox::computeLogicalWidth(LogicalExtentComputedValues& computedValues)
computedValues.m_margins.m_start = minimumValueForLength(styleToUse.marginStart(), containerLogicalWidth);
computedValues.m_margins.m_end = minimumValueForLength(styleToUse.marginEnd(), containerLogicalWidth);
if (treatAsReplaced)
- computedValues.m_extent = std::max<LayoutUnit>(floatValueForLength(logicalWidthLength, 0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth());
+ computedValues.m_extent = std::max(LayoutUnit(floatValueForLength(logicalWidthLength, 0)) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth());
return;
}
// Width calculations
if (treatAsReplaced) {
- computedValues.m_extent = logicalWidthLength.value() + borderAndPaddingLogicalWidth();
+ computedValues.m_extent = LayoutUnit(logicalWidthLength.value()) + borderAndPaddingLogicalWidth();
} else if (parent()->isLayoutGrid() && style()->logicalWidth().isAuto() && style()->logicalMinWidth().isAuto() && style()->overflowX() == OVISIBLE && containerLogicalWidth < minPreferredLogicalWidth()) {
// TODO (lajava) Move this logic to the LayoutGrid class.
// Implied minimum size of Grid items.
@@ -2173,7 +2177,7 @@ LayoutUnit LayoutBox::computeIntrinsicLogicalWidthUsing(const Length& logicalWid
}
ASSERT_NOT_REACHED();
- return 0;
+ return LayoutUnit();
}
LayoutUnit LayoutBox::computeLogicalWidthUsing(SizeType widthType, const Length& logicalWidth, LayoutUnit availableLogicalWidth, const LayoutBlock* cb) const
@@ -2461,7 +2465,7 @@ void LayoutBox::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logica
// been given as an override. Just use that. The value has already been adjusted
// for box-sizing.
ASSERT(h.isFixed());
- heightResult = h.value() + borderAndPaddingLogicalHeight();
+ heightResult = LayoutUnit(h.value()) + borderAndPaddingLogicalHeight();
}
computedValues.m_extent = heightResult;
@@ -2493,7 +2497,7 @@ LayoutUnit LayoutBox::computeLogicalHeightWithoutLayout() const
// TODO(cbiesinger): We should probably return something other than just border + padding, but for now
// we have no good way to do anything else without layout, so we just use that.
LogicalExtentComputedValues computedValues;
- computeLogicalHeight(borderAndPaddingLogicalHeight(), 0, computedValues);
+ computeLogicalHeight(borderAndPaddingLogicalHeight(), LayoutUnit(), computedValues);
return computedValues.m_extent;
}
@@ -2509,7 +2513,7 @@ LayoutUnit LayoutBox::computeContentLogicalHeight(SizeType heightType, const Len
{
LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(heightType, height, intrinsicContentHeight);
if (heightIncludingScrollbar == -1)
- return -1;
+ return LayoutUnit(-1);
return std::max(LayoutUnit(), adjustContentBoxLogicalHeightForBoxSizing(heightIncludingScrollbar) - scrollbarLogicalHeight());
}
@@ -2527,25 +2531,25 @@ LayoutUnit LayoutBox::computeIntrinsicLogicalContentHeightUsing(const Length& lo
if (logicalHeightLength.isFillAvailable())
return containingBlock()->availableLogicalHeight(ExcludeMarginBorderPadding) - borderAndPadding;
ASSERT_NOT_REACHED();
- return 0;
+ return LayoutUnit();
}
LayoutUnit LayoutBox::computeContentAndScrollbarLogicalHeightUsing(SizeType heightType, const Length& height, LayoutUnit intrinsicContentHeight) const
{
if (height.isAuto())
- return heightType == MinSize ? 0 : -1;
+ return heightType == MinSize ? LayoutUnit() : LayoutUnit(-1);
// FIXME(cbiesinger): The css-sizing spec is considering changing what min-content/max-content should resolve to.
// If that happens, this code will have to change.
if (height.isIntrinsic()) {
if (intrinsicContentHeight == -1)
- return -1; // Intrinsic height isn't available.
+ return LayoutUnit(-1); // Intrinsic height isn't available.
return computeIntrinsicLogicalContentHeightUsing(height, intrinsicContentHeight, borderAndPaddingLogicalHeight()) + scrollbarLogicalHeight();
}
if (height.isFixed())
- return height.value();
+ return LayoutUnit(height.value());
if (height.hasPercent())
return computePercentageLogicalHeight(height);
- return -1;
+ return LayoutUnit(-1);
}
bool LayoutBox::stretchesToViewportInQuirksMode() const
@@ -2578,7 +2582,7 @@ bool LayoutBox::skipContainingBlockForPercentHeightCalculation(const LayoutBox*
LayoutUnit LayoutBox::computePercentageLogicalHeight(const Length& height) const
{
- LayoutUnit availableHeight = -1;
+ LayoutUnit availableHeight(-1);
bool skippedAutoHeightContainingBlock = false;
LayoutBlock* cb = containingBlock();
@@ -2625,14 +2629,14 @@ LayoutUnit LayoutBox::computePercentageLogicalHeight(const Length& height) const
LayoutTableCell* cell = toLayoutTableCell(cb);
if (scrollsOverflowY() && (!cell->style()->logicalHeight().isAuto() || !cell->table()->style()->logicalHeight().isAuto()))
return LayoutUnit();
- return -1;
+ return LayoutUnit(-1);
}
availableHeight = cb->overrideLogicalContentHeight();
includeBorderPadding = true;
}
} else if (cbstyle.logicalHeight().isFixed()) {
- LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSizing(cbstyle.logicalHeight().value());
- availableHeight = std::max(LayoutUnit(), cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeight - cb->scrollbarLogicalHeight(), -1));
+ LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit(cbstyle.logicalHeight().value()));
+ availableHeight = std::max(LayoutUnit(), cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeight - cb->scrollbarLogicalHeight(), LayoutUnit(-1)));
} else if (cbstyle.logicalHeight().hasPercent() && !isOutOfFlowPositionedWithSpecifiedHeight) {
// We need to recur and compute the percentage height for our containing block.
LayoutUnit heightWithScrollbar = cb->computePercentageLogicalHeight(cbstyle.logicalHeight());
@@ -2642,14 +2646,14 @@ LayoutUnit LayoutBox::computePercentageLogicalHeight(const Length& height) const
// handle the min/max of the current block, its caller does. So the
// return value from the recursive call will not have been adjusted
// yet.
- LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight(), -1);
+ LayoutUnit contentBoxHeight = cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeightWithScrollbar - cb->scrollbarLogicalHeight(), LayoutUnit(-1));
availableHeight = std::max(LayoutUnit(), contentBoxHeight);
}
} else if (isOutOfFlowPositionedWithSpecifiedHeight) {
// Don't allow this to affect the block' size() member variable, since this
// can get called while the block is still laying out its kids.
LogicalExtentComputedValues computedValues;
- cb->computeLogicalHeight(cb->logicalHeight(), 0, computedValues);
+ cb->computeLogicalHeight(cb->logicalHeight(), LayoutUnit(), computedValues);
availableHeight = computedValues.m_extent - cb->borderAndPaddingLogicalHeight() - cb->scrollbarLogicalHeight();
} else if (cb->isLayoutView()) {
availableHeight = view()->viewLogicalHeightForPercentages();
@@ -2691,7 +2695,7 @@ LayoutUnit LayoutBox::computeReplacedLogicalWidthUsing(SizeType sizeType, const
{
ASSERT(sizeType == MinSize || sizeType == MainOrPreferredSize || !logicalWidth.isAuto());
if (sizeType == MinSize && logicalWidth.isAuto())
- return adjustContentBoxLogicalWidthForBoxSizing(0);
+ return adjustContentBoxLogicalWidthForBoxSizing(LayoutUnit());
switch (logicalWidth.type()) {
case Fixed:
@@ -2729,7 +2733,7 @@ LayoutUnit LayoutBox::computeReplacedLogicalWidthUsing(SizeType sizeType, const
}
ASSERT_NOT_REACHED();
- return 0;
+ return LayoutUnit();
}
LayoutUnit LayoutBox::computeReplacedLogicalHeight() const
@@ -2768,7 +2772,7 @@ LayoutUnit LayoutBox::computeReplacedLogicalHeightUsing(SizeType sizeType, const
{
ASSERT(sizeType == MinSize || sizeType == MainOrPreferredSize || !logicalHeight.isAuto());
if (sizeType == MinSize && logicalHeight.isAuto())
- return adjustContentBoxLogicalHeightForBoxSizing(0);
+ return adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit());
switch (logicalHeight.type()) {
case Fixed:
@@ -2786,7 +2790,7 @@ LayoutUnit LayoutBox::computeReplacedLogicalHeightUsing(SizeType sizeType, const
ASSERT_WITH_SECURITY_IMPLICATION(cb->isLayoutBlock());
LayoutBlock* block = toLayoutBlock(cb);
LogicalExtentComputedValues computedValues;
- block->computeLogicalHeight(block->logicalHeight(), 0, computedValues);
+ block->computeLogicalHeight(block->logicalHeight(), LayoutUnit(), computedValues);
LayoutUnit newContentHeight = computedValues.m_extent - block->borderAndPaddingLogicalHeight() - block->scrollbarLogicalHeight();
LayoutUnit newHeight = block->adjustContentBoxLogicalHeightForBoxSizing(newContentHeight);
return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeight, newHeight));
@@ -2831,13 +2835,16 @@ LayoutUnit LayoutBox::computeReplacedLogicalHeightUsing(SizeType sizeType, const
LayoutUnit LayoutBox::availableLogicalHeight(AvailableLogicalHeightType heightType) const
{
// http://www.w3.org/TR/CSS2/visudet.html#propdef-height - We are interested in the content height.
- return constrainContentBoxLogicalHeightByMinMax(availableLogicalHeightUsing(style()->logicalHeight(), heightType), -1);
+ return constrainContentBoxLogicalHeightByMinMax(availableLogicalHeightUsing(style()->logicalHeight(), heightType), LayoutUnit(-1));
}
LayoutUnit LayoutBox::availableLogicalHeightUsing(const Length& h, AvailableLogicalHeightType heightType) const
{
- if (isLayoutView())
- return isHorizontalWritingMode() ? toLayoutView(this)->frameView()->visibleContentSize().height() : toLayoutView(this)->frameView()->visibleContentSize().width();
+ if (isLayoutView()) {
+ return LayoutUnit(isHorizontalWritingMode()
+ ? toLayoutView(this)->frameView()->visibleContentSize().height()
+ : toLayoutView(this)->frameView()->visibleContentSize().width());
+ }
// We need to stop here, since we don't want to increase the height of the table
// artificially. We're going to rely on this cell getting expanded to some new
@@ -2854,7 +2861,7 @@ LayoutUnit LayoutBox::availableLogicalHeightUsing(const Length& h, AvailableLogi
return adjustContentBoxLogicalHeightForBoxSizing(valueForLength(h, availableHeight));
}
- LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(MainOrPreferredSize, h, -1);
+ LayoutUnit heightIncludingScrollbar = computeContentAndScrollbarLogicalHeightUsing(MainOrPreferredSize, h, LayoutUnit(-1));
if (heightIncludingScrollbar != -1)
return std::max(LayoutUnit(), adjustContentBoxLogicalHeightForBoxSizing(heightIncludingScrollbar) - scrollbarLogicalHeight());
@@ -2863,7 +2870,7 @@ LayoutUnit LayoutBox::availableLogicalHeightUsing(const Length& h, AvailableLogi
if (isLayoutBlock() && isOutOfFlowPositioned() && style()->height().isAuto() && !(style()->top().isAuto() || style()->bottom().isAuto())) {
LayoutBlock* block = const_cast<LayoutBlock*>(toLayoutBlock(this));
LogicalExtentComputedValues computedValues;
- block->computeLogicalHeight(block->logicalHeight(), 0, computedValues);
+ block->computeLogicalHeight(block->logicalHeight(), LayoutUnit(), computedValues);
LayoutUnit newContentHeight = computedValues.m_extent - block->borderAndPaddingLogicalHeight() - block->scrollbarLogicalHeight();
return adjustContentBoxLogicalHeightForBoxSizing(newContentHeight);
}
@@ -2900,8 +2907,8 @@ LayoutUnit LayoutBox::containingBlockLogicalWidthForPositioned(const LayoutBoxMo
const LayoutView* view = toLayoutView(containingBlock);
if (FrameView* frameView = view->frameView()) {
// Don't use visibleContentRect since the PaintLayer's size has not been set yet.
- IntSize viewportSize = frameView->layoutViewportScrollableArea()->excludeScrollbars(frameView->frameRect().size());
- return containingBlock->isHorizontalWritingMode() ? viewportSize.width() : viewportSize.height();
+ LayoutSize viewportSize(frameView->layoutViewportScrollableArea()->excludeScrollbars(frameView->frameRect().size()));
+ return LayoutUnit(containingBlock->isHorizontalWritingMode() ? viewportSize.width() : viewportSize.height());
}
}
@@ -2948,7 +2955,7 @@ LayoutUnit LayoutBox::containingBlockLogicalHeightForPositioned(const LayoutBoxM
const LayoutView* view = toLayoutView(containingBlock);
if (FrameView* frameView = view->frameView()) {
// Don't use visibleContentRect since the PaintLayer's size has not been set yet.
- IntSize viewportSize = frameView->layoutViewportScrollableArea()->excludeScrollbars(frameView->frameRect().size());
+ LayoutSize viewportSize(frameView->layoutViewportScrollableArea()->excludeScrollbars(frameView->frameRect().size()));
return containingBlock->isHorizontalWritingMode() ? viewportSize.height() : viewportSize.width();
}
}
@@ -3218,11 +3225,11 @@ void LayoutBox::computePositionedLogicalWidthUsing(SizeType widthSizeType, Lengt
// Use the containing block's direction rather than the parent block's
// per CSS 2.1 reference test abspos-non-replaced-width-margin-000.
if (containerDirection == LTR) {
- marginLogicalLeftValue = 0;
+ marginLogicalLeftValue = LayoutUnit();
marginLogicalRightValue = availableSpace; // will be negative
} else {
marginLogicalLeftValue = availableSpace; // will be negative
- marginLogicalRightValue = 0;
+ marginLogicalRightValue = LayoutUnit();
}
}
} else if (marginLogicalLeft.isAuto()) {
@@ -3628,7 +3635,7 @@ LayoutRect LayoutBox::localCaretRect(InlineBox* box, int caretOffset, LayoutUnit
// <rdar://problem/3777804> Deleting all content in a document can result in giant tall-as-window insertion point
//
// FIXME: ignoring :first-line, missing good reason to take care of
- LayoutUnit fontHeight = style()->fontMetrics().height();
+ LayoutUnit fontHeight = LayoutUnit(style()->fontMetrics().height());
if (fontHeight > rect.height() || (!isAtomicInlineLevel() && !isTable()))
rect.setHeight(fontHeight);
@@ -3884,7 +3891,7 @@ void LayoutBox::incrementallyInvalidatePaint(const LayoutBoxModelObject& paintIn
LayoutUnit smallerWidth = std::min(oldBorderBoxSize.width(), newBorderBoxSize.width());
LayoutUnit borderTopRightRadiusWidth = valueForLength(style()->borderTopRightRadius().width(), smallerWidth);
LayoutUnit borderBottomRightRadiusWidth = valueForLength(style()->borderBottomRightRadius().width(), smallerWidth);
- LayoutUnit borderWidth = std::max<LayoutUnit>(borderRight(), std::max(borderTopRightRadiusWidth, borderBottomRightRadiusWidth));
+ LayoutUnit borderWidth = std::max(LayoutUnit(borderRight()), std::max(borderTopRightRadiusWidth, borderBottomRightRadiusWidth));
LayoutRect rightDeltaRect(positionFromPaintInvalidationBacking.x() + smallerWidth - borderWidth,
positionFromPaintInvalidationBacking.y(),
deltaWidth + borderWidth,
@@ -3898,7 +3905,7 @@ void LayoutBox::incrementallyInvalidatePaint(const LayoutBoxModelObject& paintIn
LayoutUnit smallerHeight = std::min(oldBorderBoxSize.height(), newBorderBoxSize.height());
LayoutUnit borderBottomLeftRadiusHeight = valueForLength(style()->borderBottomLeftRadius().height(), smallerHeight);
LayoutUnit borderBottomRightRadiusHeight = valueForLength(style()->borderBottomRightRadius().height(), smallerHeight);
- LayoutUnit borderHeight = std::max<LayoutUnit>(borderBottom(), std::max(borderBottomLeftRadiusHeight, borderBottomRightRadiusHeight));
+ LayoutUnit borderHeight = std::max(LayoutUnit(borderBottom()), std::max(borderBottomLeftRadiusHeight, borderBottomRightRadiusHeight));
LayoutRect bottomDeltaRect(positionFromPaintInvalidationBacking.x(),
positionFromPaintInvalidationBacking.y() + smallerHeight - borderHeight,
std::max(oldBorderBoxSize.width(), newBorderBoxSize.width()),
@@ -3957,10 +3964,10 @@ LayoutRectOutsets LayoutBox::computeVisualEffectOverflowOutsets() const
if (const ShadowList* boxShadow = style()->boxShadow()) {
// FIXME: Use LayoutUnit edge outsets, and then simplify this.
FloatRectOutsets outsets = boxShadow->rectOutsetsIncludingOriginal();
- top = outsets.top();
- right = outsets.right();
- bottom = outsets.bottom();
- left = outsets.left();
+ top = LayoutUnit(outsets.top());
+ right = LayoutUnit(outsets.right());
+ bottom = LayoutUnit(outsets.bottom());
+ left = LayoutUnit(outsets.left());
}
if (style()->hasBorderImageOutsets()) {
@@ -4294,10 +4301,10 @@ LayoutRect LayoutBox::noOverflowRect() const
const int scrollBarWidth = verticalScrollbarWidth();
const int scrollBarHeight = horizontalScrollbarHeight();
- LayoutUnit left = borderLeft() + (shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? scrollBarWidth : 0);
- LayoutUnit top = borderTop();
- LayoutUnit right = borderRight();
- LayoutUnit bottom = borderBottom();
+ LayoutUnit left(borderLeft() + (shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? scrollBarWidth : 0));
+ LayoutUnit top(borderTop());
+ LayoutUnit right(borderRight());
+ LayoutUnit bottom(borderBottom());
LayoutRect rect(left, top, size().width() - left - right, size().height() - top - bottom);
flipForWritingMode(rect);
// Subtract space occupied by scrollbars. Order is important here: first flip, then subtract

Powered by Google App Engine
This is Rietveld 408576698