Chromium Code Reviews| Index: Source/core/layout/LayoutFlexibleBox.cpp |
| diff --git a/Source/core/layout/LayoutFlexibleBox.cpp b/Source/core/layout/LayoutFlexibleBox.cpp |
| index e1f9fede5c8486e6d1330b4978243dbf0ff78813..e8b9635f3f0c2208c01468df046cfece53f5fee6 100644 |
| --- a/Source/core/layout/LayoutFlexibleBox.cpp |
| +++ b/Source/core/layout/LayoutFlexibleBox.cpp |
| @@ -94,6 +94,7 @@ void LayoutFlexibleBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidt |
| // FIXME: We're ignoring flex-basis here and we shouldn't. We can't start honoring it though until |
| // the flex shorthand stops setting it to 0. |
| // See https://bugs.webkit.org/show_bug.cgi?id=116117 and http://crbug.com/240765. |
| + float previousMaxContentFlexFraction = -1; |
| for (LayoutBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { |
| if (child->isOutOfFlowPositioned()) |
| continue; |
| @@ -125,6 +126,24 @@ void LayoutFlexibleBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidt |
| minLogicalWidth = std::max(minPreferredLogicalWidth, minLogicalWidth); |
| maxLogicalWidth = std::max(maxPreferredLogicalWidth, maxLogicalWidth); |
| } |
| + |
| + // Determine whether the new version of the intrinsic size algorithm of the flexbox |
| + // spec would produce a different result than our above algorithm. |
|
leviw_travelin_and_unemployed
2015/08/20 21:45:49
Could we maybe extract this into a function?
cbiesinger
2015/08/20 22:00:44
Done
|
| + // The algorithm produces a different result iff the max-content flex fraction |
| + // (as defined in the new algorithm) is not identical for each flex item. |
| + if (isColumnFlow()) |
| + continue; |
| + Length flexBasis = child->styleRef().flexBasis(); |
| + float flexGrow = child->styleRef().flexGrow(); |
| + // A flex-basis of auto will lead to a max-content flex fraction of zero, so just like |
| + // an inflexible item it would compute to a size of max-content, so we ignore it here. |
| + if (flexBasis.isAuto() || flexGrow == 0) |
| + continue; |
| + flexGrow = std::max(1.0f, flexGrow); |
| + float maxContentFlexFraction = maxPreferredLogicalWidth.toFloat() / flexGrow; |
| + if (previousMaxContentFlexFraction != -1 && maxContentFlexFraction != previousMaxContentFlexFraction) |
| + UseCounter::count(document(), UseCounter::FlexboxIntrinsicSizeAlgorithmIsDifferent); |
| + previousMaxContentFlexFraction = maxContentFlexFraction; |
| } |
| maxLogicalWidth = std::max(minLogicalWidth, maxLogicalWidth); |