Modified: trunk/Source/WebCore/ChangeLog (287470 => 287471)
--- trunk/Source/WebCore/ChangeLog 2021-12-28 16:40:24 UTC (rev 287470)
+++ trunk/Source/WebCore/ChangeLog 2021-12-28 16:52:05 UTC (rev 287471)
@@ -1,5 +1,21 @@
2021-12-28 Alan Bujtas <[email protected]>
+ [LFC][IFC] Hanging content may not be whitespace type
+ https://bugs.webkit.org/show_bug.cgi?id=234698
+
+ Reviewed by Antti Koivisto.
+
+ While we only allow whitespace hanging content, they could be any type.
+
+ * layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:
+ (WebCore::Layout::horizontalAlignmentOffset):
+ (WebCore::Layout::LineBoxBuilder::build):
+ * layout/formattingContexts/inline/InlineLineBuilder.h:
+ * layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp:
+ (WebCore::Layout::InlineDisplayLineBuilder::build const):
+
+2021-12-28 Alan Bujtas <[email protected]>
+
REGRESSION(r287440) Do not wrap the content for a collapsed whitespace
https://bugs.webkit.org/show_bug.cgi?id=234710
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp (287470 => 287471)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp 2021-12-28 16:40:24 UTC (rev 287470)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp 2021-12-28 16:52:05 UTC (rev 287471)
@@ -41,7 +41,7 @@
// Depending on the line’s alignment/justification, the hanging glyph can be placed outside the line box.
auto& runs = lineContent.runs;
auto contentLogicalWidth = lineContent.contentLogicalWidth;
- if (lineContent.hangingWhitespaceWidth) {
+ if (lineContent.hangingContentWidth) {
ASSERT(!runs.isEmpty());
// If white-space is set to pre-wrap, the UA must (unconditionally) hang this sequence, unless the sequence is followed
// by a forced line break, in which case it must conditionally hang the sequence is instead.
@@ -52,7 +52,7 @@
// FIXME: Conditional hanging needs partial overflow trimming at glyph boundary, one by one until they fit.
contentLogicalWidth = std::min(contentLogicalWidth, lineContent.lineLogicalWidth);
} else
- contentLogicalWidth -= lineContent.hangingWhitespaceWidth;
+ contentLogicalWidth -= lineContent.hangingContentWidth;
}
auto extraHorizontalSpace = lineContent.lineLogicalWidth - contentLogicalWidth;
if (extraHorizontalSpace <= 0)
@@ -108,7 +108,7 @@
auto& rootStyle = lineIndex ? rootBox().firstLineStyle() : rootBox().style();
auto rootInlineBoxAlignmentOffset = Layout::horizontalAlignmentOffset(rootStyle.textAlign(), lineContent, rootStyle.isLeftToRightDirection()).value_or(InlineLayoutUnit { });
// FIXME: The overflowing hanging content should be part of the ink overflow.
- auto lineBox = LineBox { rootBox(), rootInlineBoxAlignmentOffset, lineContent.contentLogicalWidth - lineContent.hangingWhitespaceWidth, lineIndex, lineContent.nonSpanningInlineLevelBoxCount };
+ auto lineBox = LineBox { rootBox(), rootInlineBoxAlignmentOffset, lineContent.contentLogicalWidth - lineContent.hangingContentWidth, lineIndex, lineContent.nonSpanningInlineLevelBoxCount };
auto lineBoxLogicalHeight = constructAndAlignInlineLevelBoxes(lineBox, lineContent, lineIndex);
return { lineBox, lineBoxLogicalHeight };
}
@@ -297,7 +297,7 @@
// Inline box run is based on margin box. Let's convert it to border box.
auto marginStart = formattingContext().geometryForBox(layoutBox).marginStart();
auto initialLogicalWidth = rootInlineBox.logicalWidth() - (run.logicalLeft() + marginStart);
- ASSERT(initialLogicalWidth >= 0 || lineContent.hangingWhitespaceWidth);
+ ASSERT(initialLogicalWidth >= 0 || lineContent.hangingContentWidth);
initialLogicalWidth = std::max(initialLogicalWidth, 0.f);
auto inlineBox = InlineLevelBox::createInlineBox(layoutBox, style, logicalLeft + marginStart, initialLogicalWidth);
inlineBox.setIsFirstBox();
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h (287470 => 287471)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h 2021-12-28 16:40:24 UTC (rev 287470)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.h 2021-12-28 16:52:05 UTC (rev 287471)
@@ -61,7 +61,7 @@
InlineLayoutPoint lineLogicalTopLeft;
InlineLayoutUnit lineLogicalWidth { 0 };
InlineLayoutUnit contentLogicalWidth { 0 };
- InlineLayoutUnit hangingWhitespaceWidth { 0 };
+ InlineLayoutUnit hangingContentWidth { 0 };
bool isLastLineWithInlineContent { true };
size_t nonSpanningInlineLevelBoxCount { 0 };
Vector<int32_t> visualOrderList;
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp (287470 => 287471)
--- trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp 2021-12-28 16:40:24 UTC (rev 287470)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayLineBuilder.cpp 2021-12-28 16:52:05 UTC (rev 287471)
@@ -86,7 +86,7 @@
: InlineLayoutUnit { rootGeometry.borderEnd() } + rootGeometry.paddingEnd().value_or(0_lu);
auto contentVisualLeft = isLeftToRightDirection
? lineBox.rootInlineBoxAlignmentOffset()
- : rootGeometry.contentBoxWidth() - lineOffsetFromContentBox - lineBox.rootInlineBoxAlignmentOffset() - rootInlineBox.logicalWidth() - lineContent.hangingWhitespaceWidth;
+ : rootGeometry.contentBoxWidth() - lineOffsetFromContentBox - lineBox.rootInlineBoxAlignmentOffset() - rootInlineBox.logicalWidth() - lineContent.hangingContentWidth;
auto lineBoxRect = InlineRect { lineContent.lineLogicalTopLeft.y(), lineBoxVisualLeft, lineContent.lineLogicalWidth, lineBoxLogicalHeight };
auto enclosingLineGeometry = collectEnclosingLineGeometry(lineBox, lineBoxRect);