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

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: Traits vs Properties vs Pandas 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..aa9fff15bf5f2efc9626a554888d67eed9c790bf 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()).floor()));
}
// 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).floor()));
}
// 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).floor()));
}
// Finally, with our true width determined, compute our margins for real.
@@ -317,7 +317,7 @@ void LayoutTable::updateLogicalWidth()
// its own content which doesn't match CSS nor what authors expect.
// FIXME: When we convert to sub-pixel layout for tables we can remove the int conversion
// https://code.google.com/p/chromium/issues/detail?id=241198
- ASSERT(logicalWidth().toInt() >= minPreferredLogicalWidth().toInt());
+ ASSERT(logicalWidth().floor() >= minPreferredLogicalWidth().floor());
}
// This method takes a ComputedStyle's logical width, min-width, or max-width length and computes its actual value.
@@ -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());
}
}
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutTableRow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698