Bug 576642 - Backed out changeset cfc0accaf8b2
authorRob Campbell <rcampbell@mozilla.com>
Tue, 10 Aug 2010 08:02:56 -0300
changeset 49271 d50d2ccb5bbf7c64e303153793210c728a2dce90
parent 49229 cfc0accaf8b230976b87e4c0dd75fc1b074af79b
child 49273 bde077d681964c713a18e30905859ecb5c3fa4f0
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs576642
milestone2.0b4pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 576642 - Backed out changeset cfc0accaf8b2
toolkit/components/console/hudservice/HUDService.jsm
toolkit/components/console/hudservice/tests/browser/browser_HUDServiceTestsAll.js
toolkit/themes/pinstripe/global/headsUpDisplay.css
toolkit/themes/winstripe/global/headsUpDisplay.css
--- a/toolkit/components/console/hudservice/HUDService.jsm
+++ b/toolkit/components/console/hudservice/HUDService.jsm
@@ -2462,20 +2462,18 @@ JSTerm.prototype = {
   COMPLETE_BACKWARD: 1,
   COMPLETE_HINT_ONLY: 2,
 
   init: function JST_init()
   {
     this.createSandbox();
     this.inputNode = this.mixins.inputNode;
     this.scrollToNode = this.mixins.scrollToNode;
-    let eventHandlerKeyDown = this.keyDown();
-    this.inputNode.addEventListener('keypress', eventHandlerKeyDown, false);
-    let eventHandlerInput = this.inputEventHandler();
-    this.inputNode.addEventListener('input', eventHandlerInput, false);
+    let eventHandler = this.keyDown();
+    this.inputNode.addEventListener('keypress', eventHandler, false);
     this.outputNode = this.mixins.outputNode;
     if (this.mixins.cssClassOverride) {
       this.cssClassOverride = this.mixins.cssClassOverride;
     }
   },
 
   get codeInputString()
   {
@@ -2593,26 +2591,16 @@ JSTerm.prototype = {
 
     while (outputNode.firstChild) {
       outputNode.removeChild(outputNode.firstChild);
     }
 
     outputNode.lastTimestamp = 0;
   },
 
-  inputEventHandler: function JSTF_inputEventHandler()
-  {
-    var self = this;
-    function handleInputEvent(aEvent) {
-      self.inputNode.setAttribute("rows",
-        Math.min(8, self.inputNode.value.split("\n").length));
-    }
-    return handleInputEvent;
-  },
-
   keyDown: function JSTF_keyDown(aEvent)
   {
     var self = this;
     function handleKeyDown(aEvent) {
       // ctrl-a
       var setTimeout = aEvent.target.ownerDocument.defaultView.setTimeout;
       var target = aEvent.target;
       var tmp;
@@ -2646,17 +2634,16 @@ JSTerm.prototype = {
         // TODO: expand the inputNode height by one line
         return;
       }
       else {
         switch(aEvent.keyCode) {
           case 13:
             // return
             self.execute();
-            aEvent.preventDefault();
             break;
           case 38:
             // up arrow: history previous
             if (self.caretInFirstLine()){
               self.historyPeruse(true);
               if (aEvent.cancelable) {
                 let inputEnd = self.inputNode.value.length;
                 self.inputNode.setSelectionRange(inputEnd, inputEnd);
@@ -2761,17 +2748,17 @@ JSTerm.prototype = {
     this.inputNode.blur();
     this.inputNode.focus();
   },
 
   caretInFirstLine: function JSTF_caretInFirstLine()
   {
     var firstLineBreak = this.codeInputString.indexOf("\n");
     return ((firstLineBreak == -1) ||
-            (this.inputNode.selectionStart <= firstLineBreak));
+            (this.codeInputString.selectionStart <= firstLineBreak));
   },
 
   caretInLastLine: function JSTF_caretInLastLine()
   {
     var lastLineBreak = this.codeInputString.lastIndexOf("\n");
     return (this.inputNode.selectionEnd > lastLineBreak);
   },
 
@@ -2937,18 +2924,16 @@ JSTermFirefoxMixin.prototype = {
    * just the input node used under the console output
    *
    * @returns void
    */
   generateUI: function JSTF_generateUI()
   {
     let inputNode = this.xulElementFactory("textbox");
     inputNode.setAttribute("class", "jsterm-input-node");
-    inputNode.setAttribute("multiline", "true");
-    inputNode.setAttribute("rows", "1");
 
     if (this.existingConsoleNode == undefined) {
       // create elements
       let term = this.elementFactory("div");
       term.setAttribute("class", "jsterm-wrapper-node");
       term.setAttribute("flex", "1");
 
       let outputNode = this.elementFactory("div");
--- a/toolkit/components/console/hudservice/tests/browser/browser_HUDServiceTestsAll.js
+++ b/toolkit/components/console/hudservice/tests/browser/browser_HUDServiceTestsAll.js
@@ -564,49 +564,16 @@ function testCompletion()
 
   // Test pressing shift_tab.
   jsterm.complete(jsterm.COMPLETE_BACKWARD);
   is(input.value, "document.getElementById", "'document.getElem' untab completion");
   is(input.selectionStart, 16, "start selection is alright");
   is(input.selectionEnd, 23, "end selection is alright");
 }
 
-function testJSInputExpand()
-{
-  let HUD = HUDService.hudWeakReferences[hudId].get();
-  let jsterm = HUD.jsterm;
-  let input = jsterm.inputNode;
-  input.focus();
-
-  is(input.getAttribute("multiline"), "true", "multiline is enabled");
-
-  // Tests if the inputNode expands.
-  input.value = "hello\nworld\n";
-  let length = input.value.length;
-  input.selectionEnd = length;
-  input.selectionStart = length;
-  // Performs an "d". This will trigger/test for the input event that should
-  // change the "row" attribute of the inputNode.
-  EventUtils.synthesizeKey("d", {});
-  is(input.getAttribute("rows"), "3", "got 3 rows");
-
-  // Add some more rows. Tests for the 8 row limit.
-  input.value = "row1\nrow2\nrow3\nrow4\nrow5\nrow6\nrow7\nrow8\nrow9\nrow10\n";
-  length = input.value.length;
-  input.selectionEnd = length;
-  input.selectionStart = length;
-  EventUtils.synthesizeKey("d", {});
-  is(input.getAttribute("rows"), "8", "got 8 rows");
-
-  // Test if the inputNode shrinks again.
-  input.value = "";
-  EventUtils.synthesizeKey("d", {});
-  is(input.getAttribute("rows"), "1", "got 1 row");
-}
-
 function testExecutionScope()
 {
   content.location.href = TEST_URI;
 
   let HUD = HUDService.hudWeakReferences[hudId].get();
   let jsterm = HUD.jsterm;
 
   jsterm.clearOutput();
@@ -783,13 +750,12 @@ function test() {
       testConsoleHistory();
       testOutputOrder();
       testGroups();
       testNullUndefinedOutput();
       testJSInputAndOutputStyling();
       testExecutionScope();
       testCompletion();
       testPropertyProvider();
-      testJSInputExpand();
       testNet();
     });
   }, false);
 }
--- a/toolkit/themes/pinstripe/global/headsUpDisplay.css
+++ b/toolkit/themes/pinstripe/global/headsUpDisplay.css
@@ -149,20 +149,16 @@
     font-size: 9pt;
     background: url("chrome://global/skin/icons/commandline.png") 4px 2px
         no-repeat !important;
     border: none !important;
     padding: 0px 0px 0px 16px !important;
     -moz-appearance: none !important;
 }
 
-.jsterm-input-node textarea {
-    overflow-x: hidden;
-}
-
 .jsterm-output-line {
     font-size: 1.2em;
 }
 
 /* these need to be revised ... */
 .hud-console-filter-toolbar {
     background: @scopeBarBackground@ !important;
     padding: 4px 1px;
--- a/toolkit/themes/winstripe/global/headsUpDisplay.css
+++ b/toolkit/themes/winstripe/global/headsUpDisplay.css
@@ -150,20 +150,16 @@
     font-size: 9pt;
     background: url("chrome://global/skin/icons/commandline.png") 4px 3px
         no-repeat !important;
     border: none !important;
     padding: 0px 0px 0px 16px !important;
     -moz-appearance: none !important;
 }
 
-.jsterm-input-node textarea {
-    overflow-x: hidden;
-}
-
 .jsterm-output-line {
     font-size: 1.2em;
 }
 
 .hud-console-filter-toolbar {
     padding: 1px 0px;
     -moz-box-align: center;
 }