Commit 3aab455c authored by Sergio Villar Senin's avatar Sergio Villar Senin Committed by Commit Bot

[css-flex] Remove death paths when evaluating percentage resolution

Both CrossSizeIsDefiniteForPercentageResolution and
MainSizeIsDefiniteForPercentageResolution() are only called from
UseOverrideLogicalHeightForPerentageResolution(). The former is called
whenever MainAxisIsInlineAxis(child) is true and the latter when it's
false. However CrossSizeIsDefiniteForPercentageResolution() has a path
for MainAxisIsInlineAxis(child)==false which is impossible to reach. Thesame happens to MainSizeIsDefiniteForPercentageResolution() which has a path for MainAxisIsInlineAxis(child)==true which is also impossible to
reach.

Remove both death paths and replace them by assertions.

Change-Id: I7c97ee46e992585ff2ff9b95e23341cc10b70eed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2275446Reviewed-by: default avatarChristian Biesinger <cbiesinger@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Commit-Queue: Sergio Villar <svillar@igalia.com>
Cr-Commit-Position: refs/heads/master@{#784369}
parent ee44c7f1
......@@ -1140,14 +1140,13 @@ MinMaxSizes LayoutFlexibleBox::ComputeMinAndMaxSizesForChild(
bool LayoutFlexibleBox::CrossSizeIsDefiniteForPercentageResolution(
const LayoutBox& child) const {
DCHECK(MainAxisIsInlineAxis(child));
if (FlexLayoutAlgorithm::AlignmentForChild(StyleRef(), child.StyleRef()) !=
ItemPosition::kStretch)
return false;
// Here we implement https://drafts.csswg.org/css-flexbox/#algo-stretch
if (!MainAxisIsInlineAxis(child) && child.HasOverrideLogicalWidth())
return true;
if (MainAxisIsInlineAxis(child) && child.HasOverrideLogicalHeight())
if (child.HasOverrideLogicalHeight())
return true;
// We don't currently implement the optimization from
......@@ -1161,6 +1160,7 @@ bool LayoutFlexibleBox::CrossSizeIsDefiniteForPercentageResolution(
bool LayoutFlexibleBox::MainSizeIsDefiniteForPercentageResolution(
const LayoutBox& child) const {
DCHECK(!MainAxisIsInlineAxis(child));
// This function implements section 9.8. Definite and Indefinite Sizes, case
// 2) of the flexbox spec.
// We need to check for the flexbox to have a definite main size.
......@@ -1168,8 +1168,6 @@ bool LayoutFlexibleBox::MainSizeIsDefiniteForPercentageResolution(
if (!MainAxisLengthIsDefinite(child, Length::Percent(0), false))
return false;
if (MainAxisIsInlineAxis(child))
return child.HasOverrideLogicalWidth();
return child.HasOverrideLogicalHeight();
}
......
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