Bug 626863 Sidebars don't snap when panning iframes r=mfinkle
authorBenjamin Stover <bstover@mozilla.com>
Tue, 18 Jan 2011 16:20:15 -0800
changeset 67276 42a7b137b954b000a759c3685c63574f0f934e9b
parent 67275 23eaec40c9407a47c545a0a7a1f156c8c0a09312
child 67277 c669e1fe0b54864be692b8e06cd95213a6a82235
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)
reviewersmfinkle
bugs626863
Bug 626863 Sidebars don't snap when panning iframes r=mfinkle
mobile/chrome/content/bindings/browser.xml
mobile/chrome/content/browser.js
--- a/mobile/chrome/content/bindings/browser.xml
+++ b/mobile/chrome/content/bindings/browser.xml
@@ -429,17 +429,17 @@
       <method name="getRootView">
         <body>
           <![CDATA[
             return this._contentView;
           ]]>
         </body>
       </method>
 
-      <method name="getViewsAt">
+      <method name="getViewAt">
         <body>
           <![CDATA[
             return this._contentView;
           ]]>
         </body>
       </method>
 
       <field name="_contentView"><![CDATA[
@@ -755,18 +755,16 @@
               clearTimeout(timeout);
               this._timeout = null;
             }
 
             if (this._contentView && this._pixelsPannedSinceRefresh > 0) {
               this._updateCacheViewport();
             }
 
-            this._contentView = null;
-
             // We expect contentViews to contain our ID. If not, something bad
             // happened.
             delete this.self._contentViews[this._id];
           },
 
           /**
            * The cache viewport is what parts of content is cached in the parent process for
            * fast scrolling. This syncs that up with the current projection viewport.
@@ -916,17 +914,17 @@
           <![CDATA[
             let contentView = this._contentViewManager.rootContentView;
             return this._getView(contentView) || this._contentNoop;
           ]]>
         </body>
       </method>
 
       <!-- Get contentView for position (x, y) relative to the browser element -->
-      <method name="getViewsAt">
+      <method name="getViewAt">
         <parameter name="x"/>
         <parameter name="y"/>
         <body>
           <![CDATA[
             let manager = this._contentViewManager;
             let contentView = manager.getContentViewsIn(x, y, 0, 0, 0, 0)[0] ||
                               manager.rootContentView;
             return this._getView(contentView);
--- a/mobile/chrome/content/browser.js
+++ b/mobile/chrome/content/browser.js
@@ -1164,36 +1164,37 @@ Browser.MainDragger = function MainDragg
 Browser.MainDragger.prototype = {
   isDraggable: function isDraggable(target, scroller) {
     return { x: true, y: true };
   },
 
   dragStart: function dragStart(clientX, clientY, target, scroller) {
     let browser = getBrowser();
     let bcr = browser.getBoundingClientRect();
-    this._contentView = browser.getViewsAt(clientX - bcr.left, clientY - bcr.top);
+    this._contentView = browser.getViewAt(clientX - bcr.left, clientY - bcr.top);
   },
 
   dragStop: function dragStop(dx, dy, scroller) {
+    this._contentView = null;
     this.dragMove(Browser.snapSidebars(), 0, scroller);
     Browser.tryUnfloatToolbar();
   },
 
   dragMove: function dragMove(dx, dy, scroller) {
     let doffset = new Point(dx, dy);
 
-    if (!this._contentView.isRoot()) {
+    // First calculate any panning to take sidebars out of view
+    let panOffset = this._panControlsAwayOffset(doffset);
+
+    if (this._contentView && !this._contentView.isRoot()) {
       this._panContentView(this._contentView, doffset);
       // XXX we may need to have "escape borders" for iframe panning
       // XXX does not deal with scrollables within scrollables
     }
 
-    // First calculate any panning to take sidebars out of view
-    let panOffset = this._panControlsAwayOffset(doffset);
-
     // Do content panning
     this._panContentView(getBrowser().getRootView(), doffset);
 
     // Any leftover panning in doffset would bring controls into view. Add to sidebar
     // away panning for the total scroll offset.
     doffset.add(panOffset);
     Browser.tryFloatToolbar(doffset.x, 0);
     this._panScroller(Browser.controlsScrollboxScroller, doffset);