OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef NGFragmentBase_h | |
6 #define NGFragmentBase_h | |
7 | |
8 #include "core/CoreExport.h" | |
9 #include "core/layout/ng/ng_physical_fragment_base.h" | |
10 #include "core/layout/ng/ng_writing_mode.h" | |
11 #include "platform/LayoutUnit.h" | |
12 #include "platform/heap/Handle.h" | |
13 | |
14 namespace blink { | |
15 | |
16 class CORE_EXPORT NGFragmentBase : public GarbageCollected<NGFragmentBase> { | |
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 NGPhysicalFragmentBase::NGFragmentType Type() const; | |
38 | |
39 NGPhysicalFragmentBase* PhysicalFragment() const { | |
40 return physical_fragment_; | |
41 }; | |
42 | |
43 DECLARE_TRACE(); | |
44 | |
45 protected: | |
46 NGFragmentBase(NGWritingMode writing_mode, | |
47 TextDirection direction, | |
48 NGPhysicalFragmentBase* physical_fragment) | |
49 : physical_fragment_(physical_fragment), | |
50 writing_mode_(writing_mode), | |
51 direction_(static_cast<unsigned>(direction)) {} | |
52 | |
53 Member<NGPhysicalFragmentBase> physical_fragment_; | |
54 | |
55 unsigned writing_mode_ : 3; | |
56 unsigned direction_ : 1; | |
57 }; | |
58 | |
59 } // namespace blink | |
60 | |
61 #endif // NGFragmentBase_h | |
OLD | NEW |