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

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

Issue 1651703002: More explicit LayoutUnit conversions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@evenMoarConstructors
Patch Set: More changes 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/LayoutTable.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.cpp b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
index 7d9621e8ec0dc33907360e7f5a7aa42ca51fb68c..ad5f370792e6809fa1df835604a219fe3b6deba9 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
@@ -286,14 +286,14 @@ void LayoutTable::updateLogicalWidth()
availableContentLogicalWidth = shrinkLogicalWidthToAvoidFloats(marginStart, marginEnd, toLayoutBlockFlow(cb));
// Ensure we aren't bigger than our available width.
- setLogicalWidth(std::min<int>(availableContentLogicalWidth, maxPreferredLogicalWidth()));
+ setLogicalWidth(LayoutUnit(std::min(availableContentLogicalWidth, maxPreferredLogicalWidth()).toInt()));
eae 2016/01/30 23:58:24 Can we do floor() instead of toInt() or would that
leviw_travelin_and_unemployed 2016/01/31 00:33:13 It would, but here I don't think we care here :) T
}
// Ensure we aren't bigger than our max-width style.
Length styleMaxLogicalWidth = style()->logicalMaxWidth();
if ((styleMaxLogicalWidth.isSpecified() && !styleMaxLogicalWidth.isNegative()) || styleMaxLogicalWidth.isIntrinsic()) {
LayoutUnit computedMaxLogicalWidth = convertStyleLogicalWidthToComputedWidth(styleMaxLogicalWidth, availableLogicalWidth);
- setLogicalWidth(std::min<int>(logicalWidth(), computedMaxLogicalWidth));
+ setLogicalWidth(LayoutUnit(std::min(logicalWidth(), computedMaxLogicalWidth).toInt()));
}
// Ensure we aren't smaller than our min preferred width. This MUST be done after 'max-width' as
@@ -304,7 +304,7 @@ void LayoutTable::updateLogicalWidth()
Length styleMinLogicalWidth = style()->logicalMinWidth();
if ((styleMinLogicalWidth.isSpecified() && !styleMinLogicalWidth.isNegative()) || styleMinLogicalWidth.isIntrinsic()) {
LayoutUnit computedMinLogicalWidth = convertStyleLogicalWidthToComputedWidth(styleMinLogicalWidth, availableLogicalWidth);
- setLogicalWidth(std::max<int>(logicalWidth(), computedMinLogicalWidth));
+ setLogicalWidth(LayoutUnit(std::max(logicalWidth(), computedMinLogicalWidth).toInt()));
}
// Finally, with our true width determined, compute our margins for real.
@@ -436,7 +436,7 @@ void LayoutTable::layout()
LayoutUnit oldLogicalWidth = logicalWidth();
LayoutUnit oldLogicalHeight = logicalHeight();
- setLogicalHeight(0);
+ setLogicalHeight(LayoutUnit());
updateLogicalWidth();
if (logicalWidth() != oldLogicalWidth) {
@@ -524,7 +524,7 @@ void LayoutTable::layout()
setLogicalHeight(logicalHeight() + computedLogicalHeight);
}
- LayoutUnit sectionLogicalLeft = style()->isLeftToRightDirection() ? borderStart() : borderEnd();
+ LayoutUnit sectionLogicalLeft = LayoutUnit(style()->isLeftToRightDirection() ? borderStart() : borderEnd());
if (!collapsing)
sectionLogicalLeft += style()->isLeftToRightDirection() ? paddingStart() : paddingEnd();
@@ -654,11 +654,11 @@ void LayoutTable::subtractCaptionRect(LayoutRect& rect) const
if (style()->isHorizontalWritingMode()) {
rect.setHeight(rect.height() - captionLogicalHeight);
if (captionIsBefore)
- rect.move(0, captionLogicalHeight);
+ rect.move(LayoutUnit(), captionLogicalHeight);
} else {
rect.setWidth(rect.width() - captionLogicalHeight);
if (captionIsBefore)
- rect.move(captionLogicalHeight, 0);
+ rect.move(captionLogicalHeight, LayoutUnit());
}
}
}

Powered by Google App Engine
This is Rietveld 408576698