OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef FloatToLayoutUnit_h | 5 #ifndef FloatToLayoutUnit_h |
6 #define FloatToLayoutUnit_h | 6 #define FloatToLayoutUnit_h |
7 | 7 |
8 namespace blink { | 8 namespace blink { |
9 | 9 |
10 #if ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) | 10 #if ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) |
11 | 11 |
12 class LayoutUnit; | 12 class LayoutUnit; |
13 class LayoutPoint; | 13 class LayoutPoint; |
14 class LayoutRect; | 14 class LayoutRect; |
15 class LayoutSize; | 15 class LayoutSize; |
16 | 16 |
17 using FloatWillBeLayoutUnit = LayoutUnit; | 17 using FloatWillBeLayoutUnit = LayoutUnit; |
18 using FloatPointWillBeLayoutPoint = LayoutPoint; | 18 using FloatPointWillBeLayoutPoint = LayoutPoint; |
19 using FloatRectWillBeLayoutRect = LayoutRect; | 19 using FloatRectWillBeLayoutRect = LayoutRect; |
20 using FloatSizeWillBeLayoutSize = LayoutSize; | 20 using FloatSizeWillBeLayoutSize = LayoutSize; |
21 | 21 |
22 #define ZERO_LAYOUT_UNIT LayoutUnit(0) | 22 #define ZERO_LAYOUT_UNIT LayoutUnit(0) |
23 #define MINUS_ONE_LAYOUT_UNIT LayoutUnit(-1) | 23 #define MINUS_ONE_LAYOUT_UNIT LayoutUnit(-1) |
24 | 24 |
25 #define LAYOUT_UNIT_TO_FLOAT(layoutUnit) (layoutUnit) | 25 #define LAYOUT_UNIT_TO_FLOAT(layoutUnit) (layoutUnit) |
26 #define WILL_BE_LAYOUT_UNIT_TO_FLOAT(layoutUnit) (layoutUnit.toFloat()) | |
leviw_travelin_and_unemployed
2014/11/03 21:35:02
These names don't actually seem self-identifying t
| |
26 #define LAYOUT_UNIT_CEIL(layoutUnit) (layoutUnit.ceil()) | 27 #define LAYOUT_UNIT_CEIL(layoutUnit) (layoutUnit.ceil()) |
27 #define INT_TO_LAYOUT_UNIT(i) (LayoutUnit(i)) | 28 #define INT_TO_LAYOUT_UNIT(i) (LayoutUnit(i)) |
29 #define WILL_BE_LAYOUT_UNIT_TO_INT(layoutUnit) (layoutUnit.toInt()) | |
30 #define LAYOUT_UNIT_ROUND(layoutUnit) (layoutUnit.round()) | |
28 | 31 |
29 #else // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) | 32 #else // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) |
30 | 33 |
31 class FloatPoint; | 34 class FloatPoint; |
32 class FloatRect; | 35 class FloatRect; |
33 class FloatSize; | 36 class FloatSize; |
34 | 37 |
35 using FloatWillBeLayoutUnit = float; | 38 using FloatWillBeLayoutUnit = float; |
36 using FloatPointWillBeLayoutPoint = FloatPoint; | 39 using FloatPointWillBeLayoutPoint = FloatPoint; |
37 using FloatRectWillBeLayoutRect = FloatRect; | 40 using FloatRectWillBeLayoutRect = FloatRect; |
38 using FloatSizeWillBeLayoutSize = FloatSize; | 41 using FloatSizeWillBeLayoutSize = FloatSize; |
39 | 42 |
40 #define ZERO_LAYOUT_UNIT 0 | 43 #define ZERO_LAYOUT_UNIT 0 |
41 #define MINUS_ONE_LAYOUT_UNIT -1 | 44 #define MINUS_ONE_LAYOUT_UNIT -1 |
42 | 45 |
43 #define LAYOUT_UNIT_TO_FLOAT(layoutUnit) (layoutUnit.toFloat()) | 46 #define LAYOUT_UNIT_TO_FLOAT(layoutUnit) (layoutUnit.toFloat()) |
47 #define WILL_BE_LAYOUT_UNIT_TO_FLOAT(layoutUnit) (layoutUnit) | |
44 #define LAYOUT_UNIT_CEIL(layoutUnit) (ceilf(layoutUnit)) | 48 #define LAYOUT_UNIT_CEIL(layoutUnit) (ceilf(layoutUnit)) |
45 #define INT_TO_LAYOUT_UNIT(i) (i) | 49 #define INT_TO_LAYOUT_UNIT(i) (i) |
50 #define WILL_BE_LAYOUT_UNIT_TO_INT(layoutUnit) (layoutUnit) | |
51 #define LAYOUT_UNIT_ROUND(layoutUnit) (lroundf(layoutUnit)) | |
46 | 52 |
47 #endif // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) | 53 #endif // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) |
48 | 54 |
49 } // namespace blink | 55 } // namespace blink |
50 | 56 |
51 #endif // FloatToLayoutUnit_h | 57 #endif // FloatToLayoutUnit_h |
OLD | NEW |