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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.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/LayoutMultiColumnFlowThread.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp b/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp
index f5ffc24d23a67de54242fc8159fadfca3ca86669..2bc45e6ac51721f57ac3ba6a33a4c132b03c3d3c 100644
--- a/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp
@@ -585,10 +585,11 @@ void LayoutMultiColumnFlowThread::calculateColumnCountAndWidth(LayoutUnit& width
count = computedColumnCount;
width = ((availableWidth - ((count - 1) * columnGap)) / count).clampNegativeToZero();
} else if (!columnStyle->hasAutoColumnWidth() && columnStyle->hasAutoColumnCount()) {
- count = std::max(LayoutUnit(1), (availableWidth + columnGap) / (computedColumnWidth + columnGap));
+ count = std::max(LayoutUnit(1), (availableWidth + columnGap) / (computedColumnWidth + columnGap)).toUnsigned();
width = ((availableWidth + columnGap) / count) - columnGap;
} else {
- count = std::max(std::min(LayoutUnit(computedColumnCount), (availableWidth + columnGap) / (computedColumnWidth + columnGap)), LayoutUnit(1));
+ count = std::max(std::min(LayoutUnit(computedColumnCount), (availableWidth + columnGap) / (computedColumnWidth + columnGap)), LayoutUnit(1)).toUnsigned();
+ count = std::max(count, 1u);
mstensho (USE GERRIT) 2016/08/22 18:05:17 What's this for? The line above already makes sure
Xianzhu 2016/08/22 18:15:37 Thanks for the catch. This is garbage left from pr
width = ((availableWidth + columnGap) / count) - columnGap;
}
}

Powered by Google App Engine
This is Rietveld 408576698