Title: [286448] trunk/Source/WebCore
Revision
286448
Author
[email protected]
Date
2021-12-02 13:25:35 -0800 (Thu, 02 Dec 2021)

Log Message

[LFC][IFC] Redundant line run type checking in InlineDisplayContentBuilder::processNonBidiContent
https://bugs.webkit.org/show_bug.cgi?id=233597

Reviewed by Antti Koivisto.

* layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::processNonBidiContent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (286447 => 286448)


--- trunk/Source/WebCore/ChangeLog	2021-12-02 21:13:02 UTC (rev 286447)
+++ trunk/Source/WebCore/ChangeLog	2021-12-02 21:25:35 UTC (rev 286448)
@@ -1,3 +1,13 @@
+2021-12-02  Alan Bujtas  <[email protected]>
+
+        [LFC][IFC] Redundant line run type checking in InlineDisplayContentBuilder::processNonBidiContent
+        https://bugs.webkit.org/show_bug.cgi?id=233597
+
+        Reviewed by Antti Koivisto.
+
+        * layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp:
+        (WebCore::Layout::InlineDisplayContentBuilder::processNonBidiContent):
+
 2021-12-02  Andreu Botella  <[email protected]>
 
         Remove the multipart parameter to FormAssociatedElement::appendFormData, InputType::appendFormData and HTMLFormElement::constructEntryList

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp (286447 => 286448)


--- trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp	2021-12-02 21:13:02 UTC (rev 286447)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/InlineDisplayContentBuilder.cpp	2021-12-02 21:25:35 UTC (rev 286448)
@@ -286,43 +286,37 @@
 {
     // Create the inline boxes on the current line. This is mostly text and atomic inline boxes.
     for (auto& lineRun : lineContent.runs) {
+        auto& layoutBox = lineRun.layoutBox();
 
-        auto displayBoxRect = [&] {
-            auto& layoutBox = lineRun.layoutBox();
-            auto logicalRect = InlineRect { };
-
-            if (lineRun.isText() || lineRun.isSoftLineBreak())
-                logicalRect = lineBox.logicalRectForTextRun(lineRun);
-            else if (lineRun.isHardLineBreak())
-                logicalRect = lineBox.logicalRectForLineBreakBox(layoutBox);
-            else if (lineRun.isBox())
-                logicalRect = lineBox.logicalBorderBoxForAtomicInlineLevelBox(layoutBox, formattingState().boxGeometry(layoutBox));
-            else if (lineRun.isInlineBoxStart() || lineRun.isLineSpanningInlineBoxStart())
-                logicalRect = lineBox.logicalBorderBoxForInlineBox(layoutBox, formattingState().boxGeometry(layoutBox));
-            else
-                ASSERT_NOT_REACHED();
+        auto logicalRectRelativeToRoot = [&](auto logicalRect) {
             logicalRect.moveBy(lineBoxLogicalTopLeft);
             return logicalRect;
         };
 
         if (lineRun.isText()) {
-            appendTextDisplayBox(lineRun, displayBoxRect(), boxes);
+            appendTextDisplayBox(lineRun, logicalRectRelativeToRoot(lineBox.logicalRectForTextRun(lineRun)), boxes);
             continue;
         }
         if (lineRun.isSoftLineBreak()) {
-            appendSoftLineBreakDisplayBox(lineRun, displayBoxRect(), boxes);
+            appendSoftLineBreakDisplayBox(lineRun, logicalRectRelativeToRoot(lineBox.logicalRectForTextRun(lineRun)), boxes);
             continue;
         }
         if (lineRun.isHardLineBreak()) {
-            appendHardLineBreakDisplayBox(lineRun, displayBoxRect(), boxes);
+            appendHardLineBreakDisplayBox(lineRun, logicalRectRelativeToRoot(lineBox.logicalRectForLineBreakBox(layoutBox)), boxes);
             continue;
         }
         if (lineRun.isBox()) {
-            appendAtomicInlineLevelDisplayBox(lineRun, displayBoxRect(), boxes);
+            appendAtomicInlineLevelDisplayBox(lineRun
+                , logicalRectRelativeToRoot(lineBox.logicalBorderBoxForAtomicInlineLevelBox(layoutBox, formattingState().boxGeometry(layoutBox)))
+                , boxes);
             continue;
         }
         if (lineRun.isInlineBoxStart()) {
-            appendInlineBoxDisplayBox(lineRun, lineBox.inlineLevelBoxForLayoutBox(lineRun.layoutBox()), displayBoxRect(), lineBox.hasContent(), boxes);
+            appendInlineBoxDisplayBox(lineRun
+                , lineBox.inlineLevelBoxForLayoutBox(lineRun.layoutBox())
+                , logicalRectRelativeToRoot(lineBox.logicalBorderBoxForInlineBox(layoutBox, formattingState().boxGeometry(layoutBox)))
+                , lineBox.hasContent()
+                , boxes);
             continue;
         }
         if (lineRun.isLineSpanningInlineBoxStart()) {
@@ -332,7 +326,10 @@
                 // don't extend the spanning line box over to this line -also there is no next line in cases like this.
                 continue;
             }
-            appendSpanningInlineBoxDisplayBox(lineRun, lineBox.inlineLevelBoxForLayoutBox(lineRun.layoutBox()), displayBoxRect(), boxes);
+            appendSpanningInlineBoxDisplayBox(lineRun
+                , lineBox.inlineLevelBoxForLayoutBox(lineRun.layoutBox())
+                , logicalRectRelativeToRoot(lineBox.logicalBorderBoxForInlineBox(layoutBox, formattingState().boxGeometry(layoutBox)))
+                , boxes);
             continue;
         }
         ASSERT(lineRun.isInlineBoxEnd() || lineRun.isWordBreakOpportunity());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to