Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(441)

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h

Issue 2954953002: [LayoutNG] Abort a layout once the BFC offset is resolved. (Closed)
Patch Set: rebase. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h
index b24ab27864f1f87be6e3dfb65d67fe64c1d8ddf4..3ba176da363ac1150b82f34b8d34894b75c7a2cf 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.h
@@ -18,19 +18,35 @@ namespace blink {
class NGConstraintSpace;
class NGLayoutResult;
-struct NGInflowChildData;
-struct NGPreviousInflowPosition;
+
+// This struct is used for communicating to a child the position of the
+// previous inflow child.
+struct NGPreviousInflowPosition {
+ LayoutUnit bfc_block_offset;
+ LayoutUnit logical_block_offset;
+ NGMarginStrut margin_strut;
+};
+
+// This strut holds information for the current inflow child. The data is not
+// useful outside of handling this single inflow child.
+struct NGInflowChildData {
+ NGLogicalOffset bfc_offset_estimate;
+ NGMarginStrut margin_strut;
+ NGBoxStrut margins;
+};
// Updates the fragment's BFC offset if it's not already set.
-void MaybeUpdateFragmentBfcOffset(const NGConstraintSpace&,
+bool MaybeUpdateFragmentBfcOffset(const NGConstraintSpace&,
LayoutUnit bfc_block_offset,
NGFragmentBuilder* builder);
// Positions pending floats starting from {@origin_block_offset} and relative
// to container's BFC offset.
-void PositionPendingFloats(LayoutUnit origin_block_offset,
- NGFragmentBuilder* container_builder,
- NGConstraintSpace* space);
+void PositionPendingFloats(
+ LayoutUnit origin_block_offset,
+ NGFragmentBuilder* container_builder,
+ Vector<RefPtr<NGUnpositionedFloat>>* unpositioned_floats,
+ NGConstraintSpace* space);
// A class for general block layout (e.g. a <div> with no special style).
// Lays out the children in sequence.
@@ -55,18 +71,21 @@ class CORE_EXPORT NGBlockLayoutAlgorithm
// Creates a new constraint space for the current child.
RefPtr<NGConstraintSpace> CreateConstraintSpaceForChild(
const NGLayoutInputNode child,
- const NGInflowChildData& child_data);
+ const NGInflowChildData& child_data,
+ const WTF::Optional<NGLogicalOffset> floats_bfc_offset = WTF::nullopt);
// @return Estimated BFC offset for the "to be layout" child.
- NGInflowChildData PrepareChildLayout(const NGPreviousInflowPosition&,
- NGLayoutInputNode);
+ WTF::Optional<NGInflowChildData> PrepareChildLayout(
+ const NGPreviousInflowPosition&,
+ NGLayoutInputNode);
- NGPreviousInflowPosition FinishChildLayout(
+ WTF::Optional<NGPreviousInflowPosition> FinishChildLayout(
const NGConstraintSpace&,
const NGPreviousInflowPosition& prev_data,
const NGInflowChildData& child_data,
- const NGLayoutInputNode child,
- NGLayoutResult*);
+ NGLayoutInputNode child,
+ NGBreakToken* child_break_token,
+ RefPtr<NGLayoutResult>);
// Positions the fragment that establishes a new formatting context.
//
@@ -87,14 +106,18 @@ class CORE_EXPORT NGBlockLayoutAlgorithm
// 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
// below #float ignoring its vertical margin.
- NGLogicalOffset PositionNewFc(const NGLayoutInputNode& child,
- const NGPreviousInflowPosition&,
- const NGBoxFragment&,
- const NGInflowChildData& child_data,
- const NGConstraintSpace& child_space);
+ bool PositionNewFc(const NGLayoutInputNode& child,
+ const NGPreviousInflowPosition&,
+ const NGLayoutResult&,
+ const NGInflowChildData& child_data,
+ const NGConstraintSpace& child_space,
+ WTF::Optional<NGLogicalOffset>* child_bfc_offset);
// Positions the fragment that knows its BFC offset.
- NGLogicalOffset PositionWithBfcOffset(const NGLogicalOffset& bfc_offset);
+ WTF::Optional<NGLogicalOffset> PositionWithBfcOffset(
+ const NGLogicalOffset& bfc_offset);
+ bool PositionWithBfcOffset(const NGLogicalOffset& bfc_offset,
+ WTF::Optional<NGLogicalOffset>* child_bfc_offset);
// Positions using the parent BFC offset.
// Fragment doesn't know its offset but we can still calculate its BFC
@@ -137,6 +160,10 @@ class CORE_EXPORT NGBlockLayoutAlgorithm
NGBoxStrut border_scrollbar_padding_;
LayoutUnit content_size_;
LayoutUnit max_inline_size_;
+
+ bool abort_when_bfc_resolved_;
+
+ Vector<RefPtr<NGUnpositionedFloat>> unpositioned_floats_;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698