Autoscroll broken after moz13 update when restoring from hold and using Bubbles

RESOLVED FIXED in 1.2

Status

RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: aleth, Assigned: aleth)

Tracking

Details

(Whiteboard: [wanted][regression])

Attachments

(1 attachment, 5 obsolete attachments)

(Assignee)

Description

5 years ago
*** Original post on bio 1530 at 2012-06-20 15:45:00 UTC ***

STR
Take a conversation long enough to be displayed in chunks on reopening.
Use the mouse wheel to scroll up a bit, and then to the end of the conversation.
Put on hold and reopen.
The scroll position is not restored properly and we end up scrolled to an intermediate point ein the conversation.

Suspected reason: Scroll position is restored before all the messages have been added (and/or is somehow absolute and not relative).
(Assignee)

Updated

5 years ago
Blocks: 954919
(Assignee)

Updated

5 years ago
Whiteboard: [regression]
Whiteboard: [regression] → [1.2-blocking][regression]
(Assignee)

Comment 1

5 years ago
Created attachment 8353404 [details] [diff] [review]
Patch

*** Original post on bio 1530 as attmnt 1647 at 2012-06-20 18:43:00 UTC ***

Calling _updateAutoScrollEnabled after adding the new element could lead to autoScroll being turned off due to the new element, probably because of speed improvements in gecko. There is no need to call _updateAutoScrollEnabled here anyway, as adding a new message shouldn't change the autoScroll state, so this patch removes it.

I had a look at the scroll event handler (browserScroll) and both if clauses that prevent _updateAutoScrollEnabled are triggered, the first when you would expect, the second very rarely when resizing. Most of the time, but not always, turning off the if clauses has no effect as the insertion of new elements is fast enough. Probably better to keep that code as-is though?
Attachment #8353404 - Flags: review?(florian)
(Assignee)

Comment 2

5 years ago
Comment on attachment 8353404 [details] [diff] [review]
Patch

*** Original change on bio 1530 attmnt 1647 at 2012-06-20 21:05:34 UTC ***

Actually does not fix the original STR when there are /many/ messages to be displayed. Will investigate.
Attachment #8353404 - Flags: review?(florian) → review-
(Assignee)

Comment 3

5 years ago
Created attachment 8353406 [details] [diff] [review]
Patch

*** Original post on bio 1530 as attmnt 1649 at 2012-06-20 23:54:00 UTC ***

Two further bugfixes:
- A regression caused by me in
http://hg.instantbird.org/instantbird/rev/2eeb8a68d5a3
http://hg.instantbird.org/instantbird/rev/3b67cfcfc0ad
- The remaining issue on opening a conversation from hold: Two scroll events occurring while the messages were being displayed would cause autoScrollEnabled to be unset, as scrolling to the last added message is suppressed during that period.
And some improved comments.
Attachment #8353406 - Flags: review?(florian)
(Assignee)

Comment 4

5 years ago
Comment on attachment 8353404 [details] [diff] [review]
Patch

*** Original change on bio 1530 attmnt 1647 at 2012-06-20 23:54:08 UTC was without comment, so any subsequent comment numbers will be shifted ***
Attachment #8353404 - Attachment is obsolete: true
(Assignee)

Updated

5 years ago
Assignee: nobody → aleth
Status: NEW → ASSIGNED
(Assignee)

Comment 5

5 years ago
Comment on attachment 8353406 [details] [diff] [review]
Patch

*** Original change on bio 1530 attmnt 1649 at 2012-06-20 23:58:32 UTC was without comment, so any subsequent comment numbers will be shifted ***
Attachment #8353406 - Flags: review?(florian)
(Assignee)

Comment 6

5 years ago
Created attachment 8353407 [details] [diff] [review]
Patch

*** Original post on bio 1530 as attmnt 1650 at 2012-06-21 00:01:00 UTC ***

Scratch the first listed bug in the previous comment (issue was caused by an intermediate patch).
Attachment #8353407 - Flags: review?(florian)
(Assignee)

Comment 7

5 years ago
Comment on attachment 8353406 [details] [diff] [review]
Patch

*** Original change on bio 1530 attmnt 1649 at 2012-06-21 00:01:43 UTC was without comment, so any subsequent comment numbers will be shifted ***
Attachment #8353406 - Attachment is obsolete: true
(Assignee)

Comment 8

5 years ago
*** Original post on bio 1530 at 2012-06-21 00:03:31 UTC ***

This patch assumes that no browserScroll events can happen *during* the displayMessage loop in displayPendingMessages. (Otherwise the added code would have to be after each displayMessage call).
(Assignee)

Comment 9

5 years ago
Created attachment 8353520 [details] [diff] [review]
Alternative patch

*** Original post on bio 1530 as attmnt 1759 at 2012-07-27 13:10:00 UTC ***

Flo reported another aspect of this bug that is not fixed by the existing patch (which only resolves the bug on restoring from hold):
"I've been talking with Even for a while, and at some point I scroll in the scrollback to find a quote or read again a message. Then I scroll to the bottom of the conversation. And I discover that Even has actually sent a few messages only when I send a message myself and don't see it, because I need to scroll to see it and re-enable the autoscroll."

While I can't reproduce this, I've attached an alternative version of my patch which _may_ help, for testing. It changes the calculation in updateAutoScrollEnabled from the body element to window properties. While this is technically less ideal, it has the advantage that it will not trigger a synchronous relayout of the whole page to get the values. WFM, but I don't know if it addresses the issue.
Attachment #8353520 - Flags: review?(florian)
(Assignee)

Comment 10

5 years ago
Created attachment 8353527 [details] [diff] [review]
Patch for 1.2

*** Original post on bio 1530 as attmnt 1766 at 2012-08-01 16:36:00 UTC ***

