Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(616)

Side by Side Diff: Source/core/rendering/FloatToLayoutUnit.h

Issue 699683002: Continue with InlineBox float->LayoutUnit migration. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/EllipsisBox.cpp ('k') | Source/core/rendering/InlineBox.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "platform/LayoutUnit.h"
9
8 namespace blink { 10 namespace blink {
9 11
10 #if ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) 12 class FloatPoint;
11 13 class FloatRect;
14 class FloatSize;
12 class LayoutUnit; 15 class LayoutUnit;
13 class LayoutPoint; 16 class LayoutPoint;
14 class LayoutRect; 17 class LayoutRect;
15 class LayoutSize; 18 class LayoutSize;
16 19
17 using FloatWillBeLayoutUnit = LayoutUnit; 20 class FloatLineLayoutUnit {
18 using FloatPointWillBeLayoutPoint = LayoutPoint; 21 public:
19 using FloatRectWillBeLayoutRect = LayoutRect; 22 FloatLineLayoutUnit(float f) : m_value(f) { }
leviw_travelin_and_unemployed 2014/11/13 19:43:11 Nit: Can you add default constructors that initial
hartmanng 2014/11/13 19:48:34 Done.
20 using FloatSizeWillBeLayoutSize = LayoutSize;
21 23
22 #define ZERO_LAYOUT_UNIT LayoutUnit(0) 24 float toFloat() const
23 #define MINUS_ONE_LAYOUT_UNIT LayoutUnit(-1) 25 {
26 return m_value;
27 }
24 28
25 #define LAYOUT_UNIT_TO_FLOAT(layoutUnit) (layoutUnit) 29 LayoutUnit toLayoutUnit() const
26 #define LAYOUT_UNIT_CEIL(layoutUnit) (layoutUnit.ceil()) 30 {
27 #define INT_TO_LAYOUT_UNIT(i) (LayoutUnit(i)) 31 return LayoutUnit(m_value);
32 }
28 33
34 public:
35 float m_value;
36 };
37
38 class LayoutUnitLineLayoutUnit {
39 public:
40 LayoutUnitLineLayoutUnit(LayoutUnit f) : m_value(f) { }
41
42 float toFloat() const
43 {
44 return m_value.toFloat();
45 }
46
47 LayoutUnit toLayoutUnit() const
48 {
49 return m_value;
50 }
51
52 public:
53 LayoutUnit m_value;
54 };
55
56 #if ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
57 using LineLayoutUnit = LayoutUnitLineLayoutUnit;
29 #else // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) 58 #else // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
30 59 using LineLayoutUnit = FloatLineLayoutUnit;
31 class FloatPoint; 60 #endif // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
32 class FloatRect;
33 class FloatSize;
34 61
35 using FloatWillBeLayoutUnit = float; 62 using FloatWillBeLayoutUnit = float;
36 using FloatPointWillBeLayoutPoint = FloatPoint; 63 using FloatPointWillBeLayoutPoint = FloatPoint;
37 using FloatRectWillBeLayoutRect = FloatRect; 64 using FloatRectWillBeLayoutRect = FloatRect;
38 using FloatSizeWillBeLayoutSize = FloatSize; 65 using FloatSizeWillBeLayoutSize = FloatSize;
39 66
40 #define ZERO_LAYOUT_UNIT 0
41 #define MINUS_ONE_LAYOUT_UNIT -1
42
43 #define LAYOUT_UNIT_TO_FLOAT(layoutUnit) (layoutUnit.toFloat())
44 #define LAYOUT_UNIT_CEIL(layoutUnit) (ceilf(layoutUnit))
45 #define INT_TO_LAYOUT_UNIT(i) (i)
46
47 #endif // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
48
49 } // namespace blink 67 } // namespace blink
50 68
51 #endif // FloatToLayoutUnit_h 69 #endif // FloatToLayoutUnit_h
OLDNEW
« no previous file with comments | « Source/core/rendering/EllipsisBox.cpp ('k') | Source/core/rendering/InlineBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698