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
Positioned element with percentage padding should recalc width when c…
…ontaining block changed Positioned element with percentage padding should recalc width when containing block changed https://bugs.webkit.org/show_bug.cgi?id=80808 Reviewed by Alan Baradlay. This patch is to align Webkit behavior with Blink / Chrome and Gecko / Firefox. Merge - https://src.chromium.org/viewvc/blink?view=revision&revision=184672 and a test case from Patch Authored by SravanKumar Sandela. RenderBlock::removePositionObjects usually don't recalc the width of positioned descendants with percentage padding unless its width is changed. For positioned elements which changed their containing block, it should be considered as if the width of the containing block changed. * Source/WebCore/rendering/RenderBlock.cpp: (RenderBlock::removePositionObjects): Add condition to recalculate the width * LayoutTests/fast/block/containing-block-change-percentage-padding-width-recalc.html: Added Test Case * LayoutTests/fast/block/containing-block-change-percentage-padding-width-recalc-expected.html: Added Test Case Expectations * LayoutTests/fast/block/absolute-position-change-width-with-inline-container.html: Added Test Case * LayoutTests/fast/block/absolute-position-change-width-with-inline-container-expected.html: Added Test Case Expectations Canonical link: https://commits.webkit.org/256315@main
- Loading branch information
1 parent
5551d9e
commit c1324d73bd3c9620496236c7b3abbda0c0cbd607
Showing
5 changed files
with
89 additions
and
2 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,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<style type='text/css'> | ||
#container { | ||
position: relative; | ||
} | ||
.abs { | ||
outline: solid 1px skyblue; | ||
position: absolute; | ||
left: 0; | ||
top: 0; | ||
right: 0; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<p>When you click <button id="more">moooore</button>, the span.abs should expand with the container</p> | ||
<p><span id="container"><span class="abs"> </span>Words, words, words moooore</span> | ||
</body> | ||
</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,28 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<style type='text/css'> | ||
#container { | ||
position: relative; | ||
} | ||
.abs { | ||
outline: solid 1px skyblue; | ||
position: absolute; | ||
left: 0; | ||
top: 0; | ||
right: 0; | ||
} | ||
</style> | ||
<script type='text/javascript'> | ||
window.onload=function(){ | ||
var span = document.createElement('span'); | ||
span.innerHTML = ' moooore'; | ||
document.getElementById('container').appendChild(span); | ||
}; | ||
</script> | ||
</head> | ||
<body> | ||
<p>When you click <button id="more">moooore</button>, the span.abs should expand with the container</p> | ||
<p><span id="container"><span class="abs"> </span>Words, words, words</span> | ||
</body> | ||
</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,15 @@ | ||
<!DOCTYPE html> | ||
<style> | ||
#dynamic-container { | ||
width: 500px; | ||
} | ||
#percentage-padding { | ||
position: absolute; | ||
padding: 10%; | ||
} | ||
</style> | ||
<div id='dynamic-container'> | ||
<div id='percentage-padding'> | ||
There should be no line break. | ||
</div> | ||
</div> |
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,20 @@ | ||
<!DOCTYPE html> | ||
<style> | ||
#dynamic-container { | ||
width: 500px; | ||
transform: translateX(0); | ||
} | ||
#percentage-padding { | ||
position: absolute; | ||
padding: 10%; | ||
} | ||
</style> | ||
<div id='dynamic-container'> | ||
<div id='percentage-padding'> | ||
There should be no line break. | ||
</div> | ||
</div> | ||
<script> | ||
document.body.offsetTop; | ||
document.getElementById('dynamic-container').style.transform = "none"; | ||
</script> |
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