This patch only fixes the bug when restoring from hold, while not touching the "just to be sure" updateAutoScrollEnabled call.

STR for other occurrences of this bug are unknown.
Attachment #8353527 - Flags: review?(florian)
(Assignee)

Comment 11

5 years ago
Comment on attachment 8353527 [details] [diff] [review]
Patch for 1.2

*** Original change on bio 1530 attmnt 1766 at 2012-08-02 09:27:53 UTC was without comment, so any subsequent comment numbers will be shifted ***
Attachment #8353527 - Flags: review?(florian)
(Assignee)

Comment 12

5 years ago
Comment on attachment 8353520 [details] [diff] [review]
Alternative patch

*** Original change on bio 1530 attmnt 1759 at 2012-08-02 09:28:05 UTC was without comment, so any subsequent comment numbers will be shifted ***
Attachment #8353520 - Flags: review?(florian)
(Assignee)

Comment 13

5 years ago
Comment on attachment 8353407 [details] [diff] [review]
Patch

*** Original change on bio 1530 attmnt 1650 at 2012-08-02 09:28:06 UTC was without comment, so any subsequent comment numbers will be shifted ***
Attachment #8353407 - Flags: review?(florian)
*** Original post on bio 1530 at 2012-08-02 10:27:23 UTC ***

We don't have a good understanding of what's going on here, so it can't block 1.2. However we know this is really annoying, so we still really want to fix it, but it may be after 1.2 ships.
Whiteboard: [1.2-blocking][regression] → [wanted][regression]
(Assignee)

Comment 15

5 years ago
Created attachment 8353536 [details] [diff] [review]
Patch

*** Original post on bio 1530 as attmnt 1775 at 2012-08-02 19:43:00 UTC ***

This is a fix for the problem on restoring from hold, which turns out to be due to a race condition when using Bubbles. I could not reproduce with other message styles when ensuring there were no user-triggered scroll events. STR are simply to restore a conversation from hold which is long enough to trigger a progress bar, but not so long that the scroll position hardly changes when messages are added. As it's a race condition this will not "work" for everyone.

Without Bubbles, this is a typical sequence on restoring from hold:
message block displayed
message block displayed
**show progress bar after this block
message block displayed   <-- The progress bar will be shown after
                              this step, triggering a scroll event...
**show progress bar after this block
message block displayed
browserScroll scrollingintoview   <-- ...which is handled here.
message block displayed
...
Since this._scrollingIntoView was set, this does not lead to updateAutoScrollEnabled being called and possibly turning off autoScrollEnabled.
After browserScroll handles the event, this._scrollingIntoView==false, but there is only one scroll event.

With Bubbles, there is also the scrollIntoView triggered by the timeout on adding messages if enough time elapses between messages. When adding messages from hold this is usually not the case. However, displaying the progress bar takes enough time so that a scroll may occur, at least on some machines:
message block displayed
message block displayed
**show progress bar after this block
message block displayed
--scrollIntoView Bubbles
**show progress bar after this block
message block displayed
browserScroll scrollingintoview
message block displayed
...
In this case there is also no problem as there is still only one scroll event fired. But when the timing is just right this can happen:
message block displayed
message block displayed
**show progress bar after this block
message block displayed
browserScroll scrollingintoview #ubuntu
--scrollintoview Bubbles        <-- Here this scroll happens AFTER the first
                                    scroll event has been handled, triggering
                                    another scroll event...
**show progress bar after this block
message block displayed
browserScroll update      <-- which is handled here and causes the bug.
**show progress bar after this block
message block displayed

The fix in the patch is for Bubbles to call convbrowser._scrollToElement rather than scrollIntoView. This resets this._scrollIntoView=true (just as when autoscrolling to the last message after inserting it), thus preventing the bug.

I hope I found the best place to add the scrollToElement method to the browser window. (The convbrowser init method is called too early.)
Attachment #8353536 - Flags: review?(florian)
(Assignee)

Comment 16

5 years ago
Comment on attachment 8353407 [details] [diff] [review]
Patch

*** Original change on bio 1530 attmnt 1650 at 2012-08-02 19:43:07 UTC was without comment, so any subsequent comment numbers will be shifted ***
Attachment #8353407 - Attachment is obsolete: true
(Assignee)

Comment 17

5 years ago
Comment on attachment 8353520 [details] [diff] [review]
Alternative patch

*** Original change on bio 1530 attmnt 1759 at 2012-08-02 19:43:07 UTC was without comment, so any subsequent comment numbers will be shifted ***
Attachment #8353520 - Attachment is obsolete: true
(Assignee)

Comment 18

5 years ago
Comment on attachment 8353527 [details] [diff] [review]
Patch for 1.2

*** Original change on bio 1530 attmnt 1766 at 2012-08-02 19:43:07 UTC was without comment, so any subsequent comment numbers will be shifted ***
Attachment #8353527 - Attachment is obsolete: true
(Assignee)

Updated

5 years ago
Summary: Autoscroll subtly broken after moz13 update → Autoscroll broken after moz13 update when restoring from hold
(Assignee)

Updated

5 years ago
Summary: Autoscroll broken after moz13 update when restoring from hold → Autoscroll broken after moz13 update when restoring from hold and using Bubbles
Comment on attachment 8353536 [details] [diff] [review]
Patch

*** Original change on bio 1530 attmnt 1775 at 2012-08-03 13:17:17 UTC ***

Looks good. We rephrased the comment a bit over IRC.
Attachment #8353536 - Flags: review?(florian) → review+
*** Original post on bio 1530 at 2012-08-03 18:10:47 UTC ***

Checked in as http://hg.instantbird.org/instantbird/rev/fe0c0fb1c1af
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.2
You need to log in before you can comment on or make changes to this bug.