Commit c7028c4e authored by David Grogan's avatar David Grogan Committed by Commit Bot

[LayoutNG] Support non-horizontal flows in Flexbox

This includes column containers, ortho children, and non-horizontal
writing modes.

This is a reland after the original[1] triggered an underlying crash
issue.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/1332247


Bug: 845235, 909021
Change-Id: I0d29126d5d4c2f203deecb03ee23480d46b447ef
Reviewed-on: https://chromium-review.googlesource.com/c/1371196Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Commit-Queue: David Grogan <dgrogan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615681}
parent 9c995a82
...@@ -67,6 +67,7 @@ typedef Vector<FlexItem, 8> FlexItemVector; ...@@ -67,6 +67,7 @@ typedef Vector<FlexItem, 8> FlexItemVector;
class FlexItem { class FlexItem {
public: public:
// flex_base_content_size includes scrollbar width but not border or padding. // flex_base_content_size includes scrollbar width but not border or padding.
// min_max_sizes is the min and max size in the main axis direction.
FlexItem(LayoutBox*, FlexItem(LayoutBox*,
LayoutUnit flex_base_content_size, LayoutUnit flex_base_content_size,
MinMaxSize min_max_sizes, MinMaxSize min_max_sizes,
......
...@@ -29,6 +29,18 @@ class CORE_EXPORT NGFlexLayoutAlgorithm ...@@ -29,6 +29,18 @@ class CORE_EXPORT NGFlexLayoutAlgorithm
base::Optional<MinMaxSize> ComputeMinMaxSize( base::Optional<MinMaxSize> ComputeMinMaxSize(
const MinMaxSizeInput&) const override; const MinMaxSizeInput&) const override;
private:
// This is same method as FlexItem but we need that logic before FlexItem is
// constructed.
bool MainAxisIsInlineAxis(NGBlockNode child);
LayoutUnit MainAxisContentExtent(LayoutUnit sum_hypothetical_main_size);
NGLogicalSize border_box_size_;
NGBoxStrut border_scrollbar_padding_;
NGLogicalSize content_box_size_;
NGBoxStrut borders_;
NGBoxStrut padding_;
}; };
} // namespace blink } // namespace blink
......
...@@ -130,10 +130,11 @@ MinMaxSize ComputeMinAndMaxContentContribution( ...@@ -130,10 +130,11 @@ MinMaxSize ComputeMinAndMaxContentContribution(
NGLayoutInputNode child, NGLayoutInputNode child,
const MinMaxSizeInput& input); const MinMaxSizeInput& input);
// Resolves the computed value in style.logicalWidth (Length) to a layout unit, // Returns inline size of the node's border box by resolving the computed value
// then constrains the result by the resolved min logical width and max logical // in style.logicalWidth (Length) to a layout unit, adding border and padding,
// width from the ComputedStyle object. Calls Node::ComputeMinMaxSize if needed. // then constraining the result by the resolved min logical width and max
// override_minmax is provided *solely* for use by unit tests. // logical width from the ComputedStyle object. Calls Node::ComputeMinMaxSize if
// needed. override_minmax is provided *solely* for use by unit tests.
// border_padding can be passed in as an optimization; otherwise this function // border_padding can be passed in as an optimization; otherwise this function
// will compute it itself. // will compute it itself.
CORE_EXPORT LayoutUnit ComputeInlineSizeForFragment( CORE_EXPORT LayoutUnit ComputeInlineSizeForFragment(
......
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