Title: [293791] branches/safari-613-branch/Source/WebCore
Revision
293791
Author
alanc...@apple.com
Date
2022-05-04 14:23:32 -0700 (Wed, 04 May 2022)

Log Message

Cherry-pick r291299. rdar://problem/91446377

    Line Builder and Content Breaker out of sync
    https://bugs.webkit.org/show_bug.cgi?id=237903

    Reviewed by Simon Fraser.

    Line builder and content breaker could become out of sync in the case where
    the first line style was different than following styles. This could result
    in issues with wrapping later on.

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

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291299 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (293790 => 293791)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-05-04 21:18:42 UTC (rev 293790)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-05-04 21:23:32 UTC (rev 293791)
@@ -1,3 +1,35 @@
+2022-05-04  Alan Coon  <alanc...@apple.com>
+
+        Cherry-pick r291299. rdar://problem/91446377
+
+    Line Builder and Content Breaker out of sync
+    https://bugs.webkit.org/show_bug.cgi?id=237903
+    
+    Reviewed by Simon Fraser.
+    
+    Line builder and content breaker could become out of sync in the case where
+    the first line style was different than following styles. This could result
+    in issues with wrapping later on.
+    
+    * layout/formattingContexts/inline/InlineLineBuilder.cpp:
+    (WebCore::Layout::LineBuilder::handleInlineContent):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291299 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-15  Brandon Stewart  <brandonstew...@apple.com>
+
+            Line Builder and Content Breaker out of sync
+            https://bugs.webkit.org/show_bug.cgi?id=237903
+
+            Reviewed by Simon Fraser.
+
+            Line builder and content breaker could become out of sync in the case where
+            the first line style was different than following styles. This could result
+            in issues with wrapping later on.
+
+            * layout/formattingContexts/inline/InlineLineBuilder.cpp:
+            (WebCore::Layout::LineBuilder::handleInlineContent):
+
 2022-04-29  Alan Coon  <alanc...@apple.com>
 
         Cherry-pick r287877. rdar://problem/92357915

Modified: branches/safari-613-branch/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp (293790 => 293791)


--- branches/safari-613-branch/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp	2022-05-04 21:18:42 UTC (rev 293790)
+++ branches/safari-613-branch/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp	2022-05-04 21:23:32 UTC (rev 293791)
@@ -924,9 +924,14 @@
         if (lineCandidate.inlineContent.hasTrailingSoftWrapOpportunity() && m_line.hasContent()) {
             auto& trailingRun = candidateRuns.last();
             auto& trailingInlineItem = trailingRun.inlineItem;
+
             // Note that wrapping here could be driven both by the style of the parent and the inline item itself.
             // e.g inline boxes set the wrapping rules for their content and not for themselves.
-            auto& parentStyle = trailingInlineItem.layoutBox().parent().style();
+            auto& layoutBoxParent = trailingInlineItem.layoutBox().parent();
+
+            // Need to ensure we use the correct style here, so the content breaker and line builder remain in sync.
+            auto& parentStyle = isFirstLine() ? layoutBoxParent.firstLineStyle() : layoutBoxParent.style();
+
             auto isWrapOpportunity = TextUtil::isWrappingAllowed(parentStyle);
             if (!isWrapOpportunity && (trailingInlineItem.isInlineBoxStart() || trailingInlineItem.isInlineBoxEnd()))
                 isWrapOpportunity = TextUtil::isWrappingAllowed(trailingRun.style);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to