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:
Frédéric Wang
2024-01-24 12:13:42 +00:00
parent a6c0549a83
commit 45c39bb2ac
2 changed files with 10 additions and 5 deletions

View File

@@ -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);