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

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

Issue 2261663002: Disallow cast/implicit conversion from LayoutUnit to int/unsigned (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 4 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/TableLayoutAlgorithmAuto.cpp
diff --git a/third_party/WebKit/Source/core/layout/TableLayoutAlgorithmAuto.cpp b/third_party/WebKit/Source/core/layout/TableLayoutAlgorithmAuto.cpp
index 79132d7c0f879718b368c6ff048a6f2fcafc4c9d..f7eeec7f8dd9a330b18211b82dad9ff1c98ce439 100644
--- a/third_party/WebKit/Source/core/layout/TableLayoutAlgorithmAuto.cpp
+++ b/third_party/WebKit/Source/core/layout/TableLayoutAlgorithmAuto.cpp
@@ -69,9 +69,9 @@ void TableLayoutAlgorithmAuto::recalcColumn(unsigned effCol)
columnLayout.emptyCellsOnly = false;
if (cell->colSpan() == 1) {
- columnLayout.minLogicalWidth = std::max<int>(cell->minPreferredLogicalWidth(), columnLayout.minLogicalWidth);
+ columnLayout.minLogicalWidth = std::max<int>(cell->minPreferredLogicalWidth().toInt(), columnLayout.minLogicalWidth);
if (cell->maxPreferredLogicalWidth() > columnLayout.maxLogicalWidth) {
- columnLayout.maxLogicalWidth = cell->maxPreferredLogicalWidth();
+ columnLayout.maxLogicalWidth = cell->maxPreferredLogicalWidth().toInt();
maxContributor = cell;
}
@@ -91,7 +91,7 @@ void TableLayoutAlgorithmAuto::recalcColumn(unsigned effCol)
case Fixed:
// ignore width=0
if (cellLogicalWidth.isPositive() && !columnLayout.logicalWidth.hasPercent()) {
- int logicalWidth = cell->adjustBorderBoxLogicalWidthForBoxSizing(cellLogicalWidth.value());
+ int logicalWidth = cell->adjustBorderBoxLogicalWidthForBoxSizing(cellLogicalWidth.value()).toInt();
if (columnLayout.logicalWidth.isFixed()) {
// Nav/IE weirdness
if ((logicalWidth > columnLayout.logicalWidth.value())
@@ -321,8 +321,8 @@ int TableLayoutAlgorithmAuto::calcEffectiveLogicalWidth()
unsigned effCol = m_table->absoluteColumnToEffectiveColumn(cell->absoluteColumnIndex());
size_t lastCol = effCol;
- int cellMinLogicalWidth = cell->minPreferredLogicalWidth() + spacingInRowDirection;
- int cellMaxLogicalWidth = cell->maxPreferredLogicalWidth() + spacingInRowDirection;
+ int cellMinLogicalWidth = (cell->minPreferredLogicalWidth() + spacingInRowDirection).toInt();
+ int cellMaxLogicalWidth = (cell->maxPreferredLogicalWidth() + spacingInRowDirection).toInt();
float totalPercent = 0;
int spanMinLogicalWidth = 0;
int spanMaxLogicalWidth = 0;
@@ -519,7 +519,7 @@ void TableLayoutAlgorithmAuto::insertSpanCell(LayoutTableCell *cell)
void TableLayoutAlgorithmAuto::layout()
{
// table layout based on the values collected in the layout structure.
- int tableLogicalWidth = m_table->logicalWidth() - m_table->bordersPaddingAndSpacingInRowDirection();
+ int tableLogicalWidth = (m_table->logicalWidth() - m_table->bordersPaddingAndSpacingInRowDirection()).toInt();
int available = tableLogicalWidth;
size_t nEffCols = m_table->numEffectiveColumns();
@@ -580,7 +580,7 @@ void TableLayoutAlgorithmAuto::layout()
Length& logicalWidth = m_layoutStruct[i].effectiveLogicalWidth;
if (logicalWidth.hasPercent()) {
int cellLogicalWidth = std::max<int>(m_layoutStruct[i].effectiveMinLogicalWidth,
- minimumValueForLength(logicalWidth, LayoutUnit(tableLogicalWidth)));
+ minimumValueForLength(logicalWidth, LayoutUnit(tableLogicalWidth)).toInt());
available += m_layoutStruct[i].computedLogicalWidth - cellLogicalWidth;
m_layoutStruct[i].computedLogicalWidth = cellLogicalWidth;
}

Powered by Google App Engine
This is Rietveld 408576698