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

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

Issue 2365083002: Make NGFragment to own NGPhysicalFragment (Closed)
Patch Set: Created 4 years, 2 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 NGPhysicalFragmentBase_h 5 #ifndef NGPhysicalFragmentBase_h
6 #define NGPhysicalFragmentBase_h 6 #define NGPhysicalFragmentBase_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 "core/layout/ng/ng_units.h" 10 #include "core/layout/ng/ng_units.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 // The NGPhysicalFragmentBase contains the output information from layout. The 17 // The NGPhysicalFragmentBase contains the output information from layout. The
18 // fragment stores all of its information in the physical coordinate system for 18 // fragment stores all of its information in the physical coordinate system for
19 // use by paint, hit-testing etc. 19 // use by paint, hit-testing etc.
20 // 20 //
21 // Layout code should only access output layout information through the 21 // Layout code should only access output layout information through the
22 // NGFragmentBase classes which transforms information into the logical 22 // NGFragmentBase classes which transforms information into the logical
23 // coordinate system. 23 // coordinate system.
24 class CORE_EXPORT NGPhysicalFragmentBase 24 class CORE_EXPORT NGPhysicalFragmentBase {
25 : public GarbageCollected<NGPhysicalFragmentBase> {
26 public: 25 public:
27 enum NGFragmentType { FragmentBox = 0, FragmentText = 1 }; 26 enum NGFragmentType { FragmentBox = 0, FragmentText = 1 };
28 27
29 NGFragmentType Type() const { return static_cast<NGFragmentType>(type_); } 28 NGFragmentType Type() const { return static_cast<NGFragmentType>(type_); }
30 29
31 // The accessors in this class shouldn't be used by layout code directly, 30 // The accessors in this class shouldn't be used by layout code directly,
32 // instead should be accessed by the NGFragmentBase classes. These accessors 31 // instead should be accessed by the NGFragmentBase classes. These accessors
33 // exist for paint, hit-testing, etc. 32 // exist for paint, hit-testing, etc.
34 33
35 // Returns the border-box size. 34 // Returns the border-box size.
(...skipping 18 matching lines...) Expand all
54 53
55 // Should only be used by the parent fragement's layout. 54 // Should only be used by the parent fragement's layout.
56 void SetOffset(NGPhysicalOffset offset) { 55 void SetOffset(NGPhysicalOffset offset) {
57 DCHECK(!has_been_placed_); 56 DCHECK(!has_been_placed_);
58 offset_ = offset; 57 offset_ = offset;
59 has_been_placed_ = true; 58 has_been_placed_ = true;
60 } 59 }
61 60
62 NGMarginStrut MarginStrut() const { return margin_strut_; } 61 NGMarginStrut MarginStrut() const { return margin_strut_; }
63 62
64 DEFINE_INLINE_TRACE_AFTER_DISPATCH() {}
65 DECLARE_TRACE();
66
67 protected: 63 protected:
68 NGPhysicalFragmentBase(NGPhysicalSize size, 64 NGPhysicalFragmentBase(NGPhysicalSize size,
69 NGPhysicalSize overflow, 65 NGPhysicalSize overflow,
70 NGFragmentType type, 66 NGFragmentType type,
71 NGMarginStrut margin_strut) 67 NGMarginStrut margin_strut)
72 : size_(size), 68 : size_(size),
73 overflow_(overflow), 69 overflow_(overflow),
74 margin_strut_(margin_strut), 70 margin_strut_(margin_strut),
75 type_(type), 71 type_(type),
76 has_been_placed_(false) {} 72 has_been_placed_(false) {}
77 73
78 NGPhysicalSize size_; 74 NGPhysicalSize size_;
79 NGPhysicalSize overflow_; 75 NGPhysicalSize overflow_;
80 NGPhysicalOffset offset_; 76 NGPhysicalOffset offset_;
81 NGMarginStrut margin_strut_; 77 NGMarginStrut margin_strut_;
82 78
83 unsigned type_ : 1; 79 unsigned type_ : 1;
84 unsigned has_been_placed_ : 1; 80 unsigned has_been_placed_ : 1;
85 }; 81 };
86 82
87 } // namespace blink 83 } // namespace blink
88 84
89 #endif // NGFragmentBase_h 85 #endif // NGFragmentBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698