This repository has been archived by the owner on Mar 3, 2023. It is now read-only.
Round return values of getMaxScrollTop, getScrollHeight #15345
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #15343
If the current
scrollTop
/scrollLeft
value exceeds themaxScrollTop
/maxScrollLeft
, we reassign the values to the max on read. This allows us to behave correctly when the editor has changed in dimensions or the content has changed since the scroll position was previously assigned.Prior to this PR, we were applying
Math.round
to the scroll positions when assigning them but not rounding the values when reassigning them to the max.In situations where the content height contains fractional pixels, this can lead to a fractional-pixel scroll position when scrolled all the way down/right which causes blurry text. This can also cause unexpected firing of
onDidChangeScrollTop
when the value isn't actually changing due to a decision to notify listeners based on a rounded-up value not matching a fractional clipped value, as was the case in #15343./cc @t9md @Ben3eeE