Merge NS_BLOCK_STATIC_BFC and NS_BLOCK_DYNAMIC_BFC into a single bit
Categories
(Core :: Layout, task)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox125 | --- | fixed |
People
(Reporter: fwang, Assigned: emilio)
Details
Attachments
(3 files)
In bug 1765615, two flags were introduced to describe block formatting context:
- NS_BLOCK_STATIC_BFC for frames that are always BFC after construction/initialization.
- NS_BLOCK_DYNAMIC_BFC for frames to set the BFC property dynamically after a restyle (currently due to CSS paint/layout containment change)
We can probably merge them into a single flag.
Comment from Emilio on D198530:
So I guess the idea behind having both of these (instead of just one) is basically that we don't know otherwise whether a frame is meant to always be a BFC (because of NS_NewBlockFormattingContext or so) vs. due to a style change, right?
That seems fixable nowadays, tho... A lot of the anonymous blocks that we create like ::-moz-fieldset-content, etc could use display: flow-root rather than display: block for example.
| Reporter | ||
Comment 1•2 years ago
|
||
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.
This patch instead makes StyleEstablishesBFC() return true for
IsColumnContainerStyle() 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.
| Reporter | ||
Comment 2•2 years ago
|
||
The following classes deriving from nsBlockFrame always set
NS_BLOCK_STATIC_BFC in their constructors or initializers:
- nsComboboxControlFrame
- nsFileControlFrame
- nsSelectsAreaFrame
- ColumnSetWrapperFrame
- nsMathMLmathBlockFrame
Do that in nsBlockFrame::Init instead, by attempting to cast to these
classes. Behavior is unchanged.
| Reporter | ||
Comment 3•2 years ago
|
||
With the two attached patches, the remaining AddStateBits(NS_BLOCK_STATIC_BFC) are:
- NS_NewBlockFormattingContext
- nsBlockFrame::Init
- nsBlockFrame::SetMarkerFrameForListItem
- nsFieldSetFrame::SetInitialChildList/InsertFrames
- nsCSSFrameConstructor::ConstructNonScrollableBlock
Updated•2 years ago
|
Updated•2 years ago
|
| Reporter | ||
Updated•2 years ago
|
Comment 5•2 years ago
|
||
Backed out for causing assertion failures at builds/worker/checkouts/gecko/layout/generic/nsBlockFrame.cpp
Backout link: https://hg.mozilla.org/integration/autoland/rev/db6542a5ca6182386e394ed6199d33e0b0480e36
| Reporter | ||
Comment 6•2 years ago
|
||
(In reply to Sandor Molnar[:smolnar] from comment #5)
Backed out for causing assertion failures at builds/worker/checkouts/gecko/layout/generic/nsBlockFrame.cpp
Backout link: https://hg.mozilla.org/integration/autoland/rev/db6542a5ca6182386e394ed6199d33e0b0480e36
Mmh, indeed this new code is reachable, it's expected that there are other frame types that should render false. Will reland with that fixed.
Comment 8•2 years ago
|
||
Backed out for causing assertion failures at builds/worker/checkouts/gecko/layout/generic/nsIFrame.cpp
Backout link: https://hg.mozilla.org/integration/autoland/rev/ce20634f32a1b78384fbbc028b4f86266056e7fb
| Reporter | ||
Updated•2 years ago
|
Comment 10•2 years ago
|
||
| bugherder | ||
| Reporter | ||
Comment 11•2 years ago
|
||
(In reply to Frédéric Wang (:fredw) from comment #3)
With the two attached patches, the remaining AddStateBits(NS_BLOCK_STATIC_BFC) are:
- NS_NewBlockFormattingContext
- nsBlockFrame::Init
- nsBlockFrame::SetMarkerFrameForListItem
- nsFieldSetFrame::SetInitialChildList/InsertFrames
- nsCSSFrameConstructor::ConstructNonScrollableBlock
The remaining cases seem a bit more involved. I'm unassigning myself in case someone wants to take over.
| Assignee | ||
Comment 12•2 years ago
|
||
Put all the "is this block a BFC" logic in nsBlockFrame.cpp.
The CLIP_PAGINATED_OVERFLOW flag is also redundant, it can just be "has
non-propagated overflow styles" check in ShouldApplyOverflowClipping(),
and frees another bit.
Shouldn't change behavior.
Updated•2 years ago
|
Comment 13•2 years ago
|
||
| Assignee | ||
Updated•2 years ago
|
Comment 14•2 years ago
|
||
| bugherder | ||
Description
•