Bug 793157, address extra review comments, r=neil
authorNeil Deakin <neil@mozilla.com>
Tue, 30 Oct 2012 15:55:00 -0400
changeset 111926 3ee9ad46c81cbf16a680f5d219593f3ab9aff93e
parent 111925 1c6b13fd3b6ad6826d6aeb8c27e293d7d9786696
child 111927 25cb48666bd68db628a3da96a3f22bb5f183780f
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersneil
bugs793157
milestone19.0a1
Bug 793157, address extra review comments, r=neil
layout/xul/base/src/nsPopupBoxObject.cpp
toolkit/content/tests/chrome/test_popup_moveToAnchor.xul
--- a/layout/xul/base/src/nsPopupBoxObject.cpp
+++ b/layout/xul/base/src/nsPopupBoxObject.cpp
@@ -116,18 +116,17 @@ nsPopupBoxObject::MoveTo(int32_t aLeft, 
 }
 
 NS_IMETHODIMP
 nsPopupBoxObject::MoveToAnchor(nsIDOMElement* aAnchorElement,
                                const nsAString& aPosition,
                                int32_t aXPos, int32_t aYPos,
                                bool aAttributesOverride)
 {
-  nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
-  if (pm && mContent) {
+  if (mContent) {
     nsCOMPtr<nsIContent> anchorContent(do_QueryInterface(aAnchorElement));
 
     nsMenuPopupFrame *menuPopupFrame = do_QueryFrame(mContent->GetPrimaryFrame());
     if (menuPopupFrame && menuPopupFrame->PopupState() == ePopupOpenAndVisible) {
       menuPopupFrame->MoveToAnchor(anchorContent, aPosition, aXPos, aYPos, aAttributesOverride);
     }
   }
 
--- a/toolkit/content/tests/chrome/test_popup_moveToAnchor.xul
+++ b/toolkit/content/tests/chrome/test_popup_moveToAnchor.xul
@@ -18,50 +18,50 @@
   <menuitem label="Two"/>
 </menupopup>
 
 <script>
 SimpleTest.waitForExplicitFinish();
 
 function runTest(id)
 {
-  $("popup").openPopup($("button1"), "after_start", 0, 0);
+  $("popup").openPopup($("button1"), "after_start");
 }
 
 function popupshown()
 {
   var popup = $("popup");
   var popupheight = popup.getBoundingClientRect().height;
   var button1rect = $("button1").getBoundingClientRect();
   var button2rect = $("button2").getBoundingClientRect();
 
   checkCoords(popup, button1rect.left, button1rect.bottom, "initial");
 
-  popup.moveToAnchor($("button1"), "after_start", 0, 8, false);
+  popup.moveToAnchor($("button1"), "after_start", 0, 8);
   checkCoords(popup, button1rect.left, button1rect.bottom + 8, "move anchor top + 8");
 
-  popup.moveToAnchor($("button1"), "after_start", 6, -10, false);
+  popup.moveToAnchor($("button1"), "after_start", 6, -10);
   checkCoords(popup, button1rect.left + 6, button1rect.bottom - 10, "move anchor left + 6, top - 10");
 
-  popup.moveToAnchor($("button1"), "before_start", -2, 0, false);
+  popup.moveToAnchor($("button1"), "before_start", -2, 0);
   checkCoords(popup, button1rect.left - 2, button1rect.top - popupheight, "move anchor before_start");
 
-  popup.moveToAnchor($("button2"), "before_start", 0, 0, false);
+  popup.moveToAnchor($("button2"), "before_start");
   checkCoords(popup, button2rect.left, button2rect.top - popupheight, "move button2");
 
-  popup.moveToAnchor($("button1"), "end_before", 0, 0, false);
+  popup.moveToAnchor($("button1"), "end_before");
   checkCoords(popup, button1rect.right, button1rect.top, "move anchor end_before");
 
-  popup.moveToAnchor($("button2"), "after_start", 5, 4, false);
+  popup.moveToAnchor($("button2"), "after_start", 5, 4);
   checkCoords(popup, button2rect.left + 5, button2rect.bottom + 4, "move button2 left + 5, top + 4");
 
   popup.moveTo($("button1").boxObject.screenX + 10, $("button1").boxObject.screenY + 12);
   checkCoords(popup, button1rect.left + 10, button1rect.top + 12, "move to button1 screen with offset");
 
-  popup.moveToAnchor($("button1"), "after_start", 1, 2, false);
+  popup.moveToAnchor($("button1"), "after_start", 1, 2);
   checkCoords(popup, button1rect.left + 1, button1rect.bottom + 2, "move button2 after screen");
 
   popup.hidePopup();
 }
 
 function checkCoords(popup, expectedx, expectedy, testid)
 {
   var rect = popup.getBoundingClientRect();