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 "core/layout/ng/ng_constraint_space.h" | 9 #include "core/layout/ng/ng_constraint_space.h" |
10 #include "platform/LayoutUnit.h" | 10 #include "platform/LayoutUnit.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
12 #include "wtf/Vector.h" | 12 #include "wtf/Vector.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class CORE_EXPORT NGFragmentBase : public GarbageCollected<NGFragmentBase> { | 16 class CORE_EXPORT NGFragmentBase : public GarbageCollected<NGFragmentBase> { |
17 public: | 17 public: |
18 enum NGFragmentType { FragmentBox = 0, FragmentText = 1 }; | 18 enum NGFragmentType { FragmentBox = 0, FragmentText = 1 }; |
19 | 19 |
20 NGFragmentType type() const { return static_cast<NGFragmentType>(m_type); } | 20 NGFragmentType Type() const { return static_cast<NGFragmentType>(type_); } |
21 NGWritingMode writingMode() const { | 21 NGWritingMode WritingMode() const { |
22 return static_cast<NGWritingMode>(m_writingMode); | 22 return static_cast<NGWritingMode>(writing_mode_); |
23 } | 23 } |
24 NGDirection direction() const { | 24 NGDirection Direction() const { return static_cast<NGDirection>(direction_); } |
25 return static_cast<NGDirection>(m_direction); | |
26 } | |
27 | 25 |
28 // Returns the border-box size. | 26 // Returns the border-box size. |
29 LayoutUnit inlineSize() const { return m_inlineSize; } | 27 LayoutUnit InlineSize() const { return size_.inlineSize; } |
30 LayoutUnit blockSize() const { return m_blockSize; } | 28 LayoutUnit BlockSize() const { return size_.blockSize; } |
31 | 29 |
32 // Returns the total size, including the contents outside of the border-box. | 30 // Returns the total size, including the contents outside of the border-box. |
33 LayoutUnit inlineOverflow() const { return m_inlineOverflow; } | 31 LayoutUnit InlineOverflow() const { return overflow_.inlineSize; } |
34 LayoutUnit blockOverflow() const { return m_blockOverflow; } | 32 LayoutUnit BlockOverflow() const { return overflow_.blockSize; } |
35 | 33 |
36 // Returns the offset relative to the parent fragement's content-box. | 34 // Returns the offset relative to the parent fragement's content-box. |
37 LayoutUnit inlineOffset() const { return m_inlineOffset; } | 35 LayoutUnit InlineOffset() const { return offset_.inlineOffset; } |
38 LayoutUnit blockOffset() const { return m_blockOffset; } | 36 LayoutUnit BlockOffset() const { return offset_.blockOffset; } |
39 | 37 |
40 // Should only be used by the parent fragement's layout. | 38 // Should only be used by the parent fragement's layout. |
41 void setOffset(LayoutUnit inlineOffset, LayoutUnit blockOffset); | 39 void SetOffset(LayoutUnit inline_offset, LayoutUnit block_offset); |
42 | 40 |
43 DEFINE_INLINE_TRACE_AFTER_DISPATCH() {} | 41 DEFINE_INLINE_TRACE_AFTER_DISPATCH() {} |
44 DECLARE_TRACE(); | 42 DECLARE_TRACE(); |
45 | 43 |
46 protected: | 44 protected: |
47 NGFragmentBase(LayoutUnit inlineSize, | 45 NGFragmentBase(NGLogicalSize size, |
48 LayoutUnit blockSize, | 46 NGLogicalSize overflow, |
49 LayoutUnit inlineOverflow, | |
50 LayoutUnit blockOverflow, | |
51 NGWritingMode, | 47 NGWritingMode, |
52 NGDirection, | 48 NGDirection, |
53 NGFragmentType); | 49 NGFragmentType); |
54 | 50 |
55 LayoutUnit m_inlineSize; | 51 NGLogicalSize size_; |
56 LayoutUnit m_blockSize; | 52 NGLogicalSize overflow_; |
57 LayoutUnit m_inlineOverflow; | 53 NGLogicalOffset offset_; |
58 LayoutUnit m_blockOverflow; | |
59 LayoutUnit m_inlineOffset; | |
60 LayoutUnit m_blockOffset; | |
61 | 54 |
62 unsigned m_type : 1; | 55 unsigned type_ : 1; |
63 unsigned m_writingMode : 3; | 56 unsigned writing_mode_ : 3; |
64 unsigned m_direction : 1; | 57 unsigned direction_ : 1; |
65 unsigned m_hasBeenPlaced : 1; | 58 unsigned has_been_placed_ : 1; |
66 }; | 59 }; |
67 | 60 |
68 } // namespace blink | 61 } // namespace blink |
69 | 62 |
70 #endif // NGFragmentBase_h | 63 #endif // NGFragmentBase_h |
OLD | NEW |