Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/ng/ng_layout_result.h |
| diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_result.h b/third_party/WebKit/Source/core/layout/ng/ng_layout_result.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0ac0b31c179b2e543477f3bada5a07c930c90318 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_result.h |
| @@ -0,0 +1,73 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef NGLayoutResult_h |
| +#define NGLayoutResult_h |
| + |
| +#include "core/CoreExport.h" |
| +#include "core/layout/ng/ng_physical_fragment.h" |
| +#include "core/layout/ng/ng_units.h" |
| +#include "platform/LayoutUnit.h" |
| +#include "platform/heap/Handle.h" |
| +#include "wtf/Vector.h" |
| + |
| +namespace blink { |
| + |
| +class LayoutObject; |
| +class NGPhysicalFragment; |
| +class NGBlockNode; |
| +struct NGFloatingObject; |
| + |
| +// 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
|
| +// geometry information in form of a NGPhysicalFragment, which is kept around |
| +// for painting, hit testingm etc., as well as additional data which is only |
| +// necessary doing layout and stored on this object. |
|
eae
2017/02/21 22:39:05
s/doing/during?
|
| +// Layout code should access the NGPhysicalFragment through the wrappers in |
| +// NGFragment et al. |
| +class CORE_EXPORT NGLayoutResult : public RefCounted<NGLayoutResult> { |
| + public: |
| + RefPtr<NGPhysicalFragment> PhysicalFragment() const { |
| + return physical_fragment_; |
| + } |
| + |
| + const HeapLinkedHashSet<WeakMember<NGBlockNode>>& OutOfFlowDescendants() |
| + const { |
| + return out_of_flow_descendants_; |
| + } |
| + |
| + const Vector<NGStaticPosition>& OutOfFlowPositions() const { |
| + return out_of_flow_positions_; |
| + } |
| + |
| + // List of floats that need to be positioned by the next in-flow child that |
| + // can determine its position in space. |
| + // Use case example where it may be needed: |
| + // <div><float></div> |
| + // <div style="margin-top: 10px; height: 20px"></div> |
| + // The float cannot be positioned right away inside of the 1st div because |
| + // the vertical position is not known at that moment. It will be known only |
| + // after the 2nd div collapses its margin with its parent. |
| + const Vector<Persistent<NGFloatingObject>>& UnpositionedFloats() const { |
| + return unpositioned_floats_; |
| + } |
| + |
| + private: |
| + friend class NGFragmentBuilder; |
| + |
| + NGLayoutResult(PassRefPtr<NGPhysicalFragment> physical_fragment, |
| + PersistentHeapLinkedHashSet<WeakMember<NGBlockNode>>& |
| + out_of_flow_descendants, |
| + Vector<NGStaticPosition> out_of_flow_positions, |
| + Vector<Persistent<NGFloatingObject>>& unpositioned_floats); |
| + |
| + RefPtr<NGPhysicalFragment> physical_fragment_; |
| + LayoutObject* layout_object_; |
| + PersistentHeapLinkedHashSet<WeakMember<NGBlockNode>> out_of_flow_descendants_; |
| + Vector<NGStaticPosition> out_of_flow_positions_; |
| + Vector<Persistent<NGFloatingObject>> unpositioned_floats_; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // NGLayoutResult_h |