зеркало из https://github.com/mozilla/pjs.git
Implement the ability to remove top level menus on MacOS, essentially just reflecting removal of a content node. r=pink
This commit is contained in:
Родитель
91257a1d13
Коммит
c61930d421
|
@ -1523,7 +1523,28 @@ nsMenu::ContentRemoved(
|
|||
nsIContent * aContainer,
|
||||
nsIContent * aChild,
|
||||
PRInt32 aIndexInContainer)
|
||||
{
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
if(!element) {
|
||||
NS_ERROR("Unable to QI dom element.");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> contentNode;
|
||||
contentNode = do_QueryInterface(element);
|
||||
if (!contentNode) {
|
||||
NS_ERROR("DOM Node doesn't support the nsIContent interface required to handle DOM events.");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if(aChild == contentNode.get()) {
|
||||
if(mMenuParent) {
|
||||
mMenuParent->RemoveItem(aIndexInContainer);
|
||||
} else if(mMenuBarParent) {
|
||||
mMenuBarParent->RemoveMenu(aIndexInContainer);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
//-------------------------------------------------------------------------
|
||||
|
|
|
@ -493,6 +493,12 @@ NS_METHOD nsMenuBar::InsertMenuAt(const PRUint32 aCount, nsIMenu *& aMenu)
|
|||
//-------------------------------------------------------------------------
|
||||
NS_METHOD nsMenuBar::RemoveMenu(const PRUint32 aCount)
|
||||
{
|
||||
nsISupports* menu = (nsISupports*)mMenuVoidArray[aCount];
|
||||
NS_IF_RELEASE( menu );
|
||||
|
||||
mMenuVoidArray.RemoveElementAt(aCount);
|
||||
|
||||
::DrawMenuBar();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче