Skip to content

Commit

Permalink
[IFC] Hanging trailing content should not be treated trimmable
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=249711

Reviewed by Antti Koivisto.

If the trailing content on the line is hanging whitespace (pre-wrap), it should be treated as preserved (again, pre-wrap) and not trimmable (this likely has no visual impact though).

* Source/WebCore/layout/formattingContexts/inline/InlineLine.h:
(WebCore::Layout::Line::hangingTrailingWhitespaceWidth const): Deleted.
* Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::tryPlacingFloatBox):
(WebCore::Layout::LineBuilder::handleInlineContent):
(WebCore::Layout::trimmableTrailingContentWidth): Deleted.

Canonical link: https://commits.webkit.org/258216@main
  • Loading branch information
alanbaradlay committed Dec 21, 2022
1 parent 11eb340 commit 23d5b94
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
Expand Up @@ -58,7 +58,6 @@ class Line {
InlineLayoutUnit trimmableTrailingWidth() const { return m_trimmableTrailingContent.width(); }
bool isTrailingRunFullyTrimmable() const { return m_trimmableTrailingContent.isTrailingRunFullyTrimmable(); }

InlineLayoutUnit hangingTrailingWhitespaceWidth() const { return m_hangingContent.trailingWhitespaceWidth(); }
InlineLayoutUnit hangingTrailingContentWidth() const { return m_hangingContent.trailingWidth(); }

std::optional<InlineLayoutUnit> trailingSoftHyphenWidth() const { return m_trailingSoftHyphenWidth; }
Expand Down
Expand Up @@ -813,15 +813,6 @@ static bool shouldDisableHyphenation(const RenderStyle& rootStyle, unsigned succ
return successiveHyphenatedLineCount >= limitLines;
}

static float trimmableTrailingContentWidth(const Line& line)
{
if (auto trimmableWidth = line.trimmableTrailingWidth()) {
ASSERT(!line.hangingTrailingWhitespaceWidth());
return trimmableWidth;
}
return line.hangingTrailingWhitespaceWidth();
}

static inline InlineLayoutUnit availableWidth(const LineCandidate::InlineContent& candidateContent, const Line& line, InlineLayoutUnit availableWidthForContent)
{
#if USE_FLOAT_AS_INLINE_LAYOUT_UNIT
Expand Down Expand Up @@ -929,7 +920,7 @@ bool LineBuilder::tryPlacingFloatBox(const InlineItem& floatItem, LineBoxConstra
auto lineIsConsideredEmpty = !m_line.hasContent() && !m_lineIsConstrainedByFloat;
if (lineIsConsideredEmpty)
return true;
auto availableWidthForFloat = m_lineLogicalRect.width() - m_line.contentLogicalRight() + trimmableTrailingContentWidth(m_line);
auto availableWidthForFloat = m_lineLogicalRect.width() - m_line.contentLogicalRight() + m_line.trimmableTrailingWidth();
return availableWidthForFloat >= boxGeometry.marginBoxWidth();
};
if (!shouldBePlaced()) {
Expand Down Expand Up @@ -1010,7 +1001,7 @@ LineBuilder::Result LineBuilder::handleInlineContent(InlineContentBreaker& inlin
auto lineStatus = InlineContentBreaker::LineStatus {
m_line.contentLogicalRight(),
availableWidthForCandidateContent,
trimmableTrailingContentWidth(m_line),
m_line.trimmableTrailingWidth(),
m_line.trailingSoftHyphenWidth(),
m_line.isTrailingRunFullyTrimmable(),
lineIsConsideredContentful,
Expand Down

0 comments on commit 23d5b94

Please sign in to comment.