atom/atom — pull request #2370 by nathansobo (2014-05-23 02:26:31+00:00)
Title: Prevent React editor's scroll view from being auto-scrolled by Chromium

Because we need to draw content before scrolling to it, the editor's scrolling behavior is completely synthetic. We use `translate3d` to move the `.lines` div around and never actually set the `scrollTop` or `scrollLeft` of the `.scroll-view` that contains them.

However, if the hidden input field ever gets out of the visible area of the scroll view, the browser tries to be helpful and scroll it into view, which changes the `scrollTop` and `scrollLeft` and ruins everything. This PR tries to stop that.

* If we do scroll, we log a warning and auto-correct the problem. I'd like to remove this stop gap once we don't see warnings for a long enough time, but it's better than leaving the editor in a busted state.
* When the editor is blurred, we always park the hidden input at 0, 0. This eliminates some cases where the editor could autoscroll after changing size while unfocused and then being focused.
* Allow 2px for the hidden input when the cursor reaches the end of the longest line. This ensures we don't autoscroll to the right when moving the cursor to the right edge of the editor.