Bug 792295 - ensure social flyout moves when already open. r=jaws
authorMark Hammond <mhammond@skippinet.com.au>
Fri, 21 Sep 2012 15:18:48 +1000
changeset 107710 deda9b2561abf5c34de864d1492b7047fa885dd7
parent 107709 9b81d80f94920413226a3b6106426c30b9c46d5b
child 107711 6b3d739129915c6e6685208e1bfd78e12f725950
push id23507
push userryanvm@gmail.com
push dateSat, 22 Sep 2012 02:38:57 +0000
treeherdermozilla-central@8f359a9d1f19 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs792295
milestone18.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 792295 - ensure social flyout moves when already open. r=jaws
browser/base/content/browser-social.js
--- a/browser/base/content/browser-social.js
+++ b/browser/base/content/browser-social.js
@@ -284,17 +284,28 @@ let SocialFlyout = {
         aCallback(iframe.contentWindow);
       } catch(e) {
         Cu.reportError(e);
       }
     }
 
     sizeSocialPanelToContent(iframe);
     let anchor = document.getElementById("social-sidebar-browser");
-    panel.openPopup(anchor, "start_before", 0, yOffset, false, false);
+    if (panel.state == "open") {
+      // this is painful - there is no way to say "move to a new anchor offset",
+      // only "move to new screen pos".  So we remember the last yOffset,
+      // calculate the adjustment needed to the new yOffset, then calc the
+      // screen Y position.
+      let yAdjust = yOffset - this.yOffset;
+      let box = panel.boxObject;
+      panel.moveTo(box.screenX, box.screenY + yAdjust);
+    } else {
+      panel.openPopup(anchor, "start_before", 0, yOffset, false, false);
+    }
+    this.yOffset = yOffset;
   }
 }
 
 let SocialShareButton = {
   // promptImages and promptMessages being null means we are yet to get the
   // message back from the provider with the images and icons (or that we got
   // the response but determined it was invalid.)
   promptImages: null,