| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 NGLayoutResult_h | 5 #ifndef NGLayoutResult_h |
| 6 #define NGLayoutResult_h | 6 #define NGLayoutResult_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/layout/ng/geometry/ng_static_position.h" | 9 #include "core/layout/ng/geometry/ng_static_position.h" |
| 10 #include "core/layout/ng/ng_floating_object.h" |
| 10 #include "core/layout/ng/ng_physical_fragment.h" | 11 #include "core/layout/ng/ng_physical_fragment.h" |
| 11 #include "platform/LayoutUnit.h" | 12 #include "platform/LayoutUnit.h" |
| 12 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
| 13 #include "wtf/Vector.h" | 14 #include "wtf/Vector.h" |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 | 17 |
| 17 class LayoutObject; | 18 class LayoutObject; |
| 18 class NGPhysicalFragment; | |
| 19 class NGBlockNode; | 19 class NGBlockNode; |
| 20 struct NGFloatingObject; | 20 struct NGFloatingObject; |
| 21 | 21 |
| 22 // The NGLayoutResult stores the resulting data from layout. This includes | 22 // The NGLayoutResult stores the resulting data from layout. This includes |
| 23 // geometry information in form of a NGPhysicalFragment, which is kept around | 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 | 24 // for painting, hit testing, etc., as well as additional data which is only |
| 25 // necessary during layout and stored on this object. | 25 // necessary during layout and stored on this object. |
| 26 // Layout code should access the NGPhysicalFragment through the wrappers in | 26 // Layout code should access the NGPhysicalFragment through the wrappers in |
| 27 // NGFragment et al. | 27 // NGFragment et al. |
| 28 class CORE_EXPORT NGLayoutResult : public RefCounted<NGLayoutResult> { | 28 class CORE_EXPORT NGLayoutResult : public RefCounted<NGLayoutResult> { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 | 42 |
| 43 // List of floats that need to be positioned by the next in-flow child that | 43 // List of floats that need to be positioned by the next in-flow child that |
| 44 // can determine its position in space. | 44 // can determine its position in space. |
| 45 // Use case example where it may be needed: | 45 // Use case example where it may be needed: |
| 46 // <div><float></div> | 46 // <div><float></div> |
| 47 // <div style="margin-top: 10px; height: 20px"></div> | 47 // <div style="margin-top: 10px; height: 20px"></div> |
| 48 // The float cannot be positioned right away inside of the 1st div because | 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 | 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. | 50 // after the 2nd div collapses its margin with its parent. |
| 51 const Vector<Persistent<NGFloatingObject>>& UnpositionedFloats() const { | 51 const Vector<RefPtr<NGFloatingObject>>& UnpositionedFloats() const { |
| 52 return unpositioned_floats_; | 52 return unpositioned_floats_; |
| 53 } | 53 } |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 friend class NGFragmentBuilder; | 56 friend class NGFragmentBuilder; |
| 57 | 57 |
| 58 NGLayoutResult(PassRefPtr<NGPhysicalFragment> physical_fragment, | 58 NGLayoutResult(PassRefPtr<NGPhysicalFragment> physical_fragment, |
| 59 PersistentHeapLinkedHashSet<WeakMember<NGBlockNode>>& | 59 PersistentHeapLinkedHashSet<WeakMember<NGBlockNode>>& |
| 60 out_of_flow_descendants, | 60 out_of_flow_descendants, |
| 61 Vector<NGStaticPosition> out_of_flow_positions, | 61 Vector<NGStaticPosition> out_of_flow_positions, |
| 62 Vector<Persistent<NGFloatingObject>>& unpositioned_floats); | 62 Vector<RefPtr<NGFloatingObject>>& unpositioned_floats); |
| 63 | 63 |
| 64 RefPtr<NGPhysicalFragment> physical_fragment_; | 64 RefPtr<NGPhysicalFragment> physical_fragment_; |
| 65 LayoutObject* layout_object_; | 65 LayoutObject* layout_object_; |
| 66 PersistentHeapLinkedHashSet<WeakMember<NGBlockNode>> out_of_flow_descendants_; | 66 PersistentHeapLinkedHashSet<WeakMember<NGBlockNode>> out_of_flow_descendants_; |
| 67 Vector<NGStaticPosition> out_of_flow_positions_; | 67 Vector<NGStaticPosition> out_of_flow_positions_; |
| 68 Vector<Persistent<NGFloatingObject>> unpositioned_floats_; | 68 Vector<RefPtr<NGFloatingObject>> unpositioned_floats_; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 } // namespace blink | 71 } // namespace blink |
| 72 | 72 |
| 73 #endif // NGLayoutResult_h | 73 #endif // NGLayoutResult_h |
| OLD | NEW |