Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[IFC] Unexpected content wrapping when percent padding is present
https://bugs.webkit.org/show_bug.cgi?id=256131
rdar://108666239

Reviewed by Antti Koivisto.

Apparently this is how the rest of the render tree code deals with percent padding (see updateBlockChildDirtyBitsBeforeLayout, layoutLineBoxes etc).

* LayoutTests/fast/inline/inline-block-with-precent-padding-expected.html: Added.
* LayoutTests/fast/inline/inline-block-with-precent-padding.html: Added.
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::layoutModernLines):

Canonical link: https://commits.webkit.org/263535@main
  • Loading branch information
alanbaradlay committed Apr 29, 2023
1 parent aa760bb commit 36e87a1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 5 deletions.
@@ -0,0 +1,10 @@
<style>
div {
background-color: cyan;
font-family: Ahem;
padding-left: 1%;
font-size: 20px;
width: 540px;
}
</style>
<div>PASS if this is not wrapped</div>
10 changes: 10 additions & 0 deletions LayoutTests/fast/inline/inline-block-with-precent-padding.html
@@ -0,0 +1,10 @@
<style>
div {
background-color: cyan;
padding-left: 1%;
display: inline-block;
font-family: Ahem;
font-size: 20px;
}
</style>
<div>PASS if this is not wrapped</div>
Expand Up @@ -82,13 +82,13 @@ layer at (0,0) size 800x307
RenderText {#text} at (1,0) size 106x20
text run at (1,1) width 106: "(25, 26) (25, 22)"
RenderTableCell {TD} at (391,61) size 135x41 [r=3 c=3 rs=1 cs=1]
RenderButton {INPUT} at (1,1) size 31x40 [color=#000000D8] [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
RenderBlock (anonymous) at (15,13) size 0x14
RenderButton {INPUT} at (1,1) size 48x40 [color=#000000D8] [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
RenderBlock (anonymous) at (15,13) size 18x14
RenderText at (0,0) size 17x13
text run at (0,0) width 17: "foo"
RenderTableCell {TD} at (525,71) size 171x21 [r=3 c=4 rs=1 cs=1]
RenderText {#text} at (1,0) size 106x20
text run at (1,1) width 106: "(39, 30) (39, 26)"
text run at (1,1) width 106: "(39, 47) (39, 43)"
RenderTableRow {TR} at (0,102) size 696x20
RenderTableCell {TD} at (0,102) size 170x20 [r=4 c=0 rs=1 cs=1]
RenderText {#text} at (1,1) size 84x18
Expand Down
8 changes: 6 additions & 2 deletions Source/WebCore/rendering/RenderBlockFlow.cpp
Expand Up @@ -4060,13 +4060,17 @@ void RenderBlockFlow::layoutModernLines(bool relayoutChildren, LayoutUnit& repai

for (auto walker = InlineWalker(*this); !walker.atEnd(); walker.advance()) {
auto& renderer = *walker.current();
if (relayoutChildren || (is<RenderBox>(renderer) && downcast<RenderBox>(renderer).hasRelativeDimensions()))
auto childNeedsLayout = relayoutChildren || (is<RenderBox>(renderer) && downcast<RenderBox>(renderer).hasRelativeDimensions());
auto childNeedsPreferredWidthComputation = relayoutChildren && is<RenderBox>(renderer) && downcast<RenderBox>(renderer).needsPreferredWidthsRecalculation();
if (childNeedsLayout)
renderer.setNeedsLayout(MarkOnlyThis);
if (childNeedsPreferredWidthComputation)
renderer.setPreferredLogicalWidthsDirty(true, MarkOnlyThis);

if (renderer.isOutOfFlowPositioned())
renderer.containingBlock()->insertPositionedObject(downcast<RenderBox>(renderer));

if (!renderer.needsLayout() && !needsUpdateReplacedDimensions)
if (!renderer.needsLayout() && !renderer.preferredLogicalWidthsDirty() && !needsUpdateReplacedDimensions)
continue;

auto shouldRunInFlowLayout = renderer.isInFlow() && is<RenderElement>(renderer) && !is<RenderLineBreak>(renderer) && !is<RenderInline>(renderer) && !is<RenderCounter>(renderer);
Expand Down

0 comments on commit 36e87a1

Please sign in to comment.