| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 REPORT_OVERFLOW(value > std::numeric_limits<int>::min() && value < std::
numeric_limits<int>::max()); | 124 REPORT_OVERFLOW(value > std::numeric_limits<int>::min() && value < std::
numeric_limits<int>::max()); |
| 125 m_value = static_cast<int>(value); | 125 m_value = static_cast<int>(value); |
| 126 } | 126 } |
| 127 | 127 |
| 128 LayoutUnit abs() const | 128 LayoutUnit abs() const |
| 129 { | 129 { |
| 130 LayoutUnit returnValue; | 130 LayoutUnit returnValue; |
| 131 returnValue.setRawValue(::abs(m_value)); | 131 returnValue.setRawValue(::abs(m_value)); |
| 132 return returnValue; | 132 return returnValue; |
| 133 } | 133 } |
| 134 #if OS(MACOSX) | |
| 135 int wtf_ceil() const | |
| 136 #else | |
| 137 int ceil() const | 134 int ceil() const |
| 138 #endif | |
| 139 { | 135 { |
| 140 if (UNLIKELY(m_value >= INT_MAX - kFixedPointDenominator + 1)) | 136 if (UNLIKELY(m_value >= INT_MAX - kFixedPointDenominator + 1)) |
| 141 return intMaxForLayoutUnit; | 137 return intMaxForLayoutUnit; |
| 142 | 138 |
| 143 if (m_value >= 0) | 139 if (m_value >= 0) |
| 144 return (m_value + kFixedPointDenominator - 1) / kFixedPointDenominat
or; | 140 return (m_value + kFixedPointDenominator - 1) / kFixedPointDenominat
or; |
| 145 return toInt(); | 141 return toInt(); |
| 146 } | 142 } |
| 147 ALWAYS_INLINE int round() const | 143 ALWAYS_INLINE int round() const |
| 148 { | 144 { |
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 if (value >= max) | 789 if (value >= max) |
| 794 return max; | 790 return max; |
| 795 if (value <= min) | 791 if (value <= min) |
| 796 return min; | 792 return min; |
| 797 return value; | 793 return value; |
| 798 } | 794 } |
| 799 | 795 |
| 800 } // namespace blink | 796 } // namespace blink |
| 801 | 797 |
| 802 #endif // LayoutUnit_h | 798 #endif // LayoutUnit_h |
| OLD | NEW |