Commit 9e27f198 authored by Christian Biesinger's avatar Christian Biesinger Committed by Commit Bot

[layoutng] Avoid recomputing the ICB size where we can

It's somewhat expensive to compute it.

R=mstensho@chromium.org,ikilpatrick@chromium.org

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: Ic1fc1b7b2e11c18a96a268fb731716d074940a36
Reviewed-on: https://chromium-review.googlesource.com/1235213Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Christian Biesinger <cbiesinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592842}
parent d0244453
...@@ -130,9 +130,9 @@ void UpdateLegacyMultiColumnFlowThread( ...@@ -130,9 +130,9 @@ void UpdateLegacyMultiColumnFlowThread(
} }
NGConstraintSpaceBuilder CreateConstraintSpaceBuilderForMinMax( NGConstraintSpaceBuilder CreateConstraintSpaceBuilderForMinMax(
NGBlockNode node) { NGBlockNode node,
return NGConstraintSpaceBuilder(node.Style().GetWritingMode(), NGPhysicalSize icb_size) {
node.InitialContainingBlockSize()) return NGConstraintSpaceBuilder(node.Style().GetWritingMode(), icb_size)
.SetTextDirection(node.Style().Direction()) .SetTextDirection(node.Style().Direction())
.SetIsIntermediateLayout(true) .SetIsIntermediateLayout(true)
.SetIsNewFormattingContext(node.CreatesNewFormattingContext()) .SetIsNewFormattingContext(node.CreatesNewFormattingContext())
...@@ -323,9 +323,12 @@ MinMaxSize NGBlockNode::ComputeMinMaxSize( ...@@ -323,9 +323,12 @@ MinMaxSize NGBlockNode::ComputeMinMaxSize(
return ComputeMinMaxSizeFromLegacy(input.size_type); return ComputeMinMaxSizeFromLegacy(input.size_type);
} }
NGPhysicalSize icb_size = constraint_space
? constraint_space->InitialContainingBlockSize()
: InitialContainingBlockSize();
NGConstraintSpace zero_constraint_space = NGConstraintSpace zero_constraint_space =
CreateConstraintSpaceBuilderForMinMax(*this).ToConstraintSpace( CreateConstraintSpaceBuilderForMinMax(*this, icb_size)
Style().GetWritingMode()); .ToConstraintSpace(Style().GetWritingMode());
if (!constraint_space) { if (!constraint_space) {
// Using the zero-sized constraint space when measuring for an orthogonal // Using the zero-sized constraint space when measuring for an orthogonal
...@@ -378,7 +381,7 @@ MinMaxSize NGBlockNode::ComputeMinMaxSize( ...@@ -378,7 +381,7 @@ MinMaxSize NGBlockNode::ComputeMinMaxSize(
// Now, redo with infinite space for max_content // Now, redo with infinite space for max_content
NGConstraintSpace infinite_constraint_space = NGConstraintSpace infinite_constraint_space =
CreateConstraintSpaceBuilderForMinMax(*this) CreateConstraintSpaceBuilderForMinMax(*this, icb_size)
.SetAvailableSize({LayoutUnit::Max(), LayoutUnit()}) .SetAvailableSize({LayoutUnit::Max(), LayoutUnit()})
.SetPercentageResolutionSize({LayoutUnit(), LayoutUnit()}) .SetPercentageResolutionSize({LayoutUnit(), LayoutUnit()})
.ToConstraintSpace(Style().GetWritingMode()); .ToConstraintSpace(Style().GetWritingMode());
......
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