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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 while (0) | 55 while (0) |
56 | 56 |
57 #endif | 57 #endif |
58 | 58 |
59 static const int kLayoutUnitFractionalBits = 6; | 59 static const int kLayoutUnitFractionalBits = 6; |
60 static const int kFixedPointDenominator = 1 << kLayoutUnitFractionalBits; | 60 static const int kFixedPointDenominator = 1 << kLayoutUnitFractionalBits; |
61 | 61 |
62 const int intMaxForLayoutUnit = INT_MAX / kFixedPointDenominator; | 62 const int intMaxForLayoutUnit = INT_MAX / kFixedPointDenominator; |
63 const int intMinForLayoutUnit = INT_MIN / kFixedPointDenominator; | 63 const int intMinForLayoutUnit = INT_MIN / kFixedPointDenominator; |
64 | 64 |
| 65 // TODO(thakis): Remove these two lines once http://llvm.org/PR26504 is resolved |
| 66 class LayoutUnit; |
| 67 inline bool operator<(const LayoutUnit&, const LayoutUnit&); |
| 68 |
65 class LayoutUnit { | 69 class LayoutUnit { |
66 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 70 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
67 public: | 71 public: |
68 LayoutUnit() : m_value(0) { } | 72 LayoutUnit() : m_value(0) { } |
69 // TODO(leviw): All of the below constructors should be explicit. crbug.com/
581254 | 73 // TODO(leviw): All of the below constructors should be explicit. crbug.com/
581254 |
70 LayoutUnit(int value) { setValue(value); } | 74 LayoutUnit(int value) { setValue(value); } |
71 LayoutUnit(unsigned short value) { setValue(value); } | 75 LayoutUnit(unsigned short value) { setValue(value); } |
72 LayoutUnit(unsigned value) { setValue(value); } | 76 LayoutUnit(unsigned value) { setValue(value); } |
73 LayoutUnit(unsigned long value) { m_value = clampTo<int>(value * kFixedPoint
Denominator); } | 77 LayoutUnit(unsigned long value) { m_value = clampTo<int>(value * kFixedPoint
Denominator); } |
74 LayoutUnit(unsigned long long value) { m_value = clampTo<int>(value * kFixed
PointDenominator); } | 78 LayoutUnit(unsigned long long value) { m_value = clampTo<int>(value * kFixed
PointDenominator); } |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 if (value >= max) | 806 if (value >= max) |
803 return max; | 807 return max; |
804 if (value <= min) | 808 if (value <= min) |
805 return min; | 809 return min; |
806 return value; | 810 return value; |
807 } | 811 } |
808 | 812 |
809 } // namespace blink | 813 } // namespace blink |
810 | 814 |
811 #endif // LayoutUnit_h | 815 #endif // LayoutUnit_h |
OLD | NEW |