Commit 8820ded0 authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

[LayoutNG] Decrease the amount that we miss the intrinsic sizes cache.

This adds additional logic to CanUseCachedIntrinsicInlineSizes to use
the cache logic more.

This logic is covered by the "new"
css/css-sizing/intrinsic-percent-replaced-dynamic-*

Change-Id: Ic0cdf68978ba1fb84fa0a586c48da035239fb7a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2116531
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Reviewed-by: default avatarAleks Totic <atotic@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756067}
parent 8ad47e8d
...@@ -301,26 +301,48 @@ void SetupBoxLayoutExtraInput(const NGConstraintSpace& space, ...@@ -301,26 +301,48 @@ void SetupBoxLayoutExtraInput(const NGConstraintSpace& space,
} }
bool CanUseCachedIntrinsicInlineSizes(const MinMaxSizesInput& input, bool CanUseCachedIntrinsicInlineSizes(const MinMaxSizesInput& input,
const LayoutBox& box) { const NGBlockNode& node,
bool is_orthogonal_flow_root) {
const auto& box = *node.GetLayoutBox();
// Obviously can't use the cache if our intrinsic logical widths are dirty. // Obviously can't use the cache if our intrinsic logical widths are dirty.
if (box.IntrinsicLogicalWidthsDirty()) if (box.IntrinsicLogicalWidthsDirty())
return false; return false;
if (is_orthogonal_flow_root)
return false;
// We don't store the float inline sizes for comparison, always skip the // We don't store the float inline sizes for comparison, always skip the
// cache in this case. // cache in this case.
if (input.float_left_inline_size || input.float_right_inline_size) if (input.float_left_inline_size || input.float_right_inline_size)
return false; return false;
// Check if we have any percentage inline padding. // Check if we have any percentage inline padding.
const auto& style = box.StyleRef(); const auto& style = node.Style();
if (style.MayHavePadding() && (style.PaddingStart().IsPercentOrCalc() || if (style.MayHavePadding() && (style.PaddingStart().IsPercentOrCalc() ||
style.PaddingEnd().IsPercentOrCalc())) style.PaddingEnd().IsPercentOrCalc()))
return false; return false;
// Check if the %-block-size matches. // Check if the %-block-size matches.
if (input.percentage_resolution_block_size != if (input.percentage_resolution_block_size !=
box.IntrinsicLogicalWidthsPercentageResolutionBlockSize()) box.IntrinsicLogicalWidthsPercentageResolutionBlockSize()) {
return false; // Miss the cache if our children use our %-block-size.
if (node.UseParentPercentageResolutionBlockSizeForChildren())
return false;
// OOF-positioned nodes have the %-block-size computed for their children
// up front.
if (node.IsOutOfFlowPositioned())
return false;
if (node.IsTable())
return false;
if (style.LogicalHeight().IsPercentOrCalc() ||
style.LogicalMinHeight().IsPercentOrCalc() ||
style.LogicalMaxHeight().IsPercentOrCalc())
return false;
}
return true; return true;
} }
...@@ -660,7 +682,7 @@ MinMaxSizes NGBlockNode::ComputeMinMaxSizes( ...@@ -660,7 +682,7 @@ MinMaxSizes NGBlockNode::ComputeMinMaxSizes(
bool is_orthogonal_flow_root = bool is_orthogonal_flow_root =
!IsParallelWritingMode(container_writing_mode, Style().GetWritingMode()); !IsParallelWritingMode(container_writing_mode, Style().GetWritingMode());
if (CanUseCachedIntrinsicInlineSizes(input, *box_)) if (CanUseCachedIntrinsicInlineSizes(input, *this, is_orthogonal_flow_root))
return box_->IntrinsicLogicalWidths(); return box_->IntrinsicLogicalWidths();
box_->SetIntrinsicLogicalWidthsDirty(); box_->SetIntrinsicLogicalWidthsDirty();
......
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