Title: [291299] trunk/Source/WebCore
Revision
291299
Author
[email protected]
Date
2022-03-15 10:06:49 -0700 (Tue, 15 Mar 2022)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (291298 => 291299)


--- trunk/Source/WebCore/ChangeLog	2022-03-15 16:56:07 UTC (rev 291298)
+++ trunk/Source/WebCore/ChangeLog	2022-03-15 17:06:49 UTC (rev 291299)
@@ -1,3 +1,17 @@
+2022-03-15  Brandon Stewart  <[email protected]>
+
+        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-03-15  Jer Noble  <[email protected]>
 
         [Cocoa] Adopt AVAssetPrefersSandboxedParsingOptionKey

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


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp	2022-03-15 16:56:07 UTC (rev 291298)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp	2022-03-15 17:06:49 UTC (rev 291299)
@@ -953,9 +953,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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to