Skip to content

Commit 8a9a5a9

Browse files
committed
[blocks-in-inline] getClientRects is missing an entry when called on an inline box
https://bugs.webkit.org/show_bug.cgi?id=304665 Reviewed by Antti Koivisto. A single block inside inline (<span><div></div></span>) generates 3 "lines" and getClientRects is supposed to return all of them. However due to ignoring 0px width (non-leading) inline boxes in collectInlineBoxRects, we only return 2 (the first, leading (0px tall) line and the one generated by the block). Having all lines included makes block-in-inline-client-rects-001.html fail but we already render such content incorrectly on trunk. <div> <span style="outline: 1px solid green"> <div style="width: 500px"></div> </span> </div> There should _not_ be a green line here. * LayoutTests/TestExpectations: * LayoutTests/fast/block/inside-inlines/getClientRects-on-inline-box-missing-entry-expected.txt: Added. * LayoutTests/fast/block/inside-inlines/getClientRects-on-inline-box-missing-entry.html: Added. * LayoutTests/fast/inline/blocks-in-inline-client-rects-expected.txt: Removed. : this is a copy of block-in-inline-client-rects-001.html * LayoutTests/fast/inline/blocks-in-inline-client-rects.html: Removed. * Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp: (WebCore::LayoutIntegration::LineLayout::collectInlineBoxRects const): Canonical link: https://commits.webkit.org/304949@main
1 parent 5eec534 commit 8a9a5a9

File tree

6 files changed

+32
-79
lines changed

6 files changed

+32
-79
lines changed

LayoutTests/TestExpectations

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8184,6 +8184,10 @@ imported/w3c/web-platform-tests/css/css-viewport/zoom/border.html [ ImageOnlyFai
81848184
# RenderTreeNeedsLayoutChecker hits.
81858185
webkit.org/b/304002 [ Debug ] fast/inline/missing-content-on-autofill-with-out-of-flow-input-descendant.html [ Skip ]
81868186

8187+
# This already fails visually as we stretch the inline box to the size of the containing block (in inline direction)
8188+
# as opposed to the size of the content.
8189+
webkit.org/b/304666 imported/w3c/web-platform-tests/css/CSS2/normal-flow/block-in-inline-client-rects-001.html [ Failure ]
8190+
81878191
# Digital Credentials API tests failing due to lack of implementation
81888192
webkit.org/b/303807 imported/w3c/web-platform-tests/digital-credentials/allow-attribute-with-create.https.html [ Skip ]
81898193
webkit.org/b/303807 imported/w3c/web-platform-tests/digital-credentials/create-enabled-on-self-origin-by-permissions-policy.https.sub.html [ Skip ]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
0 0 0 0
2+
0 0 50 50
3+
0 50 0 0
4+
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<style>
2+
body {
3+
margin: 0px;
4+
}
5+
.container {
6+
width: 50px;
7+
}
8+
9+
.block-in-inline {
10+
height: 50px;
11+
}
12+
</style>
13+
<div class=container>
14+
<span id=target>
15+
<div class=block-in-inline></div>
16+
</span>
17+
</div>
18+
<pre id=log></pre>
19+
<script>
20+
window.testRunner?.dumpAsText();
21+
for (const rect of target.getClientRects())
22+
log.textContent += rect.x + " " + rect.y + " " + rect.width + " " + rect.height + "\n";
23+
</script>

LayoutTests/fast/inline/blocks-in-inline-client-rects-expected.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

LayoutTests/fast/inline/blocks-in-inline-client-rects.html

Lines changed: 0 additions & 70 deletions
This file was deleted.

Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,9 +1151,7 @@ Vector<FloatRect> LineLayout::collectInlineBoxRects(const RenderInline& renderIn
11511151

11521152
Vector<FloatRect> result;
11531153
m_inlineContent->traverseNonRootInlineBoxes(layoutBox, [&](auto& inlineBox) {
1154-
auto rect = inlineBox.visualRectIgnoringBlockDirection();
1155-
if (result.isEmpty() || !rect.isEmpty())
1156-
result.append(rect);
1154+
result.append(inlineBox.visualRectIgnoringBlockDirection());
11571155
});
11581156
return result;
11591157
}

0 commit comments

Comments
 (0)