WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
165603
Implement CSS `display: flow-root` (modern clearfix)
https://bugs.webkit.org/show_bug.cgi?id=165603
Summary
Implement CSS `display: flow-root` (modern clearfix)
Marat Tanalin
Reported
Thursday, December 8, 2016 4:19:02 PM UTC
`display: flow-root` is a modern way to force a block to be a formatting context that floated elements are contained in (aka clearfix). From the spec [1]:
> The element generates a block container box, and lays out its contents using flow layout. It always establishes a new block formatting context for its contents.
Tab Atkins and Elika Etemad (fantasai) from CSSWG consider the feature stable enough to be implemented [2]. [1]
https://drafts.csswg.org/css-display-3/#valdef-display-flow-root
[2]
https://discourse.wicg.io/t/1835/6
Attachments
Patch
(9.82 KB, patch)
2019-05-14 16:49 PDT
,
Joonghun Park
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
Sunday, January 8, 2017 6:12:47 PM UTC
<
rdar://problem/29918759
>
Joonghun Park
Comment 2
Wednesday, May 15, 2019 12:49:16 AM UTC
Created
attachment 369909
[details]
Patch
Joonghun Park
Comment 3
Thursday, May 16, 2019 12:26:25 AM UTC
Could you please review this change?
Simon Fraser (smfr)
Comment 4
Thursday, May 16, 2019 12:57:19 AM UTC
Comment on
attachment 369909
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=369909&action=review
> Source/WebCore/css/StyleResolver.cpp:699 > + case DisplayType::FlowRoot:
Is this change sufficient to get the behavior described in the spec? It's unclear to me if this change is complete.
Joonghun Park
Comment 5
Thursday, May 16, 2019 4:03:42 PM UTC
Comment on
attachment 369909
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=369909&action=review
>> Source/WebCore/css/StyleResolver.cpp:699 >> + case DisplayType::FlowRoot: > > Is this change sufficient to get the behavior described in the spec? It's unclear to me if this change is complete.
The 'flow-root' spec says that if it is specified it creates a new block formatting context.
https://www.w3.org/TR/CSS2/visuren.html#normal-flow
specifies the condition which when BFC is created, and the conditions are listed in RenderBox::createsNewFormattingContext(). So I added flow-root to the end of the list of the conditions for creating BFC as below. bool RenderBox::createsNewFormattingContext() const { return isInlineBlockOrInlineTable() || isFloatingOrOutOfFlowPositioned() || hasOverflowClip() || isFlexItemIncludingDeprecated() || isTableCell() || isTableCaption() || isFieldset() || isWritingModeRoot() || isDocumentElementRenderer() || isRenderFragmentedFlow() || isRenderFragmentContainer() || isGridItem() || style().specifiesColumns() || style().columnSpan() == ColumnSpan::All || style().display() == DisplayType::FlowRoot; } BFC creation is addressed above, so I think FlowRoot display type works as expected and this change is sufficient. But if I missed something, please let me know:)
Simon Fraser (smfr)
Comment 6
Thursday, May 16, 2019 7:08:11 PM UTC
Is the WPT enough to test the behavior of flow and flow-root?
zalan
Comment 7
Friday, May 17, 2019 3:27:53 AM UTC
Comment on
attachment 369909
[details]
Patch Unfortunately we can't explicitly say that this block level box should establish a block formatting context, instead the combination of the renderer type (RenderBlock in this case) and its children will imply the type of layout (e.g. inline vs block). ::createsNewFormattingContext() is really mostly used to check against float intruding and avoiding. So while this patch is fine in this context, we really lack some fundamental CSS basics in our codebase.
Joonghun Park
Comment 8
Friday, May 17, 2019 12:24:17 PM UTC
(In reply to Simon Fraser (smfr) from
comment #6
)
> Is the WPT enough to test the behavior of flow and flow-root?
Yes, the WPT test includes 5 sub test and I think they are testing the expected behavior for flow-root and flow well.
Joonghun Park
Comment 9
Friday, May 17, 2019 12:34:09 PM UTC
(In reply to zalan from
comment #7
)
> Comment on
attachment 369909
[details]
> Patch > > Unfortunately we can't explicitly say that this block level box should > establish a block formatting context, instead the combination of the > renderer type (RenderBlock in this case) and its children will imply the > type of layout (e.g. inline vs block). ::createsNewFormattingContext() is > really mostly used to check against float intruding and avoiding. So while > this patch is fine in this context, we really lack some fundamental CSS > basics in our codebase.
For supporting more CSS basic things, I will make a bug in jira if needed, or if there are existing bugs, I will check that to try to address it. Thank you for your review Zalan:)
zalan
Comment 10
Friday, May 17, 2019 7:26:40 PM UTC
(In reply to Joonghun Park from
comment #9
)
> (In reply to zalan from
comment #7
) > > Comment on
attachment 369909
[details]
> > Patch > > > > Unfortunately we can't explicitly say that this block level box should > > establish a block formatting context, instead the combination of the > > renderer type (RenderBlock in this case) and its children will imply the > > type of layout (e.g. inline vs block). ::createsNewFormattingContext() is > > really mostly used to check against float intruding and avoiding. So while > > this patch is fine in this context, we really lack some fundamental CSS > > basics in our codebase. > > For supporting more CSS basic things, I will make a bug in jira if needed, > or if there are existing bugs, I will check that to try to address it. > Thank you for your review Zalan:)
No I don't have a bug on this but the LFC code (WebCore/layout) is meant to fix all these visual formatting model fundamentals.
Joonghun Park
Comment 11
Saturday, May 18, 2019 5:00:41 AM UTC
(In reply to zalan from
comment #10
)
> (In reply to Joonghun Park from
comment #9
) > > (In reply to zalan from
comment #7
) > > > Comment on
attachment 369909
[details]
> > > Patch > > > > > > Unfortunately we can't explicitly say that this block level box should > > > establish a block formatting context, instead the combination of the > > > renderer type (RenderBlock in this case) and its children will imply the > > > type of layout (e.g. inline vs block). ::createsNewFormattingContext() is > > > really mostly used to check against float intruding and avoiding. So while > > > this patch is fine in this context, we really lack some fundamental CSS > > > basics in our codebase. > > > > For supporting more CSS basic things, I will make a bug in jira if needed, > > or if there are existing bugs, I will check that to try to address it. > > Thank you for your review Zalan:) > No I don't have a bug on this but the LFC code (WebCore/layout) is meant to > fix all these visual formatting model fundamentals.
I can see the patches with tag [LFC] in log. I will read that patches and follow up the changes. Thank you:)
WebKit Commit Bot
Comment 12
Saturday, May 18, 2019 5:29:54 AM UTC
Comment on
attachment 369909
[details]
Patch Clearing flags on attachment: 369909 Committed
r245494
: <
https://trac.webkit.org/changeset/245494
>
WebKit Commit Bot
Comment 13
Saturday, May 18, 2019 5:29:56 AM UTC
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug