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

Side by Side Diff: Source/platform/LayoutUnit.h

Issue 200023002: Making LayoutUnit conversions to Float type explicit (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase to trunk Created 6 years, 9 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 unified diff | Download patch
« no previous file with comments | « Source/core/rendering/svg/RenderSVGRoot.cpp ('k') | Source/platform/geometry/FloatPoint.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012, Google Inc. All rights reserved. 2 * Copyright (c) 2012, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 if (static_cast<int>(floatValue * kFixedPointDenominator) == m_value) 100 if (static_cast<int>(floatValue * kFixedPointDenominator) == m_value)
101 return floatValue; 101 return floatValue;
102 if (floatValue > 0) 102 if (floatValue > 0)
103 return nextafterf(floatValue, std::numeric_limits<float>::max()); 103 return nextafterf(floatValue, std::numeric_limits<float>::max());
104 return nextafterf(floatValue, std::numeric_limits<float>::min()); 104 return nextafterf(floatValue, std::numeric_limits<float>::min());
105 } 105 }
106 unsigned toUnsigned() const { REPORT_OVERFLOW(m_value >= 0); return toInt(); } 106 unsigned toUnsigned() const { REPORT_OVERFLOW(m_value >= 0); return toInt(); }
107 107
108 operator int() const { return toInt(); } 108 operator int() const { return toInt(); }
109 operator unsigned() const { return toUnsigned(); } 109 operator unsigned() const { return toUnsigned(); }
110 operator float() const { return toFloat(); }
111 operator double() const { return toDouble(); } 110 operator double() const { return toDouble(); }
112 operator bool() const { return m_value; } 111 operator bool() const { return m_value; }
113 112
114 LayoutUnit operator++(int) 113 LayoutUnit operator++(int)
115 { 114 {
116 m_value += kFixedPointDenominator; 115 m_value += kFixedPointDenominator;
117 return *this; 116 return *this;
118 } 117 }
119 118
120 inline int rawValue() const { return m_value; } 119 inline int rawValue() const { return m_value; }
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 if (value >= max) 798 if (value >= max)
800 return max; 799 return max;
801 if (value <= min) 800 if (value <= min)
802 return min; 801 return min;
803 return value; 802 return value;
804 } 803 }
805 804
806 } // namespace WebCore 805 } // namespace WebCore
807 806
808 #endif // LayoutUnit_h 807 #endif // LayoutUnit_h
OLDNEW
« no previous file with comments | « Source/core/rendering/svg/RenderSVGRoot.cpp ('k') | Source/platform/geometry/FloatPoint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698