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
This commit is contained in:
@@ -31,8 +31,6 @@ REQUIRES = \
|
||||
string \
|
||||
widget \
|
||||
xpcom \
|
||||
locale \
|
||||
layout_xul \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS = \
|
||||
|
||||
@@ -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<nsIPresShell> shell = do_QueryReferent(mPresShell);
|
||||
if (shell) {
|
||||
nsCOMPtr<nsIContent> 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<nsIDOMElement> element(do_QueryInterface(mDOMNode));
|
||||
NS_ASSERTION(element, "No DOM element for menu node!");
|
||||
nsCOMPtr<nsIDOMNode> parentNode;
|
||||
mDOMNode->GetParentNode(getter_AddRefs(parentNode));
|
||||
if (parentNode) {
|
||||
nsCOMPtr<nsIDOMElement> currentItem;
|
||||
nsCOMPtr<nsIDOMXULPopupElement> popupEl = do_QueryInterface(parentNode);
|
||||
if (popupEl)
|
||||
popupEl->GetActiveItem(getter_AddRefs(currentItem));
|
||||
else {
|
||||
nsCOMPtr<nsIDOMXULMenuBarElement> menubar = do_QueryInterface(parentNode);
|
||||
if (menubar)
|
||||
menubar->GetActiveMenu(getter_AddRefs(currentItem));
|
||||
}
|
||||
|
||||
if (currentItem == element)
|
||||
*_retval |= STATE_FOCUSED;
|
||||
}
|
||||
|
||||
// Has Popup?
|
||||
nsCOMPtr<nsIDOMElement> 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")))
|
||||
|
||||
@@ -40,7 +40,6 @@ REQUIRES = xpcom \
|
||||
gfx \
|
||||
content_xul \
|
||||
view \
|
||||
layout_xul \
|
||||
$(NULL)
|
||||
|
||||
DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
|
||||
|
||||
@@ -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<nsIPresShell> 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<nsIDOMElement> currentItem;
|
||||
nsCOMPtr<nsIDOMXULPopupElement> popupEl = do_QueryInterface(mParentContent);
|
||||
if (popupEl)
|
||||
popupEl->GetActiveItem(getter_AddRefs(currentItem));
|
||||
else {
|
||||
nsCOMPtr<nsIDOMXULMenuBarElement> menubar = do_QueryInterface(mParentContent);
|
||||
if (menubar)
|
||||
menubar->GetActiveMenu(getter_AddRefs(currentItem));
|
||||
}
|
||||
|
||||
if (currentItem) {
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mContent);
|
||||
if (currentItem == element)
|
||||
mIsMenuActive = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -815,6 +815,13 @@
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIDOMXULMenuBarElement.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
</FILELIST>
|
||||
<LINKORDER>
|
||||
<FILEREF>
|
||||
@@ -892,6 +899,11 @@
|
||||
<PATH>nsIDOMXULPopupElement.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIDOMXULMenuBarElement.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
</LINKORDER>
|
||||
</TARGET>
|
||||
<TARGET>
|
||||
@@ -1656,6 +1668,13 @@
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
<FILE>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIDOMXULMenuBarElement.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
<FILEKIND>Text</FILEKIND>
|
||||
<FILEFLAGS></FILEFLAGS>
|
||||
</FILE>
|
||||
</FILELIST>
|
||||
<LINKORDER>
|
||||
<FILEREF>
|
||||
@@ -1733,6 +1752,11 @@
|
||||
<PATH>nsIDOMXULPopupElement.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIDOMXULMenuBarElement.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
</LINKORDER>
|
||||
</TARGET>
|
||||
</TARGETLIST>
|
||||
@@ -1821,6 +1845,12 @@
|
||||
<PATH>nsIDOMXULPopupElement.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>headers</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
<PATH>nsIDOMXULMenuBarElement.idl</PATH>
|
||||
<PATHFORMAT>MacOS</PATHFORMAT>
|
||||
</FILEREF>
|
||||
<FILEREF>
|
||||
<TARGETNAME>headers</TARGETNAME>
|
||||
<PATHTYPE>Name</PATHTYPE>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
nsIDOMXULCommandDispatcher.idl
|
||||
nsIDOMXULDocument.idl
|
||||
nsIDOMXULElement.idl
|
||||
nsIDOMXULMenuBarElement.idl
|
||||
|
||||
@@ -45,6 +45,7 @@ XPIDLSRCS = \
|
||||
nsIDOMXULSelectCntrlEl.idl \
|
||||
nsIDOMXULSelectCntrlItemEl.idl \
|
||||
nsIDOMXULMultSelectCntrlEl.idl \
|
||||
nsIDOMXULMenuBarElement.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
@@ -41,6 +41,7 @@ XPIDLSRCS = \
|
||||
.\nsIDOMXULSelectCntrlEl.idl \
|
||||
.\nsIDOMXULSelectCntrlItemEl.idl \
|
||||
.\nsIDOMXULMultSelectCntrlEl.idl \
|
||||
.\nsIDOMXULMenuBarElement.idl \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
45
mozilla/dom/public/idl/xul/nsIDOMXULMenuBarElement.idl
Normal file
45
mozilla/dom/public/idl/xul/nsIDOMXULMenuBarElement.idl
Normal file
@@ -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 <bryner@netscape.com>
|
||||
*
|
||||
* 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;
|
||||
|
||||
};
|
||||
@@ -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);
|
||||
|
||||
@@ -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<nsIPresShell> 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<nsIDOMElement> currentItem;
|
||||
nsCOMPtr<nsIDOMXULPopupElement> popupEl = do_QueryInterface(mParentContent);
|
||||
if (popupEl)
|
||||
popupEl->GetActiveItem(getter_AddRefs(currentItem));
|
||||
else {
|
||||
nsCOMPtr<nsIDOMXULMenuBarElement> menubar = do_QueryInterface(mParentContent);
|
||||
if (menubar)
|
||||
menubar->GetActiveMenu(getter_AddRefs(currentItem));
|
||||
}
|
||||
|
||||
if (currentItem) {
|
||||
nsCOMPtr<nsIDOMElement> element = do_QueryInterface(mContent);
|
||||
if (currentItem == element)
|
||||
mIsMenuActive = PR_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ XPIDL_MODULE = layout_xul
|
||||
EXPORTS = \
|
||||
nsPIBoxObject.h \
|
||||
nsIMenuFrame.h \
|
||||
nsIMenuParent.h \
|
||||
nsIPopupSetFrame.h \
|
||||
nsITreeFrame.h \
|
||||
$(NULL)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
nsPIBoxObject.h
|
||||
nsIMenuFrame.h
|
||||
nsIMenuParent.h
|
||||
nsIPopupSetFrame.h
|
||||
nsITreeFrame.h
|
||||
|
||||
|
||||
@@ -23,10 +23,9 @@ DEPTH=..\..\..\..
|
||||
|
||||
EXPORTS = \
|
||||
nsIMenuFrame.h \
|
||||
nsIMenuParent.h \
|
||||
nsIPopupSetFrame.h \
|
||||
nsITreeFrame.h \
|
||||
nsPIBoxObject.h \
|
||||
nsPIBoxObject.h \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS= .\nsIBoxObject.idl \
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
{ 0xd407bf61, 0x3efa, 0x11d3, { 0x97, 0xfa, 0x0, 0x40, 0x5, 0x53, 0xee, 0xf0 } }
|
||||
|
||||
class nsIMenuFrame;
|
||||
class nsIWidget;
|
||||
|
||||
class nsIMenuParent : public nsISupports {
|
||||
|
||||
|
||||
88
mozilla/layout/xul/base/src/nsIMenuParent.h
Normal file
88
mozilla/layout/xul/base/src/nsIMenuParent.h
Normal file
@@ -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 <dean_tessman@hotmail.com>
|
||||
*
|
||||
* 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
|
||||
|
||||
@@ -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<nsIDOMXULMenuBarElement> menubar = do_QueryInterface(mContent);
|
||||
nsCOMPtr<nsIDOMElement> newActive;
|
||||
if (mCurrentMenu) {
|
||||
nsIFrame* frame = nsnull;
|
||||
CallQueryInterface(mCurrentMenu, &frame);
|
||||
nsCOMPtr<nsIContent> 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<nsIDOMXULMenuBarElement> menubar = do_QueryInterface(mContent);
|
||||
nsCOMPtr<nsIDOMElement> newActive;
|
||||
if (mCurrentMenu) {
|
||||
nsIFrame* frame = nsnull;
|
||||
CallQueryInterface(mCurrentMenu, &frame);
|
||||
nsCOMPtr<nsIContent> 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);
|
||||
|
||||
@@ -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<nsIContent> newContent;
|
||||
if (mCurrentMenu) {
|
||||
nsIFrame* frame = nsnull;
|
||||
CallQueryInterface(mCurrentMenu, &frame);
|
||||
frame->GetContent(getter_AddRefs(newContent));
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMXULPopupElement> popupEl = do_QueryInterface(mContent);
|
||||
nsCOMPtr<nsIDOMElement> 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<nsIDOMXULPopupElement> popupEl = do_QueryInterface(mContent);
|
||||
if (popupEl)
|
||||
popupEl->SetActiveItem(nsnull);
|
||||
|
||||
return nsBoxFrame::Destroy(aPresContext);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIDOMXULPopupElement, nsIAccessibleProvider">
|
||||
<field name="activeItem"/>
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
|
||||
@@ -177,7 +177,8 @@
|
||||
</xul:hbox>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<implementation implements="nsIDOMXULMenuBarElement, nsIAccessibleProvider">
|
||||
<field name="activeMenu"/>
|
||||
<property name="accessible">
|
||||
<getter>
|
||||
<![CDATA[
|
||||
|
||||
Reference in New Issue
Block a user