Bug 670148, remove nsIMenuFrame, r=roc
authorNeil Deakin <neil@mozilla.com>
Mon, 11 Jul 2011 10:05:07 -0400
changeset 72597 09df029315a77682db03cbd7ca5106667d466735
parent 72596 64d00c88b3a6f189c433c23850db94f6023355b4
child 72598 b905a7aa518a3cc181ea92f366ddfa62c9aff3f5
push id30
push usertim.taubert@gmx.de
push dateWed, 13 Jul 2011 17:53:37 +0000
treeherderfx-team@fc299923d422 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs670148
milestone8.0a1
Bug 670148, remove nsIMenuFrame, r=roc
accessible/src/base/nsRootAccessible.cpp
content/xul/content/src/nsXULPopupListener.cpp
layout/xul/base/public/Makefile.in
layout/xul/base/public/nsIMenuFrame.h
layout/xul/base/src/nsMenuFrame.cpp
layout/xul/base/src/nsMenuFrame.h
widget/src/gtk2/Makefile.in
widget/src/gtk2/nsNativeThemeGTK.cpp
widget/src/windows/Makefile.in
widget/src/windows/nsNativeThemeWin.cpp
widget/src/xpwidgets/nsNativeTheme.cpp
--- a/accessible/src/base/nsRootAccessible.cpp
+++ b/accessible/src/base/nsRootAccessible.cpp
@@ -62,17 +62,17 @@
 #include "nsIDOMNSEvent.h"
 #include "nsIDOMXULMenuListElement.h"
 #include "nsIDOMXULMultSelectCntrlEl.h"
 #include "nsIDOMXULSelectCntrlItemEl.h"
 #include "nsIDOMXULPopupElement.h"
 #include "nsIDocument.h"
 #include "nsEventListenerManager.h"
 #include "nsIFrame.h"
-#include "nsIMenuFrame.h"
+#include "nsMenuFrame.h"
 #include "nsIHTMLDocument.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsISelectionPrivate.h"
 #include "nsIServiceManager.h"
 #include "nsPIDOMWindow.h"
 #include "nsIWebBrowserChrome.h"
 #include "nsReadableUtils.h"
 #include "nsRootAccessible.h"
