Skip to content

Commit

Permalink
Out-of-flow line break box does not initiate render layer
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=267270
rdar://120662818

Reviewed by Antti Koivisto.

1. Let's not assume that an out-of-flow box is a type of RenderBox (e.g. line break)
2. Not all out-of-flow positioned boxes trigger layers.

* LayoutTests/fast/text/align-line-shift-crash-with-positioned-line-break-expected.txt: Added.
* LayoutTests/fast/text/align-line-shift-crash-with-positioned-line-break.html: Added.
* Source/WebCore/layout/integration/inline/LayoutIntegrationLineLayout.cpp:
(WebCore::LayoutIntegration::LineLayout::shiftLinesBy):

Originally-landed-as: 272448.26@safari-7618-branch (6eed834). rdar://124557101
Canonical link: https://commits.webkit.org/276181@main
  • Loading branch information
alanbaradlay authored and robert-jenner committed Mar 15, 2024
1 parent 6f20a05 commit dcc6d93
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

PASS if no crash or assert
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<style>
br {
position: fixed;
}
body {
-webkit-align-content: flex-end;
}
</style><br>
<div>PASS if no crash or assert</div>
<script>
if (window.testRunner)
testRunner.dumpAsText();
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -1037,8 +1037,9 @@ void LineLayout::shiftLinesBy(LayoutUnit blockShift)
for (auto& object : m_boxTree.renderers()) {
Layout::Box& layoutBox = *object->layoutBox();
if (layoutBox.isOutOfFlowPositioned() && layoutBox.style().hasStaticBlockPosition(isHorizontalWritingMode)) {
CheckedRef renderer = downcast<RenderBox>(m_boxTree.rendererForLayoutBox(layoutBox));
ASSERT(renderer->layer());
CheckedRef renderer = downcast<RenderLayerModelObject>(m_boxTree.rendererForLayoutBox(layoutBox));
if (!renderer->layer())
continue;
CheckedRef layer = *renderer->layer();
layer->setStaticBlockPosition(layer->staticBlockPosition() + blockShift);
renderer->setChildNeedsLayout(MarkOnlyThis);
Expand Down

0 comments on commit dcc6d93

Please sign in to comment.