OLD | NEW |
---|---|
(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 | |
eae
2017/02/21 22:39:05
NGLayoutContext or NGLayoutIntermediate Result mig
ikilpatrick
2017/02/21 22:48:55
I'm a fan of NGLayoutResult, as this is the unit t
| |
23 // geometry information in form of a NGPhysicalFragment, which is kept around | |
24 // for painting, hit testingm etc., as well as additional data which is only | |
25 // necessary doing layout and stored on this object. | |
eae
2017/02/21 22:39:05
s/doing/during?
| |
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 | |
OLD | NEW |