Title: [285999] trunk/Source/WebCore
- Revision
- 285999
- Author
- [email protected]
- Date
- 2021-11-18 06:20:45 -0800 (Thu, 18 Nov 2021)
Log Message
[LFC][IFC] Glyphs that conditionally hang are taken into account for max-content only
https://bugs.webkit.org/show_bug.cgi?id=233287
Reviewed by Antti Koivisto.
Remove hanging glyphs for min-content only. It simply means that content followed by (pre-wrap) whitespace may make shrink wrapped lines wider.
* layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::close):
* rendering/RenderBlockFlow.cpp:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (285998 => 285999)
--- trunk/Source/WebCore/ChangeLog 2021-11-18 13:12:28 UTC (rev 285998)
+++ trunk/Source/WebCore/ChangeLog 2021-11-18 14:20:45 UTC (rev 285999)
@@ -1,3 +1,16 @@
+2021-11-18 Alan Bujtas <[email protected]>
+
+ [LFC][IFC] Glyphs that conditionally hang are taken into account for max-content only
+ https://bugs.webkit.org/show_bug.cgi?id=233287
+
+ Reviewed by Antti Koivisto.
+
+ Remove hanging glyphs for min-content only. It simply means that content followed by (pre-wrap) whitespace may make shrink wrapped lines wider.
+
+ * layout/formattingContexts/inline/InlineLineBuilder.cpp:
+ (WebCore::Layout::LineBuilder::close):
+ * rendering/RenderBlockFlow.cpp:
+
2021-11-18 Ziran Sun <[email protected]>
Images as grid items should use the overridingLogicalWidth when defined to compute the logical Height
Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp (285998 => 285999)
--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp 2021-11-18 13:12:28 UTC (rev 285998)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp 2021-11-18 14:20:45 UTC (rev 285999)
@@ -459,6 +459,7 @@
// Line is empty, we only managed to place float boxes.
return lineRange;
}
+ auto isLastLine = isLastLineWithInlineContent(lineRange, needsLayoutRange.end, committedContent.partialTrailingContentLength);
auto horizontalAvailableSpace = m_lineLogicalRect.width();
auto isInIntrinsicWidthMode = this->isInIntrinsicWidthMode();
// Legacy line layout quirk: keep the trailing whitespace around when it is followed by a line break, unless the content overflows the line.
@@ -472,13 +473,19 @@
if (isInIntrinsicWidthMode) {
// When a glyph at the start or end edge of a line hangs, it is not considered when measuring the line’s contents for fit.
// https://drafts.csswg.org/css-text/#hanging
- // FIXME: Add support for conditionally hanging glyphs.
- m_line.removeHangingGlyphs();
+ if (*intrinsicWidthMode() == IntrinsicWidthMode::Minimum)
+ m_line.removeHangingGlyphs();
+ else {
+ // Glyphs that conditionally hang are not taken into account when computing min-content sizes and any sizes derived thereof, but they are taken into account for max-content sizes and any sizes derived thereof.
+ auto isConditionalHanging = isLastLine || (!m_line.runs().isEmpty() && m_line.runs().last().isLineBreak());
+ if (!isConditionalHanging)
+ m_line.removeHangingGlyphs();
+ }
} else
m_line.visuallyCollapseHangingOverflowingGlyphs(horizontalAvailableSpace);
auto horizontalAlignment = root().style().textAlign();
- auto runsExpandHorizontally = horizontalAlignment == TextAlignMode::Justify && !isLastLineWithInlineContent(lineRange, needsLayoutRange.end, committedContent.partialTrailingContentLength);
+ auto runsExpandHorizontally = horizontalAlignment == TextAlignMode::Justify && !isLastLine;
if (runsExpandHorizontally)
m_line.applyRunExpansion(horizontalAvailableSpace);
auto lineEndsWithHyphen = false;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes