OLD | NEW |
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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 { | 211 { |
212 return value <= static_cast<unsigned>(std::numeric_limits<int>::max()) /
kFixedPointDenominator; | 212 return value <= static_cast<unsigned>(std::numeric_limits<int>::max()) /
kFixedPointDenominator; |
213 } | 213 } |
214 static bool isInBounds(double value) | 214 static bool isInBounds(double value) |
215 { | 215 { |
216 return ::fabs(value) <= std::numeric_limits<int>::max() / kFixedPointDen
ominator; | 216 return ::fabs(value) <= std::numeric_limits<int>::max() / kFixedPointDen
ominator; |
217 } | 217 } |
218 | 218 |
219 ALWAYS_INLINE void setValue(int value) | 219 ALWAYS_INLINE void setValue(int value) |
220 { | 220 { |
221 m_value = saturatedSet(value, kLayoutUnitFractionalBits); | 221 m_value = saturatedSet<kLayoutUnitFractionalBits>(value); |
222 } | 222 } |
223 | 223 |
224 inline void setValue(unsigned value) | 224 inline void setValue(unsigned value) |
225 { | 225 { |
226 m_value = saturatedSet(value, kLayoutUnitFractionalBits); | 226 m_value = saturatedSet<kLayoutUnitFractionalBits>(value); |
227 } | 227 } |
228 | 228 |
229 int m_value; | 229 int m_value; |
230 }; | 230 }; |
231 | 231 |
232 inline bool operator<=(const LayoutUnit& a, const LayoutUnit& b) | 232 inline bool operator<=(const LayoutUnit& a, const LayoutUnit& b) |
233 { | 233 { |
234 return a.rawValue() <= b.rawValue(); | 234 return a.rawValue() <= b.rawValue(); |
235 } | 235 } |
236 | 236 |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 if (value >= max) | 789 if (value >= max) |
790 return max; | 790 return max; |
791 if (value <= min) | 791 if (value <= min) |
792 return min; | 792 return min; |
793 return value; | 793 return value; |
794 } | 794 } |
795 | 795 |
796 } // namespace blink | 796 } // namespace blink |
797 | 797 |
798 #endif // LayoutUnit_h | 798 #endif // LayoutUnit_h |
OLD | NEW |