Title: [291951] trunk
Revision
291951
Author
[email protected]
Date
2022-03-27 07:23:49 -0700 (Sun, 27 Mar 2022)

Log Message

[LFC][IFC] ASSERTs in BoxGeometry when loading Twitter page
https://bugs.webkit.org/show_bug.cgi?id=238421
<rdar://89980547>

Reviewed by Antti Koivisto.

Source/WebCore:

Ensure that we set size/position on trailing, empty inline box(es) in bidi context.
e.g.
<div>some content<span> <-line breaks here</span></div>

where the first line has the following runs:
  [some content]
  [inline box start]

second line has:
  [spanning inline box start]
  [<-line breaks here]
  [inline box end]

The first line's trailing (and empty, due to trailing whitespace trimming) [inline box start] run
needs computed geometry/display box so that when on the subsequent line we see the [spanning inline box start] run
we can properly compute the enclosing geometry for the <span> element.
(and that's where we currently assert as we don't find the associated box geometry for the inline box on the first line.)

See the comment in InlineDisplayContentBuilder::processBidiContent for details.
(Note that this change has no visual impact as these trailing inline boxes are always empty.)

Test: fast/inline/trailing-empty-bidi-inline-box.html

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

LayoutTests:

* fast/inline/trailing-empty-bidi-inline-box-expected.txt: Added.
* fast/inline/trailing-empty-bidi-inline-box.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (291950 => 291951)


--- trunk/LayoutTests/ChangeLog	2022-03-27 11:53:41 UTC (rev 291950)
+++ trunk/LayoutTests/ChangeLog	2022-03-27 14:23:49 UTC (rev 291951)
@@ -1,3 +1,14 @@
+2022-03-27  Alan Bujtas  <[email protected]>
+
+        [LFC][IFC] ASSERTs in BoxGeometry when loading Twitter page
+        https://bugs.webkit.org/show_bug.cgi?id=238421
+        <rdar://89980547>
+
+        Reviewed by Antti Koivisto.
+
+        * fast/inline/trailing-empty-bidi-inline-box-expected.txt: Added.
+        * fast/inline/trailing-empty-bidi-inline-box.html: Added.
+
 2022-03-27  Alexander Mikhaylenko  <[email protected]>
 
         [GTK][WPE] Support CSS accent-color

Added: trunk/LayoutTests/fast/inline/trailing-empty-bidi-inline-box-expected.txt (0 => 291951)


--- trunk/LayoutTests/fast/inline/trailing-empty-bidi-inline-box-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/trailing-empty-bidi-inline-box-expected.txt	2022-03-27 14:23:49 UTC (rev 291951)
@@ -0,0 +1,2 @@
+PASS if no crash or assert.
+XXXX XXXX

Added: trunk/LayoutTests/fast/inline/trailing-empty-bidi-inline-box.html (0 => 291951)


--- trunk/LayoutTests/fast/inline/trailing-empty-bidi-inline-box.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/trailing-empty-bidi-inline-box.html	2022-03-27 14:23:49 UTC (rev 291951)
@@ -0,0 +1,15 @@
+<style>
+div {
+  direction: rtl;
+  border: solid;
+  width: 100px;
+  font-size: 20px;
+  font-family: Monospace;
+}
+</style>
+PASS if no crash or assert.
+<div><span>XXXX</span><span> XXXX</span></div>
+<script>
+if (window.testRunner)
+  testRunner.dumpAsText();
+</script>

Modified: trunk/Source/WebCore/ChangeLog (291950 => 291951)


--- trunk/Source/WebCore/ChangeLog	2022-03-27 11:53:41 UTC (rev 291950)
+++ trunk/Source/WebCore/ChangeLog	2022-03-27 14:23:49 UTC (rev 291951)
@@ -1,3 +1,37 @@
+2022-03-27  Alan Bujtas  <[email protected]>
+
+        [LFC][IFC] ASSERTs in BoxGeometry when loading Twitter page
+        https://bugs.webkit.org/show_bug.cgi?id=238421
+        <rdar://89980547>
+
+        Reviewed by Antti Koivisto.
+
+        Ensure that we set size/position on trailing, empty inline box(es) in bidi context.
+        e.g. 
+        <div>some content<span> <-line breaks here</span></div>
+
+        where the first line has the following runs:
+          [some content]
+          [inline box start]
+
+        second line has:
+          [spanning inline box start]
+          [<-line breaks here]
+          [inline box end]
+
+        The first line's trailing (and empty, due to trailing whitespace trimming) [inline box start] run
+        needs computed geometry/display box so that when on the subsequent line we see the [spanning inline box start] run
+        we can properly compute the enclosing geometry for the <span> element.
+        (and that's where we currently assert as we don't find the associated box geometry for the inline box on the first line.)
+
+        See the comment in InlineDisplayContentBuilder::processBidiContent for details.
+        (Note that this change has no visual impact as these trailing inline boxes are always empty.) 
+
+        Test: fast/inline/trailing-empty-bidi-inline-box.html
+
+        * layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
+        (WebCore::Layout::InlineDisplayContentBuilder::processBidiContent):
+
 2022-03-27  Alexander Mikhaylenko  <[email protected]>
 
         [GTK][WPE] Support CSS accent-color

Modified: trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp (291950 => 291951)


--- trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp	2022-03-27 11:53:41 UTC (rev 291950)
+++ trunk/Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp	2022-03-27 14:23:49 UTC (rev 291951)
@@ -681,6 +681,24 @@
         adjustVisualGeometryWithInlineBoxes();
     };
     handleInlineBoxes();
+
+    auto handleTrailingOpenInlineBoxes = [&] {
+        for (auto& lineRun : makeReversedRange(lineContent.runs)) {
+            if (!lineRun.isInlineBoxStart() || lineRun.bidiLevel() != InlineItem::opaqueBidiLevel)
+                break;
+            // These are trailing inline box start runs (without the closing inline box end <span> <-line breaks here</span>).
+            // They don't participate in visual reordering (see createDisplayBoxesInVisualOrder above) as they we don't find them
+            // empty at inline building time (see setBidiLevelForOpaqueInlineItems) due to trailing whitespace.
+            // Non-empty inline boxes are normally get their display boxes generated when we process their content runs, but
+            // these trailing runs have their content on the subsequent line(s).
+            appendInlineBoxDisplayBox(lineRun
+                , lineBox.inlineLevelBoxForLayoutBox(lineRun.layoutBox())
+                , boxes.last().visualRectIgnoringBlockDirection()
+                , lineBox.hasContent()
+                , boxes);
+        }
+    };
+    handleTrailingOpenInlineBoxes();
 }
 
 void InlineDisplayContentBuilder::processOverflownRunsForEllipsis(DisplayBoxes& boxes, InlineLayoutUnit lineBoxRight)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to