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

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 LineLayoutUnit {
leviw_travelin_and_unemployed 2014/11/12 21:27:45 This may be easier if you create 2 separate classe
hartmanng 2014/11/13 16:08:26 Done. I did go with the hideous LayoutUnitLineLay
18 using FloatPointWillBeLayoutPoint = LayoutPoint; 21 public:
19 using FloatRectWillBeLayoutRect = LayoutRect; 22 #if ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
20 using FloatSizeWillBeLayoutSize = LayoutSize; 23 LineLayoutUnit(LayoutUnit f) : m_data(f) { }
24 #else // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
25 LineLayoutUnit(float f) : m_data(f) { }
26 #endif // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
21 27
22 #define ZERO_LAYOUT_UNIT LayoutUnit(0) 28 float toFloat() const
23 #define MINUS_ONE_LAYOUT_UNIT LayoutUnit(-1) 29 {
30 #if ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
31 return m_data.toFloat();
32 #else // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
33 return m_data;
34 #endif // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
35 }
24 36
25 #define LAYOUT_UNIT_TO_FLOAT(layoutUnit) (layoutUnit) 37 LayoutUnit toLayoutUnit() const
26 #define LAYOUT_UNIT_CEIL(layoutUnit) (layoutUnit.ceil()) 38 {
27 #define INT_TO_LAYOUT_UNIT(i) (LayoutUnit(i)) 39 #if ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
40 return m_data;
41 #else // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
42 return LayoutUnit(m_data);
43 #endif // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
44 }
28 45
46 public:
47 #if ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
48 LayoutUnit m_data;
29 #else // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) 49 #else // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
30 50 float m_data;
31 class FloatPoint; 51 #endif // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
32 class FloatRect; 52 };
33 class FloatSize;
34 53
35 using FloatWillBeLayoutUnit = float; 54 using FloatWillBeLayoutUnit = float;
36 using FloatPointWillBeLayoutPoint = FloatPoint; 55 using FloatPointWillBeLayoutPoint = FloatPoint;
37 using FloatRectWillBeLayoutRect = FloatRect; 56 using FloatRectWillBeLayoutRect = FloatRect;
38 using FloatSizeWillBeLayoutSize = FloatSize; 57 using FloatSizeWillBeLayoutSize = FloatSize;
39 58
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 59 } // namespace blink
50 60
51 #endif // FloatToLayoutUnit_h 61 #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