Commit 639c840b authored by ikilpatrick's avatar ikilpatrick Committed by Commit Bot

[LayoutNG] Removes per-child state from NGBlockLayoutAlgorithm.

Removes curr_bfc_offset_, curr_child_margins_, curr_margin_strut_ in
favour of stack variables.

This clears up the information flow between children, and makes it clear
*which* margin strut, etc is being used for a particular child's
positioning. (E.g. the OOFPositioned child's positioning was difficult
to determine before).

This introduces one regression which I'll investigate separately (static
position is weird with abs-pos legacy children now) - so I've removed the
LayoutNG CQ bot.

BUG=635619

Review-Url: https://codereview.chromium.org/2899413002
Cr-Commit-Position: refs/heads/master@{#476354}
parent ba20af04
...@@ -502,7 +502,6 @@ crbug.com/719646 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-in-in ...@@ -502,7 +502,6 @@ crbug.com/719646 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-in-in
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-in-inline-percents-001.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-in-inline-percents-001.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-non-replaced-height-005.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-non-replaced-height-005.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-non-replaced-width-007.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-non-replaced-width-007.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-replaced-width-002.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-replaced-width-006.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/block-replaced-width-006.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/blocks-013.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/blocks-013.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/blocks-017.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/blocks-017.xht [ Failure ]
...@@ -553,13 +552,7 @@ crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-bloc ...@@ -553,13 +552,7 @@ crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-bloc
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-block-non-replaced-height-002.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-block-non-replaced-height-002.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-block-replaced-height-008.xht [ Skip ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-block-replaced-height-008.xht [ Skip ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-block-valign-002.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-block-valign-002.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-non-replaced-height-002.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-non-replaced-height-003.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-replaced-height-008.xht [ Skip ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-replaced-height-008.xht [ Skip ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-replaced-width-001.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-replaced-width-002.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-replaced-width-003.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-replaced-width-006.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-replaced-width-012.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-replaced-width-012.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-replaced-width-013.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-replaced-width-013.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-replaced-width-015.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-replaced-width-015.xht [ Failure ]
...@@ -596,6 +589,7 @@ crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-height- ...@@ -596,6 +589,7 @@ crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-height-
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-height-081.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-height-081.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-height-082.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-height-082.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-height-090.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-height-090.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/inline-replaced-width-006.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-height-092.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-height-092.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-height-093.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-height-093.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-height-101.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/normal-flow/max-height-101.xht [ Failure ]
...@@ -737,8 +731,6 @@ crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/positioning ...@@ -737,8 +731,6 @@ crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/positioning
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/positioning-float-002.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/positioning-float-002.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/relpos-calcs-004.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/relpos-calcs-004.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/relpos-calcs-005.xht [ Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/relpos-calcs-005.xht [ Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-007.xht [ Crash ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-008.xht [ Crash ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-019.xht [ Crash Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-019.xht [ Crash Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-020.xht [ Crash Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-020.xht [ Crash Failure ]
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-031.xht [ Crash Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-031.xht [ Crash Failure ]
...@@ -758,7 +750,7 @@ crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-104.xht ...@@ -758,7 +750,7 @@ crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-104.xht
crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-113.xht [ Crash Failure ] crbug.com/635619 virtual/layout_ng/external/wpt/css/CSS2/positioning/top-113.xht [ Crash Failure ]
### virtual/layout_ng/fast/block/basic ### virtual/layout_ng/fast/block/basic
crbug.com/635619 virtual/layout_ng/fast/block/basic/003.html [ Failure ] crbug.com/635619 virtual/layout_ng/fast/block/basic/001.html [ Failure ]
crbug.com/635619 virtual/layout_ng/fast/block/basic/006.html [ Failure ] crbug.com/635619 virtual/layout_ng/fast/block/basic/006.html [ Failure ]
crbug.com/635619 virtual/layout_ng/fast/block/basic/011.html [ Failure ] crbug.com/635619 virtual/layout_ng/fast/block/basic/011.html [ Failure ]
crbug.com/635619 virtual/layout_ng/fast/block/basic/013.html [ Failure ] crbug.com/635619 virtual/layout_ng/fast/block/basic/013.html [ Failure ]
...@@ -825,7 +817,6 @@ crbug.com/635619 virtual/layout_ng/fast/block/float/br-with-clear.html [ Failure ...@@ -825,7 +817,6 @@ crbug.com/635619 virtual/layout_ng/fast/block/float/br-with-clear.html [ Failure
crbug.com/635619 virtual/layout_ng/fast/block/float/canvas-with-floats-marked-for-layout.html [ Crash ] crbug.com/635619 virtual/layout_ng/fast/block/float/canvas-with-floats-marked-for-layout.html [ Crash ]
crbug.com/635619 virtual/layout_ng/fast/block/float/centered-float-avoidance-complexity.html [ Failure ] crbug.com/635619 virtual/layout_ng/fast/block/float/centered-float-avoidance-complexity.html [ Failure ]
crbug.com/635619 virtual/layout_ng/fast/block/float/checkbox-and-radio-avoid-floats.html [ Failure ] crbug.com/635619 virtual/layout_ng/fast/block/float/checkbox-and-radio-avoid-floats.html [ Failure ]
crbug.com/635619 virtual/layout_ng/fast/block/float/clamped-right-float.html [ Failure ]
crbug.com/635619 virtual/layout_ng/fast/block/float/clear-element-too-wide-for-containing-block.html [ Failure ] crbug.com/635619 virtual/layout_ng/fast/block/float/clear-element-too-wide-for-containing-block.html [ Failure ]
crbug.com/635619 virtual/layout_ng/fast/block/float/clear-intruding-floats-when-moving-to-inline-parent-3.html [ Crash Failure ] crbug.com/635619 virtual/layout_ng/fast/block/float/clear-intruding-floats-when-moving-to-inline-parent-3.html [ Crash Failure ]
crbug.com/635619 virtual/layout_ng/fast/block/float/clear-to-fit.html [ Failure ] crbug.com/635619 virtual/layout_ng/fast/block/float/clear-to-fit.html [ Failure ]
......
...@@ -55,11 +55,11 @@ NGInlineLayoutAlgorithm::NGInlineLayoutAlgorithm( ...@@ -55,11 +55,11 @@ NGInlineLayoutAlgorithm::NGInlineLayoutAlgorithm(
// Only resolve our BFC offset if we know that we are non-empty as we may // Only resolve our BFC offset if we know that we are non-empty as we may
// need to pass through our margin strut. // need to pass through our margin strut.
if (!inline_node->Items().IsEmpty()) { if (!inline_node->Items().IsEmpty()) {
NGLogicalOffset bfc_offset = ConstraintSpace().BfcOffset(); LayoutUnit bfc_block_offset = ConstraintSpace().BfcOffset().block_offset;
bfc_offset.block_offset += ConstraintSpace().MarginStrut().Sum(); bfc_block_offset += ConstraintSpace().MarginStrut().Sum();
MaybeUpdateFragmentBfcOffset(ConstraintSpace(), bfc_offset, MaybeUpdateFragmentBfcOffset(ConstraintSpace(), bfc_block_offset,
&container_builder_); &container_builder_);
PositionPendingFloats(bfc_offset.block_offset, &container_builder_, PositionPendingFloats(bfc_block_offset, &container_builder_,
MutableConstraintSpace()); MutableConstraintSpace());
} }
......
...@@ -18,10 +18,12 @@ namespace blink { ...@@ -18,10 +18,12 @@ namespace blink {
class NGConstraintSpace; class NGConstraintSpace;
class NGLayoutResult; class NGLayoutResult;
struct NGInflowChildData;
struct NGPreviousInflowPosition;
// Updates the fragment's BFC offset if it's not already set. // Updates the fragment's BFC offset if it's not already set.
void MaybeUpdateFragmentBfcOffset(const NGConstraintSpace&, void MaybeUpdateFragmentBfcOffset(const NGConstraintSpace&,
const NGLogicalOffset&, LayoutUnit bfc_block_offset,
NGFragmentBuilder* builder); NGFragmentBuilder* builder);
// Positions pending floats starting from {@origin_block_offset} and relative // Positions pending floats starting from {@origin_block_offset} and relative
...@@ -52,15 +54,19 @@ class CORE_EXPORT NGBlockLayoutAlgorithm ...@@ -52,15 +54,19 @@ class CORE_EXPORT NGBlockLayoutAlgorithm
// Creates a new constraint space for the current child. // Creates a new constraint space for the current child.
RefPtr<NGConstraintSpace> CreateConstraintSpaceForChild( RefPtr<NGConstraintSpace> CreateConstraintSpaceForChild(
const NGLogicalOffset& child_bfc_offset, const NGLayoutInputNode& child,
const NGLayoutInputNode&); const NGInflowChildData& child_data);
// @return Estimated BFC offset for the "to be layout" child. // @return Estimated BFC offset for the "to be layout" child.
NGLogicalOffset PrepareChildLayout(NGLayoutInputNode*); NGInflowChildData PrepareChildLayout(const NGPreviousInflowPosition&,
NGLayoutInputNode*);
void FinishChildLayout(const NGConstraintSpace&, NGPreviousInflowPosition FinishChildLayout(
const NGLayoutInputNode* child, const NGConstraintSpace&,
NGLayoutResult*); const NGPreviousInflowPosition& prev_data,
const NGInflowChildData& child_data,
const NGLayoutInputNode* child,
NGLayoutResult*);
// Positions the fragment that establishes a new formatting context. // Positions the fragment that establishes a new formatting context.
// //
...@@ -81,7 +87,10 @@ class CORE_EXPORT NGBlockLayoutAlgorithm ...@@ -81,7 +87,10 @@ class CORE_EXPORT NGBlockLayoutAlgorithm
// then it will be placed there and we collapse its margin. // then it will be placed there and we collapse its margin.
// 2) If #new-fc is too big then we need to clear its position and place it // 2) If #new-fc is too big then we need to clear its position and place it
// below #float ignoring its vertical margin. // below #float ignoring its vertical margin.
NGLogicalOffset PositionNewFc(const NGBoxFragment&, NGLogicalOffset PositionNewFc(const NGLayoutInputNode& child,
const NGPreviousInflowPosition&,
const NGBoxFragment&,
const NGInflowChildData& child_data,
const NGConstraintSpace& child_space); const NGConstraintSpace& child_space);
// Positions the fragment that knows its BFC offset. // Positions the fragment that knows its BFC offset.
...@@ -95,12 +104,16 @@ class CORE_EXPORT NGBlockLayoutAlgorithm ...@@ -95,12 +104,16 @@ class CORE_EXPORT NGBlockLayoutAlgorithm
// <div style="padding: 1px"> // <div style="padding: 1px">
// <div id="empty-div" style="margins: 1px"></div> // <div id="empty-div" style="margins: 1px"></div>
NGLogicalOffset PositionWithParentBfc(const NGConstraintSpace&, NGLogicalOffset PositionWithParentBfc(const NGConstraintSpace&,
const NGInflowChildData& child_data,
const NGBoxFragment&); const NGBoxFragment&);
NGLogicalOffset PositionLegacy(const NGConstraintSpace& child_space); NGLogicalOffset PositionLegacy(const NGConstraintSpace& child_space,
const NGInflowChildData& child_data);
void HandleOutOfFlowPositioned(NGBlockNode*); void HandleOutOfFlowPositioned(const NGPreviousInflowPosition&, NGBlockNode*);
void HandleFloating(NGBlockNode*, NGBlockBreakToken*); void HandleFloating(const NGPreviousInflowPosition&,
NGBlockNode*,
NGBlockBreakToken*);
// Final adjustments before fragment creation. We need to prevent the // Final adjustments before fragment creation. We need to prevent the
// fragment from crossing fragmentainer boundaries, and rather create a break // fragment from crossing fragmentainer boundaries, and rather create a break
...@@ -112,6 +125,7 @@ class CORE_EXPORT NGBlockLayoutAlgorithm ...@@ -112,6 +125,7 @@ class CORE_EXPORT NGBlockLayoutAlgorithm
// or {@code known_fragment_offset} if the fragment knows it's offset // or {@code known_fragment_offset} if the fragment knows it's offset
// @return Fragment's offset relative to the fragment's parent. // @return Fragment's offset relative to the fragment's parent.
NGLogicalOffset CalculateLogicalOffset( NGLogicalOffset CalculateLogicalOffset(
const NGBoxStrut& child_margins,
const WTF::Optional<NGLogicalOffset>& known_fragment_offset); const WTF::Optional<NGLogicalOffset>& known_fragment_offset);
NGLogicalSize child_available_size_; NGLogicalSize child_available_size_;
...@@ -120,10 +134,6 @@ class CORE_EXPORT NGBlockLayoutAlgorithm ...@@ -120,10 +134,6 @@ class CORE_EXPORT NGBlockLayoutAlgorithm
NGBoxStrut border_and_padding_; NGBoxStrut border_and_padding_;
LayoutUnit content_size_; LayoutUnit content_size_;
LayoutUnit max_inline_size_; LayoutUnit max_inline_size_;
// MarginStrut for the previous child.
NGMarginStrut curr_margin_strut_;
NGLogicalOffset curr_bfc_offset_;
NGBoxStrut curr_child_margins_;
}; };
} // namespace blink } // namespace blink
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment