Title: [286001] trunk/Source/WebCore
Revision
286001
Author
[email protected]
Date
2021-11-18 06:54:14 -0800 (Thu, 18 Nov 2021)

Log Message

[LFC][IFC] Should not always keep the entire continuous content when the line is empty
https://bugs.webkit.org/show_bug.cgi?id=233303

Reviewed by Antti Koivisto.

The rule of "let's keep the first glyph on the line" should take into account when
the continuous content has a series of runs e.g [X][X][X] where each 'X' represents an individual inline text item.
In such cases we should just return the first text run as the trailing inline item with 'break' action.
(This patch is in preparation for enabling IFC's preferred width computation.)

* layout/formattingContexts/inline/InlineContentBreaker.cpp:
(WebCore::Layout::InlineContentBreaker::processOverflowingContent const):
* rendering/RenderBlockFlow.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (286000 => 286001)


--- trunk/Source/WebCore/ChangeLog	2021-11-18 14:43:13 UTC (rev 286000)
+++ trunk/Source/WebCore/ChangeLog	2021-11-18 14:54:14 UTC (rev 286001)
@@ -1,5 +1,21 @@
 2021-11-18  Alan Bujtas  <[email protected]>
 
+        [LFC][IFC] Should not always keep the entire continuous content when the line is empty
+        https://bugs.webkit.org/show_bug.cgi?id=233303
+
+        Reviewed by Antti Koivisto.
+
+        The rule of "let's keep the first glyph on the line" should take into account when
+        the continuous content has a series of runs e.g [X][X][X] where each 'X' represents an individual inline text item.
+        In such cases we should just return the first text run as the trailing inline item with 'break' action.
+        (This patch is in preparation for enabling IFC's preferred width computation.)
+
+        * layout/formattingContexts/inline/InlineContentBreaker.cpp:
+        (WebCore::Layout::InlineContentBreaker::processOverflowingContent const):
+        * rendering/RenderBlockFlow.cpp:
+
+2021-11-18  Alan Bujtas  <[email protected]>
+
         [LFC][IFC] Inline boxes with unbreakable decoration can produce a breaking position with no trailing run
         https://bugs.webkit.org/show_bug.cgi?id=233302
 

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp (286000 => 286001)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp	2021-11-18 14:43:13 UTC (rev 286000)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineContentBreaker.cpp	2021-11-18 14:54:14 UTC (rev 286001)
@@ -221,8 +221,13 @@
                     return endOfCodePoint;
                 }();
 
-                if (inlineTextItem.length() <= firstCodePointLength)
-                    return Result { Result::Action::Keep, IsEndOfLine::Yes };
+                if (inlineTextItem.length() <= firstCodePointLength) {
+                    if (continuousContent.runs().size() == 1) {
+                        // Let's return single, leading text items as is.
+                        return Result { Result::Action::Keep, IsEndOfLine::Yes };
+                    }
+                    return Result { Result::Action::Break, IsEndOfLine::Yes, Result::PartialTrailingContent { leadingTextRunIndex, { } } };
+                }
 
                 auto firstCodePointWidth = TextUtil::width(inlineTextItem, leadingTextRun.style.fontCascade(), inlineTextItem.start(), inlineTextItem.start() + firstCodePointLength, lineStatus.contentLogicalRight);
                 return Result { Result::Action::Break, IsEndOfLine::Yes, Result::PartialTrailingContent { leadingTextRunIndex, PartialRun { firstCodePointLength, firstCodePointWidth } } };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to