From bf5ff724ae22350b938b594b40b5db36bea28af6 Mon Sep 17 00:00:00 2001 From: Neil Deakin Date: Mon, 11 Jul 2011 10:05:07 -0400 Subject: [PATCH] Bug 670148, remove nsIMenuFrame, r=roc --- accessible/src/base/nsRootAccessible.cpp | 15 ++--- .../xul/content/src/nsXULPopupListener.cpp | 1 - layout/xul/base/public/Makefile.in | 1 - layout/xul/base/public/nsIMenuFrame.h | 65 ------------------- layout/xul/base/src/nsMenuFrame.cpp | 2 +- layout/xul/base/src/nsMenuFrame.h | 17 +++-- widget/src/gtk2/Makefile.in | 2 + widget/src/gtk2/nsNativeThemeGTK.cpp | 4 +- widget/src/windows/Makefile.in | 2 + widget/src/windows/nsNativeThemeWin.cpp | 8 +-- widget/src/xpwidgets/nsNativeTheme.cpp | 4 +- 11 files changed, 30 insertions(+), 91 deletions(-) delete mode 100644 layout/xul/base/public/nsIMenuFrame.h diff --git a/accessible/src/base/nsRootAccessible.cpp b/accessible/src/base/nsRootAccessible.cpp index 2b389d3fb91e..ad690ac964a9 100644 --- a/accessible/src/base/nsRootAccessible.cpp +++ b/accessible/src/base/nsRootAccessible.cpp @@ -67,7 +67,7 @@ #include "nsIDocument.h" #include "nsEventListenerManager.h" #include "nsIFrame.h" -#include "nsIMenuFrame.h" +#include "nsMenuFrame.h" #include "nsIHTMLDocument.h" #include "nsIInterfaceRequestorUtils.h" #include "nsISelectionPrivate.h" @@ -688,16 +688,13 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent) return; // Tree with nothing selected } #endif - nsIFrame* menuFrame = accessible->GetFrame(); - if (!menuFrame) - return; - nsIMenuFrame* imenuFrame = do_QueryFrame(menuFrame); - if (imenuFrame) + nsMenuFrame* menuFrame = do_QueryFrame(accessible->GetFrame()); + if (menuFrame) fireFocus = PR_TRUE; - // QI failed for nsIMenuFrame means it's not on menu bar - if (imenuFrame && imenuFrame->IsOnMenuBar() && - !imenuFrame->IsOnActiveMenuBar()) { + // QI failed for nsMenuFrame means it's not on menu bar + if (menuFrame && menuFrame->IsOnMenuBar() && + !menuFrame->IsOnActiveMenuBar()) { // It is a top level menuitem. Only fire a focus event when the menu bar // is active. return; diff --git a/content/xul/content/src/nsXULPopupListener.cpp b/content/xul/content/src/nsXULPopupListener.cpp index 2f7b6937708e..6e5eac0d6685 100644 --- a/content/xul/content/src/nsXULPopupListener.cpp +++ b/content/xul/content/src/nsXULPopupListener.cpp @@ -79,7 +79,6 @@ #include "nsPIDOMWindow.h" #include "nsIViewManager.h" #include "nsDOMError.h" -#include "nsIMenuFrame.h" using namespace mozilla; diff --git a/layout/xul/base/public/Makefile.in b/layout/xul/base/public/Makefile.in index f2630a95175e..4b9c775d03d4 100644 --- a/layout/xul/base/public/Makefile.in +++ b/layout/xul/base/public/Makefile.in @@ -48,7 +48,6 @@ GRE_MODULE = 1 EXPORTS = \ nsPIBoxObject.h \ - nsIMenuFrame.h \ nsIScrollbarMediator.h \ nsXULPopupManager.h \ $(NULL) diff --git a/layout/xul/base/public/nsIMenuFrame.h b/layout/xul/base/public/nsIMenuFrame.h deleted file mode 100644 index 3c65ba8cbca5..000000000000 --- a/layout/xul/base/public/nsIMenuFrame.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** 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 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): - * - * Alternatively, the contents of this file may be used under the terms of - * either of 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 ***** */ - -#ifndef nsIMenuFrame_h___ -#define nsIMenuFrame_h___ - -#include "nsQueryFrame.h" - -enum nsMenuListType { - eNotMenuList, - eReadonlyMenuList, - eEditableMenuList -}; - -// this interface exists solely because native themes need to call into it. -// Only menu frames should implement it - -class nsIMenuFrame -{ -public: - NS_DECL_QUERYFRAME_TARGET(nsIMenuFrame) - - virtual PRBool IsOpen() = 0; - virtual PRBool IsMenu() = 0; - virtual PRBool IsOnMenuBar() = 0; - virtual PRBool IsOnActiveMenuBar() = 0; - virtual nsMenuListType GetParentMenuListType() = 0; -}; - -#endif - diff --git a/layout/xul/base/src/nsMenuFrame.cpp b/layout/xul/base/src/nsMenuFrame.cpp index 205cf1ecc76c..442ef8104e7d 100644 --- a/layout/xul/base/src/nsMenuFrame.cpp +++ b/layout/xul/base/src/nsMenuFrame.cpp @@ -213,7 +213,7 @@ NS_NewMenuItemFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) NS_IMPL_FRAMEARENA_HELPERS(nsMenuFrame) NS_QUERYFRAME_HEAD(nsMenuFrame) - NS_QUERYFRAME_ENTRY(nsIMenuFrame) + NS_QUERYFRAME_ENTRY(nsMenuFrame) NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame) // diff --git a/layout/xul/base/src/nsMenuFrame.h b/layout/xul/base/src/nsMenuFrame.h index fdc34c614f86..6d9516bf833c 100644 --- a/layout/xul/base/src/nsMenuFrame.h +++ b/layout/xul/base/src/nsMenuFrame.h @@ -51,7 +51,6 @@ #include "nsFrameList.h" #include "nsGkAtoms.h" #include "nsMenuParent.h" -#include "nsIMenuFrame.h" #include "nsXULPopupManager.h" #include "nsITimer.h" #include "nsIDOMText.h" @@ -75,6 +74,12 @@ enum nsMenuType { eMenuType_Radio = 2 }; +enum nsMenuListType { + eNotMenuList, // not a menulist + eReadonlyMenuList, // + eEditableMenuList // +}; + class nsMenuFrame; /** @@ -101,12 +106,12 @@ private: nsMenuFrame* mFrame; }; -class nsMenuFrame : public nsBoxFrame, - public nsIMenuFrame +class nsMenuFrame : public nsBoxFrame { public: nsMenuFrame(nsIPresShell* aShell, nsStyleContext* aContext); + NS_DECL_QUERYFRAME_TARGET(nsMenuFrame) NS_DECL_QUERYFRAME NS_DECL_FRAMEARENA_HELPERS @@ -185,11 +190,11 @@ public: // nsMenuFrame methods - virtual PRBool IsOnMenuBar() { return mMenuParent && mMenuParent->IsMenuBar(); } - virtual PRBool IsOnActiveMenuBar() { return IsOnMenuBar() && mMenuParent->IsActive(); } + PRBool IsOnMenuBar() { return mMenuParent && mMenuParent->IsMenuBar(); } + PRBool IsOnActiveMenuBar() { return IsOnMenuBar() && mMenuParent->IsActive(); } virtual PRBool IsOpen(); virtual PRBool IsMenu(); - virtual nsMenuListType GetParentMenuListType(); + nsMenuListType GetParentMenuListType(); PRBool IsDisabled(); void ToggleMenuState(); diff --git a/widget/src/gtk2/Makefile.in b/widget/src/gtk2/Makefile.in index 3db756e43002..4dbdeb0deeee 100644 --- a/widget/src/gtk2/Makefile.in +++ b/widget/src/gtk2/Makefile.in @@ -137,6 +137,8 @@ DEFINES += -DCAIRO_GFX INCLUDES += \ -I$(srcdir)/../xpwidgets \ -I$(srcdir)/../shared \ + -I$(topsrcdir)/layout/generic \ + -I$(topsrcdir)/layout/xul/base/src \ -I$(topsrcdir)/other-licenses/atk-1.0 \ $(NULL) ifdef MOZ_X11 diff --git a/widget/src/gtk2/nsNativeThemeGTK.cpp b/widget/src/gtk2/nsNativeThemeGTK.cpp index 5290ff4c6f58..d8f2d926106a 100644 --- a/widget/src/gtk2/nsNativeThemeGTK.cpp +++ b/widget/src/gtk2/nsNativeThemeGTK.cpp @@ -54,7 +54,7 @@ #include "nsILookAndFeel.h" #include "nsGfxCIID.h" #include "nsTransform2D.h" -#include "nsIMenuFrame.h" +#include "nsMenuFrame.h" #include "prlink.h" #include "nsIDOMHTMLInputElement.h" #include "nsRenderingContext.h" @@ -332,7 +332,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame, aWidgetType == NS_THEME_MENUSEPARATOR || aWidgetType == NS_THEME_MENUARROW) { PRBool isTopLevel = PR_FALSE; - nsIMenuFrame *menuFrame = do_QueryFrame(aFrame); + nsMenuFrame *menuFrame = do_QueryFrame(aFrame); if (menuFrame) { isTopLevel = menuFrame->IsOnMenuBar(); } diff --git a/widget/src/windows/Makefile.in b/widget/src/windows/Makefile.in index 2f5945798d55..53277eae8d4b 100644 --- a/widget/src/windows/Makefile.in +++ b/widget/src/windows/Makefile.in @@ -124,6 +124,8 @@ LOCAL_INCLUDES = \ -I. \ -I$(srcdir)/../xpwidgets \ -I$(srcdir) \ + -I$(topsrcdir)/layout/generic \ + -I$(topsrcdir)/layout/xul/base/src \ -I$(topsrcdir)/toolkit/xre \ -I$(topsrcdir)/xpcom/base \ $(NULL) diff --git a/widget/src/windows/nsNativeThemeWin.cpp b/widget/src/windows/nsNativeThemeWin.cpp index 8f9c99ffede4..20205852a9ba 100644 --- a/widget/src/windows/nsNativeThemeWin.cpp +++ b/widget/src/windows/nsNativeThemeWin.cpp @@ -55,7 +55,7 @@ #include "nsINameSpaceManager.h" #include "nsILookAndFeel.h" #include "nsIDOMHTMLInputElement.h" -#include "nsIMenuFrame.h" +#include "nsMenuFrame.h" #include "nsWidgetAtoms.h" #include #include "nsWindow.h" @@ -148,7 +148,7 @@ nsNativeThemeWin::~nsNativeThemeWin() { static PRBool IsTopLevelMenu(nsIFrame *aFrame) { PRBool isTopLevel(PR_FALSE); - nsIMenuFrame *menuFrame = do_QueryFrame(aFrame); + nsMenuFrame *menuFrame = do_QueryFrame(aFrame); if (menuFrame) { isTopLevel = menuFrame->IsOnMenuBar(); } @@ -1062,7 +1062,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType, PRBool isTopLevel = PR_FALSE; PRBool isOpen = PR_FALSE; PRBool isHover = PR_FALSE; - nsIMenuFrame *menuFrame = do_QueryFrame(aFrame); + nsMenuFrame *menuFrame = do_QueryFrame(aFrame); nsEventStates eventState = GetContentState(aFrame, aWidgetType); isTopLevel = IsTopLevelMenu(aFrame); @@ -2759,7 +2759,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8 PRBool isTopLevel = PR_FALSE; PRBool isOpen = PR_FALSE; PRBool isContainer = PR_FALSE; - nsIMenuFrame *menuFrame = do_QueryFrame(aFrame); + nsMenuFrame *menuFrame = do_QueryFrame(aFrame); nsEventStates eventState = GetContentState(aFrame, aWidgetType); // We indicate top-level-ness using aPart. 0 is a normal menu item, diff --git a/widget/src/xpwidgets/nsNativeTheme.cpp b/widget/src/xpwidgets/nsNativeTheme.cpp index a053cd9f8ae9..8cbd008c4971 100644 --- a/widget/src/xpwidgets/nsNativeTheme.cpp +++ b/widget/src/xpwidgets/nsNativeTheme.cpp @@ -53,7 +53,7 @@ #include "nsIComponentManager.h" #include "nsPIDOMWindow.h" #include "nsProgressFrame.h" -#include "nsIMenuFrame.h" +#include "nsMenuFrame.h" nsNativeTheme::nsNativeTheme() : mAnimatedContentTimeout(PR_UINT32_MAX) @@ -514,7 +514,7 @@ nsNativeTheme::IsSubmenu(nsIFrame* aFrame, PRBool* aLeftOfParent) PRBool nsNativeTheme::IsRegularMenuItem(nsIFrame *aFrame) { - nsIMenuFrame *menuFrame = do_QueryFrame(aFrame); + nsMenuFrame *menuFrame = do_QueryFrame(aFrame); return !(menuFrame && (menuFrame->IsOnMenuBar() || menuFrame->GetParentMenuListType() != eNotMenuList)); }