Precompute more drag-drop data structures on tab strip dragstart
Categories
(Firefox :: Tabbed Browser, task, P4)
Tracking
()
People
(Reporter: sthompson, Assigned: astor, Mentored, NeedInfo)
References
(Blocks 1 open bug)
Details
(Keywords: perf, Whiteboard: [fidefe-tabgrps])
Attachments
(2 files)
The drag-drop code in the <tabs> component:
- stores
movingTabsas an array of the moving tabs on the dragged tab's dragdata object on dragstart, but _animateTabMove will reverse that on every dragover if the locale is RTL - has several places where we
slicethe array of tab strip items,filterout moving tabs, or otherwise process the array every dragover
Technically, we're wasting CPU cycles by doing the same work over and over during a drag, although we don't actually have hard evidence from profiles that this is a performance issue.
The larger opportunity is to be more explicit about:
- what data is required to implement our drag-drop logic
- how we use that data
For example, on https://searchfox.org/mozilla-central/rev/3b58bde321bf705a91c32c7a6574a3427ce81d3f/browser/components/tabbrowser/content/tabs.js#2363 we have tabs = tabs.filter(t => !movingTabs.includes(t) || t == draggedTab);. The main purpose for this data structure is to calculate the element index in getOverlappedElement where the dragged items should be dropped for purposes of animating how the non-moving tabs shift out of the way. It's not intuitive that we should exclude moving tabs but still have the dragged tab in the case where we are dragging several tabs at once. On dragstart, we could build this array once, call it something like dropIndexSearchArray, save it on the dragged tab's dragdata object, and use it without modification during the entire drag operation. Similarly, we could precompute an array of unmovingTabStripItems instead of reusing the tabs array from before and skipping the draggedTab https://searchfox.org/mozilla-central/rev/3b58bde321bf705a91c32c7a6574a3427ce81d3f/browser/components/tabbrowser/content/tabs.js#2661-2664
| Reporter | ||
Updated•7 months ago
|
Updated•7 months ago
|
| Reporter | ||
Updated•7 months ago
|
Updated•7 months ago
|
| Assignee | ||
Comment 1•4 months ago
|
||
Moves data structure creation to the on_dragstart event
Updated•4 months ago
|
Comment 4•21 days ago
|
||
Backed out for causing bc failures
- Backout link
- Push with failures
- Failure Log
- Failure line: TEST-UNEXPECTED-FAIL | browser/components/tabbrowser/test/browser/dragdrop/browser_move_unpinned_not_overflowing.js | Uncaught exception in test bound test_move_unpinned_horizontal_rtl - at chrome://global/content/customElements.js:676 - InternalError: too much recursion
| Assignee | ||
Comment 5•20 days ago
|
||
| Assignee | ||
Updated•20 days ago
|
Backed out for causing bc failures @browser_multiselect_tabs_reorder.js.
Comment 9•1 day ago
|
||
Authored by agoloman
https://github.com/mozilla-firefox/firefox/commit/28328852faef8df1ee41e277a56ec6855020cead
[main] Revert "Bug 1970541 Precompute unmovingTabStripItems and dropIndexSearchArray r=sthompson,tabbrowser-reviewers" for causing failures @browser_multiselect_tabs_reorder.js.
Comment 10•1 day ago
|
||
| bugherder | ||
Comment 11•1 day ago
|
||
Updated•1 day ago
|
Updated•1 day ago
|
Updated•1 day ago
|
Comment 12•1 day ago
|
||
Backout merged to central: https://hg.mozilla.org/mozilla-central/rev/1020df6307c5
Description
•