| Index: third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.h
|
| diff --git a/third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.h b/third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.h
|
| index b9ddfdfd1ae200e3b144228f846c317db12b34bb..a22283415ef72a176f85ef42942b4b42663cfbcd 100644
|
| --- a/third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.h
|
| +++ b/third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.h
|
| @@ -15,8 +15,9 @@ namespace blink {
|
|
|
| class NGBlockNode;
|
| class NGBreakToken;
|
| +struct NGFloatingObject;
|
|
|
| -// The NGPhysicalFragmentBase contains the output information from layout. The
|
| +// The NGPhysicalFragment contains the output information from layout. The
|
| // fragment stores all of its information in the physical coordinate system for
|
| // use by paint, hit-testing etc.
|
| //
|
| @@ -45,20 +46,20 @@ class CORE_EXPORT NGPhysicalFragment
|
|
|
| // Returns the offset relative to the parent fragement's content-box.
|
| LayoutUnit LeftOffset() const {
|
| - DCHECK(has_been_placed_);
|
| + DCHECK(is_placed_);
|
| return offset_.left;
|
| }
|
|
|
| LayoutUnit TopOffset() const {
|
| - DCHECK(has_been_placed_);
|
| + DCHECK(is_placed_);
|
| return offset_.top;
|
| }
|
|
|
| // Should only be used by the parent fragement's layout.
|
| void SetOffset(NGPhysicalOffset offset) {
|
| - DCHECK(!has_been_placed_);
|
| + DCHECK(!is_placed_);
|
| offset_ = offset;
|
| - has_been_placed_ = true;
|
| + is_placed_ = true;
|
| }
|
|
|
| NGBreakToken* BreakToken() const { return break_token_; }
|
| @@ -72,6 +73,27 @@ class CORE_EXPORT NGPhysicalFragment
|
| return out_of_flow_positions_;
|
| }
|
|
|
| + bool IsPlaced() const { return is_placed_; }
|
| +
|
| + // 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 HeapVector<Member<NGFloatingObject>>& UnpositionedFloats() const {
|
| + return unpositioned_floats_;
|
| + }
|
| +
|
| + // List of positioned float that need to be copied to the old layout tree.
|
| + // TODO(layout-ng): remove this once we change painting code to handle floats
|
| + // differently.
|
| + const HeapVector<Member<NGFloatingObject>>& PositionedFloats() const {
|
| + return positioned_floats_;
|
| + }
|
| +
|
| DECLARE_TRACE_AFTER_DISPATCH();
|
| DECLARE_TRACE();
|
|
|
| @@ -84,6 +106,8 @@ class CORE_EXPORT NGPhysicalFragment
|
| NGFragmentType type,
|
| HeapLinkedHashSet<WeakMember<NGBlockNode>>& out_of_flow_descendants,
|
| Vector<NGStaticPosition> out_of_flow_positions,
|
| + HeapVector<Member<NGFloatingObject>>& unpositioned_floats,
|
| + HeapVector<Member<NGFloatingObject>>& positioned_floats,
|
| NGBreakToken* break_token = nullptr);
|
|
|
| NGPhysicalSize size_;
|
| @@ -92,9 +116,11 @@ class CORE_EXPORT NGPhysicalFragment
|
| Member<NGBreakToken> break_token_;
|
| HeapLinkedHashSet<WeakMember<NGBlockNode>> out_of_flow_descendants_;
|
| Vector<NGStaticPosition> out_of_flow_positions_;
|
| + HeapVector<Member<NGFloatingObject>> unpositioned_floats_;
|
| + HeapVector<Member<NGFloatingObject>> positioned_floats_;
|
|
|
| unsigned type_ : 1;
|
| - unsigned has_been_placed_ : 1;
|
| + unsigned is_placed_ : 1;
|
| };
|
|
|
| } // namespace blink
|
|
|