mirror of
https://github.com/atom/atom.git
synced 2026-02-08 05:35:04 -05:00
Ignore scroll requests to NaN, null or undefined positions
This commit is contained in:
@@ -2715,6 +2715,8 @@ class TextEditorComponent {
|
||||
}
|
||||
|
||||
setScrollTop (scrollTop) {
|
||||
if (Number.isNaN(scrollTop) || scrollTop == null) return false
|
||||
|
||||
scrollTop = Math.round(Math.max(0, Math.min(this.getMaxScrollTop(), scrollTop)))
|
||||
if (scrollTop !== this.scrollTop) {
|
||||
this.derivedDimensionsCache = {}
|
||||
@@ -2744,6 +2746,8 @@ class TextEditorComponent {
|
||||
}
|
||||
|
||||
setScrollLeft (scrollLeft) {
|
||||
if (Number.isNaN(scrollLeft) || scrollLeft == null) return false
|
||||
|
||||
scrollLeft = Math.round(Math.max(0, Math.min(this.getMaxScrollLeft(), scrollLeft)))
|
||||
if (scrollLeft !== this.scrollLeft) {
|
||||
this.scrollLeftPending = true
|
||||
|
||||
Reference in New Issue
Block a user