@@ -683,26 +683,23 @@ nsRootAccessible::ProcessDOMEvent(nsIDOM
   else if (eventType.EqualsLiteral("DOMMenuItemActive")) {
     PRBool fireFocus = PR_FALSE;
     if (!treeItemAccessible) {
 #ifdef MOZ_XUL
       if (isTree) {
         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;
       } else {
         nsAccessible *containerAccessible = accessible->GetParent();
         if (!containerAccessible)
           return;
         // It is not top level menuitem
--- a/content/xul/content/src/nsXULPopupListener.cpp
+++ b/content/xul/content/src/nsXULPopupListener.cpp
@@ -74,17 +74,16 @@
 
 // for event firing in context menus
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsFocusManager.h"
 #include "nsPIDOMWindow.h"
 #include "nsIViewManager.h"
 #include "nsDOMError.h"
-#include "nsIMenuFrame.h"
 
 using namespace mozilla;
 
 // on win32 and os/2, context menus come up on mouse up. On other platforms,
 // they appear on mouse down. Certain bits of code care about this difference.
 #if !defined(XP_WIN) && !defined(XP_OS2)
 #define NS_CONTEXT_MENU_IS_MOUSEUP 1
 #endif
--- a/layout/xul/base/public/Makefile.in
+++ b/layout/xul/base/public/Makefile.in
@@ -43,17 +43,16 @@ VPATH		= @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= layout
 XPIDL_MODULE	= layout_xul
 GRE_MODULE	= 1
 
 EXPORTS		= \
 		nsPIBoxObject.h \
-		nsIMenuFrame.h \
 		nsIScrollbarMediator.h \
 		nsXULPopupManager.h \
 		$(NULL)
 
 XPIDLSRCS=      nsIBoxObject.idl                  \
                 nsIScrollBoxObject.idl              \
                 nsIScrollBoxObject.idl \
                 nsIPopupBoxObject.idl \
deleted file mode 100644
--- 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
-
--- a/layout/xul/base/src/nsMenuFrame.cpp
+++ b/layout/xul/base/src/nsMenuFrame.cpp
@@ -208,17 +208,17 @@ NS_NewMenuItemFrame(nsIPresShell* aPresS
     it->SetIsMenu(PR_FALSE);
 
   return it;
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsMenuFrame)
 
 NS_QUERYFRAME_HEAD(nsMenuFrame)
-  NS_QUERYFRAME_ENTRY(nsIMenuFrame)
+  NS_QUERYFRAME_ENTRY(nsMenuFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsBoxFrame)
 
 //
 // nsMenuFrame cntr
 //
 nsMenuFrame::nsMenuFrame(nsIPresShell* aShell, nsStyleContext* aContext):
   nsBoxFrame(aShell, aContext),
     mIsMenu(PR_FALSE),
--- a/layout/xul/base/src/nsMenuFrame.h
+++ b/layout/xul/base/src/nsMenuFrame.h
@@ -46,17 +46,16 @@
 #include "prtypes.h"
 #include "nsIAtom.h"
 #include "nsCOMPtr.h"
 
 #include "nsBoxFrame.h"
 #include "nsFrameList.h"
 #include "nsGkAtoms.h"
 #include "nsMenuParent.h"
-#include "nsIMenuFrame.h"
 #include "nsXULPopupManager.h"
 #include "nsITimer.h"
 #include "nsIDOMText.h"
 #include "nsIContent.h"
 
 nsIFrame* NS_NewMenuFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 nsIFrame* NS_NewMenuItemFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 
@@ -70,16 +69,22 @@ enum nsMenuType {
   eMenuType_Normal = 0,
   // a menuitem with a checkmark that toggles when activated
   eMenuType_Checkbox = 1,
   // a radio menuitem where only one of it and its siblings with the same
   // name attribute can be checked at a time
   eMenuType_Radio = 2
 };
 
+enum nsMenuListType {
+  eNotMenuList,      // not a menulist
+  eReadonlyMenuList, // <menulist/>
+  eEditableMenuList  // <menulist editable="true"/>
+};
+
 class nsMenuFrame;
 
 /**
  * nsMenuTimerMediator is a wrapper around an nsMenuFrame which can be safely
  * passed to timers. The class is reference counted unlike the underlying
  * nsMenuFrame, so that it will exist as long as the timer holds a reference
  * to it. The callback is delegated to the contained nsMenuFrame as long as
  * the contained nsMenuFrame has not been destroyed.
@@ -96,22 +101,22 @@ public:
   void ClearFrame();
 
 private:
 
   // Pointer to the wrapped frame.
   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
 
   // nsIBox
   NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
   virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
   virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
 
@@ -180,21 +185,21 @@ public:
 
   virtual nsMenuParent *GetMenuParent() { return mMenuParent; }
   const nsAString& GetRadioGroupName() { return mGroupName; }
   nsMenuType GetMenuType() { return mType; }
   nsMenuPopupFrame* GetPopup() { return mPopupFrame; }
 
   // 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();
 
   // indiciate that the menu's popup has just been opened, so that the menu
   // can update its open state. This method modifies the open attribute on
   // the menu, so the frames could be gone after this call.
   void PopupOpened();
   // indiciate that the menu's popup has just been closed, so that the menu
--- a/widget/src/gtk2/Makefile.in
+++ b/widget/src/gtk2/Makefile.in
@@ -132,13 +132,15 @@ CXXFLAGS += $(MOZ_GCONF_CFLAGS)
 endif
 endif
 
 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
 INCLUDES   	+= -I$(srcdir)/../shared/x11
 endif
--- a/widget/src/gtk2/nsNativeThemeGTK.cpp
+++ b/widget/src/gtk2/nsNativeThemeGTK.cpp
@@ -49,17 +49,17 @@
 #include "nsIPresShell.h"
 #include "nsIDocument.h"
 #include "nsIContent.h"
 #include "nsIViewManager.h"
 #include "nsINameSpaceManager.h"
 #include "nsILookAndFeel.h"
 #include "nsGfxCIID.h"
 #include "nsTransform2D.h"
-#include "nsIMenuFrame.h"
+#include "nsMenuFrame.h"
 #include "prlink.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsRenderingContext.h"
 #include "nsWidgetAtoms.h"
 #include "mozilla/Services.h"
 
 #include <gdk/gdkprivate.h>
 #include <gtk/gtk.h>
@@ -327,17 +327,17 @@ nsNativeThemeGTK::GetGtkWidgetAndState(P
         // if they are open, not on normal hover.
 
         if (aWidgetType == NS_THEME_MENUITEM ||
             aWidgetType == NS_THEME_CHECKMENUITEM ||
             aWidgetType == NS_THEME_RADIOMENUITEM ||
             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();
           }
 
           if (isTopLevel) {
             aState->inHover = menuFrame->IsOpen();
             *aWidgetFlags |= MOZ_TOPLEVEL_MENU_ITEM;
           } else {
--- a/widget/src/windows/Makefile.in
+++ b/widget/src/windows/Makefile.in
@@ -119,16 +119,18 @@ endif
 EXPORTS		= nsdefs.h WindowHook.h
 EXPORTS_NAMESPACES = mozilla/widget
 EXPORTS_mozilla/widget = AudioSession.h
 
 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)
 
 FORCE_STATIC_LIB = 1
 
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
--- a/widget/src/windows/nsNativeThemeWin.cpp
+++ b/widget/src/windows/nsNativeThemeWin.cpp
@@ -50,17 +50,17 @@
 #include "nsPresContext.h"
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsIFrame.h"
 #include "nsEventStates.h"
 #include "nsINameSpaceManager.h"
 #include "nsILookAndFeel.h"
 #include "nsIDOMHTMLInputElement.h"
-#include "nsIMenuFrame.h"
+#include "nsMenuFrame.h"
 #include "nsWidgetAtoms.h"
 #include <malloc.h>
 #include "nsWindow.h"
 #include "nsIComboboxControlFrame.h"
 #include "prinrval.h"
 
 #include "gfxPlatform.h"
 #include "gfxContext.h"
@@ -143,17 +143,17 @@ nsNativeThemeWin::nsNativeThemeWin() {
 
 nsNativeThemeWin::~nsNativeThemeWin() {
   nsUXThemeData::Invalidate();
 }
 
 static PRBool IsTopLevelMenu(nsIFrame *aFrame)
 {
   PRBool isTopLevel(PR_FALSE);
-  nsIMenuFrame *menuFrame = do_QueryFrame(aFrame);
+  nsMenuFrame *menuFrame = do_QueryFrame(aFrame);
   if (menuFrame) {
     isTopLevel = menuFrame->IsOnMenuBar();
   }
   return isTopLevel;
 }
 
 static MARGINS GetCheckboxMargins(HANDLE theme, HDC hdc)
 {
@@ -1057,17 +1057,17 @@ nsNativeThemeWin::GetThemePartAndState(n
       return NS_OK;
     }
     case NS_THEME_MENUITEM:
     case NS_THEME_CHECKMENUITEM: 
     case NS_THEME_RADIOMENUITEM: {
       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);
 
       if (menuFrame)
         isOpen = menuFrame->IsOpen();
 
       isHover = IsMenuActive(aFrame, aWidgetType);
@@ -2754,17 +2754,17 @@ nsresult nsNativeThemeWin::ClassicGetThe
       return NS_OK;
     }
     case NS_THEME_MENUITEM:
     case NS_THEME_CHECKMENUITEM:
     case NS_THEME_RADIOMENUITEM: {
       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,
       // 1 is a top-level menu item. The state of the item is composed of
       // DFCS_* flags only.
       aPart = 0;
       aState = 0;
 
--- a/widget/src/xpwidgets/nsNativeTheme.cpp
+++ b/widget/src/xpwidgets/nsNativeTheme.cpp
@@ -48,17 +48,17 @@
 #include "nsINameSpaceManager.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMXULMenuListElement.h"
 #include "nsILookAndFeel.h"
 #include "nsThemeConstants.h"
 #include "nsIComponentManager.h"
 #include "nsPIDOMWindow.h"
 #include "nsProgressFrame.h"
-#include "nsIMenuFrame.h"
+#include "nsMenuFrame.h"
 
 nsNativeTheme::nsNativeTheme()
 : mAnimatedContentTimeout(PR_UINT32_MAX)
 {
 }
 
 NS_IMPL_ISUPPORTS1(nsNativeTheme, nsITimerCallback)
 
@@ -509,17 +509,17 @@ nsNativeTheme::IsSubmenu(nsIFrame* aFram
   }
 
   return PR_FALSE;
 }
 
 PRBool
 nsNativeTheme::IsRegularMenuItem(nsIFrame *aFrame)
 {
-  nsIMenuFrame *menuFrame = do_QueryFrame(aFrame);
+  nsMenuFrame *menuFrame = do_QueryFrame(aFrame);
   return !(menuFrame && (menuFrame->IsOnMenuBar() ||
                          menuFrame->GetParentMenuListType() != eNotMenuList));
 }
 
 PRBool
 nsNativeTheme::IsMenuListEditable(nsIFrame *aFrame)
 {
   PRBool isEditable = PR_FALSE;