From 736fbaef17105576bb6cc13742413ba692dc29e7 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Thu, 26 Aug 2021 22:43:10 +0000 Subject: [PATCH] Bug 1725973 Part 2 - Mark flex items with percentage flex-basis in column flex container as depending on CB's block-size. r=dholbert If so, `dependsOnCBBSize` will be set to true, and later in `ReflowInput::InitResizeFlags()` we will add `NS_FRAME_CONTAINS_RELATIVE_BSIZE` to the appropriate ancestor. Sorted the #include statements in ReflowInput.cpp because I added nsFlexContainerFrame.h. Differential Revision: https://phabricator.services.mozilla.com/D123703 --- layout/generic/ReflowInput.cpp | 46 ++++++++++++------- .../css/css-flexbox/flex-basis-011.html.ini | 2 - 2 files changed, 29 insertions(+), 19 deletions(-) delete mode 100644 testing/web-platform/meta/css/css-flexbox/flex-basis-011.html.ini diff --git a/layout/generic/ReflowInput.cpp b/layout/generic/ReflowInput.cpp index 2ff7515c4e23..c5f2367789b4 100644 --- a/layout/generic/ReflowInput.cpp +++ b/layout/generic/ReflowInput.cpp @@ -8,29 +8,31 @@ #include "mozilla/ReflowInput.h" +#include + +#include "CounterStyleManager.h" #include "LayoutLogging.h" -#include "nsStyleConsts.h" -#include "nsCSSAnonBoxes.h" -#include "nsIFrame.h" -#include "nsIContent.h" -#include "nsGkAtoms.h" -#include "nsPresContext.h" -#include "nsFontMetrics.h" +#include "mozilla/dom/HTMLInputElement.h" +#include "mozilla/SVGUtils.h" #include "nsBlockFrame.h" -#include "nsLineBox.h" +#include "nsCSSAnonBoxes.h" +#include "nsFlexContainerFrame.h" +#include "nsFontInflationData.h" +#include "nsFontMetrics.h" +#include "nsGkAtoms.h" +#include "nsGridContainerFrame.h" +#include "nsIContent.h" +#include "nsIFrame.h" +#include "nsIFrameInlines.h" #include "nsImageFrame.h" -#include "nsTableFrame.h" -#include "nsTableCellFrame.h" #include "nsIPercentBSizeObserver.h" #include "nsLayoutUtils.h" -#include "nsFontInflationData.h" +#include "nsLineBox.h" +#include "nsPresContext.h" +#include "nsStyleConsts.h" +#include "nsTableCellFrame.h" +#include "nsTableFrame.h" #include "StickyScrollContainer.h" -#include "nsIFrameInlines.h" -#include "CounterStyleManager.h" -#include -#include "mozilla/SVGUtils.h" -#include "mozilla/dom/HTMLInputElement.h" -#include "nsGridContainerFrame.h" using namespace mozilla; using namespace mozilla::css; @@ -669,6 +671,16 @@ void ReflowInput::InitResizeFlags(nsPresContext* aPresContext, !mStylePosition->mOffset.GetBEnd(wm).IsAuto() || mFrame->IsXULBoxFrame(); + // If mFrame is a flex item, and mFrame's block axis is the flex container's + // main axis (e.g. in a column-oriented flex container with same + // writing-mode), then its block-size depends on its CB size, if its + // flex-basis has a percentage. + if (mFrame->IsFlexItem() && + !nsFlexContainerFrame::IsItemInlineAxisMainAxis(mFrame)) { + const auto& flexBasis = mStylePosition->mFlexBasis; + dependsOnCBBSize |= (flexBasis.IsSize() && flexBasis.AsSize().HasPercent()); + } + if (mStyleText->mLineHeight.IsMozBlockHeight()) { // line-height depends on block bsize mFrame->AddStateBits(NS_FRAME_CONTAINS_RELATIVE_BSIZE); diff --git a/testing/web-platform/meta/css/css-flexbox/flex-basis-011.html.ini b/testing/web-platform/meta/css/css-flexbox/flex-basis-011.html.ini deleted file mode 100644 index 03b30d6b4826..000000000000 --- a/testing/web-platform/meta/css/css-flexbox/flex-basis-011.html.ini +++ /dev/null @@ -1,2 +0,0 @@ -[flex-basis-011.html] - expected: FAIL