Open Bug 1805927 Opened 2 years ago Updated 2 years ago

Broken page and failed asserts with empty list item with contain:layout

Categories

(Core :: Layout: Generated Content, Lists, and Counters, defect)

defect

Tracking

()

People

(Reporter: Oriol, Unassigned, NeedInfo)

References

(Regression)

Details

(Keywords: regression)

<!DOCTYPE html>
<li style="contain: layout"></li>
Lorem ipsum

It just shows a blank page with a vertical scrollbar. The text is nowhere to be seen.
In a debug build, I get

[Parent 2978522, Main Thread] WARNING: Failed to retarget HTML data delivery to the parser thread.: file /home/oriol/src/firefox/parser/html/nsHtml5StreamParser.cpp:1234
nsBlockReflowContext: Block(li)(0)@7fd602dbecc8 metrics=75120,1073742063!
nsBlockReflowContext: Block(body)(1)@7fd602dbebb0 metrics=75120,1073743203!
[Parent 2978522, Main Thread] ###!!! ASSERTION: overflow rect must include border rect, and the clamping logic here depends on that: 'overflowRect.Contains(borderRect)', file /home/oriol/src/firefox/layout/generic/ScrollAnchorContainer.cpp:169
[Parent 2978522, Main Thread] ###!!! ASSERTION: overflow rect must include border rect, and the clamping logic here depends on that: 'overflowRect.Contains(borderRect)', file /home/oriol/src/firefox/layout/generic/ScrollAnchorContainer.cpp:169
[Parent 2978522, Main Thread] ###!!! ASSERTION: overflow rect must include border rect, and the clamping logic here depends on that: 'overflowRect.Contains(borderRect)', file /home/oriol/src/firefox/layout/generic/ScrollAnchorContainer.cpp:169
[Parent 2978522, Main Thread] ###!!! ASSERTION: overflow rect must include border rect, and the clamping logic here depends on that: 'overflowRect.Contains(borderRect)', file /home/oriol/src/firefox/layout/generic/ScrollAnchorContainer.cpp:169

Note contain: size layout works well, but contain: inline-size layout is still broken.
Similarly, container-type: size is fine but container-type: inline-size is broken.

Got as far as we can go bisecting nightlies...
Last good revision: f531f12e5c35223e49b1e657300ae83e0cf696a8 (2021-06-13)
First bad revision: 177ac92fb734b80f07c04710ec70f0b89a073351 (2021-06-14)
Pushlog: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=f531f12e5c35223e49b1e657300ae83e0cf696a8&tochange=177ac92fb734b80f07c04710ec70f0b89a073351

Keywords: regression
Regressed by: 1542807

Goes further back if I add <style>::marker { content: "" }</style>

Last good revision: d551d37b9ad0dd1c8ad2e87c74344f623fc4b694 (2019-05-23)
First bad revision: 5d3e1ea7769357bce7297b83be3863034bcf656e (2019-05-24)
Pushlog: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=d551d37b9ad0dd1c8ad2e87c74344f623fc4b694&tochange=5d3e1ea7769357bce7297b83be3863034bcf656e

Bug 1552287 did this suspicious thing:

--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -2928,12 +2928,15 @@
                  "empty ::marker frame took up space");
 
     if (!MarkerIsEmpty()) {
       // There are no lines so we have to fake up some y motion so that
       // we end up with *some* height.
-
-      if (metrics.BlockStartAscent() == ReflowOutput::ASK_FOR_BASELINE) {
+      // (Note: if we're layout-contained, we have to be sure to leave our
+      // ReflowOutput's BlockStartAscent() (i.e. the baseline) untouched,
+      // because layout-contained frames have no baseline.)
+      if (!aState.mReflowInput.mStyleDisplay->IsContainLayout() &&
+          metrics.BlockStartAscent() == ReflowOutput::ASK_FOR_BASELINE) {
         nscoord ascent;
         WritingMode wm = aState.mReflowInput.GetWritingMode();
         if (nsLayoutUtils::GetFirstLineBaseline(wm, marker, &ascent)) {
           metrics.SetBlockStartAscent(ascent);
         } else {
Flags: needinfo?(dholbert)
Regressed by: 1552287

Yeah, I don't recall the details there, but I don't think that change was suspicious.

I think the intent was to leave the baseline at its default ASK_FOR_BASELINE value -- implying "we don't have anything that we can use to resolve a baseline" -- and then any code that tries to use metrics.BlockStartAscent() should really be checking for that sentinel value, and then gracefully asking for the baseline via e.g. GetLogicalBaseline rather than using the numerical representation of the sentinel value.

Probably that's not happening here, and we're just directly using the sentinel value as if it were a baseline.

Severity: -- → S3
You need to log in before you can comment on or make changes to this bug.