aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
diff options
context:
space:
mode:
authorStephen Blott2015-01-26 06:31:34 +0000
committerStephen Blott2015-01-26 06:31:34 +0000
commitef9a8473d7d6b932de21642684f27e7696aac01b (patch)
tree508bc59da6e36ece25dcac5e7c5a732467ca9b65 /content_scripts
parent1a83f98dcbea073ddf0221fe57fcad1d1c198129 (diff)
downloadvimium-ef9a8473d7d6b932de21642684f27e7696aac01b.tar.bz2
Visual/edit modes: minor changes.
Diffstat (limited to 'content_scripts')
-rw-r--r--content_scripts/mode_visual_edit.coffee15
1 files changed, 7 insertions, 8 deletions
diff --git a/content_scripts/mode_visual_edit.coffee b/content_scripts/mode_visual_edit.coffee
index 8f7f3ded..3659c7ba 100644
--- a/content_scripts/mode_visual_edit.coffee
+++ b/content_scripts/mode_visual_edit.coffee
@@ -239,15 +239,14 @@ class Movement extends MaintainCount
# Try to scroll the focus into view.
scrollIntoView: ->
@protectClipboard =>
- element = document.activeElement
- if element and DomUtils.isEditable element
- if element.clientHeight < element.scrollHeight
- if element.isContentEditable
- # How do we do this?
+ if @element and DomUtils.isEditable @element
+ if @element.clientHeight < @element.scrollHeight
+ if @element.isContentEditable
+ # How do we do this? This case matters for gmail and Google's inbox.
else
- position = if @getDirection() == backward then element.selectionStart else element.selectionEnd
- coords = DomUtils.getCaretCoordinates element, position
- Scroller.scrollToPosition element, coords.top, coords.left
+ position = if @getDirection() == backward then @element.selectionStart else @element.selectionEnd
+ coords = DomUtils.getCaretCoordinates @element, position
+ Scroller.scrollToPosition @element, coords.top, coords.left
else
elementWithFocus = @getElementWithFocus @selection
Scroller.scrollIntoView elementWithFocus if elementWithFocus