remove XP_MAC usage. b=281889 r=cbarrett sr=roc a=roc

This commit is contained in:
joshmoz@gmail.com 2007-10-01 16:20:37 -07:00
parent fca13da9e7
commit f219b51c26
12 changed files with 23 additions and 108 deletions

View File

@ -61,7 +61,7 @@ class nsIFocusController;
class imgIContainer;
// mac uses click-hold context menus, a holdover from 4.x
#if defined(XP_MAC) || defined(XP_MACOSX)
#ifdef XP_MACOSX
#define CLICK_HOLD_CONTEXT_MENUS 1
#endif

View File

@ -88,12 +88,6 @@
// PSM2 includes
#include "nsISecureBrowserUI.h"
#if (defined(XP_MAC) || defined(XP_MACOSX)) && !defined(MOZ_WIDGET_COCOA)
#include <MacWindows.h>
#include "nsWidgetSupport.h"
#include "nsIEventSink.h"
#endif
static NS_DEFINE_IID(kWindowCID, NS_WINDOW_CID);
static NS_DEFINE_CID(kChildCID, NS_CHILD_CID);
static NS_DEFINE_CID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
@ -117,9 +111,6 @@ nsWebBrowser::nsWebBrowser() : mDocShellTreeOwner(nsnull),
mStream(nsnull),
mParentWidget(nsnull),
mListenerArray(nsnull)
#if (defined(XP_MAC) || defined(XP_MACOSX)) && !defined(MOZ_WIDGET_COCOA)
, mTopLevelWidget(nsnull)
#endif
{
mInitInfo = new nsWebBrowserInitInfo();
mWWatch = do_GetService(NS_WINDOWWATCHER_CONTRACTID);
@ -162,10 +153,6 @@ NS_IMETHODIMP nsWebBrowser::InternalDestroy()
mListenerArray = nsnull;
}
#if (defined(XP_MAC) || defined(XP_MACOSX)) && !defined(MOZ_WIDGET_COCOA)
NS_IF_RELEASE(mTopLevelWidget);
#endif
return NS_OK;
}
@ -206,11 +193,6 @@ NS_IMETHODIMP nsWebBrowser::GetInterface(const nsIID& aIID, void** aSink)
if(NS_SUCCEEDED(QueryInterface(aIID, aSink)))
return NS_OK;
#if (defined(XP_MAC) || defined(XP_MACOSX)) && !defined(MOZ_WIDGET_COCOA)
if (aIID.Equals(NS_GET_IID(nsIEventSink)) && mTopLevelWidget)
return mTopLevelWidget->QueryInterface(NS_GET_IID(nsIEventSink), aSink);
#endif
if (mDocShell) {
#ifdef NS_PRINTING
if (aIID.Equals(NS_GET_IID(nsIWebBrowserPrint))) {
@ -376,40 +358,6 @@ NS_IMETHODIMP nsWebBrowser::EnableGlobalHistory(PRBool aEnable)
return rv;
}
#if (defined(XP_MAC) || defined(XP_MACOSX)) && !defined(MOZ_WIDGET_COCOA)
NS_IMETHODIMP nsWebBrowser::EnsureTopLevelWidget(nativeWindow aWindow)
{
WindowPtr macWindow = static_cast<WindowPtr>(aWindow);
nsIWidget *widget = nsnull;
nsCOMPtr<nsIWidget> newWidget;
nsresult rv = NS_ERROR_FAILURE;
::GetWindowProperty(macWindow, kTopLevelWidgetPropertyCreator,
kTopLevelWidgetRefPropertyTag, sizeof(nsIWidget*), nsnull, (void*)&widget);
if (!widget) {
newWidget = do_CreateInstance(kWindowCID, &rv);
if (NS_SUCCEEDED(rv)) {
// Create it with huge bounds. The actual bounds that matters is that of the
// nsIBaseWindow. The bounds of the top level widget clips its children so
// we just have to make sure it is big enough to always contain the children.
nsRect r(0, 0, 32000, 32000);
rv = newWidget->Create(macWindow, r, nsnull, nsnull, nsnull, nsnull, nsnull);
if (NS_SUCCEEDED(rv))
widget = newWidget;
}
}
NS_ASSERTION(widget, "Failed to get or create a toplevel widget!!");
if (widget) {
mTopLevelWidget = widget;
NS_ADDREF(mTopLevelWidget); // Allows multiple nsWebBrowsers to be in 1 window.
rv = NS_OK;
}
return rv;
}
#endif
NS_IMETHODIMP nsWebBrowser::GetContainerWindow(nsIWebBrowserChrome** aTopWindow)
{
NS_ENSURE_ARG_POINTER(aTopWindow);
@ -1425,14 +1373,8 @@ NS_IMETHODIMP nsWebBrowser::GetParentNativeWindow(nativeWindow* aParentNativeWin
NS_IMETHODIMP nsWebBrowser::SetParentNativeWindow(nativeWindow aParentNativeWindow)
{
NS_ENSURE_STATE(!mDocShell);
#if (defined(XP_MAC) || defined(XP_MACOSX)) && !defined(MOZ_WIDGET_COCOA)
nsresult rv = EnsureTopLevelWidget(aParentNativeWindow);
NS_ENSURE_SUCCESS(rv, rv);
mParentNativeWindow = mTopLevelWidget->GetNativeData(NS_NATIVE_WINDOW);
#else
mParentNativeWindow = aParentNativeWindow;
#endif
return NS_OK;
}

View File

@ -190,13 +190,6 @@ protected:
//Weak Reference interfaces...
nsIWidget* mParentWidget;
nsVoidArray * mListenerArray;
#if (defined(XP_MAC) || defined(XP_MACOSX)) && !defined(MOZ_WIDGET_COCOA)
NS_IMETHOD EnsureTopLevelWidget(nativeWindow aWindow);
nsIWidget* mTopLevelWidget;
#endif
};
#endif /* nsWebBrowser_h__ */

View File

@ -450,9 +450,6 @@ void nsCaret::PaintCaret(nsDisplayListBuilder *aBuilder,
aCtx->FillRect(GetHookRect() + aOffset);
}
#ifdef XP_MAC
#pragma mark -
#endif
//-----------------------------------------------------------------------------
NS_IMETHODIMP nsCaret::NotifySelectionChanged(nsIDOMDocument *, nsISelection *aDomSel, PRInt16 aReason)
@ -485,9 +482,6 @@ NS_IMETHODIMP nsCaret::NotifySelectionChanged(nsIDOMDocument *, nsISelection *aD
return NS_OK;
}
#ifdef XP_MAC
#pragma mark -
#endif
//-----------------------------------------------------------------------------
void nsCaret::KillTimer()
@ -796,7 +790,7 @@ void nsCaret::GetViewForRendering(nsIFrame *caretFrame,
// Our best approach is to use the event fired widget related view.
// But if we do so, we need large change for editor and this.
if (coordType == eIMECoordinates) {
#if defined(XP_MAC) || defined(XP_MACOSX) || defined(XP_WIN)
#if defined(XP_MACOSX) || defined(XP_WIN)
// #59405 and #313918, on Mac and Windows, the coordinate for IME need to be
// root view related.
coordType = eTopLevelWindowCoordinates;
@ -1126,10 +1120,6 @@ void nsCaret::InvalidateRects(const nsRect &aRect, const nsRect &aHook,
aFrame->Invalidate(rect, PR_FALSE);
}
#ifdef XP_MAC
#pragma mark -
#endif
//-----------------------------------------------------------------------------
/* static */
void nsCaret::CaretBlinkCallback(nsITimer *aTimer, void *aClosure)

View File

@ -1550,7 +1550,7 @@ nsFrame::GetDataForTableSelection(nsFrameSelection *aFrameSelection,
{
// In Browser, special 'table selection' key must be pressed for table selection
// or when just Shift is pressed and we're already in table/cell selection mode
#if defined(XP_MAC) || defined(XP_MACOSX)
#ifdef XP_MACOSX
doTableSelection = aMouseEvent->isMeta || (aMouseEvent->isShift && selectingTableCells);
#else
doTableSelection = aMouseEvent->isControl || (aMouseEvent->isShift && selectingTableCells);
@ -1786,7 +1786,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
nsMouseEvent *me = (nsMouseEvent *)aEvent;
#if defined(XP_MAC) || defined(XP_MACOSX)
#ifdef XP_MACOSX
if (me->isControl)
return NS_OK;//short ciruit. hard coded for mac due to time restraints.
#endif
@ -1866,7 +1866,7 @@ nsFrame::HandlePress(nsPresContext* aPresContext,
frameselection->SetMouseDownState(PR_TRUE);
#if defined(XP_MAC) || defined(XP_MACOSX)
#ifdef XP_MACOSX
PRBool control = me->isMeta;
#else
PRBool control = me->isControl;

View File

@ -809,9 +809,6 @@ nsSelectionIterator::IsDone()
////////////END nsSelectionIterator methods
#ifdef XP_MAC
#pragma mark -
#endif
////////////BEGIN nsFrameSelection methods
@ -1124,9 +1121,6 @@ nsFrameSelection::UndefineCaretBidiLevel()
}
#endif
#ifdef XP_MAC
#pragma mark -
#endif
#ifdef PRINT_RANGE
void printRange(nsIDOMRange *aDomRange)
@ -3156,7 +3150,7 @@ printf("HandleTableSelection: Mouse UP event. mDragSelectingCells=%d, mStartSele
// Any other mouseup actions require that Ctrl or Cmd key is pressed
// else stop table selection mode
PRBool doMouseUpAction = PR_FALSE;
#if defined(XP_MAC) || defined(XP_MACOSX)
#ifdef XP_MACOSX
doMouseUpAction = aMouseEvent->isMeta;
#else
doMouseUpAction = aMouseEvent->isControl;
@ -3880,10 +3874,6 @@ nsFrameSelection::SetAncestorLimiter(nsIContent *aLimiter)
//END nsFrameSelection methods
#ifdef XP_MAC
#pragma mark -
#endif
//BEGIN nsISelection interface implementations

View File

@ -904,7 +904,7 @@ nsPrintEngine::GetCurrentPrintSettings(nsIPrintSettings * *aCurrentPrintSettings
nsresult
nsPrintEngine::CheckForPrinters(nsIPrintSettings* aPrintSettings)
{
#if defined(XP_MAC) || defined(XP_MACOSX)
#ifdef XP_MACOSX
// Mac doesn't support retrieving a printer list.
return NS_OK;
#else

View File

@ -109,12 +109,12 @@ void nsMenuBarListener::InitAccessKey()
// Compiled-in defaults, in case we can't get LookAndFeel --
// mac doesn't have menu shortcuts, other platforms use alt.
#if !(defined(XP_MAC) || defined(XP_MACOSX))
mAccessKey = nsIDOMKeyEvent::DOM_VK_ALT;
mAccessKeyMask = MODIFIER_ALT;
#else
#ifdef XP_MACOSX
mAccessKey = 0;
mAccessKeyMask = 0;
#else
mAccessKey = nsIDOMKeyEvent::DOM_VK_ALT;
mAccessKeyMask = MODIFIER_ALT;
#endif
// Get the menu access key value from prefs, overriding the default:
@ -249,7 +249,7 @@ nsMenuBarListener::KeyPress(nsIDOMEvent* aKeyEvent)
retVal = NS_OK; // I am consuming event
}
}
#if !defined(XP_MAC) && !defined(XP_MACOSX)
#ifndef XP_MACOSX
// Also need to handle F10 specially on Non-Mac platform.
else if (keyCode == NS_VK_F10) {
if ((GetModifiers(keyEvent) & ~MODIFIER_CONTROL) == 0) {
@ -262,7 +262,7 @@ nsMenuBarListener::KeyPress(nsIDOMEvent* aKeyEvent)
return NS_OK; // consume the event
}
}
#endif // !XP_MAC && !XP_MACOSX
#endif // !XP_MACOSX
}
}

View File

@ -1075,7 +1075,7 @@ nsMenuFrame::BuildAcceleratorText()
{
// Compiled-in defaults, in case we can't get LookAndFeel --
// command for mac, control for all other platforms.
#if defined(XP_MAC) || defined(XP_MACOSX)
#ifdef XP_MACOSX
accelKey = nsIDOMKeyEvent::DOM_VK_META;
#else
accelKey = nsIDOMKeyEvent::DOM_VK_CONTROL;

View File

@ -45,7 +45,7 @@
#include "nsRepeatService.h"
#include "nsIServiceManager.h"
#if defined(XP_MAC) || defined(XP_MACOSX)
#ifdef XP_MACOSX
#define INITAL_REPEAT_DELAY 250
#define REPEAT_DELAY 25
#else

View File

@ -1759,13 +1759,13 @@ nsXULPopupManager::KeyPress(nsIDOMEvent* aKeyEvent)
ShowMenu(content, PR_TRUE, PR_FALSE);
}
}
#if !defined(XP_MAC) && !defined(XP_MACOSX)
#ifndef XP_MACOSX
else if (theChar == NS_VK_F10) {
// doesn't matter what modifier keys are down in Non-Mac platform
// if the menu bar is active and F10 is pressed - deactivate it
Rollup();
}
#endif // !XP_MAC && !XP_MACOSX
#endif // !XP_MACOSX
else {
HandleShortcutNavigation(keyEvent, nsnull);
}

View File

@ -672,7 +672,7 @@ nsTreeBodyFrame::InvalidateRow(PRInt32 aIndex)
return NS_OK;
nsRect rowRect(mInnerBox.x, mInnerBox.y+mRowHeight*aIndex, mInnerBox.width, mRowHeight);
#if defined(XP_MAC) || defined(XP_MACOSX)
#ifdef XP_MACOSX
// Mac can't process the event loop during a drag, so if we're dragging,
// invalidate synchronously.
nsLeafBoxFrame::Invalidate(rowRect, mSlots && mSlots->mDragSession ? PR_TRUE : PR_FALSE);
@ -2565,7 +2565,9 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext,
mSlots->mDropAllowed = PR_FALSE;
InvalidateDropFeedback(lastDropRow, lastDropOrient);
}
#if !defined(XP_MACOSX)
#ifdef XP_MACOSX
ScrollByLines(mSlots->mScrollLines);
#else
if (!lastScrollLines) {
// Cancel any previously initialized timer.
if (mSlots->mTimer) {
@ -2578,8 +2580,6 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext,
LazyScrollCallback, nsITimer::TYPE_ONE_SHOT,
getter_AddRefs(mSlots->mTimer));
}
#else
ScrollByLines(mSlots->mScrollLines);
#endif
// Bail out to prevent spring loaded timer and feedback line settings.
return NS_OK;
@ -3880,7 +3880,7 @@ nsresult nsTreeBodyFrame::ScrollToRowInternal(const ScrollParts& aParts, PRInt32
{
ScrollInternal(aParts, aRow);
#if defined(XP_MAC) || defined(XP_MACOSX)
#ifdef XP_MACOSX
// mac can't process the event loop during a drag, so if we're dragging,
// grab the scroll widget and make it paint synchronously. This is
// sorta slow (having to paint the entire tree), but it works.