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

Unified 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: nit 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/rendering/EllipsisBox.cpp ('k') | Source/core/rendering/InlineBox.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/FloatToLayoutUnit.h
diff --git a/Source/core/rendering/FloatToLayoutUnit.h b/Source/core/rendering/FloatToLayoutUnit.h
index 456139ef602ddcbb8ca44cb11349d3d84a5a5254..5c31cb13374b0ac3d2c3848f12e42a80a88bd478 100644
--- a/Source/core/rendering/FloatToLayoutUnit.h
+++ b/Source/core/rendering/FloatToLayoutUnit.h
@@ -5,47 +5,67 @@
#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;
+class FloatLineLayoutUnit {
+public:
+ FloatLineLayoutUnit() : m_value(0) { }
+ FloatLineLayoutUnit(float f) : m_value(f) { }
-#define ZERO_LAYOUT_UNIT LayoutUnit(0)
-#define MINUS_ONE_LAYOUT_UNIT LayoutUnit(-1)
+ float toFloat() const
+ {
+ return m_value;
+ }
-#define LAYOUT_UNIT_TO_FLOAT(layoutUnit) (layoutUnit)
-#define LAYOUT_UNIT_CEIL(layoutUnit) (layoutUnit.ceil())
-#define INT_TO_LAYOUT_UNIT(i) (LayoutUnit(i))
+ LayoutUnit toLayoutUnit() const
+ {
+ return LayoutUnit(m_value);
+ }
+public:
+ float m_value;
+};
+
+class LayoutUnitLineLayoutUnit {
+public:
+ LayoutUnitLineLayoutUnit() { }
+ LayoutUnitLineLayoutUnit(LayoutUnit f) : m_value(f) { }
+
+ float toFloat() const
+ {
+ return m_value.toFloat();
+ }
+
+ LayoutUnit toLayoutUnit() const
+ {
+ return m_value;
+ }
+
+public:
+ LayoutUnit m_value;
+};
+
+#if ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
+using LineLayoutUnit = LayoutUnitLineLayoutUnit;
#else // ENABLE(LAYOUT_UNIT_IN_INLINE_BOXES)
-
-class FloatPoint;
-class FloatRect;
-class FloatSize;
+using LineLayoutUnit = FloatLineLayoutUnit;
+#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
« 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