Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_fragment_base.h

Issue 2282213002: [LayoutNG] Introduce NGPhysicalFragment and make NGFragment a 'view' (Closed)
Patch Set: address comments. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_physical_constraint_space.h" 9 #include "core/layout/ng/ng_physical_constraint_space.h"
10 #include "core/layout/ng/ng_writing_mode.h" 10 #include "core/layout/ng/ng_writing_mode.h"
11 #include "platform/LayoutUnit.h" 11 #include "platform/LayoutUnit.h"
12 #include "platform/heap/Handle.h" 12 #include "platform/heap/Handle.h"
13 #include "wtf/Vector.h" 13 #include "wtf/Vector.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 class NGPhysicalFragmentBase;
18
17 class CORE_EXPORT NGFragmentBase : public GarbageCollected<NGFragmentBase> { 19 class CORE_EXPORT NGFragmentBase : public GarbageCollected<NGFragmentBase> {
18 public: 20 public:
19 enum NGFragmentType { FragmentBox = 0, FragmentText = 1 };
20
21 NGFragmentType Type() const { return static_cast<NGFragmentType>(type_); }
22 NGWritingMode WritingMode() const { 21 NGWritingMode WritingMode() const {
23 return static_cast<NGWritingMode>(writing_mode_); 22 return static_cast<NGWritingMode>(writing_mode_);
24 } 23 }
25 NGDirection Direction() const { return static_cast<NGDirection>(direction_); } 24 NGDirection Direction() const { return static_cast<NGDirection>(direction_); }
26 25
27 // Returns the border-box size. 26 // Returns the border-box size.
28 LayoutUnit InlineSize() const { return size_.inline_size; } 27 LayoutUnit InlineSize() const;
29 LayoutUnit BlockSize() const { return size_.block_size; } 28 LayoutUnit BlockSize() const;
30 29
31 // 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.
32 LayoutUnit InlineOverflow() const { return overflow_.inline_size; } 31 LayoutUnit InlineOverflow() const;
33 LayoutUnit BlockOverflow() const { return overflow_.block_size; } 32 LayoutUnit BlockOverflow() const;
34 33
35 // Returns the offset relative to the parent fragement's content-box. 34 // Returns the offset relative to the parent fragement's content-box.
36 LayoutUnit InlineOffset() const { return offset_.inline_offset; } 35 LayoutUnit InlineOffset() const;
37 LayoutUnit BlockOffset() const { return offset_.block_offset; } 36 LayoutUnit BlockOffset() const;
38 37
39 // Should only be used by the parent fragement's layout. 38 NGPhysicalFragmentBase* PhysicalFragment() const {
40 void SetOffset(LayoutUnit inline_offset, LayoutUnit block_offset); 39 return physical_fragment_;
40 };
41 41
42 DEFINE_INLINE_TRACE_AFTER_DISPATCH() {}
43 DECLARE_TRACE(); 42 DECLARE_TRACE();
44 43
45 protected: 44 protected:
46 NGFragmentBase(NGLogicalSize size, 45 NGFragmentBase(NGWritingMode writing_mode,
47 NGLogicalSize overflow, 46 NGDirection direction,
48 NGWritingMode, 47 NGPhysicalFragmentBase* physical_fragment)
49 NGDirection, 48 : physical_fragment_(physical_fragment),
50 NGFragmentType); 49 writing_mode_(writing_mode),
50 direction_(direction) {}
51 51
52 NGLogicalSize size_; 52 Member<NGPhysicalFragmentBase> physical_fragment_;
53 NGLogicalSize overflow_;
54 NGLogicalOffset offset_;
55 53
56 unsigned type_ : 1;
57 unsigned writing_mode_ : 3; 54 unsigned writing_mode_ : 3;
58 unsigned direction_ : 1; 55 unsigned direction_ : 1;
59 unsigned has_been_placed_ : 1;
60 }; 56 };
61 57
62 } // namespace blink 58 } // namespace blink
63 59
64 #endif // NGFragmentBase_h 60 #endif // NGFragmentBase_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_fragment.h ('k') | third_party/WebKit/Source/core/layout/ng/ng_fragment_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698