Skip to content
Permalink
Browse files
text-align-last causes table to take full space
https://bugs.webkit.org/show_bug.cgi?id=245453
<rdar://problem/100199451>

Reviewed by Antti Koivisto.

Do not expand runs horizontally (justify align) when computing the preferred with of the block container. It produces inflated content size.

* LayoutTests/fast/block/intrinsic-size-with-text-align-last-justify-expected.html: Added.
* LayoutTests/fast/block/intrinsic-size-with-text-align-last-justify.html: Added.
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::close):

Canonical link: https://commits.webkit.org/254725@main
  • Loading branch information
alanbaradlay committed Sep 21, 2022
1 parent 70f24d8 commit 04db6217eae000daca6e23f8df128c1ef105d5c1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
@@ -0,0 +1,9 @@
<style>
div {
font-family: Ahem;
font-size: 20px;
border: solid red;
float: left;
}
</style>
<div>do not stretch</div>
@@ -0,0 +1,10 @@
<style>
div {
font-family: Ahem;
font-size: 20px;
border: solid red;
text-align-last:justify;
float: left;
}
</style>
<div>do not stretch</div>
@@ -577,8 +577,7 @@ LineBuilder::InlineItemRange LineBuilder::close(const InlineItemRange& needsLayo
// On each line, reset the embedding level of any sequence of whitespace characters at the end of the line
// to the paragraph embedding level
m_line.resetBidiLevelForTrailingWhitespace(rootStyle.isLeftToRightDirection() ? UBIDI_LTR : UBIDI_RTL);
auto runsExpandHorizontally = isLastLine ? rootStyle.textAlignLast() == TextAlignLast::Justify
: rootStyle.textAlign() == TextAlignMode::Justify;
auto runsExpandHorizontally = !isInIntrinsicWidthMode && (isLastLine ? rootStyle.textAlignLast() == TextAlignLast::Justify : rootStyle.textAlign() == TextAlignMode::Justify);
if (runsExpandHorizontally)
m_line.applyRunExpansion(horizontalAvailableSpace);
auto lineEndsWithHyphen = false;

0 comments on commit 04db621

Please sign in to comment.