Bug 398409 - "right-click -> Bookmark This Page, dialog opens in left corner of window (not under star button)" [p=florian r=Mano a=blocking-firefox3+]

This commit is contained in:
reed@reedloden.com 2007-11-13 08:30:58 -08:00
parent db8959b998
commit 8a0eb4afaa
3 changed files with 20 additions and 27 deletions

View File

@ -167,13 +167,8 @@ var PlacesCommandHook = {
* aBrowser isn't bookmarked yet, defaults to the unfiled root.
* @param [optional] aShowEditUI
* whether or not to show the edit-bookmark UI for the bookmark item
* @param [optional] aAnchorElement
* required if aShowEditUI is set, see popup's openPopup.
* @param [optional] aPosition
* required if aShowEditUI is set, see popup's openPopup.
*/
bookmarkPage: function PCH_bookmarkPage(aBrowser, aParent, aShowEditUI,
aAnchorElement, aPosition) {
bookmarkPage: function PCH_bookmarkPage(aBrowser, aParent, aShowEditUI) {
var uri = aBrowser.currentURI;
var itemId = PlacesUtils.getMostRecentBookmarkForURI(uri);
if (itemId == -1) {
@ -202,25 +197,25 @@ var PlacesCommandHook = {
itemId = PlacesUtils.getMostRecentBookmarkForURI(uri);
}
if (aShowEditUI)
this.showEditBookmarkPopup(itemId, aAnchorElement, aPosition);
if (aShowEditUI) {
// dock the panel to the star icon when possible, otherwise dock
// it to the content area
if (aBrowser.contentWindow == window.content) {
var starIcon = aBrowser.ownerDocument.getElementById("star-button");
if (starIcon && isElementVisible(starIcon)) {
this.showEditBookmarkPopup(itemId, starIcon, "after_start");
return;
}
}
this.showEditBookmarkPopup(itemId, aBrowser, "overlap");
}
},
/**
* Adds a bookmark to the page loaded in the current tab.
*/
bookmarkCurrentPage: function PCH_bookmarkCurrentPage(aShowEditUI, aParent) {
// dock the panel to the star icon if it is visible, otherwise dock
// it to the content area
var starIcon = document.getElementById("star-button");
if (starIcon && isElementVisible(starIcon)) {
this.bookmarkPage(getBrowser().selectedBrowser, aParent, aShowEditUI,
starIcon, "after_start");
}
else {
this.bookmarkPage(getBrowser().selectedBrowser, aParent, aShowEditUI,
getBrowser(), "overlap");
}
this.bookmarkPage(getBrowser().selectedBrowser, aParent, aShowEditUI);
},
/**
@ -242,7 +237,7 @@ var PlacesCommandHook = {
itemId = PlacesUtils.getMostRecentBookmarkForURI(linkURI);
}
PlacesCommandHook.showEditBookmarkPopup(itemId, getBrowser(), "overlap");
this.showEditBookmarkPopup(itemId, getBrowser(), "overlap");
},
/**

View File

@ -264,8 +264,7 @@ function BookmarkThisTab()
tab = getBrowser().mCurrentTab;
PlacesCommandHook.bookmarkPage(tab.linkedBrowser,
PlacesUtils.bookmarksRootId,
true, getBrowser(), "overlap");
PlacesUtils.bookmarksRootId, true);
}
/**

View File

@ -1140,13 +1140,12 @@ nsContextMenu.prototype = {
},
bookmarkThisPage: function CM_bookmarkThisPage() {
PlacesCommandHook.bookmarkPage(this.browser, PlacesUtils.bookmarksRootId,
true, this.browser, "overlap");
window.top.PlacesCommandHook.bookmarkPage(this.browser, PlacesUtils.bookmarksRootId, true);
},
bookmarkLink: function CM_bookmarkLink() {
PlacesCommandHook.bookmarkLink(PlacesUtils.bookmarksRootId, this.linkURL,
this.linkText());
window.top.PlacesCommandHook.bookmarkLink(PlacesUtils.bookmarksRootId, this.linkURL,
this.linkText());
},
addBookmarkForFrame: function CM_addBookmarkForFrame() {
@ -1165,7 +1164,7 @@ nsContextMenu.prototype = {
itemId = PlacesUtils.getMostRecentBookmarkForURI(uri);
}
PlacesCommandHook.showEditBookmarkPopup(itemId, this.browser, "overlap");
window.top.PlacesCommandHook.showEditBookmarkPopup(itemId, this.browser, "overlap");
},
savePageAs: function CM_savePageAs() {