-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When no clearance applies to an element with
clear
set, place the e…
…lement below the float just as we would if it was `clear:none` https://bugs.webkit.org/show_bug.cgi?id=264397 Reviewed by Antti Koivisto. This patch aligns WebKit with Blink / Chromium and Gecko / Firefox. Merge: https://chromium.googlesource.com/chromium/blink/+/502ffded2efe7d27b5e0ec085a47d4764b65c12c If an element has 'clear' set but we don't actually calculate clearance for it then it should be placed as though it had 'clear:none'. This is especially pertinent when the element has margin-top that puts it clear of any float. The relevant web-specification [1] is: "Computing the clearance of an element on which clear is set is done by ..." [1] https://drafts.csswg.org/css2/#clearance * Source/WebCore/rendering/RenderBlockFlow.cpp: (RenderBlockFlow::marginBeforeEstimateForChild): * LayoutTests/fast/block/float/element-clears-float-without-clearance.html: Add Test Case * LayoutTests/fast/block/float/element-clears-float-without-clearance-expected.html: Add Test Case Expectation Canonical link: https://commits.webkit.org/270525@main
- Loading branch information
1 parent
ecc0e56
commit f5f625b
Showing
3 changed files
with
198 additions
and
2 deletions.
There are no files selected for viewing
85 changes: 85 additions & 0 deletions
85
LayoutTests/fast/block/float/element-clears-float-without-clearance-expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<!DOCTYPE html> | ||
<style> | ||
.bfc { | ||
overflow:hidden; | ||
border:solid; | ||
margin-top:1em; | ||
} | ||
|
||
.float { | ||
background-color: aqua; | ||
height: 30px; | ||
display:inline-block; | ||
} | ||
|
||
.under { | ||
height: 50px; | ||
background-color: orange; | ||
} | ||
|
||
.clear { | ||
margin-top:20px; | ||
height: 50px; | ||
background-color: orange; | ||
} | ||
section { | ||
float: left; | ||
width: 25%; | ||
margin: 0 5px; | ||
padding: 5px; | ||
background: #ddd; | ||
} | ||
</style> | ||
<section> | ||
crbug.com/434048 : The orange boxes should sit right under the float. | ||
<div class="bfc"> | ||
<div class="float">float</div> | ||
<div class="under">clear</div> | ||
</div> | ||
|
||
<div class="bfc"> | ||
<div class="float">float</div> | ||
<div class="under">clear</div> | ||
</div> | ||
|
||
<div class="bfc"> | ||
<div class="float">float</div> | ||
<div class="under">clear</div> | ||
</div> | ||
</section> | ||
|
||
<section> | ||
crbug.com/434048 : There should be 20px between the orange box and the float. | ||
<div class="bfc"> | ||
<div class="float">float</div> | ||
<div class="clear">clear</div> | ||
</div> | ||
|
||
<div class="bfc"> | ||
<div class="float">float</div> | ||
<div class="clear">clear</div> | ||
</div> | ||
|
||
<div class="bfc"> | ||
<div class="float">float</div> | ||
<div class="clear">clear</div> | ||
</div> | ||
</section> | ||
|
||
<section> | ||
crbug.com/434048 : There should be 20px between the orange box and the float. | ||
<div class="bfc"> | ||
<div class="float">float</div> | ||
<div class="clear">clear</div> | ||
</div> | ||
|
||
<div class="bfc"> | ||
<div class="float">float</div> | ||
<div class="clear">clear</div> | ||
</div> | ||
|
||
<div class="bfc"> | ||
<div class="float">float</div> | ||
<div class="clear">clear</div> | ||
</div> | ||
</section> |
106 changes: 106 additions & 0 deletions
106
LayoutTests/fast/block/float/element-clears-float-without-clearance.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<!DOCTYPE html> | ||
<style> | ||
.bfc { | ||
overflow:hidden; | ||
border:solid; | ||
margin-top:1em; | ||
} | ||
|
||
.float { | ||
background-color: aqua; | ||
float: left; | ||
height: 30px; | ||
} | ||
|
||
.clear { | ||
clear:left; | ||
margin-top:50px; | ||
height: 50px; | ||
background-color: orange; | ||
} | ||
section { | ||
float: left; | ||
width: 25%; | ||
margin: 0 5px; | ||
padding: 5px; | ||
background: #ddd; | ||
} | ||
|
||
</style> | ||
<section> | ||
crbug.com/434048 : The orange boxes should sit right under the float. | ||
<div class="bfc"> | ||
<div> | ||
<div class="float">float</div> | ||
<div> | ||
<div class="clear">clear</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="bfc"> | ||
<div> | ||
<div class="float">float</div> | ||
<div class="clear">clear</div> | ||
</div> | ||
</div> | ||
|
||
<div class="bfc"> | ||
<div> | ||
<div> | ||
<div class="float">float</div> | ||
</div> | ||
<div class="clear">clear</div> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<section> | ||
crbug.com/434048 : There should be 20px between the orange box and the float. | ||
<div class="bfc"> | ||
<div> | ||
<div class="float">float</div> | ||
</div> | ||
<div class="clear">clear</div> | ||
</div> | ||
|
||
<div class="bfc"> | ||
<div class="float">float</div> | ||
<div style="margin-top: 30px;"> | ||
<div> | ||
<div class="clear">clear</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="bfc"> | ||
<div class="float">float</div> | ||
<div style="margin-top: 10px;"> | ||
<div> | ||
<div class="clear">clear</div> | ||
</div> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
<section> | ||
crbug.com/434048 : There should be 20px between the orange box and the float. | ||
<div class="bfc"> | ||
<div class="float">float</div> | ||
<div> | ||
<div class="clear">clear</div> | ||
</div> | ||
</div> | ||
|
||
<div class="bfc"> | ||
<div class="float">float</div> | ||
<div style="margin-top: 40px;"> | ||
<div class="clear">clear</div> | ||
</div> | ||
</div> | ||
|
||
<div class="bfc"> | ||
<div class="float">float</div> | ||
<div class="clear">clear</div> | ||
</div> | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters