Bug 556414 - Panning inside overflow:auto elements (Google Reader) stops for some posts [r=mfinkle]
authorMatt Brubeck <mbrubeck@mozilla.com>
Tue, 13 Apr 2010 15:21:35 -0400
changeset 1476 88653628be66d0e957f8dd8056ac1e95ea7f87f8
parent 1475 8a2a9932232adef82ad530fb982b34407249d765
child 1477 75c696615279aede534534347a0c4b910414083a
push id1324
push usermfinkle@mozilla.com
push dateTue, 13 Apr 2010 19:21:53 +0000
reviewersmfinkle
bugs556414
Bug 556414 - Panning inside overflow:auto elements (Google Reader) stops for some posts [r=mfinkle]
chrome/content/browser.js
--- a/chrome/content/browser.js
+++ b/chrome/content/browser.js
@@ -1342,30 +1342,27 @@ Browser.MainDragger.prototype = {
 
     this.draggedFrame = null;
     this.contentScrollbox = null;
 
     // Check if we are in a scrollable HTML element
     let htmlElement = element;
     if (htmlElement && htmlElement instanceof HTMLElement) {
       let win = htmlElement.ownerDocument.defaultView;
-      let oScroll;
-      let oAuto;
       for (; htmlElement; htmlElement = htmlElement.parentNode) {
         try {
           let cs = win.getComputedStyle(htmlElement, null);
-          let overflow = cs.getPropertyValue("overflow");
           let overflowX = cs.getPropertyValue("overflow-x");
           let overflowY = cs.getPropertyValue("overflow-y");
-          let cbr = htmlElement.getBoundingClientRect();
-          oScroll = (overflow == "scroll") || (overflowX == "scroll") || (overflowY == "scroll");
-          oAuto = (overflow == "auto") || (overflowX == "auto") || (overflowY == "auto");
-
-          if (oScroll ||
-              (oAuto && (cbr.height < htmlElement.scrollHeight || cbr.width < htmlElement.scrollWidth))) {
+
+          let scrollableY = overflowY != "hidden" && overflowY != "visible" && htmlElement.offsetHeight < htmlElement.scrollHeight;
+          let scrollableX = overflowX != "hidden" && overflowX != "visible" && htmlElement.offsetWidth  < htmlElement.scrollWidth
+            && !(htmlElement instanceof HTMLSelectElement); // Bug 295977
+
+          if (scrollableX || scrollableY) {
             this.contentScrollbox = this._createDivScrollBox(htmlElement);
             return;
           }
         } catch(e) {}
       }
     }
 
     // Check if we are in XUL land