Merge pull request #8895 from atom/as-undefined-offset-height

Allow null TextEditorComponent::domNode during visibility check
This commit is contained in:
Antonio Scandurra
2015-09-24 10:33:44 +02:00

View File

@@ -33,6 +33,13 @@ class TextEditorComponent
stylingChangeAnimationFrameRequested: false
gutterComponent: null
mounted: true
initialized: false
Object.defineProperty @prototype, "domNode",
get: -> @domNodeValue
set: (domNode) ->
atom.assert domNode?, "TextEditorComponent::domNode was set to null."
@domNodeValue = domNode
constructor: ({@editor, @hostElement, @rootElement, @stylesElement, @useShadowDOM, tileSize}) ->
@tileSize = tileSize if tileSize?
@@ -101,6 +108,7 @@ class TextEditorComponent
@updateSync()
@checkForVisibilityChange()
@initialized = true
destroy: ->
@mounted = false
@@ -557,7 +565,11 @@ class TextEditorComponent
disposables.add(@editor.onDidDestroy(stopDragging))
isVisible: ->
@domNode.offsetHeight > 0 or @domNode.offsetWidth > 0
# Investigating an exception that occurs here due to ::domNode being null.
atom.assert @domNode?, "TextEditorComponent::domNode was null.", (error) =>
error.metadata = {@initialized}
@domNode? and (@domNode.offsetHeight > 0 or @domNode.offsetWidth > 0)
pollDOM: =>
unless @checkForVisibilityChange()