Title: [284683] trunk
Revision
284683
Author
[email protected]
Date
2021-10-22 08:17:11 -0700 (Fri, 22 Oct 2021)

Log Message

[LFC][IFC] Check the parent style for content wrapping when collecting wrap opportunities
https://bugs.webkit.org/show_bug.cgi?id=232056

Reviewed by Antti Koivisto.

Source/WebCore:

See the comment in LineBuilder::handleInlineContent.

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

LayoutTests:

* TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (284682 => 284683)


--- trunk/LayoutTests/ChangeLog	2021-10-22 14:53:39 UTC (rev 284682)
+++ trunk/LayoutTests/ChangeLog	2021-10-22 15:17:11 UTC (rev 284683)
@@ -1,5 +1,14 @@
 2021-10-22  Alan Bujtas  <[email protected]>
 
+        [LFC][IFC] Check the parent style for content wrapping when collecting wrap opportunities
+        https://bugs.webkit.org/show_bug.cgi?id=232056
+
+        Reviewed by Antti Koivisto.
+
+        * TestExpectations:
+
+2021-10-22  Alan Bujtas  <[email protected]>
+
         [LFC][IFC] Add missing isAtSoftWrapOpportunity check when between two whitespace inline items
         https://bugs.webkit.org/show_bug.cgi?id=232055
 

Modified: trunk/LayoutTests/TestExpectations (284682 => 284683)


--- trunk/LayoutTests/TestExpectations	2021-10-22 14:53:39 UTC (rev 284682)
+++ trunk/LayoutTests/TestExpectations	2021-10-22 15:17:11 UTC (rev 284683)
@@ -2577,7 +2577,6 @@
 webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/line-breaking/line-breaking-014.html [ ImageOnlyFailure ]
 webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/line-breaking/line-breaking-016.html [ ImageOnlyFailure ]
 webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/line-breaking/line-breaking-017.html [ ImageOnlyFailure ]
-webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/line-breaking/line-breaking-ic-003.html [ ImageOnlyFailure ]
 webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-anywhere-003.html [ ImageOnlyFailure ]
 webkit.org/b/195345 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-min-content-size-002.html [ ImageOnlyFailure ]
 webkit.org/b/214290 imported/w3c/web-platform-tests/css/css-text/overflow-wrap/overflow-wrap-normal-keep-all-001.html [ ImageOnlyFailure ]

Modified: trunk/Source/WebCore/ChangeLog (284682 => 284683)


--- trunk/Source/WebCore/ChangeLog	2021-10-22 14:53:39 UTC (rev 284682)
+++ trunk/Source/WebCore/ChangeLog	2021-10-22 15:17:11 UTC (rev 284683)
@@ -1,5 +1,17 @@
 2021-10-22  Alan Bujtas  <[email protected]>
 
+        [LFC][IFC] Check the parent style for content wrapping when collecting wrap opportunities
+        https://bugs.webkit.org/show_bug.cgi?id=232056
+
+        Reviewed by Antti Koivisto.
+
+        See the comment in LineBuilder::handleInlineContent.
+
+        * layout/formattingContexts/inline/InlineLineBuilder.cpp:
+        (WebCore::Layout::LineBuilder::handleInlineContent):
+
+2021-10-22  Alan Bujtas  <[email protected]>
+
         [LFC][IFC] Add missing isAtSoftWrapOpportunity check when between two whitespace inline items
         https://bugs.webkit.org/show_bug.cgi?id=232055
 

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


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp	2021-10-22 14:53:39 UTC (rev 284682)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineLineBuilder.cpp	2021-10-22 15:17:11 UTC (rev 284683)
@@ -770,13 +770,20 @@
         m_lineLogicalRect = lineLogicalRectForCandidateContent;
         for (auto& run : candidateRuns)
             m_line.append(run.inlineItem, run.style, run.logicalWidth);
-        if (lineCandidate.inlineContent.hasTrailingSoftWrapOpportunity()) {
-            // Check if we are allowed to wrap at this position.
+        // We are keeping this content on the line but we need to check if we could have wrapped here
+        // in order to be able to revert back to this positon if needed.
+        // Let's just ignore cases like collapsed leading whitespace for now.
+        if (lineCandidate.inlineContent.hasTrailingSoftWrapOpportunity() && m_line.hasContent()) {
             auto& trailingRun = candidateRuns.last();
-            // FIXME: There must be a way to decide if the trailing run actually ended up on the line.
-            // Let's just deal with collapsed leading whitespace for now.
-            if (m_line.hasContent() && TextUtil::isWrappingAllowed(trailingRun.style))
-                m_wrapOpportunityList.append(&trailingRun.inlineItem);
+            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 isWrapOpportunity = TextUtil::isWrappingAllowed(parentStyle);
+            if (!isWrapOpportunity && (trailingInlineItem.isInlineBoxStart() || trailingInlineItem.isInlineBoxEnd()))
+                isWrapOpportunity = TextUtil::isWrappingAllowed(trailingRun.style);
+            if (isWrapOpportunity)
+                m_wrapOpportunityList.append(&trailingInlineItem);
         }
         return { result.isEndOfLine, { candidateRuns.size(), false } };
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to