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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } | 163 } |
164 | 164 |
165 bool mightBeSaturated() const | 165 bool mightBeSaturated() const |
166 { | 166 { |
167 return rawValue() == std::numeric_limits<int>::max() | 167 return rawValue() == std::numeric_limits<int>::max() |
168 || rawValue() == std::numeric_limits<int>::min(); | 168 || rawValue() == std::numeric_limits<int>::min(); |
169 } | 169 } |
170 | 170 |
171 static float epsilon() { return 1.0f / kFixedPointDenominator; } | 171 static float epsilon() { return 1.0f / kFixedPointDenominator; } |
172 | 172 |
| 173 static const LayoutUnit epsilonUnit() |
| 174 { |
| 175 LayoutUnit m; |
| 176 m.m_value = 1; |
| 177 return m; |
| 178 } |
| 179 |
173 static const LayoutUnit max() | 180 static const LayoutUnit max() |
174 { | 181 { |
175 LayoutUnit m; | 182 LayoutUnit m; |
176 m.m_value = std::numeric_limits<int>::max(); | 183 m.m_value = std::numeric_limits<int>::max(); |
177 return m; | 184 return m; |
178 } | 185 } |
179 static const LayoutUnit min() | 186 static const LayoutUnit min() |
180 { | 187 { |
181 LayoutUnit m; | 188 LayoutUnit m; |
182 m.m_value = std::numeric_limits<int>::min(); | 189 m.m_value = std::numeric_limits<int>::min(); |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 if (value >= max) | 796 if (value >= max) |
790 return max; | 797 return max; |
791 if (value <= min) | 798 if (value <= min) |
792 return min; | 799 return min; |
793 return value; | 800 return value; |
794 } | 801 } |
795 | 802 |
796 } // namespace blink | 803 } // namespace blink |
797 | 804 |
798 #endif // LayoutUnit_h | 805 #endif // LayoutUnit_h |
OLD | NEW |