| 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>(type_); } | 20 NGFragmentType Type() const { return static_cast<NGFragmentType>(type_); } |
| 21 NGWritingMode WritingMode() const { | 21 NGWritingMode WritingMode() const { |
| 22 return static_cast<NGWritingMode>(writing_mode_); | 22 return static_cast<NGWritingMode>(writing_mode_); |
| 23 } | 23 } |
| 24 NGDirection Direction() const { return static_cast<NGDirection>(direction_); } | 24 NGDirection Direction() const { return static_cast<NGDirection>(direction_); } |
| 25 | 25 |
| 26 // Returns the border-box size. | 26 // Returns the border-box size. |
| 27 LayoutUnit InlineSize() const { return size_.inlineSize; } | 27 LayoutUnit InlineSize() const { return size_.inline_size; } |
| 28 LayoutUnit BlockSize() const { return size_.blockSize; } | 28 LayoutUnit BlockSize() const { return size_.block_size; } |
| 29 | 29 |
| 30 // 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. |
| 31 LayoutUnit InlineOverflow() const { return overflow_.inlineSize; } | 31 LayoutUnit InlineOverflow() const { return overflow_.inline_size; } |
| 32 LayoutUnit BlockOverflow() const { return overflow_.blockSize; } | 32 LayoutUnit BlockOverflow() const { return overflow_.block_size; } |
| 33 | 33 |
| 34 // Returns the offset relative to the parent fragement's content-box. | 34 // Returns the offset relative to the parent fragement's content-box. |
| 35 LayoutUnit InlineOffset() const { return offset_.inlineOffset; } | 35 LayoutUnit InlineOffset() const { return offset_.inline_offset; } |
| 36 LayoutUnit BlockOffset() const { return offset_.blockOffset; } | 36 LayoutUnit BlockOffset() const { return offset_.block_offset; } |
| 37 | 37 |
| 38 // Should only be used by the parent fragement's layout. | 38 // Should only be used by the parent fragement's layout. |
| 39 void SetOffset(LayoutUnit inline_offset, LayoutUnit block_offset); | 39 void SetOffset(LayoutUnit inline_offset, LayoutUnit block_offset); |
| 40 | 40 |
| 41 DEFINE_INLINE_TRACE_AFTER_DISPATCH() {} | 41 DEFINE_INLINE_TRACE_AFTER_DISPATCH() {} |
| 42 DECLARE_TRACE(); | 42 DECLARE_TRACE(); |
| 43 | 43 |
| 44 protected: | 44 protected: |
| 45 NGFragmentBase(NGLogicalSize size, | 45 NGFragmentBase(NGLogicalSize size, |
| 46 NGLogicalSize overflow, | 46 NGLogicalSize overflow, |
| 47 NGWritingMode, | 47 NGWritingMode, |
| 48 NGDirection, | 48 NGDirection, |
| 49 NGFragmentType); | 49 NGFragmentType); |
| 50 | 50 |
| 51 NGLogicalSize size_; | 51 NGLogicalSize size_; |
| 52 NGLogicalSize overflow_; | 52 NGLogicalSize overflow_; |
| 53 NGLogicalOffset offset_; | 53 NGLogicalOffset offset_; |
| 54 | 54 |
| 55 unsigned type_ : 1; | 55 unsigned type_ : 1; |
| 56 unsigned writing_mode_ : 3; | 56 unsigned writing_mode_ : 3; |
| 57 unsigned direction_ : 1; | 57 unsigned direction_ : 1; |
| 58 unsigned has_been_placed_ : 1; | 58 unsigned has_been_placed_ : 1; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace blink | 61 } // namespace blink |
| 62 | 62 |
| 63 #endif // NGFragmentBase_h | 63 #endif // NGFragmentBase_h |
| OLD | NEW |