atom/atom — pull request #3353 by nathansobo (2014-08-22 00:01:38+00:00)
Title: Rework DOM measurement to try to prevent measurement errors

This is attempting to bugs like the following:

```
src/lines-component.js:426:35 [object Object].module.exports.React.createClass.measureCharactersInLine
src/display-buffer.js:439:7 DisplayBuffer.module.exports.DisplayBuffer.batchCharacterMeasurement
src/editor.js:2145:33 Editor.module.exports.Editor.batchCharacterMeasurement
src/lines-component.js:392:21 [object Object].module.exports.React.createClass.measureCharactersInNewLines
src/lines-component.js:385:19 [object Object].module.exports.React.createClass.remeasureCharacterWidths
src/editor-component.js:1446:32 [object Object].module.exports.React.createClass.remeasureCharacterWidths
src/editor-component.js:290:14 [object Object].module.exports.React.createClass.performInitialMeasurement
src/editor-component.js:1354:16 [object Object].module.exports.React.createClass.pollDOM
src/react-editor-view.js:267:22 ReactEditorView.module.exports.ReactEditorView.pollComponentDOM
src/react-editor-view.js:257:19 ReactEditorView.module.exports.ReactEditorView.show
src/pane-view.js:301:14 PaneView.module.exports.PaneView.onActiveItemChanged
src/pane.js:172:32 Pane.module.exports.Pane.activateItem
```

It seems like in some cases we're remeasuring character widths for lines that aren't on the screen yet.

* Simplify scrollbar refresh and measurement by using imperative DOM
manipulation instead of React to hide/show scrollbars.
* Rename `::performInitialMeasurement` to `::becameVisible`
* Break `::checkForVisibilityChange` out of `::pollDOM` and use it in
to check for the element becoming visible in `componentWillUpdate`.
* Don't rely on stored visibility state anywhere. Always check again.
This could potentially be cached for an update cycle but being wrong
about this is disastrous so I'm being conservative.