Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Clear floats added dynamically to previous siblings
Clear floats added dynamically to previous siblings https://bugs.webkit.org/show_bug.cgi?id=247237 Reviewed by Alan Baradlay. This patch is to align Webkit behavior with Blink / Chrome and Gecko / Firefox. Merge - https://chromium.googlesource.com/chromium/src.git/+/c75a8e71e60527400e95d0834f4a07a018087130 If margin collapsing moves a child up into a previous sibling, we shouldn't add any floats that it may have cleared and prompt another layout so that the child can also clear them if necessary. Confining the need for a layout to cases where the self-collapsing block has margin excludes the more obvious case where a sibling has a lot of negative margin and moves up into a sibling with nested floats inside. * Source/WebCore/rendering/RenderBlockFlow: (RenderBlockFlow::collapseMarginsWithChildInfo): Remove "clearanceForSelfCollapsingBlock" and conditions and update comment as needed * LayoutTests/fast/block/margin-collapse/clear-dynamically-added-float.html: Added Test Case * LayoutTests/fast/block/margin-collapse/clear-dynamically-added-float-expected.txt: Added Test Case Expectations Canonical link: https://commits.webkit.org/256238@main
- Loading branch information
1 parent
6f821cc
commit 6c2570b4a4d2472445444323e37741fc45e90904
Showing
3 changed files
with
39 additions
and
9 deletions.
There are no files selected for viewing
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,2 @@ | ||
PASS | ||
Clear floats added dynamically to previous siblings. There should be a blue bar below the green bar and both should be 50px high. |
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,33 @@ | ||
<!DOCTYPE html> | ||
<style> | ||
body { | ||
margin: 0px; | ||
} | ||
.inner{ | ||
float: left; | ||
display: none; | ||
width: 100px; | ||
height: 50px; | ||
background-color: green; | ||
} | ||
.clear { | ||
clear: both; | ||
} | ||
</style> | ||
<div style="width: 100px;"> | ||
<div> | ||
<div class="inner"></div> | ||
<div class="clear"></div> | ||
</div> | ||
<div style="margin-top: -20px;"> | ||
<div class="clear" id="clear" style="width: 100px; height:50px; background-color: blue" data-offset-y=50></div> | ||
</div> | ||
</div> | ||
<div id="test-output"></div> | ||
<script src="../../../resources/check-layout.js"></script> | ||
<script> | ||
document.body.offsetTop; | ||
document.querySelector('.inner').style.display = 'block'; | ||
window.checkLayout("#clear", document.getElementById("test-output")); | ||
</script> | ||
<p>Clear floats added dynamically to previous siblings. There should be a blue bar below the green bar and both should be 50px high.</p> |
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