Title: [283440] trunk/Source/WebCore
Revision
283440
Author
[email protected]
Date
2021-10-02 06:34:43 -0700 (Sat, 02 Oct 2021)

Log Message

[LFC][IFC] Do not reuse the overflowing width on the next line when first line style is different
https://bugs.webkit.org/show_bug.cgi?id=231107

Reviewed by Antti Koivisto.

Let's compute the leading text content width at the next line (instead of reusing the overflowing trailing width), when the first line style is present and font-cascades differ.

* layout/formattingContexts/inline/InlineLineBuilder.cpp:
(WebCore::Layout::LineBuilder::handleInlineContent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (283439 => 283440)


--- trunk/Source/WebCore/ChangeLog	2021-10-02 12:38:36 UTC (rev 283439)
+++ trunk/Source/WebCore/ChangeLog	2021-10-02 13:34:43 UTC (rev 283440)
@@ -1,3 +1,15 @@
+2021-10-02  Alan Bujtas  <[email protected]>
+
+        [LFC][IFC] Do not reuse the overflowing width on the next line when first line style is different
+        https://bugs.webkit.org/show_bug.cgi?id=231107
+
+        Reviewed by Antti Koivisto.
+
+        Let's compute the leading text content width at the next line (instead of reusing the overflowing trailing width), when the first line style is present and font-cascades differ.
+
+        * layout/formattingContexts/inline/InlineLineBuilder.cpp:
+        (WebCore::Layout::LineBuilder::handleInlineContent):
+
 2021-10-02  Ziran Sun  <[email protected]>
 
         [css-grid] Accommodate spanning items crossing flexible tracks

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


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp	2021-10-02 12:38:36 UTC (rev 283439)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp	2021-10-02 13:34:43 UTC (rev 283440)
@@ -725,10 +725,20 @@
         auto& inlineTextItem = downcast<InlineTextItem>(candidateRuns.first().inlineItem);
         if (inlineTextItem.isWhitespace())
             return { };
+        auto& overflowingRun = candidateRuns.first();
+        if (m_isFirstLine) {
+            auto& usedStyle = overflowingRun.style;
+            auto& style = overflowingRun.inlineItem.style();
+            if (&usedStyle != &style && usedStyle.fontCascade() != style.fontCascade()) {
+                // We may have the incorrect text width when styles differ. Just re-measure the text content when we place it on the next line.
+                return { };
+            }
+        }
+        auto logicalWidthForNextLineAsLeading = overflowingRun.logicalWidth;
         if (result.action == InlineContentBreaker::Result::Action::Wrap)
-            return candidateRuns.first().logicalWidth;
+            return logicalWidthForNextLineAsLeading;
         if (result.action == InlineContentBreaker::Result::Action::Break && result.partialTrailingContent->partialRun)
-            return candidateRuns.first().logicalWidth - result.partialTrailingContent->partialRun->logicalWidth;
+            return logicalWidthForNextLineAsLeading - result.partialTrailingContent->partialRun->logicalWidth;
         return { };
     };
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to