Skip to content

Commit

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

https://bugs.webkit.org/show_bug.cgi?id=242798
<rdar://problem/97436662>

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:
(WebCore::LayoutIntegration::canUseForLineLayoutWithReason):

Canonical link: https://commits.webkit.org/253076@main
  • 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 @@
<div></div>
@@ -0,0 +1,19 @@
<style>
.container {
width: 500px;
background-color: red;
}

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

.clear-after {
clear: both;
}

</style>
<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.