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

Unified Diff: Source/core/layout/MultiColumnFragmentainerGroup.cpp

Issue 1285273004: Avoid floating point when calculating the actual column count. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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
« no previous file with comments | « LayoutTests/fast/pagination/short-pages-tall-content-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/MultiColumnFragmentainerGroup.cpp
diff --git a/Source/core/layout/MultiColumnFragmentainerGroup.cpp b/Source/core/layout/MultiColumnFragmentainerGroup.cpp
index f72aed8e9ff4c97c425ad51281d6576fad697006..a290c6c7fec521a2aec6f4b541739fb7d53e37d4 100644
--- a/Source/core/layout/MultiColumnFragmentainerGroup.cpp
+++ b/Source/core/layout/MultiColumnFragmentainerGroup.cpp
@@ -280,7 +280,10 @@ unsigned MultiColumnFragmentainerGroup::actualColumnCount() const
if (!flowThreadPortionHeight)
return 1;
- unsigned count = ceil(flowThreadPortionHeight.toFloat() / m_columnHeight.toFloat());
+ unsigned count = (flowThreadPortionHeight / m_columnHeight).floor();
+ // flowThreadPortionHeight may be saturated, so detect the remainder manually.
+ if (count * m_columnHeight < flowThreadPortionHeight)
mstensho (USE GERRIT) 2015/08/17 11:18:00 If you can suggest something that looks less silly
eae 2015/08/17 21:34:53 We could check if the value is LayoutUnit::max but
+ count++;
ASSERT(count >= 1);
return count;
}
« no previous file with comments | « LayoutTests/fast/pagination/short-pages-tall-content-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698