Bug 927863 - Back out 14207ffc2b2f (bug 911574) for breaking iframe scrolling. r=backout
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 17 Oct 2013 16:37:03 -0400
changeset 151127 16de756941cf46b8eb2bccd1d3e393b130832a71
parent 151126 7cb193c966bfb86d5b2caca36d1b0c00cfbc7a3e
child 151128 0792108113b072923ea1bb048f26881a0d734d0e
push id3099
push userkgupta@mozilla.com
push dateThu, 17 Oct 2013 20:37:36 +0000
treeherderfx-team@16de756941cf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs927863, 911574
milestone27.0a1
Bug 927863 - Back out 14207ffc2b2f (bug 911574) for breaking iframe scrolling. r=backout
mobile/android/chrome/content/browser.js
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -4165,17 +4165,17 @@ var BrowserEventHandler = {
       // If we've pressed a scrollable element, let Java know that we may
       // want to override the scroll behaviour (for document sub-frames)
       this._scrollableElement = this._findScrollableElement(closest, true);
       this._firstScrollEvent = true;
 
       if (this._scrollableElement != null) {
         // Discard if it's the top-level scrollable, we let Java handle this
         let doc = BrowserApp.selectedBrowser.contentDocument;
-        if (this._scrollableElement != doc.documentElement)
+        if (this._scrollableElement != doc.body && this._scrollableElement != doc.documentElement)
           sendMessageToJava({ type: "Panning:Override" });
       }
     }
 
     if (!ElementTouchHelper.isElementClickable(closest, null, false))
       closest = ElementTouchHelper.elementFromPoint(aEvent.changedTouches[0].screenX,
                                                     aEvent.changedTouches[0].screenY);
     if (!closest)
@@ -4252,16 +4252,17 @@ var BrowserEventHandler = {
 
         if (this._firstScrollEvent) {
           while (this._scrollableElement != null &&
                  !this._elementCanScroll(this._scrollableElement, x, y))
             this._scrollableElement = this._findScrollableElement(this._scrollableElement, false);
 
           let doc = BrowserApp.selectedBrowser.contentDocument;
           if (this._scrollableElement == null ||
+              this._scrollableElement == doc.body ||
               this._scrollableElement == doc.documentElement) {
             sendMessageToJava({ type: "Panning:CancelOverride" });
             return;
           }
 
           this._firstScrollEvent = false;
         }
 
@@ -4622,24 +4623,25 @@ var BrowserEventHandler = {
         || computedStyle.overflowY == 'auto' || computedStyle.overflowY == 'scroll';
   },
 
   _findScrollableElement: function(elem, checkElem) {
     // Walk the DOM tree until we find a scrollable element
     let scrollable = false;
     while (elem) {
       /* Element is scrollable if its scroll-size exceeds its client size, and:
-       * - It has overflow 'auto' or 'scroll', or
-       * - It's a textarea or HTML node, or
+       * - It has overflow 'auto' or 'scroll'
+       * - It's a textarea
+       * - It's an HTML/BODY node
        * - It's a select element showing multiple rows
        */
       if (checkElem) {
         if ((elem.scrollTopMax > 0 || elem.scrollLeftMax > 0) &&
             (this._hasScrollableOverflow(elem) ||
-             elem.mozMatchesSelector("html, textarea")) ||
+             elem.mozMatchesSelector("html, body, textarea")) ||
             (elem instanceof HTMLSelectElement && (elem.size > 1 || elem.multiple))) {
           scrollable = true;
           break;
         }
       } else {
         checkElem = true;
       }