Back out 73b1860d1fdc (bug 833511) for failures in browser_gestureSupport.js
authorPhil Ringnalda <philringnalda@gmail.com>
Wed, 30 Jan 2013 20:41:02 -0800
changeset 120435 09d8683347473775708c358481b5aba905ba74dc
parent 120434 21cbd89537b584c83a16dbfd6ca6c776c013b776
child 120436 8b4c02455736cda73ad1036a6e6b2a8f7b0a2713
push id24251
push userryanvm@gmail.com
push dateThu, 31 Jan 2013 20:56:22 +0000
treeherdermozilla-central@683b08dc1afd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs833511
milestone21.0a1
backs out73b1860d1fdc8db7d98f38700e0ba8e61ee0bb14
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
Back out 73b1860d1fdc (bug 833511) for failures in browser_gestureSupport.js CLOSED TREE
browser/app/profile/firefox.js
browser/base/content/browser-sets.inc
browser/base/content/browser.js
toolkit/themes/pinstripe/global/media/TopLevelImageDocument.css
toolkit/themes/winstripe/global/media/TopLevelImageDocument.css
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -516,20 +516,19 @@ pref("browser.gesture.pinch.in.shift", "
 #else
 // Disabled by default due to issues with track pad input.
 pref("browser.gesture.pinch.out", "");
 pref("browser.gesture.pinch.in", "");
 pref("browser.gesture.pinch.out.shift", "");
 pref("browser.gesture.pinch.in.shift", "");
 #endif
 pref("browser.gesture.twist.latched", false);
-pref("browser.gesture.twist.threshold", 0);
-pref("browser.gesture.twist.right", "cmd_gestureRotateRight");
-pref("browser.gesture.twist.left", "cmd_gestureRotateLeft");
-pref("browser.gesture.twist.end", "cmd_gestureRotateEnd");
+pref("browser.gesture.twist.threshold", 25);
+pref("browser.gesture.twist.right", "");
+pref("browser.gesture.twist.left", "");
 pref("browser.gesture.tap", "cmd_fullZoomReset");
 
 // 0: Nothing happens
 // 1: Scrolling contents
 // 2: Go back or go forward, in your history
 // 3: Zoom in or out.
 #ifdef XP_MACOSX
 // On OS X, if the wheel has one axis only, shift+wheel comes through as a
--- a/browser/base/content/browser-sets.inc
+++ b/browser/base/content/browser-sets.inc
@@ -79,19 +79,16 @@
     <command id="Browser:PrevTab" oncommand="gBrowser.tabContainer.advanceSelectedTab(-1, true);"/>
     <command id="Browser:ShowAllTabs" oncommand="allTabs.open();"/>
     <command id="Browser:ToggleTabView" oncommand="TabView.toggle();"/>
     <command id="Browser:FocusNextFrame" oncommand="focusNextFrame(event);"/>
     <command id="cmd_fullZoomReduce"  oncommand="FullZoom.reduce()"/>
     <command id="cmd_fullZoomEnlarge" oncommand="FullZoom.enlarge()"/>
     <command id="cmd_fullZoomReset"   oncommand="FullZoom.reset()"/>
     <command id="cmd_fullZoomToggle"  oncommand="ZoomManager.toggleZoom();"/>
-    <command id="cmd_gestureRotateLeft" oncommand="gGestureSupport.rotate(event.sourceEvent)"/>
-    <command id="cmd_gestureRotateRight" oncommand="gGestureSupport.rotate(event.sourceEvent)"/>
-    <command id="cmd_gestureRotateEnd" oncommand="gGestureSupport.rotateEnd()"/>
     <command id="Browser:OpenLocation" oncommand="openLocation();"/>
     <command id="Browser:RestoreLastSession" oncommand="restoreLastSession();" disabled="true"/>
 
     <command id="Tools:Search" oncommand="BrowserSearch.webSearch();"/>
     <command id="Tools:Downloads" oncommand="BrowserDownloadsUI();"/>
     <command id="Tools:DevToolbox" oncommand="gDevToolsBrowser.toggleToolboxCommand(gBrowser);"/>
     <command id="Tools:DevToolbar" oncommand="DeveloperToolbar.toggle();" disabled="true" hidden="true"/>
     <command id="Tools:DevToolbarFocus" oncommand="DeveloperToolbar.focusToggle();" disabled="true"/>
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -731,20 +731,16 @@ const gFormSubmitObserver = {
 // infancy and we do NOT want to be forced into supporting an API that
 // will probably have to change in the future.  (The current Mac OS X
 // API is undocumented and was reverse-engineered.)  Until support is
 // implemented in the event dispatcher to keep these events as
 // chrome-only, we must listen for the simple gesture events during
 // the capturing phase and call stopPropagation on every event.
 
 let gGestureSupport = {
-  _currentRotation: 0,
-  _lastRotateDelta: 0,
-  _rotateMomentumThreshold: .75,
-
   /**
    * Add or remove mouse gesture event listeners
    *
    * @param aAddListener
    *        True to add/init listeners and false to remove/uninit
    */
   init: function GS_init(aAddListener) {
     const gestureEvents = ["SwipeGesture",
@@ -795,20 +791,16 @@ let gGestureSupport = {
       case "MozRotateGestureUpdate":
         aEvent.preventDefault();
         this._doUpdate(aEvent);
         break;
       case "MozTapGesture":
         aEvent.preventDefault();
         this._doAction(aEvent, ["tap"]);
         break;
-      case "MozRotateGesture":
-        aEvent.preventDefault();
-        this._doAction(aEvent, ["twist", "end"]);
-        break;
       /* case "MozPressTapGesture":
         break; */
     }
   },
 
   /**
    * Called at the start of "pinch" and "twist" gestures to setup all of the
    * information needed to process the gesture
@@ -915,17 +907,17 @@ let gGestureSupport = {
         continue;
 
       let node = document.getElementById(command);
       if (node) {
         if (node.getAttribute("disabled") != "true") {
           let cmdEvent = document.createEvent("xulcommandevent");
           cmdEvent.initCommandEvent("command", true, true, window, 0,
                                     aEvent.ctrlKey, aEvent.altKey, aEvent.shiftKey,
-                                    aEvent.metaKey, aEvent);
+                                    aEvent.metaKey, null);
           node.dispatchEvent(cmdEvent);
         }
       } else {
         goDoCommand(command);
       }
 
       break;
     }
@@ -975,133 +967,16 @@ let gGestureSupport = {
       let getFunc = "get" + (type == "boolean" ? "Bool" :
                              type == "number" ? "Int" : "Char") + "Pref";
       return gPrefService[getFunc](branch + aPref);
     }
     catch (e) {
       return aDef;
     }
   },
-
-  /**
-   * Perform rotation for ImageDocuments
-   *
-   * @param aEvent
-   *        The MozRotateGestureUpdate event triggering this call
-   */
-  rotate: function(aEvent) {
-    if (!(content.document instanceof ImageDocument))
-      return;
-
-    let contentElement = content.document.body.firstElementChild;
-    if (!contentElement)
-      return;
-
-    this.rotation = Math.round(this.rotation + aEvent.delta);
-    contentElement.style.transform = "rotate(" + this.rotation + "deg)";
-    this._lastRotateDelta = aEvent.delta;
-  },
-
-  /**
-   * Perform a rotation end for ImageDocuments
-   */
-  rotateEnd: function() {
-    if (!(content.document instanceof ImageDocument))
-      return;
-
-    let contentElement = content.document.body.firstElementChild;
-    if (!contentElement)
-      return;
-
-    let transitionRotation = 0;
-
-    // The reason that 360 is allowed here is because when rotating between
-    // 315 and 360, setting rotate(0deg) will cause it to rotate the wrong
-    // direction around--spinning wildly.
-    if (this.rotation <= 45)
-      transitionRotation = 0;
-    else if (this.rotation > 45 && this.rotation <= 135)
-      transitionRotation = 90;
-    else if (this.rotation > 135 && this.rotation <= 225)
-      transitionRotation = 180;
-    else if (this.rotation > 225 && this.rotation <= 315)
-      transitionRotation = 270;
-    else
-      transitionRotation = 360;
-
-    // If we're going fast enough, and we didn't already snap ahead of rotation,
-    // then snap ahead of rotation to simulate momentum
-    if (this._lastRotateDelta > this._rotateMomentumThreshold &&
-        this.rotation > transitionRotation)
-      transitionRotation += 90;
-    else if (this._lastRotateDelta < -1 * this._rotateMomentumThreshold &&
-             this.rotation < transitionRotation)
-      transitionRotation -= 90;
-
-    contentElement.classList.add("completeRotation");
-    contentElement.addEventListener("transitionend", this._clearCompleteRotation);
-
-    contentElement.style.transform = "rotate(" + transitionRotation + "deg)";
-    this.rotation = transitionRotation;
-  },
-
-  /**
-   * Gets the current rotation for the ImageDocument
-   */
-  get rotation() {
-    return this._currentRotation;
-  },
-
-  /**
-   * Sets the current rotation for the ImageDocument
-   *
-   * @param aVal
-   *        The new value to take.  Can be any value, but it will be bounded to
-   *        0 inclusive to 360 exclusive.
-   */
-  set rotation(aVal) {
-    this._currentRotation = aVal % 360;
-    if (this._currentRotation < 0)
-      this._currentRotation += 360;
-    return this._currentRotation;
-  },
-
-  /**
-   * When the location/tab changes, need to reload the current rotation for the
-   * image
-   */
-  restoreRotationState: function() {
-    if (!(content.document instanceof ImageDocument))
-      return;
-
-    let contentElement = content.document.body.firstElementChild;
-    let transformValue = content.window.getComputedStyle(contentElement, null)
-                                       .transform;
-
-    if (transformValue == "none") {
-      this.rotation = 0;
-      return;
-    }
-
-    // transformValue is a rotation matrix--split it and do mathemagic to
-    // obtain the real rotation value
-    transformValue = transformValue.split("(")[1]
-                                   .split(")")[0]
-                                   .split(",");
-    this.rotation = Math.round(Math.atan2(transformValue[1], transformValue[0]) *
-                               (180 / Math.PI));
-  },
-
-  /**
-   * Removes the transition rule by removing the completeRotation class
-   */
-  _clearCompleteRotation: function() {
-    this.classList.remove("completeRotation");
-    this.removeEventListener("transitionend", this._clearCompleteRotation);
-  },
 };
 
 var gBrowserInit = {
   onLoad: function() {
     // window.arguments[0]: URI to load (string), or an nsISupportsArray of
     //                      nsISupportsStrings to load, or a xul:tab of
     //                      a tabbrowser, which will be replaced by this
     //                      window (for this case, all other arguments are
@@ -4304,18 +4179,16 @@ var XULBrowserWindow = {
         }
 
         // fix bug 253793 - turn off highlight when page changes
         gFindBar.getElement("highlight").checked = false;
       }
     }
     UpdateBackForwardCommands(gBrowser.webNavigation);
 
-    gGestureSupport.restoreRotationState();
-
     // See bug 358202, when tabs are switched during a drag operation,
     // timers don't fire on windows (bug 203573)
     if (aRequest)
       setTimeout(function () { XULBrowserWindow.asyncUpdateUI(); }, 0);
     else
       this.asyncUpdateUI();
   },
 
--- a/toolkit/themes/pinstripe/global/media/TopLevelImageDocument.css
+++ b/toolkit/themes/pinstripe/global/media/TopLevelImageDocument.css
@@ -9,13 +9,9 @@
     color: #eee;
     background: #222 url("chrome://global/skin/media/imagedoc-darknoise.png");
   }
 
   img.decoded {
     background: hsl(0,0%,90%) url("chrome://global/skin/media/imagedoc-lightnoise.png");
     color: #222;
   }
-
-  .completeRotation {
-    transition: transform 0.3s ease 0s;
-  }
 }
--- a/toolkit/themes/winstripe/global/media/TopLevelImageDocument.css
+++ b/toolkit/themes/winstripe/global/media/TopLevelImageDocument.css
@@ -9,13 +9,9 @@
     color: #eee;
     background: #222 url("chrome://global/skin/media/imagedoc-darknoise.png");
   }
 
   img.decoded {
     background: hsl(0,0%,90%) url("chrome://global/skin/media/imagedoc-lightnoise.png");
     color: #222;
   }
-
-  .completeRotation {
-    transition: transform 0.3s ease 0s;
-  }
 }