Bug 915328 - Metro front-end fixes for cross slide with async panning [r=sfoster]
authorMatt Brubeck <mbrubeck@mozilla.com>
Wed, 02 Oct 2013 18:03:05 -0700
changeset 149686 e46cfd222fbdfe943f567692521a4439ca5385b5
parent 149685 e1b2032de12895decd7cc685a12efd40986d715c
child 149687 4be0c42fc81af19cf2ac59b008dd83babeea7604
push id25400
push usermbrubeck@mozilla.com
push dateThu, 03 Oct 2013 14:38:13 +0000
treeherdermozilla-central@f5b6b5523719 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfoster
bugs915328
milestone27.0a1
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 915328 - Metro front-end fixes for cross slide with async panning [r=sfoster]
browser/metro/base/content/bindings/grid.xml
browser/metro/modules/CrossSlide.jsm
browser/metro/profile/metro.js
--- a/browser/metro/base/content/bindings/grid.xml
+++ b/browser/metro/base/content/bindings/grid.xml
@@ -519,19 +519,16 @@
           if (this.controller && this.controller.gridBoundCallback != undefined)
             this.controller.gridBoundCallback();
 
           // set up cross-slide gesture handling for multiple-selection grids
           if ("undefined" !== typeof CrossSlide && "multiple" == this.getAttribute("seltype")) {
             this._xslideHandler = new CrossSlide.Handler(this, {
                   REARRANGESTART: this.crossSlideBoundary
             });
-            this.addEventListener("touchstart", this._xslideHandler, false);
-            this.addEventListener("touchmove", this._xslideHandler, false);
-            this.addEventListener("touchend", this._xslideHandler, false);
           }
 
           // XXX This event was never actually implemented (bug 223411).
           let event = document.createEvent("Events");
           event.initEvent("contentgenerated", true, true);
           this.dispatchEvent(event);
         ]]>
       </constructor>
--- a/browser/metro/modules/CrossSlide.jsm
+++ b/browser/metro/modules/CrossSlide.jsm
@@ -96,16 +96,21 @@ this.CrossSlide = {
 function CrossSlideHandler(aNode, aThresholds) {
   this.node = aNode;
   this.thresholds = Object.create(CrossSlideThresholds);
   // apply per-instance threshold configuration
   if (aThresholds) {
     for(let key in aThresholds)
       this.thresholds[key] = aThresholds[key];
   }
+  aNode.addEventListener("touchstart", this, false);
+  aNode.addEventListener("touchmove", this, false);
+  aNode.addEventListener("touchend", this, false);
+  aNode.addEventListener("touchcancel", this, false);
+  aNode.ownerDocument.defaultView.addEventListener("scroll", this, false);
 }
 
 CrossSlideHandler.prototype = {
   node: null,
   drag: null,
 
   getCrossSlideState: function(aCrossAxisDistance, aScrollAxisDistance) {
     if (aCrossAxisDistance <= 0) {
@@ -130,16 +135,20 @@ CrossSlideHandler.prototype = {
   handleEvent: function handleEvent(aEvent) {
     switch (aEvent.type) {
       case "touchstart":
         this._onTouchStart(aEvent);
         break;
       case "touchmove":
         this._onTouchMove(aEvent);
         break;
+      case "scroll":
+      case "touchcancel":
+        this.cancel(aEvent);
+        break;
       case "touchend":
         this._onTouchEnd(aEvent);
         break;
     }
   },
 
   cancel: function(aEvent){
     this._fireProgressEvent("cancelled", aEvent);
--- a/browser/metro/profile/metro.js
+++ b/browser/metro/profile/metro.js
@@ -38,17 +38,18 @@ pref("layers.async-pan-zoom.enabled", tr
 pref("layers.componentalpha.enabled", false);
 pref("gfx.azpc.touch_start_tolerance", "0.1"); // dpi * tolerance = pixel threshold
 pref("gfx.azpc.pan_repaint_interval", "50");   // prefer 20 fps
 pref("gfx.azpc.fling_repaint_interval", "50"); // prefer 20 fps
 pref("gfx.axis.fling_friction", "0.002");
 pref("gfx.axis.fling_stopped_threshold", "0.2");
 
 // 0 = free, 1 = standard, 2 = sticky
-pref("apzc.axis_lock_mode", 1);
+pref("apzc.axis_lock_mode", 2);
+pref("apzc.cross_slide.enabled", true);
 
 // Enable Microsoft TSF support by default for imes.
 pref("intl.enable_tsf_support", true);
 
 pref("general.autoScroll", true);
 pref("general.smoothScroll", true);
 pref("general.smoothScroll.durationToIntervalRatio", 200);
 pref("mousewheel.enable_pixel_scrolling", true);