Skip to content

Fix "scroll to hotspot" functionality in the source view + assembly view#5759

Merged
mstange merged 8 commits intofirefox-devtools:mainfrom
mstange:bottom-box-scrolling-improvements
Jan 19, 2026
Merged

Fix "scroll to hotspot" functionality in the source view + assembly view#5759
mstange merged 8 commits intofirefox-devtools:mainfrom
mstange:bottom-box-scrolling-improvements

Conversation

@mstange
Copy link
Contributor

@mstange mstange commented Jan 14, 2026

Production | Deploy preview

Fixes #5758 and cleans things up a bit.

Having the samples passed to getBottomBoxInfoForCallNode will also make it easier to address the TODO about picking the native symbol with the highest sample count, but I'll do that in a separate PR (or probably as part of #5349).

@mstange mstange requested a review from canova January 14, 2026 21:08
@mstange mstange self-assigned this Jan 14, 2026
@codecov
Copy link

codecov bot commented Jan 14, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.69%. Comparing base (676b779) to head (98b5328).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
src/profile-logic/bottom-box.ts 51.28% 19 Missing ⚠️
src/components/shared/AssemblyView-codemirror.tsx 50.00% 6 Missing ⚠️
src/components/shared/AssemblyView.tsx 71.42% 2 Missing ⚠️
src/components/shared/SourceView.tsx 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5759      +/-   ##
==========================================
- Coverage   85.70%   85.69%   -0.01%     
==========================================
  Files         315      316       +1     
  Lines       31130    31141      +11     
  Branches     8567     8582      +15     
==========================================
+ Hits        26679    26686       +7     
- Misses       4021     4025       +4     
  Partials      430      430              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@canova canova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Looks good to me!

Looks like the first commit is from #5755.

I'm still a bit confused by scrollToLineNumber + highlightedLineNumber but I don't think it's very crucial.

Comment on lines 780 to 781
scrollToLineNumber?: number;
highlightLineNumber?: number;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I can't remember why we had highlighted line on top of scroll to line number.

Edit: Ah, I think it was because of the marker stacks, right? Can we add some comment here and state.ts to explain their usages. It was a bit confusing to me at first.

But also, what happens if we have both scrollToLineNumber and highlightLineNumber, how does it behave. For example, does first highlighting and then scrolling resets the highlight?

Copy link
Contributor Author

@mstange mstange Jan 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right, Florian added it when clicking frames in marker stacks. With this patch, highlighting and scrolling are fully independent; and passing highlightLineNumber: undefined will unset the current highlight. So it's different from scrolling where the current scrolling isn't changed if the property isn't specified.

This mismatch suggests that, instead of highlightLineNumber?: number, it might be clearer to have highlightedLineNumber: number | null.

nativeSymbols: nativeSymbolInfos,
lineNumber,
scrollToLineNumber: lineNumber,
highlightLineNumber: lineNumber,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can they be different, or are they always the same value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment they're always the same, but the API allows them to be different. Alternatively we could have used a scrollTargetLineIsHighlighted: boolean property.

mstange and others added 7 commits January 19, 2026 14:19
I want to add a call to a function from line-timings.ts but line-timings.ts
already depends on profile-data.ts, and I can't create a circular dependency
between profile-data.ts and line-timings.ts.
This means we can compute the right line number for the "hot spot" for the
call node that was passed to getBottomBoxInfoForCallNode, and not just for
the selected call node.

For example, getBottomBoxInfoForCallNode can be called with the right-clicked
call node which can be different from the selected call node, and we were
scrolling to the wrong spot in that case before this patch.

Fixes firefox-devtools#5758.
@mstange
Copy link
Contributor Author

mstange commented Jan 19, 2026

Thanks for the review! I'll adjust the comments to answer the questions you had.

@mstange mstange force-pushed the bottom-box-scrolling-improvements branch from 3fdb075 to 7b354c1 Compare January 19, 2026 20:41
@mstange mstange enabled auto-merge January 19, 2026 20:41
@mstange mstange disabled auto-merge January 19, 2026 20:42
@mstange mstange force-pushed the bottom-box-scrolling-improvements branch from 7b354c1 to 98b5328 Compare January 19, 2026 20:43
@mstange mstange enabled auto-merge January 19, 2026 20:43
@mstange mstange merged commit 0853138 into firefox-devtools:main Jan 19, 2026
19 checks passed
@canova canova mentioned this pull request Jan 27, 2026
canova added a commit that referenced this pull request Jan 27, 2026
Lots of exciting changes 🎉:

[arai-a] Put radio buttons into labels (#5738)
[DaniPopes] Update comment for "unique-string" (#5741)
[Karan Pradhan] Hide tooltip filter button in non-sticky tooltips and
add hideFilterButton tests (#5718)
[arai-a] Add a menu to copy the Marker Table as text (#5732)
[arai-a] Make the entire list item clickable for the "Full Range"
(#5742)
[Markus Stange] Move symbol table demangling out of SymbolStore into
SymbolProvider (#5746)
[Markus Stange] Remove SVG asset imports from profile-data.ts (#5747)
[arai-a] Do not apply sticky tooltip on double click (#5754)
[arai-a] Skip the ChartCanvas redraw on the Viewport's internal default
state usage (#5744)
[Markus Stange] Stop blindly extracting uint8array.buffer after calling
compress() (#5753)
[Markus Stange] In the assembly view state, refer to the current symbol
by index (#5755)
[Markus Stange] Fix "scroll to hotspot" functionality in the source view
+ assembly view (#5759)
[Markus Stange] Keep the colorField markerSchema field when processing
profiles in the gecko format (#5760)
[Markus Stange] Implement dark mode (#5740)
[Markus Stange] Fix light-mode colors (#5765)
[Markus Stange] Tweak dark mode colours. (#5767)
[Nazım Can Altınova] Enable some basic type-aware lints (#5775)
[Markus Stange] Allow seeing different assembly code for the same
function (#5349)
[fatadel] Refine tree view a11y (#5779)
[fatadel] Align double-click behavior of stack chart with flame graph
(#5782)
[Markus Stange] Split gz.ts properly into node and browser variants
(#5764)
[Markus Stange] Simplify and optimize the computation of per-call-node
line and address timings (#5770)
[Nazım Can Altınova] Move the dark mode toggle to devtools console
(#5783)
[Nazım Can Altınova] 🔃 Sync: l10n -> main (Jan 27, 2026) (#5785)
[Nazım Can Altınova] Improve Chrome importer marker payload logic
(#5717)
[Markus Stange] Add a Focus Self transform (#5774)
[Nazım Can Altınova] Enable the Turkish locale in production (#5786)


And huge thanks to our localizers 🎉 :

be: Mikalai Udodau
de: Ger
de: Michael Köhler
el: Jim Spentzos
en-CA: chutten
en-CA: Saurabh
en-GB: Ian Neal
en-GB: Saurabh
es-CL: ravmn
fy-NL, nl: Fjoerfoks
fr: Skywarp
fr: Théo Chevalier
fur: Fabio Tomat
fy-NL: Fjoerfoks
ia: Melo46
it: Francesco Lodolo [:flod]
nl: Fjoerfoks
nl: Mark Heijl
pt-BR: Marcelo Ghelman
ru: berry
ru: Valery Ledovskoy
sv-SE: Andreas Pettersson
tr: Grk
zh-CN: Olvcpr423
zh-CN: wxie
zh-TW: Pin-guang Chen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Opening the source view from the context menu sometimes scrolls to the wrong line number

2 participants