зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1853124 - [devtools] Avoid changing cursor location when scrolling to first character. r=devtools-reviewers,bomsy
For some reason, the previous changeset triggers an additional call to `scrollToColumn` during `open-large-minified-file` DAMP test, only on try but not locally. Calling `codeMirror.charCoords` can be slow on large files and we often try to scroll to the first line/first column. Let's arbitrarily scroll to top/left when this simple case happens. Differential Revision: https://phabricator.services.mozilla.com/D188443
This commit is contained in:
Родитель
f0ccc02989
Коммит
81543e6e57
|
@ -88,6 +88,13 @@ export function toSourceLine(sourceId, line) {
|
|||
}
|
||||
|
||||
export function scrollToPosition(codeMirror, line, column) {
|
||||
// For all cases where these are on the first line and column,
|
||||
// avoid the possibly slow computation of cursor location on large bundles.
|
||||
if (!line && !column) {
|
||||
codeMirror.scrollTo(0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
const { top, left } = codeMirror.charCoords({ line, ch: column }, "local");
|
||||
|
||||
if (!isVisible(codeMirror, top, left)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче