From 71a03d2a1d8572ddfe348dd663e8f9a38e6df95f Mon Sep 17 00:00:00 2001 From: "bryner%netscape.com" Date: Thu, 21 Mar 2002 07:33:51 +0000 Subject: [PATCH] Backing out my checkin from earlier (bug 130778), it seems to be the culprit for the Tp increase. git-svn-id: svn://10.0.0.236/trunk@117039 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/accessible/src/xul/makefile.win | 2 - .../src/xul/nsXULMenuAccessible.cpp | 41 ++++----- mozilla/content/html/style/src/makefile.win | 1 - .../html/style/src/nsCSSStyleSheet.cpp | 34 ++++--- mozilla/dom/macbuild/dom_xulIDL.xml | 30 +++++++ mozilla/dom/public/idl/xul/MANIFEST_IDL | 1 + mozilla/dom/public/idl/xul/Makefile.in | 1 + mozilla/dom/public/idl/xul/makefile.win | 1 + .../idl/xul/nsIDOMXULMenuBarElement.idl | 45 ++++++++++ .../public/idl/xul/nsIDOMXULPopupElement.idl | 3 +- mozilla/layout/style/nsCSSStyleSheet.cpp | 34 ++++--- mozilla/layout/xul/base/public/Makefile.in | 1 - mozilla/layout/xul/base/public/Manifest | 1 - mozilla/layout/xul/base/public/makefile.win | 3 +- .../layout/xul/base/public/nsIMenuParent.h | 1 - mozilla/layout/xul/base/src/nsIMenuParent.h | 88 +++++++++++++++++++ .../layout/xul/base/src/nsMenuBarFrame.cpp | 26 ++++++ .../layout/xul/base/src/nsMenuPopupFrame.cpp | 18 ++++ .../resources/content/bindings/popup.xml | 1 + .../resources/content/bindings/toolbar.xml | 3 +- 20 files changed, 266 insertions(+), 69 deletions(-) create mode 100644 mozilla/dom/public/idl/xul/nsIDOMXULMenuBarElement.idl create mode 100644 mozilla/layout/xul/base/src/nsIMenuParent.h diff --git a/mozilla/accessible/src/xul/makefile.win b/mozilla/accessible/src/xul/makefile.win index fdfd989b8fd..f61d645140e 100755 --- a/mozilla/accessible/src/xul/makefile.win +++ b/mozilla/accessible/src/xul/makefile.win @@ -31,8 +31,6 @@ REQUIRES = \ string \ widget \ xpcom \ - locale \ - layout_xul \ $(NULL) CPP_OBJS = \ diff --git a/mozilla/accessible/src/xul/nsXULMenuAccessible.cpp b/mozilla/accessible/src/xul/nsXULMenuAccessible.cpp index cd111f3fb19..bc7fd89b412 100644 --- a/mozilla/accessible/src/xul/nsXULMenuAccessible.cpp +++ b/mozilla/accessible/src/xul/nsXULMenuAccessible.cpp @@ -41,9 +41,8 @@ #include "nsAccessible.h" #include "nsIAccessible.h" #include "nsIDOMElement.h" -#include "nsIFrame.h" -#include "nsIMenuFrame.h" -#include "nsIMenuParent.h" +#include "nsIDOMXULPopupElement.h" +#include "nsIDOMXULMenuBarElement.h" // ------------------------ Menu Item ----------------------------- @@ -58,30 +57,26 @@ NS_IMETHODIMP nsXULMenuitemAccessible::GetAccState(PRUint32 *_retval) nsAccessible::GetAccState(_retval); // Focused? - nsCOMPtr shell = do_QueryReferent(mPresShell); - if (shell) { - nsCOMPtr content = do_QueryInterface(mDOMNode); - nsIFrame* itemFrame; - shell->GetPrimaryFrameFor(content, &itemFrame); - if (itemFrame) { - nsIMenuFrame* menuFrame = nsnull; - CallQueryInterface(itemFrame, &menuFrame); - if (menuFrame) { - nsIMenuParent* menuParent; - menuFrame->GetMenuParent(&menuParent); - if (menuParent) { - nsIMenuFrame* currentMenuFrame; - menuParent->GetCurrentMenuItem(¤tMenuFrame); - if (currentMenuFrame == menuFrame) - *_retval |= STATE_FOCUSED; - } - } + nsCOMPtr element(do_QueryInterface(mDOMNode)); + NS_ASSERTION(element, "No DOM element for menu node!"); + nsCOMPtr parentNode; + mDOMNode->GetParentNode(getter_AddRefs(parentNode)); + if (parentNode) { + nsCOMPtr currentItem; + nsCOMPtr popupEl = do_QueryInterface(parentNode); + if (popupEl) + popupEl->GetActiveItem(getter_AddRefs(currentItem)); + else { + nsCOMPtr menubar = do_QueryInterface(parentNode); + if (menubar) + menubar->GetActiveMenu(getter_AddRefs(currentItem)); } + + if (currentItem == element) + *_retval |= STATE_FOCUSED; } // Has Popup? - nsCOMPtr element(do_QueryInterface(mDOMNode)); - NS_ASSERTION(element, "No DOM element for menu node!"); nsAutoString tagName; element->GetLocalName(tagName); if (tagName.Equals(NS_LITERAL_STRING("menu"))) diff --git a/mozilla/content/html/style/src/makefile.win b/mozilla/content/html/style/src/makefile.win index 24ebf0a197e..0e4056101eb 100644 --- a/mozilla/content/html/style/src/makefile.win +++ b/mozilla/content/html/style/src/makefile.win @@ -40,7 +40,6 @@ REQUIRES = xpcom \ gfx \ content_xul \ view \ - layout_xul \ $(NULL) DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN diff --git a/mozilla/content/html/style/src/nsCSSStyleSheet.cpp b/mozilla/content/html/style/src/nsCSSStyleSheet.cpp index 17d6ae11454..9fa40ffeb22 100644 --- a/mozilla/content/html/style/src/nsCSSStyleSheet.cpp +++ b/mozilla/content/html/style/src/nsCSSStyleSheet.cpp @@ -95,8 +95,8 @@ #include "nsQuickSort.h" #ifdef MOZ_XUL #include "nsIXULContent.h" -#include "nsIMenuParent.h" -#include "nsIMenuFrame.h" +#include "nsIDOMXULPopupElement.h" +#include "nsIDOMXULMenuBarElement.h" #include "nsXULAtoms.h" #endif @@ -3327,22 +3327,20 @@ RuleProcessorData::RuleProcessorData(nsIPresContext* aPresContext, (mContent->IsContentOfType(nsIContent::eXUL) && (mContentTag == nsXULAtoms::menuitem || mContentTag == nsXULAtoms::menu))) { - nsCOMPtr shell; - mPresContext->GetShell(getter_AddRefs(shell)); - if (shell) { - nsIFrame* optionFrame = nsnull; - nsIMenuFrame* itemFrame = nsnull; - shell->GetPrimaryFrameFor(mContent, &optionFrame); - if (optionFrame && - NS_SUCCEEDED(CallQueryInterface(optionFrame, &itemFrame))) { - nsIMenuParent* menuParent; - itemFrame->GetMenuParent(&menuParent); - nsIMenuFrame* currentItemFrame = nsnull; - if (menuParent && - NS_SUCCEEDED(menuParent->GetCurrentMenuItem(¤tItemFrame)) && - currentItemFrame == itemFrame) - mIsMenuActive = PR_TRUE; - } + nsCOMPtr currentItem; + nsCOMPtr popupEl = do_QueryInterface(mParentContent); + if (popupEl) + popupEl->GetActiveItem(getter_AddRefs(currentItem)); + else { + nsCOMPtr menubar = do_QueryInterface(mParentContent); + if (menubar) + menubar->GetActiveMenu(getter_AddRefs(currentItem)); + } + + if (currentItem) { + nsCOMPtr element = do_QueryInterface(mContent); + if (currentItem == element) + mIsMenuActive = PR_TRUE; } } } diff --git a/mozilla/dom/macbuild/dom_xulIDL.xml b/mozilla/dom/macbuild/dom_xulIDL.xml index 0f651ca53f7..27fcb046f7c 100644 --- a/mozilla/dom/macbuild/dom_xulIDL.xml +++ b/mozilla/dom/macbuild/dom_xulIDL.xml @@ -815,6 +815,13 @@ Text + + Name + nsIDOMXULMenuBarElement.idl + MacOS + Text + + @@ -892,6 +899,11 @@ nsIDOMXULPopupElement.idl MacOS + + Name + nsIDOMXULMenuBarElement.idl + MacOS + @@ -1656,6 +1668,13 @@ Text + + Name + nsIDOMXULMenuBarElement.idl + MacOS + Text + + @@ -1733,6 +1752,11 @@ nsIDOMXULPopupElement.idl MacOS + + Name + nsIDOMXULMenuBarElement.idl + MacOS + @@ -1821,6 +1845,12 @@ nsIDOMXULPopupElement.idl MacOS + + headers + Name + nsIDOMXULMenuBarElement.idl + MacOS + headers Name diff --git a/mozilla/dom/public/idl/xul/MANIFEST_IDL b/mozilla/dom/public/idl/xul/MANIFEST_IDL index 89b917e2fc1..95d6e70ad1a 100644 --- a/mozilla/dom/public/idl/xul/MANIFEST_IDL +++ b/mozilla/dom/public/idl/xul/MANIFEST_IDL @@ -1,3 +1,4 @@ nsIDOMXULCommandDispatcher.idl nsIDOMXULDocument.idl nsIDOMXULElement.idl +nsIDOMXULMenuBarElement.idl diff --git a/mozilla/dom/public/idl/xul/Makefile.in b/mozilla/dom/public/idl/xul/Makefile.in index c57f4a788b3..e0f257dba8a 100644 --- a/mozilla/dom/public/idl/xul/Makefile.in +++ b/mozilla/dom/public/idl/xul/Makefile.in @@ -45,6 +45,7 @@ XPIDLSRCS = \ nsIDOMXULSelectCntrlEl.idl \ nsIDOMXULSelectCntrlItemEl.idl \ nsIDOMXULMultSelectCntrlEl.idl \ + nsIDOMXULMenuBarElement.idl \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/dom/public/idl/xul/makefile.win b/mozilla/dom/public/idl/xul/makefile.win index 1beb2253fa8..4c6ee81ede9 100644 --- a/mozilla/dom/public/idl/xul/makefile.win +++ b/mozilla/dom/public/idl/xul/makefile.win @@ -41,6 +41,7 @@ XPIDLSRCS = \ .\nsIDOMXULSelectCntrlEl.idl \ .\nsIDOMXULSelectCntrlItemEl.idl \ .\nsIDOMXULMultSelectCntrlEl.idl \ + .\nsIDOMXULMenuBarElement.idl \ $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/dom/public/idl/xul/nsIDOMXULMenuBarElement.idl b/mozilla/dom/public/idl/xul/nsIDOMXULMenuBarElement.idl new file mode 100644 index 00000000000..2f201b89208 --- /dev/null +++ b/mozilla/dom/public/idl/xul/nsIDOMXULMenuBarElement.idl @@ -0,0 +1,45 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 2002 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Brian Ryner + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsIDOMXULElement.idl" + +[scriptable, uuid(159c637c-1dd2-11b2-ab18-811904c2e7fb)] +interface nsIDOMXULMenuBarElement : nsIDOMXULElement { + + attribute nsIDOMElement activeMenu; + +}; diff --git a/mozilla/dom/public/idl/xul/nsIDOMXULPopupElement.idl b/mozilla/dom/public/idl/xul/nsIDOMXULPopupElement.idl index 1922750811e..99856d6c2b6 100644 --- a/mozilla/dom/public/idl/xul/nsIDOMXULPopupElement.idl +++ b/mozilla/dom/public/idl/xul/nsIDOMXULPopupElement.idl @@ -54,7 +54,8 @@ interface nsIDOMXULPopupElement : nsIDOMXULElement { const unsigned short AFTER_POINTER = 11; attribute DOMString position; - + attribute nsIDOMElement activeItem; + void showPopup(in unsigned short alignment, in nsIDOMElement target, in nsIDOMElement anchor); diff --git a/mozilla/layout/style/nsCSSStyleSheet.cpp b/mozilla/layout/style/nsCSSStyleSheet.cpp index 17d6ae11454..9fa40ffeb22 100644 --- a/mozilla/layout/style/nsCSSStyleSheet.cpp +++ b/mozilla/layout/style/nsCSSStyleSheet.cpp @@ -95,8 +95,8 @@ #include "nsQuickSort.h" #ifdef MOZ_XUL #include "nsIXULContent.h" -#include "nsIMenuParent.h" -#include "nsIMenuFrame.h" +#include "nsIDOMXULPopupElement.h" +#include "nsIDOMXULMenuBarElement.h" #include "nsXULAtoms.h" #endif @@ -3327,22 +3327,20 @@ RuleProcessorData::RuleProcessorData(nsIPresContext* aPresContext, (mContent->IsContentOfType(nsIContent::eXUL) && (mContentTag == nsXULAtoms::menuitem || mContentTag == nsXULAtoms::menu))) { - nsCOMPtr shell; - mPresContext->GetShell(getter_AddRefs(shell)); - if (shell) { - nsIFrame* optionFrame = nsnull; - nsIMenuFrame* itemFrame = nsnull; - shell->GetPrimaryFrameFor(mContent, &optionFrame); - if (optionFrame && - NS_SUCCEEDED(CallQueryInterface(optionFrame, &itemFrame))) { - nsIMenuParent* menuParent; - itemFrame->GetMenuParent(&menuParent); - nsIMenuFrame* currentItemFrame = nsnull; - if (menuParent && - NS_SUCCEEDED(menuParent->GetCurrentMenuItem(¤tItemFrame)) && - currentItemFrame == itemFrame) - mIsMenuActive = PR_TRUE; - } + nsCOMPtr currentItem; + nsCOMPtr popupEl = do_QueryInterface(mParentContent); + if (popupEl) + popupEl->GetActiveItem(getter_AddRefs(currentItem)); + else { + nsCOMPtr menubar = do_QueryInterface(mParentContent); + if (menubar) + menubar->GetActiveMenu(getter_AddRefs(currentItem)); + } + + if (currentItem) { + nsCOMPtr element = do_QueryInterface(mContent); + if (currentItem == element) + mIsMenuActive = PR_TRUE; } } } diff --git a/mozilla/layout/xul/base/public/Makefile.in b/mozilla/layout/xul/base/public/Makefile.in index ddd7972a5c7..2bf72138b92 100644 --- a/mozilla/layout/xul/base/public/Makefile.in +++ b/mozilla/layout/xul/base/public/Makefile.in @@ -32,7 +32,6 @@ XPIDL_MODULE = layout_xul EXPORTS = \ nsPIBoxObject.h \ nsIMenuFrame.h \ - nsIMenuParent.h \ nsIPopupSetFrame.h \ nsITreeFrame.h \ $(NULL) diff --git a/mozilla/layout/xul/base/public/Manifest b/mozilla/layout/xul/base/public/Manifest index 80f09c5254e..601ce8c3222 100644 --- a/mozilla/layout/xul/base/public/Manifest +++ b/mozilla/layout/xul/base/public/Manifest @@ -1,6 +1,5 @@ nsPIBoxObject.h nsIMenuFrame.h -nsIMenuParent.h nsIPopupSetFrame.h nsITreeFrame.h diff --git a/mozilla/layout/xul/base/public/makefile.win b/mozilla/layout/xul/base/public/makefile.win index 0186dd51f26..ab831cc5e3d 100644 --- a/mozilla/layout/xul/base/public/makefile.win +++ b/mozilla/layout/xul/base/public/makefile.win @@ -23,10 +23,9 @@ DEPTH=..\..\..\.. EXPORTS = \ nsIMenuFrame.h \ - nsIMenuParent.h \ nsIPopupSetFrame.h \ nsITreeFrame.h \ - nsPIBoxObject.h \ + nsPIBoxObject.h \ $(NULL) XPIDLSRCS= .\nsIBoxObject.idl \ diff --git a/mozilla/layout/xul/base/public/nsIMenuParent.h b/mozilla/layout/xul/base/public/nsIMenuParent.h index a1cf08cf2c4..fa26c32af80 100644 --- a/mozilla/layout/xul/base/public/nsIMenuParent.h +++ b/mozilla/layout/xul/base/public/nsIMenuParent.h @@ -45,7 +45,6 @@ { 0xd407bf61, 0x3efa, 0x11d3, { 0x97, 0xfa, 0x0, 0x40, 0x5, 0x53, 0xee, 0xf0 } } class nsIMenuFrame; -class nsIWidget; class nsIMenuParent : public nsISupports { diff --git a/mozilla/layout/xul/base/src/nsIMenuParent.h b/mozilla/layout/xul/base/src/nsIMenuParent.h new file mode 100644 index 00000000000..fa26c32af80 --- /dev/null +++ b/mozilla/layout/xul/base/src/nsIMenuParent.h @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Dean Tessman + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef nsIMenuParent_h___ +#define nsIMenuParent_h___ + + +// {D407BF61-3EFA-11d3-97FA-00400553EEF0} +#define NS_IMENUPARENT_IID \ +{ 0xd407bf61, 0x3efa, 0x11d3, { 0x97, 0xfa, 0x0, 0x40, 0x5, 0x53, 0xee, 0xf0 } } + +class nsIMenuFrame; + +class nsIMenuParent : public nsISupports { + +public: + static const nsIID& GetIID() { static nsIID iid = NS_IMENUPARENT_IID; return iid; } + + NS_IMETHOD GetCurrentMenuItem(nsIMenuFrame** aMenuItem) = 0; + NS_IMETHOD SetCurrentMenuItem(nsIMenuFrame* aMenuItem) = 0; + NS_IMETHOD GetNextMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResult) = 0; + NS_IMETHOD GetPreviousMenuItem(nsIMenuFrame* aStart, nsIMenuFrame** aResult) = 0; + + NS_IMETHOD SetActive(PRBool aActiveFlag) = 0; + NS_IMETHOD GetIsActive(PRBool& isActive) = 0; + NS_IMETHOD GetWidget(nsIWidget **aWidget) = 0; + + NS_IMETHOD IsMenuBar(PRBool& isMenuBar) = 0; + + NS_IMETHOD DismissChain() = 0; + NS_IMETHOD HideChain() = 0; + NS_IMETHOD KillPendingTimers() = 0; + + NS_IMETHOD CreateDismissalListener() = 0; + + NS_IMETHOD InstallKeyboardNavigator() = 0; + NS_IMETHOD RemoveKeyboardNavigator() = 0; + + // Used to move up, down, left, and right in menus. + NS_IMETHOD KeyboardNavigation(PRUint32 aDirection, PRBool& aHandledFlag) = 0; + NS_IMETHOD ShortcutNavigation(PRUint32 aLetter, PRBool& aHandledFlag) = 0; + // Called when the ESC key is held down to close levels of menus. + NS_IMETHOD Escape(PRBool& aHandledFlag) = 0; + // Called to execute a menu item. + NS_IMETHOD Enter() = 0; + + NS_IMETHOD SetIsContextMenu(PRBool aIsContextMenu) = 0; + NS_IMETHOD GetIsContextMenu(PRBool& aIsContextMenu) = 0; + +}; + +#endif + diff --git a/mozilla/layout/xul/base/src/nsMenuBarFrame.cpp b/mozilla/layout/xul/base/src/nsMenuBarFrame.cpp index 206841e9efa..e5673cc64e9 100644 --- a/mozilla/layout/xul/base/src/nsMenuBarFrame.cpp +++ b/mozilla/layout/xul/base/src/nsMenuBarFrame.cpp @@ -58,6 +58,7 @@ #include "nsMenuPopupFrame.h" #include "nsGUIEvent.h" #include "nsUnicharUtils.h" +#include "nsIDOMXULMenuBarElement.h" #ifdef XP_WIN #include "nsISound.h" #include "nsWidgetsCID.h" @@ -234,6 +235,18 @@ nsMenuBarFrame::ToggleMenuActiveState() } } + // Update the state on the menubar content node + nsCOMPtr menubar = do_QueryInterface(mContent); + nsCOMPtr newActive; + if (mCurrentMenu) { + nsIFrame* frame = nsnull; + CallQueryInterface(mCurrentMenu, &frame); + nsCOMPtr content; + frame->GetContent(getter_AddRefs(content)); + newActive = do_QueryInterface(content); + } + menubar->SetActiveMenu(newActive); + // Now send a CSS state change notification if (mCurrentMenu) mCurrentMenu->NotifyStateChanged(oldCurrent); @@ -544,6 +557,19 @@ NS_IMETHODIMP nsMenuBarFrame::SetCurrentMenuItem(nsIMenuFrame* aMenuItem) mCurrentMenu = aMenuItem; + // Update the menubar content node + nsCOMPtr menubar = do_QueryInterface(mContent); + nsCOMPtr newActive; + if (mCurrentMenu) { + nsIFrame* frame = nsnull; + CallQueryInterface(mCurrentMenu, &frame); + nsCOMPtr content; + frame->GetContent(getter_AddRefs(content)); + newActive = do_QueryInterface(content); + } + + menubar->SetActiveMenu(newActive); + // Now send a CSS state change notification if (mCurrentMenu) mCurrentMenu->NotifyStateChanged(oldMenuFrame); diff --git a/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp b/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp index f1e8a3702bd..0cf6f882619 100644 --- a/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp +++ b/mozilla/layout/xul/base/src/nsMenuPopupFrame.cpp @@ -69,6 +69,7 @@ #include "nsIFrameManager.h" #include "nsGUIEvent.h" #include "nsIRootBox.h" +#include "nsIDOMXULPopupElement.h" #ifdef XP_WIN #include "nsISound.h" #endif @@ -1433,6 +1434,18 @@ NS_IMETHODIMP nsMenuPopupFrame::SetCurrentMenuItem(nsIMenuFrame* aMenuItem) mCurrentMenu = aMenuItem; + // Update the content node's idea of the current item. + nsCOMPtr newContent; + if (mCurrentMenu) { + nsIFrame* frame = nsnull; + CallQueryInterface(mCurrentMenu, &frame); + frame->GetContent(getter_AddRefs(newContent)); + } + + nsCOMPtr popupEl = do_QueryInterface(mContent); + nsCOMPtr domEl = do_QueryInterface(newContent); + popupEl->SetActiveItem(domEl); + // Send menuactive state notification. if (mCurrentMenu) mCurrentMenu->NotifyStateChanged(oldMenuFrame); @@ -1866,6 +1879,11 @@ nsMenuPopupFrame::HandleEvent(nsIPresContext* aPresContext, NS_IMETHODIMP nsMenuPopupFrame::Destroy(nsIPresContext* aPresContext) { + // Make sure the content node doesn't think we still have an active item. + nsCOMPtr popupEl = do_QueryInterface(mContent); + if (popupEl) + popupEl->SetActiveItem(nsnull); + return nsBoxFrame::Destroy(aPresContext); } diff --git a/mozilla/xpfe/global/resources/content/bindings/popup.xml b/mozilla/xpfe/global/resources/content/bindings/popup.xml index 529771d7418..d7b2d70cd10 100644 --- a/mozilla/xpfe/global/resources/content/bindings/popup.xml +++ b/mozilla/xpfe/global/resources/content/bindings/popup.xml @@ -18,6 +18,7 @@ + - + +