Bug 670148, remove nsIMenuFrame, r=roc

This commit is contained in:
Neil Deakin 2011-07-11 10:05:07 -04:00
Родитель 6c0a229437
Коммит 20885dc711
11 изменённых файлов: 30 добавлений и 91 удалений

Просмотреть файл

@ -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;

Просмотреть файл

@ -79,7 +79,6 @@
#include "nsPIDOMWindow.h"
#include "nsIViewManager.h"
#include "nsDOMError.h"
#include "nsIMenuFrame.h"
using namespace mozilla;

Просмотреть файл

@ -48,7 +48,6 @@ GRE_MODULE = 1
EXPORTS = \
nsPIBoxObject.h \
nsIMenuFrame.h \
nsIScrollbarMediator.h \
nsXULPopupManager.h \
$(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

Просмотреть файл

@ -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)
//

Просмотреть файл

@ -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, // <menulist/>
eEditableMenuList // <menulist editable="true"/>
};
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();

Просмотреть файл

@ -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

Просмотреть файл

@ -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();
}

Просмотреть файл

@ -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)

Просмотреть файл

@ -55,7 +55,7 @@
#include "nsINameSpaceManager.h"
#include "nsILookAndFeel.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIMenuFrame.h"
#include "nsMenuFrame.h"
#include "nsWidgetAtoms.h"
#include <malloc.h>
#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,

Просмотреть файл

@ -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));
}