Skip to content


Browse files Browse the repository at this point in the history
Inline element with a block ::before following a floated element is c…

Reviewed by Antti Koivisto.

This patch disables the IFC codepath for inline content when the formatting context has the combination of intrusive float and non-line-break inline level element with "clear".

IFC has partial "clear" implementation.
1. r268202 enabled "clear" specifically for <br>
2. r290868 (where floats got enabled) failed to check against the rest of the non-line-break type of content for clear.

* LayoutTests/fast/block/float/clear-stretches-block-height-incorrect-expected.html: Added.
* LayoutTests/fast/block/float/clear-stretches-block-height-incorrect.html: Added.
* Source/WebCore/layout/integration/LayoutIntegrationCoverage.cpp:

Canonical link:
  • Loading branch information
alanbaradlay committed Aug 3, 2022
1 parent 9b9a6c2 commit 2c461c5
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
@@ -0,0 +1 @@
@@ -0,0 +1,19 @@
.container {
width: 500px;
background-color: red;

.floated {
float: left;
background-color: transparent;
width: 100px;
height: 100px;

.clear-after {
clear: both;

<div class=container><div></div><div class="floated"></div><span class=clear-after></span></div>
Expand Up @@ -484,9 +484,14 @@ OptionSet<AvoidanceReason> canUseForLineLayoutWithReason(const RenderBlockFlow&
SET_REASON_AND_RETURN_IF_NEEDED(FlowIsPaginated, reasons, includeReasons);
// This currently covers <blockflow>#text</blockflow>, <blockflow>#text<br></blockflow> and mutiple (sibling) RenderText cases.
// The <blockflow><inline>#text</inline></blockflow> case is also popular and should be relatively easy to cover.
auto contentHasFloat = flow.containsFloats();
for (auto walker = InlineWalker(flow); !walker.atEnd(); walker.advance()) {
if (auto childReasons = canUseForChild(*walker.current(), includeReasons))
auto& child = *walker.current();
if (auto childReasons = canUseForChild(child, includeReasons))
ADD_REASONS_AND_RETURN_IF_NEEDED(childReasons, reasons, includeReasons);
auto nonLineBreakBoxWithFloatClear = contentHasFloat && !is<RenderLineBreak>(child) && RenderStyle::usedClear(child) != UsedClear::None;
if (nonLineBreakBoxWithFloatClear)
SET_REASON_AND_RETURN_IF_NEEDED(FlowHasUnsupportedFloat, reasons, includeReasons);
auto styleReasons = canUseForStyle(flow, includeReasons);
if (styleReasons)
Expand Down

0 comments on commit 2c461c5

Please sign in to comment.