Bug 1874823 - Use NS_BLOCK_DYNAMIC_BFC flag on multi-column containers. r=layout-reviewers,emilio
Per https://drafts.csswg.org/css-multicol/#columns: "A multi-column container therefore is a regular block container that establishes a new independent formatting context" IsColumnContainerStyle() and BeginBuildingColumns() are currently used in three places and always together (namely ConstructFieldSetFrame, ConstructFrameFromItemInternal and the generic ConstructBlock). BeginBuildingColumns() asserts that aColumnContent is an nsBlockFrame and that aComputedStyle corresponds to multi-column container. It always adds the NS_BLOCK_STATIC_BFC to aColumnContent. It also makes aColumnContent a `PseudoStyleType::columnContent` and that's the only place where it's used. This patch instead makes StyleEstablishesBFC() return true for PseudoStyleType::columnContent so that the NS_BLOCK_DYNAMIC_BFC bit is set at init and after further style updates. It thus removes the need for to explicitly set NS_BLOCK_STATIC_BFC in BeginBuildingColumns(). There is no behavior changes. Differential Revision: https://phabricator.services.mozilla.com/D199091
This commit is contained in:
@@ -10718,8 +10718,7 @@ nsBlockFrame* nsCSSFrameConstructor::BeginBuildingColumns(
|
||||
PseudoStyleType::columnContent, columnSetStyle);
|
||||
aColumnContent->SetComputedStyleWithoutNotification(blockStyle);
|
||||
InitAndRestoreFrame(aState, aContent, columnSet, aColumnContent);
|
||||
aColumnContent->AddStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR |
|
||||
NS_BLOCK_STATIC_BFC);
|
||||
aColumnContent->AddStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR);
|
||||
|
||||
// Set up the parent-child chain.
|
||||
SetInitialSingleChild(columnSetWrapper, columnSet);
|
||||
|
||||
@@ -6409,9 +6409,15 @@ nsBlockInFlowLineIterator::nsBlockInFlowLineIterator(nsBlockFrame* aFrame,
|
||||
*aFoundValidLine = FindValidLine();
|
||||
}
|
||||
|
||||
static bool StyleEstablishesBFC(const ComputedStyle* style) {
|
||||
return style->StyleDisplay()->IsContainPaint() ||
|
||||
style->StyleDisplay()->IsContainLayout();
|
||||
static bool StyleEstablishesBFC(const ComputedStyle* aStyle) {
|
||||
// paint/layout containment boxes and multi-column containers establish an
|
||||
// independent formatting context.
|
||||
// https://drafts.csswg.org/css-contain/#containment-paint
|
||||
// https://drafts.csswg.org/css-contain/#containment-layout
|
||||
// https://drafts.csswg.org/css-multicol/#columns
|
||||
return aStyle->StyleDisplay()->IsContainPaint() ||
|
||||
aStyle->StyleDisplay()->IsContainLayout() ||
|
||||
aStyle->GetPseudoType() == PseudoStyleType::columnContent;
|
||||
}
|
||||
|
||||
void nsBlockFrame::DidSetComputedStyle(ComputedStyle* aOldStyle) {
|
||||
|
||||
Reference in New Issue
Block a user