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

Unified Diff: third_party/WebKit/Source/platform/LengthFunctions.cpp

Issue 2597103002: Prevent floating point overflow when using calc() with large values (Closed)
Patch Set: Bigger numbers Created 4 years 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 | « third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/LengthFunctions.cpp
diff --git a/third_party/WebKit/Source/platform/LengthFunctions.cpp b/third_party/WebKit/Source/platform/LengthFunctions.cpp
index e469e2ad439883a0012b5cbe9064d227ce1990d3..8f6bd55bd1460b9d56e26f1e9a27610d86fecfdf 100644
--- a/third_party/WebKit/Source/platform/LengthFunctions.cpp
+++ b/third_party/WebKit/Source/platform/LengthFunctions.cpp
@@ -38,10 +38,10 @@ float floatValueForLength(const Length& length, float maximumValue) {
case Fixed:
return length.getFloatValue();
case Percent:
- return static_cast<float>(maximumValue * length.percent() / 100.0f);
+ return clampTo<float>(maximumValue * length.percent() / 100.0f);
eae 2017/01/03 04:37:30 clampTo is significantly more expensive than a sta
alancutter (OOO until 2018) 2017/01/03 05:17:02 The performance impact of this is a bit scary actu
case FillAvailable:
case Auto:
- return static_cast<float>(maximumValue);
+ return maximumValue;
case Calculated:
return length.nonNanCalculatedValue(LayoutUnit(maximumValue));
case MinContent:
« no previous file with comments | « third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698