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

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

Issue 2702403003: [layoutng] Split NGLayoutResult out of NGPhysicalFragment (Closed)
Patch Set: rebased Created 3 years, 10 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
(Empty)
1 // Copyright 2017 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 NGLayoutResult_h
6 #define NGLayoutResult_h
7
8 #include "core/CoreExport.h"
9 #include "core/layout/ng/ng_physical_fragment.h"
10 #include "core/layout/ng/ng_units.h"
11 #include "platform/LayoutUnit.h"
12 #include "platform/heap/Handle.h"
13 #include "wtf/Vector.h"
14
15 namespace blink {
16
17 class LayoutObject;
18 class NGPhysicalFragment;
19 class NGBlockNode;
20 struct NGFloatingObject;
21
22 // The NGLayoutResult stores the resulting data from layout. This includes
23 // geometry information in form of a NGPhysicalFragment, which is kept around
24 // for painting, hit testing, etc., as well as additional data which is only
25 // necessary during layout and stored on this object.
26 // Layout code should access the NGPhysicalFragment through the wrappers in
27 // NGFragment et al.
28 class CORE_EXPORT NGLayoutResult : public RefCounted<NGLayoutResult> {
29 public:
30 RefPtr<NGPhysicalFragment> PhysicalFragment() const {
31 return physical_fragment_;
32 }
33
34 const HeapLinkedHashSet<WeakMember<NGBlockNode>>& OutOfFlowDescendants()
35 const {
36 return out_of_flow_descendants_;
37 }
38
39 const Vector<NGStaticPosition>& OutOfFlowPositions() const {
40 return out_of_flow_positions_;
41 }
42
43 // List of floats that need to be positioned by the next in-flow child that
44 // can determine its position in space.
45 // Use case example where it may be needed:
46 // <div><float></div>
47 // <div style="margin-top: 10px; height: 20px"></div>
48 // The float cannot be positioned right away inside of the 1st div because
49 // the vertical position is not known at that moment. It will be known only
50 // after the 2nd div collapses its margin with its parent.
51 const Vector<Persistent<NGFloatingObject>>& UnpositionedFloats() const {
52 return unpositioned_floats_;
53 }
54
55 private:
56 friend class NGFragmentBuilder;
57
58 NGLayoutResult(PassRefPtr<NGPhysicalFragment> physical_fragment,
59 PersistentHeapLinkedHashSet<WeakMember<NGBlockNode>>&
60 out_of_flow_descendants,
61 Vector<NGStaticPosition> out_of_flow_positions,
62 Vector<Persistent<NGFloatingObject>>& unpositioned_floats);
63
64 RefPtr<NGPhysicalFragment> physical_fragment_;
65 LayoutObject* layout_object_;
66 PersistentHeapLinkedHashSet<WeakMember<NGBlockNode>> out_of_flow_descendants_;
67 Vector<NGStaticPosition> out_of_flow_positions_;
68 Vector<Persistent<NGFloatingObject>> unpositioned_floats_;
69 };
70
71 } // namespace blink
72
73 #endif // NGLayoutResult_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698