diff options
| author | Stephen Blott | 2016-03-21 09:09:03 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2016-03-21 12:04:27 +0000 | 
| commit | 8783569983d8b3634b1b1eed9b6560dbea5698ab (patch) | |
| tree | 838b56a36737031e6026dc97bf68117fc9ffcc97 /lib | |
| parent | 17715e5eed068722ce74fae05a51d67f65cef77c (diff) | |
| download | vimium-8783569983d8b3634b1b1eed9b6560dbea5698ab.tar.bz2 | |
Rework visual mode.
- Refactor the three visual-mode modes.
- Use the key-handling framework from #2022.
- Strip some legacy edit-mode code.
- Rename the file (the old file name was misleading).
- Add "aw" and "as", previously we had the code for this from edit mode.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/dom_utils.coffee | 45 | 
1 files changed, 0 insertions, 45 deletions
| diff --git a/lib/dom_utils.coffee b/lib/dom_utils.coffee index 3581bd3f..00b6c676 100644 --- a/lib/dom_utils.coffee +++ b/lib/dom_utils.coffee @@ -306,51 +306,6 @@ DomUtils =      t = o || t?.parentNode      t -  # This calculates the caret coordinates within an input element.  It is used by edit mode to calculate the -  # caret position for scrolling.  It creates a hidden div contain a mirror of element, and all of the text -  # from element up to position, then calculates the scroll position. -  # From: https://github.com/component/textarea-caret-position/blob/master/index.js -  getCaretCoordinates: do -> -    # The properties that we copy to the mirrored div. -    properties = [ -      'direction', 'boxSizing', 'width', 'height', 'overflowX', 'overflowY', -      'borderTopWidth', 'borderRightWidth', 'borderBottomWidth', 'borderLeftWidth', -      'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', -      'fontStyle', 'fontVariant', 'fontWeight', 'fontStretch', 'fontSize', 'fontSizeAdjust', -      'lineHeight', 'fontFamily', -      'textAlign', 'textTransform', 'textIndent', 'textDecoration', -      'letterSpacing', 'wordSpacing' ] - -    (element, position) -> -      div = @createElement "div" -      div.id = "vimium-input-textarea-caret-position-mirror-div" -      document.body.appendChild div - -      style = div.style -      computed = getComputedStyle element - -      style.whiteSpace = "pre-wrap" -      style.wordWrap = "break-word" if element.nodeName.toLowerCase() != "input" -      style.position = "absolute" -      style.visibility = "hidden" -      style[prop] = computed[prop] for prop in properties -      style.overflow = "hidden" - -      div.textContent = element.value.substring 0, position -      if element.nodeName.toLowerCase() == "input" -        div.textContent = div.textContent.replace /\s/g, "\u00a0" - -      span = @createElement "span" -      span.textContent = element.value.substring(position) || "." -      div.appendChild span - -      coordinates = -        top: span.offsetTop + parseInt computed["borderTopWidth"] -        left: span.offsetLeft + parseInt computed["borderLeftWidth"] - -      document.body.removeChild div -      coordinates -    getSelectionFocusElement: ->      sel = window.getSelection()      if not sel.focusNode? | 
