hterm 1.46: Fix right-click paste issues.

* Version 1.44 introduced an issue with right-click paste where focusing the
  paste target would force the page to scroll 1000px past the end of the
  terminal.  Now we place the paste target within the visible bounds of the
  terminal, but nehind it in z-index.

BUG=chromium:397182

Change-Id: I5f5aab56afb8fc9a4c39281b8f03a0639da96bef
Reviewed-on: https://chromium-review.googlesource.com/209748
Reviewed-by: Rob Spies <wilford@google.com>
Commit-Queue: Rob Spies <wilford@google.com>
Reviewed-by: Robert Ginda <rginda@chromium.org>
Tested-by: Robert Ginda <rginda@chromium.org>
diff --git a/hterm/doc/changelog.txt b/hterm/doc/changelog.txt
index 1b26649..67253a1 100644
--- a/hterm/doc/changelog.txt
+++ b/hterm/doc/changelog.txt
@@ -1,3 +1,10 @@
+1.46, 2014-07-24, Fix right-click paste issues.
+
+* Version 1.44 introduced an issue with right-click paste where focusing the
+  paste target would force the page to scroll 1000px past the end of the
+  terminal.  Now we place the paste target within the visible bounds of the
+  terminal, but nehind it in z-index.
+
 1.45, 2014-07-22, Fix overlay position on Firefox.
 
 * Add the trailing 'px' in the css top/left property.  Chrome is ok without it,
diff --git a/hterm/js/hterm_scrollport.js b/hterm/js/hterm_scrollport.js
index 4fb2cda..3e9fb7f 100644
--- a/hterm/js/hterm_scrollport.js
+++ b/hterm/js/hterm_scrollport.js
@@ -328,20 +328,6 @@
 
   doc.body.addEventListener('keydown', this.onBodyKeyDown_.bind(this));
 
-  // We send focus to this element just before a paste happens, so we can
-  // capture the pasted text and forward it on to someone who cares.
-  this.pasteTarget_ = doc.createElement('textarea');
-  this.pasteTarget_.setAttribute('tabindex', '-1');
-  this.pasteTarget_.style.cssText = (
-    'position: absolute;' +
-    'height: 5px;' +
-    'bottom: -999px');
-  this.pasteTarget_.contentEditable = true;
-
-  this.screen_.appendChild(this.pasteTarget_);
-  this.pasteTarget_.addEventListener(
-      'textInput', this.handlePasteTargetTextInput_.bind(this));
-
   // This is the main container for the fixed rows.
   this.rowNodes_ = doc.createElement('div');
   this.rowNodes_.style.cssText = (
@@ -398,6 +384,24 @@
       'left: 0;' +
       'visibility: hidden');
 
+
+  // We send focus to this element just before a paste happens, so we can
+  // capture the pasted text and forward it on to someone who cares.
+  this.pasteTarget_ = doc.createElement('textarea');
+  this.pasteTarget_.setAttribute('tabindex', '-1');
+  this.pasteTarget_.style.cssText = (
+    'position: absolute;' +
+    'height: 1px;' +
+    'width: 1px;' +
+    'left: 0px; ' +
+    'bottom: 0px;' +
+    'opacity: 0');
+  this.pasteTarget_.contentEditable = true;
+
+  this.screen_.appendChild(this.pasteTarget_);
+  this.pasteTarget_.addEventListener(
+      'textInput', this.handlePasteTargetTextInput_.bind(this));
+
   this.resize();
 };