Chromium Code Reviews| Index: Source/core/rendering/FloatToLayoutUnit.h |
| diff --git a/Source/core/rendering/FloatToLayoutUnit.h b/Source/core/rendering/FloatToLayoutUnit.h |
| index 456139ef602ddcbb8ca44cb11349d3d84a5a5254..cf4d0e1237b4f6fa3f4d32ac4fea66d4ab04307d 100644 |
| --- a/Source/core/rendering/FloatToLayoutUnit.h |
| +++ b/Source/core/rendering/FloatToLayoutUnit.h |
| @@ -5,47 +5,57 @@ |
| #ifndef FloatToLayoutUnit_h |
| #define FloatToLayoutUnit_h |
| +#include "platform/LayoutUnit.h" |
| + |
| namespace blink { |
| -#if ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) |
| - |
| +class FloatPoint; |
| +class FloatRect; |
| +class FloatSize; |
| class LayoutUnit; |
| class LayoutPoint; |
| class LayoutRect; |
| class LayoutSize; |
| -using FloatWillBeLayoutUnit = LayoutUnit; |
| -using FloatPointWillBeLayoutPoint = LayoutPoint; |
| -using FloatRectWillBeLayoutRect = LayoutRect; |
| -using FloatSizeWillBeLayoutSize = LayoutSize; |
| - |
| -#define ZERO_LAYOUT_UNIT LayoutUnit(0) |
| -#define MINUS_ONE_LAYOUT_UNIT LayoutUnit(-1) |
| +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
|
| +public: |
| +#if ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) |
| + LineLayoutUnit(LayoutUnit f) : m_data(f) { } |
| +#else // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) |
| + LineLayoutUnit(float f) : m_data(f) { } |
| +#endif // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) |
| -#define LAYOUT_UNIT_TO_FLOAT(layoutUnit) (layoutUnit) |
| -#define LAYOUT_UNIT_CEIL(layoutUnit) (layoutUnit.ceil()) |
| -#define INT_TO_LAYOUT_UNIT(i) (LayoutUnit(i)) |
| + float toFloat() const |
| + { |
| +#if ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) |
| + return m_data.toFloat(); |
| +#else // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) |
| + return m_data; |
| +#endif // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) |
| + } |
| + LayoutUnit toLayoutUnit() const |
| + { |
| +#if ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) |
| + return m_data; |
| #else // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) |
| + return LayoutUnit(m_data); |
| +#endif // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) |
| + } |
| -class FloatPoint; |
| -class FloatRect; |
| -class FloatSize; |
| +public: |
| +#if ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) |
| + LayoutUnit m_data; |
| +#else // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) |
| + float m_data; |
| +#endif // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) |
| +}; |
| using FloatWillBeLayoutUnit = float; |
| using FloatPointWillBeLayoutPoint = FloatPoint; |
| using FloatRectWillBeLayoutRect = FloatRect; |
| using FloatSizeWillBeLayoutSize = FloatSize; |
| -#define ZERO_LAYOUT_UNIT 0 |
| -#define MINUS_ONE_LAYOUT_UNIT -1 |
| - |
| -#define LAYOUT_UNIT_TO_FLOAT(layoutUnit) (layoutUnit.toFloat()) |
| -#define LAYOUT_UNIT_CEIL(layoutUnit) (ceilf(layoutUnit)) |
| -#define INT_TO_LAYOUT_UNIT(i) (i) |
| - |
| -#endif // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES) |
| - |
| } // namespace blink |
| #endif // FloatToLayoutUnit_h |