Title: [285931] trunk/Source/WebCore
Revision
285931
Author
[email protected]
Date
2021-11-17 08:30:20 -0800 (Wed, 17 Nov 2021)

Log Message

[LFC][IFC] Fix imported/w3c/web-platform-tests/css/css-text/white-space/white-space-intrinsic-size-013.html
https://bugs.webkit.org/show_bug.cgi?id=233237

Reviewed by Antti Koivisto.

Do not take hanging glyphs into account when measuring content for preferred width.
(Note that this patch is in preparation for enabling IFC preferred width computation)

* layout/formattingContexts/inline/InlineLine.cpp:
(WebCore::Layout::Line::removeHangingGlyphs):
* layout/formattingContexts/inline/InlineLine.h:
* layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::close):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (285930 => 285931)


--- trunk/Source/WebCore/ChangeLog	2021-11-17 15:10:51 UTC (rev 285930)
+++ trunk/Source/WebCore/ChangeLog	2021-11-17 16:30:20 UTC (rev 285931)
@@ -1,5 +1,21 @@
 2021-11-17  Alan Bujtas  <[email protected]>
 
+        [LFC][IFC] Fix imported/w3c/web-platform-tests/css/css-text/white-space/white-space-intrinsic-size-013.html
+        https://bugs.webkit.org/show_bug.cgi?id=233237
+
+        Reviewed by Antti Koivisto.
+
+        Do not take hanging glyphs into account when measuring content for preferred width.
+        (Note that this patch is in preparation for enabling IFC preferred width computation)
+
+        * layout/formattingContexts/inline/InlineLine.cpp:
+        (WebCore::Layout::Line::removeHangingGlyphs):
+        * layout/formattingContexts/inline/InlineLine.h:
+        * layout/formattingContexts/inline/InlineLineBuilder.cpp:
+        (WebCore::Layout::LineBuilder::close):
+
+2021-11-17  Alan Bujtas  <[email protected]>
+
         [LFC][IFC] break-word is not considered when calculating min-content intrinsic sizes.
         https://bugs.webkit.org/show_bug.cgi?id=233222
 

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.cpp (285930 => 285931)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.cpp	2021-11-17 15:10:51 UTC (rev 285930)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.cpp	2021-11-17 16:30:20 UTC (rev 285931)
@@ -196,6 +196,13 @@
     m_contentLogicalWidth -= m_trimmableTrailingContent.remove();
 }
 
+void Line::removeHangingGlyphs()
+{
+    ASSERT(m_trimmableTrailingContent.isEmpty());
+    m_contentLogicalWidth -= m_hangingTrailingContent.width();
+    m_hangingTrailingContent.reset();
+}
+
 void Line::visuallyCollapseHangingOverflowingGlyphs(InlineLayoutUnit horizontalAvailableSpace)
 {
     ASSERT(m_trimmableTrailingContent.isEmpty());

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.h (285930 => 285931)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.h	2021-11-17 15:10:51 UTC (rev 285930)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLine.h	2021-11-17 16:30:20 UTC (rev 285931)
@@ -64,6 +64,7 @@
     void addTrailingHyphen(InlineLayoutUnit hyphenLogicalWidth);
 
     void removeTrailingTrimmableContent();
+    void removeHangingGlyphs();
     void visuallyCollapseHangingOverflowingGlyphs(InlineLayoutUnit horizontalAvailableSpace);
     void applyRunExpansion(InlineLayoutUnit horizontalAvailableSpace);
 

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp (285930 => 285931)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp	2021-11-17 15:10:51 UTC (rev 285930)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp	2021-11-17 16:30:20 UTC (rev 285931)
@@ -458,7 +458,14 @@
     }
     auto horizontalAvailableSpace = m_lineLogicalRect.width();
     m_line.removeTrailingTrimmableContent();
-    m_line.visuallyCollapseHangingOverflowingGlyphs(horizontalAvailableSpace);
+    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();
+    } else
+        m_line.visuallyCollapseHangingOverflowingGlyphs(horizontalAvailableSpace);
+
     auto horizontalAlignment = root().style().textAlign();
     auto runsExpandHorizontally = horizontalAlignment == TextAlignMode::Justify && !isLastLineWithInlineContent(lineRange, needsLayoutRange.end, committedContent.partialTrailingContentLength);
     if (runsExpandHorizontally)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to