Title: [256466] trunk/Source/WebCore
Revision
256466
Author
[email protected]
Date
2020-02-12 12:01:14 -0800 (Wed, 12 Feb 2020)

Log Message

[LFC][IFC] Do not create Display::Boxes for anonymous inline text boxes
https://bugs.webkit.org/show_bug.cgi?id=207612
<rdar://problem/59374909>

Reviewed by Antti Koivisto.

<div>text content</div> : [text content] only needs a Display::Run.
<div><span>text content</span></div> [span] needs a Display::Box and [text content] needs a Display::Run.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (256465 => 256466)


--- trunk/Source/WebCore/ChangeLog	2020-02-12 19:43:00 UTC (rev 256465)
+++ trunk/Source/WebCore/ChangeLog	2020-02-12 20:01:14 UTC (rev 256466)
@@ -1,3 +1,17 @@
+2020-02-12  Zalan Bujtas  <[email protected]>
+
+        [LFC][IFC] Do not create Display::Boxes for anonymous inline text boxes
+        https://bugs.webkit.org/show_bug.cgi?id=207612
+        <rdar://problem/59374909>
+
+        Reviewed by Antti Koivisto.
+
+        <div>text content</div> : [text content] only needs a Display::Run.
+        <div><span>text content</span></div> [span] needs a Display::Box and [text content] needs a Display::Run.
+
+        * layout/inlineformatting/InlineFormattingContext.cpp:
+        (WebCore::Layout::InlineFormattingContext::setDisplayBoxesForLine):
+
 2020-02-12  Said Abou-Hallawa  <[email protected]>
 
         REGRESSION (r255158): http/tests/frame-throttling/raf-throttle-in-cross-origin-subframe.html is a flaky failure

Modified: trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp (256465 => 256466)


--- trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2020-02-12 19:43:00 UTC (rev 256465)
+++ trunk/Source/WebCore/layout/inlineformatting/InlineFormattingContext.cpp	2020-02-12 20:01:14 UTC (rev 256466)
@@ -461,7 +461,6 @@
         auto& lineRun = lineRuns.at(index);
         auto& logicalRect = lineRun.logicalRect();
         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.
@@ -489,9 +488,7 @@
         }
 
         if (lineRun.isLineBreak()) {
-            displayBox.setTopLeft(toLayoutPoint(logicalRect.topLeft()));
-            displayBox.setContentBoxWidth(toLayoutUnit(logicalRect.width()));
-            displayBox.setContentBoxHeight(toLayoutUnit(logicalRect.height()));
+            // FIXME: Since <br> and <wbr> runs have associated DOM elements, we might need to construct a display box here. 
             continue;
         }
 
@@ -500,6 +497,7 @@
             auto topLeft = logicalRect.topLeft();
             if (layoutBox.isInFlowPositioned())
                 topLeft += geometry().inFlowPositionedPositionOffset(layoutBox, horizontalConstraints);
+            auto& displayBox = formattingState.displayBox(layoutBox);
             displayBox.setTopLeft(toLayoutPoint(topLeft));
             continue;
         }
@@ -506,6 +504,7 @@
 
         // Inline level container start (<span>)
         if (lineRun.isContainerStart()) {
+            auto& displayBox = formattingState.displayBox(layoutBox);
             displayBox.setTopLeft(toLayoutPoint(logicalRect.topLeft()));
             continue;
         }
@@ -512,6 +511,7 @@
 
         // Inline level container end (</span>)
         if (lineRun.isContainerEnd()) {
+            auto& displayBox = formattingState.displayBox(layoutBox);
             if (layoutBox.isInFlowPositioned()) {
                 auto inflowOffset = geometry().inFlowPositionedPositionOffset(layoutBox, horizontalConstraints);
                 displayBox.moveHorizontally(inflowOffset.width());
@@ -526,17 +526,8 @@
         }
 
         if (lineRun.isText()) {
+            // Anonymous inline text boxes do not create display boxes.
             lastTextItemIndex = inlineContent.runs.size() - 1;
-            auto firstRunForLayoutBox = !index || &lineRuns[index - 1].layoutBox() != &layoutBox; 
-            if (firstRunForLayoutBox) {
-                // Setup display box for the associated layout box.
-                displayBox.setTopLeft(toLayoutPoint(logicalRect.topLeft()));
-                displayBox.setContentBoxWidth(toLayoutUnit(logicalRect.width()));
-                displayBox.setContentBoxHeight(toLayoutUnit(logicalRect.height()));
-            } else {
-                // FIXME fix it for multirun/multiline.
-                displayBox.setContentBoxWidth(toLayoutUnit(displayBox.contentBoxWidth() + logicalRect.width()));
-            }
             continue;
         }
         ASSERT_NOT_REACHED();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to