OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 NGFragmentBase_h | 5 #ifndef NGFragmentBase_h |
6 #define NGFragmentBase_h | 6 #define NGFragmentBase_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "platform/LayoutUnit.h" | 9 #include "platform/LayoutUnit.h" |
10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
11 #include "wtf/Vector.h" | 11 #include "wtf/Vector.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class CORE_EXPORT NGFragmentBase : public GarbageCollected<NGFragmentBase> { | 15 class CORE_EXPORT NGFragmentBase : public GarbageCollected<NGFragmentBase> { |
16 public: | 16 public: |
| 17 enum NGFragmentType { FragmentBox = 0, FragmentText = 1 }; |
| 18 |
| 19 // TODO(eae): We might want to re-use WritingMode and Direction from style. |
| 20 enum NGWritingMode { |
| 21 HorizontalTopBottom = 0, |
| 22 VerticalRightLeft = 1, |
| 23 VerticalLeftRight = 2, |
| 24 SidewaysRightLeft = 3, |
| 25 SidewaysLeftRight = 4 |
| 26 }; |
| 27 enum NGDirection { LeftToRight = 0, RightToLeft = 1 }; |
| 28 |
| 29 NGFragmentType type() const { return static_cast<NGFragmentType>(m_type); } |
| 30 NGWritingMode writingMode() const { |
| 31 return static_cast<NGWritingMode>(m_writingMode); |
| 32 } |
| 33 NGDirection direction() const { |
| 34 return static_cast<NGDirection>(m_direction); |
| 35 } |
| 36 |
17 // Returns the border-box size. | 37 // Returns the border-box size. |
18 LayoutUnit inlineSize() const { return m_inlineSize; } | 38 LayoutUnit inlineSize() const { return m_inlineSize; } |
19 LayoutUnit blockSize() const { return m_blockSize; } | 39 LayoutUnit blockSize() const { return m_blockSize; } |
20 | 40 |
21 // Returns the total size, including the contents outside of the border-box. | 41 // Returns the total size, including the contents outside of the border-box. |
22 LayoutUnit inlineOverflow() const { return m_inlineOverflow; } | 42 LayoutUnit inlineOverflow() const { return m_inlineOverflow; } |
23 LayoutUnit blockOverflow() const { return m_blockOverflow; } | 43 LayoutUnit blockOverflow() const { return m_blockOverflow; } |
24 | 44 |
25 // Returns the offset relative to the parent fragement's content-box. | 45 // Returns the offset relative to the parent fragement's content-box. |
26 LayoutUnit inlineOffset() const { return m_inlineOffset; } | 46 LayoutUnit inlineOffset() const { return m_inlineOffset; } |
27 LayoutUnit blockOffset() const { return m_blockOffset; } | 47 LayoutUnit blockOffset() const { return m_blockOffset; } |
28 | 48 |
29 // Should only be used by the parent fragement's layout. | 49 // Should only be used by the parent fragement's layout. |
30 void setOffset(LayoutUnit inlineOffset, LayoutUnit blockOffset); | 50 void setOffset(LayoutUnit inlineOffset, LayoutUnit blockOffset); |
31 | 51 |
32 DEFINE_INLINE_TRACE_AFTER_DISPATCH() {} | 52 DEFINE_INLINE_TRACE_AFTER_DISPATCH() {} |
33 DECLARE_TRACE(); | 53 DECLARE_TRACE(); |
34 | 54 |
35 protected: | 55 protected: |
36 NGFragmentBase(LayoutUnit inlineSize, | 56 NGFragmentBase(LayoutUnit inlineSize, |
37 LayoutUnit blockSize, | 57 LayoutUnit blockSize, |
38 LayoutUnit inlineOverflow, | 58 LayoutUnit inlineOverflow, |
39 LayoutUnit blockOverflow); | 59 LayoutUnit blockOverflow, |
| 60 NGWritingMode, |
| 61 NGDirection, |
| 62 NGFragmentType); |
40 | 63 |
41 LayoutUnit m_inlineSize; | 64 LayoutUnit m_inlineSize; |
42 LayoutUnit m_blockSize; | 65 LayoutUnit m_blockSize; |
43 LayoutUnit m_inlineOverflow; | 66 LayoutUnit m_inlineOverflow; |
44 LayoutUnit m_blockOverflow; | 67 LayoutUnit m_blockOverflow; |
45 LayoutUnit m_inlineOffset; | 68 LayoutUnit m_inlineOffset; |
46 LayoutUnit m_blockOffset; | 69 LayoutUnit m_blockOffset; |
47 bool m_isText; | 70 |
| 71 unsigned m_type : 1; |
| 72 unsigned m_writingMode : 3; |
| 73 unsigned m_direction : 1; |
| 74 unsigned m_hasBeenPlaced : 1; |
48 }; | 75 }; |
49 | 76 |
50 } // namespace blink | 77 } // namespace blink |
51 | 78 |
52 #endif // NGFragmentBase_h | 79 #endif // NGFragmentBase_h |
OLD | NEW |