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

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

Issue 1648573002: Transition to explicit constructors in LayoutUnit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove int constructors for size/point... they result in incorrect conversions until LayoutUnit is … 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/platform/LengthFunctions.cpp
diff --git a/third_party/WebKit/Source/platform/LengthFunctions.cpp b/third_party/WebKit/Source/platform/LengthFunctions.cpp
index 483e322f72b725b65b5d6eec3d2c73fa84906751..0a15e5171dc3df64b62c720f63cf4653db1e8681 100644
--- a/third_party/WebKit/Source/platform/LengthFunctions.cpp
+++ b/third_party/WebKit/Source/platform/LengthFunctions.cpp
@@ -44,7 +44,7 @@ float floatValueForLength(const Length& length, float maximumValue)
case Auto:
return static_cast<float>(maximumValue);
case Calculated:
- return length.nonNanCalculatedValue(maximumValue);
+ return length.nonNanCalculatedValue(LayoutUnit(maximumValue));
case MinContent:
case MaxContent:
case FitContent:
@@ -63,15 +63,15 @@ LayoutUnit minimumValueForLength(const Length& length, LayoutUnit maximumValue)
{
switch (length.type()) {
case Fixed:
- return length.value();
+ return LayoutUnit(length.value());
case Percent:
// Don't remove the extra cast to float. It is needed for rounding on 32-bit Intel machines that use the FPU stack.
- return static_cast<float>(maximumValue * length.percent() / 100.0f);
+ return LayoutUnit(static_cast<float>(maximumValue * length.percent() / 100.0f));
case Calculated:
- return length.nonNanCalculatedValue(maximumValue.toFloat());
+ return LayoutUnit(length.nonNanCalculatedValue(maximumValue));
case FillAvailable:
case Auto:
- return 0;
+ return LayoutUnit();
case MinContent:
case MaxContent:
case FitContent:
@@ -80,10 +80,10 @@ LayoutUnit minimumValueForLength(const Length& length, LayoutUnit maximumValue)
case DeviceHeight:
case MaxSizeNone:
ASSERT_NOT_REACHED();
- return 0;
+ return LayoutUnit();
}
ASSERT_NOT_REACHED();
- return 0;
+ return LayoutUnit();
}
LayoutUnit roundedMinimumValueForLength(const Length& length, LayoutUnit maximumValue)
@@ -111,10 +111,10 @@ LayoutUnit valueForLength(const Length& length, LayoutUnit maximumValue)
case DeviceHeight:
case MaxSizeNone:
ASSERT_NOT_REACHED();
- return 0;
+ return LayoutUnit();
}
ASSERT_NOT_REACHED();
- return 0;
+ return LayoutUnit();
}
FloatSize floatSizeForLengthSize(const LengthSize& lengthSize, const FloatSize& boxSize)
« no previous file with comments | « third_party/WebKit/Source/platform/LayoutUnit.h ('k') | third_party/WebKit/Source/platform/animation/AnimationUtilities.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698