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 NGFragment_h | 5 #ifndef NGFragment_h |
6 #define NGFragment_h | 6 #define NGFragment_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "core/layout/ng/ng_fragment_base.h" | 9 #include "core/layout/ng/ng_writing_mode.h" |
10 #include "core/layout/ng/ng_physical_fragment.h" | 10 #include "core/layout/ng/ng_physical_fragment.h" |
11 #include "core/layout/ng/ng_units.h" | 11 #include "platform/LayoutUnit.h" |
12 #include "core/layout/ng/ng_writing_mode.h" | 12 #include "platform/heap/Handle.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class CORE_EXPORT NGFragment final : public NGFragmentBase { | 16 class CORE_EXPORT NGFragment : public GarbageCollected<NGFragment> { |
17 public: | 17 public: |
| 18 NGWritingMode WritingMode() const { |
| 19 return static_cast<NGWritingMode>(writing_mode_); |
| 20 } |
| 21 TextDirection Direction() const { |
| 22 return static_cast<TextDirection>(direction_); |
| 23 } |
| 24 |
| 25 // Returns the border-box size. |
| 26 LayoutUnit InlineSize() const; |
| 27 LayoutUnit BlockSize() const; |
| 28 |
| 29 // Returns the total size, including the contents outside of the border-box. |
| 30 LayoutUnit InlineOverflow() const; |
| 31 LayoutUnit BlockOverflow() const; |
| 32 |
| 33 // Returns the offset relative to the parent fragement's content-box. |
| 34 LayoutUnit InlineOffset() const; |
| 35 LayoutUnit BlockOffset() const; |
| 36 |
| 37 NGPhysicalFragment::NGFragmentType Type() const; |
| 38 |
| 39 NGPhysicalFragment* PhysicalFragment() const { return physical_fragment_; }; |
| 40 |
| 41 DECLARE_TRACE(); |
| 42 |
| 43 protected: |
18 NGFragment(NGWritingMode writing_mode, | 44 NGFragment(NGWritingMode writing_mode, |
19 TextDirection direction, | 45 TextDirection direction, |
20 NGPhysicalFragment* physical_fragment) | 46 NGPhysicalFragment* physical_fragment) |
21 : NGFragmentBase(writing_mode, direction, physical_fragment) {} | 47 : physical_fragment_(physical_fragment), |
| 48 writing_mode_(writing_mode), |
| 49 direction_(static_cast<unsigned>(direction)) {} |
22 | 50 |
23 NGMarginStrut MarginStrut() const; | 51 Member<NGPhysicalFragment> physical_fragment_; |
| 52 |
| 53 unsigned writing_mode_ : 3; |
| 54 unsigned direction_ : 1; |
24 }; | 55 }; |
25 | 56 |
26 DEFINE_TYPE_CASTS(NGFragment, | |
27 NGFragmentBase, | |
28 fragment, | |
29 fragment->Type() == NGPhysicalFragmentBase::kFragmentBox, | |
30 fragment.Type() == NGPhysicalFragmentBase::kFragmentBox); | |
31 | |
32 } // namespace blink | 57 } // namespace blink |
33 | 58 |
34 #endif // NGFragment_h | 59 #endif // NGFragment_h |
OLD | NEW |