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 const int intMinForLayoutUnit = INT_MIN / kFixedPointDenominator; | 55 const int intMinForLayoutUnit = INT_MIN / kFixedPointDenominator; |
56 | 56 |
57 // TODO(thakis): Remove these two lines once http://llvm.org/PR26504 is resolved | 57 // TODO(thakis): Remove these two lines once http://llvm.org/PR26504 is resolved |
58 class LayoutUnit; | 58 class LayoutUnit; |
59 inline bool operator<(const LayoutUnit&, const LayoutUnit&); | 59 inline bool operator<(const LayoutUnit&, const LayoutUnit&); |
60 | 60 |
61 class LayoutUnit { | 61 class LayoutUnit { |
62 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 62 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
63 public: | 63 public: |
64 LayoutUnit() : m_value(0) { } | 64 LayoutUnit() : m_value(0) { } |
65 // TODO(leviw): All of the below constructors should be explicit. crbug.com/
581254 | |
66 explicit LayoutUnit(int value) { setValue(value); } | 65 explicit LayoutUnit(int value) { setValue(value); } |
67 explicit LayoutUnit(unsigned short value) { setValue(value); } | 66 explicit LayoutUnit(unsigned short value) { setValue(value); } |
68 explicit LayoutUnit(unsigned value) { setValue(value); } | 67 explicit LayoutUnit(unsigned value) { setValue(value); } |
69 explicit LayoutUnit(unsigned long value) { m_value = clampTo<int>(value * kF
ixedPointDenominator); } | 68 explicit LayoutUnit(unsigned long value) { m_value = clampTo<int>(value * kF
ixedPointDenominator); } |
70 explicit LayoutUnit(unsigned long long value) { m_value = clampTo<int>(value
* kFixedPointDenominator); } | 69 explicit LayoutUnit(unsigned long long value) { m_value = clampTo<int>(value
* kFixedPointDenominator); } |
71 explicit LayoutUnit(float value) { m_value = clampTo<int>(value * kFixedPoin
tDenominator); } | 70 explicit LayoutUnit(float value) { m_value = clampTo<int>(value * kFixedPoin
tDenominator); } |
72 explicit LayoutUnit(double value) { m_value = clampTo<int>(value * kFixedPoi
ntDenominator); } | 71 explicit LayoutUnit(double value) { m_value = clampTo<int>(value * kFixedPoi
ntDenominator); } |
73 | 72 |
74 static LayoutUnit fromFloatCeil(float value) | 73 static LayoutUnit fromFloatCeil(float value) |
75 { | 74 { |
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 } | 807 } |
809 | 808 |
810 inline std::ostream& operator<<(std::ostream& stream, const LayoutUnit& value) | 809 inline std::ostream& operator<<(std::ostream& stream, const LayoutUnit& value) |
811 { | 810 { |
812 return stream << value.toDouble(); | 811 return stream << value.toDouble(); |
813 } | 812 } |
814 | 813 |
815 } // namespace blink | 814 } // namespace blink |
816 | 815 |
817 #endif // LayoutUnit_h | 816 #endif // LayoutUnit_h |
OLD | NEW |