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

Unified Diff: third_party/WebKit/Source/platform/LayoutUnit.h

Issue 1648573002: Transition to explicit constructors in LayoutUnit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moar tweaks! 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/LayoutUnit.h
diff --git a/third_party/WebKit/Source/platform/LayoutUnit.h b/third_party/WebKit/Source/platform/LayoutUnit.h
index 552ec0495cd4a9749a89f3bd050ba7c4a390996b..cf69ae772328999b33a03b5d4dfe48765adc62ef 100644
--- a/third_party/WebKit/Source/platform/LayoutUnit.h
+++ b/third_party/WebKit/Source/platform/LayoutUnit.h
@@ -65,6 +65,7 @@ class LayoutUnit {
DISALLOW_NEW_EXCEPT_PLACEMENT_NEW();
public:
LayoutUnit() : m_value(0) { }
+ // TODO(leviw): All of the below constructors should be explicit. crbug.com/581254
LayoutUnit(int value) { setValue(value); }
LayoutUnit(unsigned short value) { setValue(value); }
LayoutUnit(unsigned value) { setValue(value); }
@@ -678,13 +679,13 @@ inline LayoutUnit& operator+=(LayoutUnit& a, const LayoutUnit& b)
inline LayoutUnit& operator+=(LayoutUnit& a, int b)
{
- a = a + b;
+ a = a + LayoutUnit(b);
return a;
}
inline LayoutUnit& operator+=(LayoutUnit& a, float b)
{
- a = a + b;
+ a = a + LayoutUnit(b);
return a;
}
@@ -696,7 +697,7 @@ inline float& operator+=(float& a, const LayoutUnit& b)
inline LayoutUnit& operator-=(LayoutUnit& a, int b)
{
- a = a - b;
+ a = a - LayoutUnit(b);
return a;
}
@@ -708,7 +709,7 @@ inline LayoutUnit& operator-=(LayoutUnit& a, const LayoutUnit& b)
inline LayoutUnit& operator-=(LayoutUnit& a, float b)
{
- a = a - b;
+ a = LayoutUnit(a - b);
return a;
}
@@ -723,11 +724,10 @@ inline LayoutUnit& operator*=(LayoutUnit& a, const LayoutUnit& b)
a = a * b;
return a;
}
-// operator*=(LayoutUnit& a, int b) is supported by the operator above plus LayoutUnit(int).
inline LayoutUnit& operator*=(LayoutUnit& a, float b)
{
- a = a * b;
+ a = LayoutUnit(a * b);
return a;
}
@@ -742,11 +742,10 @@ inline LayoutUnit& operator/=(LayoutUnit& a, const LayoutUnit& b)
a = a / b;
return a;
}
-// operator/=(LayoutUnit& a, int b) is supported by the operator above plus LayoutUnit(int).
inline LayoutUnit& operator/=(LayoutUnit& a, float b)
{
- a = a / b;
+ a = LayoutUnit(a / b);
return a;
}

Powered by Google App Engine
This is Rietveld 408576698