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(DARWIN) | 134 #if OS(MACOSX) |
135 int wtf_ceil() const | 135 int wtf_ceil() const |
136 #else | 136 #else |
137 int ceil() const | 137 int ceil() const |
138 #endif | 138 #endif |
139 { | 139 { |
140 if (UNLIKELY(m_value >= INT_MAX - kFixedPointDenominator + 1)) | 140 if (UNLIKELY(m_value >= INT_MAX - kFixedPointDenominator + 1)) |
141 return intMaxForLayoutUnit; | 141 return intMaxForLayoutUnit; |
142 | 142 |
143 if (m_value >= 0) | 143 if (m_value >= 0) |
144 return (m_value + kFixedPointDenominator - 1) / kFixedPointDenominat
or; | 144 return (m_value + kFixedPointDenominator - 1) / kFixedPointDenominat
or; |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 } | 790 } |
791 | 791 |
792 inline bool isIntegerValue(const LayoutUnit value) | 792 inline bool isIntegerValue(const LayoutUnit value) |
793 { | 793 { |
794 return value.toInt() == value; | 794 return value.toInt() == value; |
795 } | 795 } |
796 | 796 |
797 } // namespace WebCore | 797 } // namespace WebCore |
798 | 798 |
799 #endif // LayoutUnit_h | 799 #endif // LayoutUnit_h |
OLD | NEW |