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

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

Issue 2722763002: [LayoutNG] Switch NGBreakToken to being RefCounted. (Closed)
Patch Set: remove comments. Created 3 years, 9 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 NGPhysicalFragment_h 5 #ifndef NGPhysicalFragment_h
6 #define NGPhysicalFragment_h 6 #define NGPhysicalFragment_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "core/layout/ng/ng_break_token.h"
9 #include "core/layout/ng/ng_units.h" 10 #include "core/layout/ng/ng_units.h"
10 #include "platform/LayoutUnit.h" 11 #include "platform/LayoutUnit.h"
11 #include "platform/heap/Handle.h" 12 #include "platform/heap/Handle.h"
13 #include "wtf/RefPtr.h"
12 #include "wtf/Vector.h" 14 #include "wtf/Vector.h"
13 15
14 namespace blink { 16 namespace blink {
15 17
16 class ComputedStyle; 18 class ComputedStyle;
17 class LayoutObject; 19 class LayoutObject;
18 class NGBreakToken;
19 20
20 // The NGPhysicalFragment contains the output geometry from layout. The 21 // The NGPhysicalFragment contains the output geometry from layout. The
21 // fragment stores all of its information in the physical coordinate system for 22 // fragment stores all of its information in the physical coordinate system for
22 // use by paint, hit-testing etc. 23 // use by paint, hit-testing etc.
23 // 24 //
24 // The fragment keeps a pointer back to the LayoutObject which generated it. 25 // The fragment keeps a pointer back to the LayoutObject which generated it.
25 // Once we have transitioned fully to LayoutNG it should be a const pointer 26 // Once we have transitioned fully to LayoutNG it should be a const pointer
26 // such that paint/hit-testing/etc don't modify it. 27 // such that paint/hit-testing/etc don't modify it.
27 // 28 //
28 // Layout code should only access geometry information through the 29 // Layout code should only access geometry information through the
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 return offset_; 73 return offset_;
73 } 74 }
74 75
75 // Should only be used by the parent fragement's layout. 76 // Should only be used by the parent fragement's layout.
76 void SetOffset(NGPhysicalOffset offset) { 77 void SetOffset(NGPhysicalOffset offset) {
77 DCHECK(!is_placed_); 78 DCHECK(!is_placed_);
78 offset_ = offset; 79 offset_ = offset;
79 is_placed_ = true; 80 is_placed_ = true;
80 } 81 }
81 82
82 NGBreakToken* BreakToken() const { return break_token_; } 83 NGBreakToken* BreakToken() const { return break_token_.get(); }
83 84
84 const ComputedStyle& Style() const; 85 const ComputedStyle& Style() const;
85 86
86 // GetLayoutObject should only be used when necessary for compatibility 87 // GetLayoutObject should only be used when necessary for compatibility
87 // with LegacyLayout. 88 // with LegacyLayout.
88 LayoutObject* GetLayoutObject() const { return layout_object_; } 89 LayoutObject* GetLayoutObject() const { return layout_object_; }
89 90
90 bool IsPlaced() const { return is_placed_; } 91 bool IsPlaced() const { return is_placed_; }
91 92
92 protected: 93 protected:
93 NGPhysicalFragment(LayoutObject* layout_object, 94 NGPhysicalFragment(LayoutObject* layout_object,
94 NGPhysicalSize size, 95 NGPhysicalSize size,
95 NGPhysicalSize overflow, 96 NGPhysicalSize overflow,
96 NGFragmentType type, 97 NGFragmentType type,
97 NGBreakToken* break_token = nullptr); 98 RefPtr<NGBreakToken> break_token = nullptr);
98 99
99 LayoutObject* layout_object_; 100 LayoutObject* layout_object_;
100 NGPhysicalSize size_; 101 NGPhysicalSize size_;
101 NGPhysicalSize overflow_; 102 NGPhysicalSize overflow_;
102 NGPhysicalOffset offset_; 103 NGPhysicalOffset offset_;
103 Persistent<NGBreakToken> break_token_; 104 RefPtr<NGBreakToken> break_token_;
104 105
105 unsigned type_ : 1; 106 unsigned type_ : 1;
106 unsigned is_placed_ : 1; 107 unsigned is_placed_ : 1;
107 108
108 private: 109 private:
109 void destroy() const; 110 void destroy() const;
110 }; 111 };
111 112
112 } // namespace blink 113 } // namespace blink
113 114
114 #endif // NGPhysicalFragment_h 115 #endif // NGPhysicalFragment_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698