Closed Bug 2059800 Opened 3 months ago Closed 3 months ago

Revisit the chrome tab bar displayport bail-out now that the tab strip is user-scrollable

Categories

(Core :: Panning and Zooming, task)

task

Tracking

()

RESOLVED FIXED
155 Branch
Tracking Status
firefox155 --- fixed

People

(Reporter: dao, Assigned: tnikkel)

References

(Blocks 1 open bug)

Details

Attachments

(1 external file)

DisplayPortUtils::MaybeCreateDisplayPortInFirstScrollFrameEncountered() bails out on nsGkAtoms::tabbrowser_arrowscrollbox, with the comment "Don`t descend into the tab bar in chrome, it can be very large and does not contain any async scrollable elements".

That premise held when bug 1755290 added it: <scrollbox> was overflow: hidden and therefore never WantAsyncScroll(). Bug 1755290 comment 1 spells it out, including "they have been that way since the early 2000s, so doesn`t seem likely to change".

It has changed. The vertical tab strip's scrollbox is a real scroll container as of bug 2059794, so the tab bar does now contain an async scrollable element, and bug 1970536 will do the same for the horizontal strip. Today the strip only picks up a minimal displayport via ScrollContainerFrame::ShouldActivateAllScrollFrames(), which with apz.prefer_jank_minimal_displayports means the async scroll offset is suppressed until APZ requests a content repaint.

The original motivation still stands and should not be regressed: bug 1755290 measured this code at roughly 15% of the parent-process time to open a new tab in a session with many tabs. So the fix is presumably to let the tab bar`s own scroll frame be found without walking everything inside it, rather than to simply drop the bail-out.

We should be able to consider the tab bar scrollable but not descend any further and preserve the optimization.

MaybeCreateDisplayPortInFirstScrollFrameEncountered gives a displayport to the
first async scrollable frame it finds, so that frame is ready for APZ before
anything scrolls it. It skips tabbrowser-arrowscrollbox entirely. That was
correct when bug 1755290 added the bail out, because <scrollbox> was
overflow: hidden and so never WantAsyncScroll(). Bug 1899582 gave the vertical
tab strip's scrollbox overflow-y: auto, and bug 2059794 moves that into
arrowscrollbox.css gated on [overflowing], so the tab bar does contain an async
scrollable element now.

The strip therefore has only the minimal displayport from
ShouldActivateAllScrollFrames(), which with apz.prefer_jank_minimal_displayports
suppresses the async scroll offset until APZ requests a content repaint. It gets
a non-minimal one the first time it is scrolled. The bail out does not prevent
the strip from getting a displayport, only from having one before that first
scroll.

The arrowscrollbox's scroll container is a direct child frame and every tab
lives inside it, so scanning only the direct children finds it without walking
the tabs. That preserves the optimization bug 1755290 added, which was measured
at roughly 15% of the parent-process time to open a new tab in a session with
many tabs.

Assignee: nobody → tnikkel
Status: NEW → ASSIGNED
See Also: → 2059794
See Also: → 1970536
Pushed by tnikkel@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/667ef7dd6c9f https://hg.mozilla.org/integration/autoland/rev/5ba5df245a51 Teach the code that looks for the first scrollable frame to give a displayport about the tab bar scroller. r=dao,hiro,layout-reviewers,emilio,akulyk
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 155 Branch
QA Whiteboard: [qa-triage-done-c156/b155]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: