Closed Bug 1362758 Opened 8 years ago Closed 6 years ago

Flexbox layout does not update properly after content changes

Categories

(Core :: Layout: Flexbox, defect, P2)

defect

Tracking

()

RESOLVED WORKSFORME
Tracking Status
firefox-esr52 --- unaffected
firefox53 --- wontfix
firefox54 --- fix-optional
firefox55 - fix-optional
firefox56 - fix-optional
firefox57 --- fix-optional
firefox58 --- wontfix
firefox59 --- wontfix
firefox60 --- fix-optional

People

(Reporter: f1041701, Unassigned)

References

Details

(Keywords: regression, testcase)

Attachments

(2 files)

1. go to (NSFW) https://meguca.org/a/2050972 ¹
2. wait for page to load
3. scroll to the end of the page
3. press alt+g (some posts should be hidden now)
4. press alt+g again

This leaves some flexbox items (<article> nodes) in an incorrectly rendered state.

Forcing a relayout, e.g. by running |for(let art of Array.from(document.querySelectorAll("article"))) {art.style.top = 0};| on the console fixes it until the layout is changed again.

I suspect this is the result of some recent flexbox optimizations under bug 1304473


¹ The thread will expire in a few days. Any long thread (>1000 posts) on that site should work.
If it's a regression you can use mozregression to find out what caused the problem  http://mozilla.github.io/mozregression/
I can reproduce.  This is indeed a regression, and it seems to be caused by bug 1209697. (a flex optimization, as suspected in comment 0)  So, new regression in Firefox 53.

I narrowed to this regression range, in which bug 1209697 is the only commit to mention "flex":
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=1d025ac534a6333a8170a59a95a8a3673d4028ee&tochange=bf15d4078c2a6db7df37ab466d28a1e075c9eb4d
Blocks: 1209697
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
Attached image screenshot of bug
Here's a screenshot of what the bug looks like, BTW. (Text overflowing from comment boxes, and some text overlapping other text.)

(Screenshot is SFW, though the site has NSFW content as noted in comment 0.)
Attachment #8867061 - Attachment mime type: text/html → image/png
Per investigation in comment 2.
Flags: needinfo?(emilio+bugs)
I can take a look, I guess :)

So what pressing alt + g does is calling a toggleGallery function that, as far as I can tell, only toggles a class in the root ("gallery"), which makes some articles to be hidden with a selector that looks like: 

    .gallery:root #threads article[id^="p"]:not(.media):not(.editing)

However, that's not enough to trigger the bug I think, per my experimentation with the console: doing from devtools:

    document.documentElement.classList.toggle("gallery")

Twice, doesn't produce the garbled content.

If the reporter knew off-hand about what is going on apart from toggling that class (if anything, this could just be an artifact of the devtools), that'd save me a bit of time :). Otherwise I'll keep digging today when I come back from class.
Assignee: nobody → emilio+bugs
Flags: needinfo?(emilio+bugs) → needinfo?(f1041701)
Too late for a fix for 53, likely to miss 54 as well. But if you land a patch and can verify the fix we could still uplift to 54, potentially.
A reduced test-case would help... I guess a potential fix is just using the DOM generation id as key for the reflow input too as I had planned initially for bug 1209697, but understanding what's making us hit the cache incorrectly would help a lot.

I'm with exams these weeks, but I could prepare the easy fix, wdyt Daniel?
Flags: needinfo?(dholbert)
(In reply to Emilio Cobos Álvarez [:emilio] from comment #7)
Thanks for working on this bug.
Status: NEW → ASSIGNED
(In reply to Emilio Cobos Álvarez [:emilio] from comment #5)
> If the reporter knew off-hand about what is going on apart from toggling
> that class (if anything, this could just be an artifact of the devtools),
> that'd save me a bit of time :). Otherwise I'll keep digging today when I
> come back from class.

Toggling the class is all it should be doing.
Flags: needinfo?(f1041701)
The original thread has disappeared, but here's a standalone (not reduced) testcase taken from a snapshot of another thread.

In this version, you can just click some blank space to toggle the "gallery" class.  STR: click blank space, wait for re-render, click again, wait for re-render, scroll to end & look for content that overlaps text.
Flags: needinfo?(dholbert)
(For the record, my attached testcase is based on a snapshot from https://meguca.org/a/2105712 [NSFW])
I suspect this is related to interruptible reflow (and specifically to a measurement from an interruptible reflow being mistakenly cached or reused or something).

My "testcase 1" isn't 100% reliable, but I can generally get it to repro the issue after a few atttempts at clicking twice + scrolling to end (no reloading needed BTW).  Specifically: the first part of the wide comment about "dig things up from history if needed" will often be covered up by the comment-box that follows it.

However: if I toggle the about:config pref "layout.interruptible-reflow.enabled" to false, then I can't (yet) make the bug reproduce.

(I'd thought we instantiated a nsPresContext::InterruptPreventer to avoid interruptible-reflow interrupts during flexbox reflow, but I'm not finding that now, so it might've been removed, or I might be misremembering.)
Marking affected for 56 as well.
We could still uplift a fix to 55, but I don't think release management needs to track this.
I don't feel the need to track this for 55. If a fix is ready and deemed low risk, please nominate for uplift to Beta55.
Priority: -- → P2
Assuming this is still an issue but I am not sure. In any case, too late for a fix in 56.
(Yeah, it is indeed still an issue -- just reproduced with attached testcase in latest Nightly.)
Keywords: testcase
OS: Windows 10 → All
Hardware: x86_64 → All
Discussed this with Emilio and he is not working on it. I will see if I can find a new owner.
Assignee: emilio → nobody
Status: ASSIGNED → NEW
I think this is fixed -- possibly by bug 1495169 (which emilio just landed a fix for), or possibly by something earlier.

The attached testcase is a little tricky because if you interact with it too much, it makes the layout explode and take forever, which I'll spin off another bug for (though it might already be covered somewhere).  So I used these STR, which reliably trigger the bug in older builds without exploding the layout:

 1. Start with a blank tab.
 2. Visit https://bugzilla.mozilla.org/attachment.cgi?id=8873229
 3. As soon as you see some page content appear, press the "End" key on your keyboard.
 4. Wait for the page to finish loading (as reported by the throbber in the tab)
 5. Press "End" key again.

In old builds, e.g. Nightly 2017-09-26, I reliably see overlapping text/posts when I perform those STR.

In today's Nightly (2018-10-05), I do not see overlapping text/posts when I perform those STR.  Nor do I see any overlap in yesterday's Nightly (2018-10-04) -- hence, something else may have helped here before bug 1495169 was merged last night.  So, resolving as WORKSFORME rather than a dupe, since I'm not sure precisely when this became fixed.
Depends on: 1495169
QA Contact: svoisen
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WORKSFORME
Component: Layout → Layout: Flexbox
(In reply to Daniel Holbert [:dholbert] from comment #18)
> The attached testcase is a little tricky because if you interact with it too
> much, it makes the layout explode and take forever, which I'll spin off
> another bug for

BTW: I filed bug 1496817 for this part.
QA Contact: svoisen
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: