Title: [252810] trunk/Source/WebCore
Revision
252810
Author
[email protected]
Date
2019-11-22 15:30:43 -0800 (Fri, 22 Nov 2019)

Log Message

[LFC][IFC] Merge "insert inline runs" and "setup display runs" loops in InlineFormattingContext::setDisplayBoxesForLine
https://bugs.webkit.org/show_bug.cgi?id=204537
<rdar://problem/57440394>

Reviewed by Antti Koivisto.

Let's loop the new Line::Run list only once.

* layout/inlineformatting/InlineFormattingContext.cpp:
(WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (252809 => 252810)


--- trunk/Source/WebCore/ChangeLog	2019-11-22 23:14:13 UTC (rev 252809)
+++ trunk/Source/WebCore/ChangeLog	2019-11-22 23:30:43 UTC (rev 252810)
@@ -1,3 +1,16 @@
+2019-11-22  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Merge "insert inline runs" and "setup display runs" loops in InlineFormattingContext::setDisplayBoxesForLine
+        https://bugs.webkit.org/show_bug.cgi?id=204537
+        <rdar://problem/57440394>
+
+        Reviewed by Antti Koivisto.
+
+        Let's loop the new Line::Run list only once.
+
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine):
+
 2019-11-22  Chris Dumez  <[email protected]>
 
         Bindings generator fails to add includes for iterable<> key / value types

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (252809 => 252810)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2019-11-22 23:14:13 UTC (rev 252809)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2019-11-22 23:30:43 UTC (rev 252810)
@@ -427,20 +427,8 @@
         }
     }
 
-    // Add final display runs to state.
     formattingState.addLineBox(lineContent.lineBox);
-    // FIXME: This is tempoary.
     auto& currentLine = *formattingState.lineBoxes().last();
-    for (auto& lineRun : lineContent.runList) {
-        // Inline level containers (<span>) don't generate display runs.
-        if (lineRun.isContainerStart() || lineRun.isContainerEnd())
-            continue;
-        // Completely collapsed line runs don't generate display runs either.
-        if (lineRun.isCollapsedToVisuallyEmpty())
-            continue;
-        formattingState.addInlineRun(makeUnique<Display::Run>(lineRun.layoutBox().style(), lineRun.logicalRect(), lineRun.textContext()), currentLine);
-    }
-
     // Compute box final geometry.
     auto& lineRuns = lineContent.runList;
     for (unsigned index = 0; index < lineRuns.size(); ++index) {
@@ -449,6 +437,12 @@
         auto& layoutBox = lineRun.layoutBox();
         auto& displayBox = formattingState.displayBox(layoutBox);
 
+        // Add final display runs to state first.
+        // Inline level containers (<span>) don't generate display runs and neither do completely collapsed runs.
+        auto initiatesInlineRun = !lineRun.isContainerStart() && !lineRun.isContainerEnd() && !lineRun.isCollapsedToVisuallyEmpty();
+        if (initiatesInlineRun)
+            formattingState.addInlineRun(makeUnique<Display::Run>(lineRun.layoutBox().style(), lineRun.logicalRect(), lineRun.textContext()), currentLine);
+
         if (lineRun.isForcedLineBreak()) {
             displayBox.setTopLeft(logicalRect.topLeft());
             displayBox.setContentBoxWidth(logicalRect.width());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to