diff --git a/layout/style/nsCSSKeywordList.h b/layout/style/nsCSSKeywordList.h index ca88212ea846..daf05b45f3de 100644 --- a/layout/style/nsCSSKeywordList.h +++ b/layout/style/nsCSSKeywordList.h @@ -142,6 +142,7 @@ CSS_KEY(-moz-mac-alternateprimaryhighlight, _moz_mac_alternateprimaryhighlight) CSS_KEY(-moz-mac-focusring, _moz_mac_focusring) CSS_KEY(-moz-mac-menuselect, _moz_mac_menuselect) CSS_KEY(-moz-mac-menushadow, _moz_mac_menushadow) +CSS_KEY(-moz-mac-menutextdisable, _moz_mac_menutextdisable) CSS_KEY(-moz-mac-menutextselect, _moz_mac_menutextselect) CSS_KEY(-moz-mac-secondaryhighlight, _moz_mac_secondaryhighlight) CSS_KEY(-moz-malayalam, _moz_malayalam) diff --git a/layout/style/nsCSSProps.cpp b/layout/style/nsCSSProps.cpp index 9626ae6a632b..4098ab55c81e 100644 --- a/layout/style/nsCSSProps.cpp +++ b/layout/style/nsCSSProps.cpp @@ -434,6 +434,7 @@ const PRInt32 nsCSSProps::kColorKTable[] = { eCSSKeyword__moz_mac_focusring, nsILookAndFeel::eColor__moz_mac_focusring, eCSSKeyword__moz_mac_menuselect, nsILookAndFeel::eColor__moz_mac_menuselect, eCSSKeyword__moz_mac_menushadow, nsILookAndFeel::eColor__moz_mac_menushadow, + eCSSKeyword__moz_mac_menutextdisable, nsILookAndFeel::eColor__moz_mac_menutextdisable, eCSSKeyword__moz_mac_menutextselect, nsILookAndFeel::eColor__moz_mac_menutextselect, eCSSKeyword__moz_mac_accentlightesthighlight, nsILookAndFeel::eColor__moz_mac_accentlightesthighlight, eCSSKeyword__moz_mac_accentregularhighlight, nsILookAndFeel::eColor__moz_mac_accentregularhighlight, diff --git a/toolkit/themes/pinstripe/global/menu.css b/toolkit/themes/pinstripe/global/menu.css index 7412164706f3..5fb2ae0460c4 100644 --- a/toolkit/themes/pinstripe/global/menu.css +++ b/toolkit/themes/pinstripe/global/menu.css @@ -50,7 +50,7 @@ menuitem { -moz-appearance: menuitem !important; -moz-box-align: center; color: MenuText; - font: menu; + font: -moz-pull-down-menu; list-style-image: none; -moz-image-region: auto; } @@ -58,7 +58,7 @@ menuitem { menu[disabled="true"], menuitem[disabled="true"], menu[_moz-menuactive="true"][disabled="true"], menuitem[_moz-menuactive="true"][disabled="true"] { - color: GrayText; + color: -moz-mac-menutextdisable; } /* ..... internal content .... */ @@ -71,20 +71,20 @@ menuitem[_moz-menuactive="true"][disabled="true"] { } .menu-text { - margin-left: 20px !important; + margin-left: 13px !important; font-weight: inherit; } .menu-description { font-style: italic; - color: GrayText; + color: -moz-mac-menutextdisable; -moz-margin-start: 1ex !important; } .menu-accel, .menu-iconic-accel { margin: 0px 2px 0px 7px !important; - padding-right: 14px; + padding-right: 3px; color: inherit; } @@ -129,9 +129,9 @@ menupopup > menu, popup > menu, menupopup > menuitem, popup > menuitem { - padding: 1px 8px 1px 8px !important; + padding: 0px 8px 2px 8px !important; max-width: 42em; - min-height: 20px; + min-height: 19px; } menupopup > menu[_moz-menuactive="true"], @@ -149,7 +149,7 @@ menulist > menupopup > menuitem, menulist > menupopup > menu { padding-right: 25px !important; max-width: none; - font: inherit; + font: -moz-pull-down-menu; color: -moz-FieldText; } diff --git a/toolkit/themes/pinstripe/global/menu/menu-arrow-dis.gif b/toolkit/themes/pinstripe/global/menu/menu-arrow-dis.gif index 414fd6f45b81..c9932b0aa86f 100644 Binary files a/toolkit/themes/pinstripe/global/menu/menu-arrow-dis.gif and b/toolkit/themes/pinstripe/global/menu/menu-arrow-dis.gif differ diff --git a/toolkit/themes/pinstripe/global/menu/menu-arrow-hov.gif b/toolkit/themes/pinstripe/global/menu/menu-arrow-hov.gif index 741f4ce789c1..932918937b44 100644 Binary files a/toolkit/themes/pinstripe/global/menu/menu-arrow-hov.gif and b/toolkit/themes/pinstripe/global/menu/menu-arrow-hov.gif differ diff --git a/toolkit/themes/pinstripe/global/menu/menu-arrow.gif b/toolkit/themes/pinstripe/global/menu/menu-arrow.gif index 81f660fa9a2e..6d31ad6e2975 100644 Binary files a/toolkit/themes/pinstripe/global/menu/menu-arrow.gif and b/toolkit/themes/pinstripe/global/menu/menu-arrow.gif differ diff --git a/toolkit/themes/pinstripe/global/menu/menu-check-dis.gif b/toolkit/themes/pinstripe/global/menu/menu-check-dis.gif index 3bab5c0be272..416e2d65b336 100644 Binary files a/toolkit/themes/pinstripe/global/menu/menu-check-dis.gif and b/toolkit/themes/pinstripe/global/menu/menu-check-dis.gif differ diff --git a/toolkit/themes/pinstripe/global/menu/menu-check-dis.png b/toolkit/themes/pinstripe/global/menu/menu-check-dis.png index 10913c5f75ad..f3fd7d6ef784 100644 Binary files a/toolkit/themes/pinstripe/global/menu/menu-check-dis.png and b/toolkit/themes/pinstripe/global/menu/menu-check-dis.png differ diff --git a/toolkit/themes/pinstripe/global/menu/menu-check-hov.gif b/toolkit/themes/pinstripe/global/menu/menu-check-hov.gif index a7697ddf51d2..7277e07ea7aa 100644 Binary files a/toolkit/themes/pinstripe/global/menu/menu-check-hov.gif and b/toolkit/themes/pinstripe/global/menu/menu-check-hov.gif differ diff --git a/toolkit/themes/pinstripe/global/menu/menu-check-hov.png b/toolkit/themes/pinstripe/global/menu/menu-check-hov.png index e56a9544d236..f9f8b1e44c27 100644 Binary files a/toolkit/themes/pinstripe/global/menu/menu-check-hov.png and b/toolkit/themes/pinstripe/global/menu/menu-check-hov.png differ diff --git a/toolkit/themes/pinstripe/global/menu/menu-check.gif b/toolkit/themes/pinstripe/global/menu/menu-check.gif index 7be6dfcfc62b..3f09abb5dfe4 100644 Binary files a/toolkit/themes/pinstripe/global/menu/menu-check.gif and b/toolkit/themes/pinstripe/global/menu/menu-check.gif differ diff --git a/toolkit/themes/pinstripe/global/menu/menu-check.png b/toolkit/themes/pinstripe/global/menu/menu-check.png index 6408ee8e36f7..a18427658696 100644 Binary files a/toolkit/themes/pinstripe/global/menu/menu-check.png and b/toolkit/themes/pinstripe/global/menu/menu-check.png differ diff --git a/toolkit/themes/pinstripe/global/menu/menu-radio-hov.gif b/toolkit/themes/pinstripe/global/menu/menu-radio-hov.gif index 723473c16547..9d7474c866d3 100644 Binary files a/toolkit/themes/pinstripe/global/menu/menu-radio-hov.gif and b/toolkit/themes/pinstripe/global/menu/menu-radio-hov.gif differ diff --git a/toolkit/themes/pinstripe/global/menu/menu-radio.gif b/toolkit/themes/pinstripe/global/menu/menu-radio.gif index f3a0a48cfc57..d845a3059e41 100644 Binary files a/toolkit/themes/pinstripe/global/menu/menu-radio.gif and b/toolkit/themes/pinstripe/global/menu/menu-radio.gif differ diff --git a/widget/public/nsILookAndFeel.h b/widget/public/nsILookAndFeel.h index 3f1a921f5ffb..762e6cb8048d 100644 --- a/widget/public/nsILookAndFeel.h +++ b/widget/public/nsILookAndFeel.h @@ -139,6 +139,7 @@ public: eColor__moz_mac_focusring, //ring around text fields and lists eColor__moz_mac_menuselect, //colour used when mouse is over a menu item eColor__moz_mac_menushadow, //colour used to do shadows on menu items + eColor__moz_mac_menutextdisable, // color used to display text for disabled menu items eColor__moz_mac_menutextselect, //colour used to display text while mouse is over a menu item //all of the accent colours diff --git a/widget/src/mac/nsLookAndFeel.cpp b/widget/src/mac/nsLookAndFeel.cpp index 2464f67ff9fc..1a3d18eceb71 100644 --- a/widget/src/mac/nsLookAndFeel.cpp +++ b/widget/src/mac/nsLookAndFeel.cpp @@ -323,6 +323,9 @@ nsresult nsLookAndFeel::NativeGetColor(const nsColorID aID, nscolor &aColor) case eColor__moz_mac_menushadow: res = GetMacBrushColor(kThemeBrushBevelActiveDark, aColor, NS_RGB(0x88,0x88,0x88)); break; + case eColor__moz_mac_menutextdisable: + res = GetMacTextColor(kThemeTextColorMenuItemDisabled, aColor, NS_RGB(0x99,0x99,0x99)); + break; case eColor__moz_mac_menutextselect: //default to white, which is what Platinum uses, if not available res = GetMacTextColor(kThemeTextColorMenuItemSelected, aColor, NS_RGB(0xFF,0xFF,0xFF)); @@ -539,6 +542,9 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric) // xul popups are not allowed to overlap the menubar. aMetric = 0; break; + case eMetric_SkipNavigatingDisabledMenuItem: + aMetric = 1; + break; case eMetric_DragFullWindow: aMetric = 1; break; diff --git a/widget/src/mac/nsMacWindow.cpp b/widget/src/mac/nsMacWindow.cpp index 9d0b6ee29e52..73ab17d48bc0 100644 --- a/widget/src/mac/nsMacWindow.cpp +++ b/widget/src/mac/nsMacWindow.cpp @@ -53,11 +53,27 @@ #include "nsCRT.h" #include "nsWidgetSupport.h" -#include +#include +#include -#include -#include -#include +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_3 +#define kWindowFadeTransitionEffect 4 +#define kEventWindowTransitionCompleted 89 + +typedef struct TransitionWindowOptions { + UInt32 version; + EventTime duration; + WindowRef window; + void* userData; +} TransitionWindowOptions; +#endif + +typedef OSStatus (*TransitionWindowWithOptions_type) (WindowRef, + WindowTransitionEffect, + WindowTransitionAction, + const HIRect*, + Boolean, + TransitionWindowOptions*); static const char sScreenManagerContractID[] = "@mozilla.org/gfx/screenmanager;1"; @@ -236,12 +252,6 @@ nsMacWindow::nsMacWindow() : Inherited() nsMacWindow::~nsMacWindow() { if ( mWindowPtr && mWindowMadeHere ) { - - // cleanup our special defproc if we are a popup - if ( mWindowType == eWindowType_popup ) - RemoveBorderlessDefProc ( mWindowPtr ); - - // clean up DragManager stuff if ( mDragTrackingHandlerUPP ) { ::RemoveTrackingHandler ( mDragTrackingHandlerUPP, mWindowPtr ); @@ -593,6 +603,8 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent, // to handle activation { kEventClassWindow, kEventWindowActivated }, { kEventClassWindow, kEventWindowDeactivated }, + // to clean up after a transition is complete + { kEventClassWindow, kEventWindowTransitionCompleted }, }; static EventHandlerUPP sWindowEventHandlerUPP; @@ -635,10 +647,14 @@ nsresult nsMacWindow::StandardCreate(nsIWidget *aParent, NS_ASSERTION ( err == noErr, "can't install drag receive handler"); } - // If we're a popup, we don't want a border (we want CSS to draw it for us). So - // install our own window defProc. - if ( mWindowType == eWindowType_popup ) - InstallBorderlessDefProc(mWindowPtr); + if (mWindowType == eWindowType_popup) { + // Popup windows are used for contextual menus, pop-up/drop-down menus, + // autocomplete dropdowns, and tooltips, all of which have a very slight + // transparency when native. Use 5%, which is almost imperceptible + // and matches what Tiger does. + const float kPopupWindowAlpha = 0.95; + ::SetWindowAlpha(mWindowPtr, kPopupWindowAlpha); + } } // if we created windowPtr @@ -764,6 +780,12 @@ nsMacWindow::WindowEventHandler ( EventHandlerCallRef inHandlerChain, EventRef i } break; + case kEventWindowTransitionCompleted: { + self->mDeathGripDuringTransition = nsnull; + retVal = noErr; + break; + } + } // case of which event? } @@ -792,31 +814,6 @@ NS_IMETHODIMP nsMacWindow::Create(nsNativeWidget aNativeParent, // this is a w } -// -// InstallBorderlessDefProc -// -// For xul popups, we want borderless windows to match win32's borderless windows. Stash -// our fake WDEF into this window which takes care of not-drawing the borders. -// -void -nsMacWindow::InstallBorderlessDefProc ( WindowPtr inWindow ) -{ -} // InstallBorderlessDefProc - - -// -// RemoveBorderlessDefProc -// -// Clean up the mess we've made with our fake defproc. Reset it to -// the system one, just in case someone needs it around after we're -// through with it. -// -void -nsMacWindow::RemoveBorderlessDefProc ( WindowPtr inWindow ) -{ -} - - //------------------------------------------------------------------------- // // Hide or show this window @@ -973,8 +970,43 @@ NS_IMETHODIMP nsMacWindow::Show(PRBool aState) } } else { - if (mWindowPtr) - ::HideWindow(mWindowPtr); + if (mWindowPtr) { + static TransitionWindowWithOptions_type transitionFunc; + if (mWindowType == eWindowType_popup) { + // Popups will hide by fading out with TransitionWindowWithOptions, + // if available. It's present in 10.3 and later. If that SDK or + // newer is used, just grab the address of the function, otherwise, + // dynamically look it up at runtime. Fall back to calling + // HideWindow if TransitionWindowWithOptions isn't available. + static PRBool sChecked; + if (!sChecked) { + sChecked = PR_TRUE; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_3 + transitionFunc = ::TransitionWindowWithOptions; +#else + CFBundleRef carbonBundle = + ::CFBundleGetBundleWithIdentifier(CFSTR("com.apple.Carbon")); + if (carbonBundle) { + transitionFunc = (TransitionWindowWithOptions_type) + ::CFBundleGetFunctionPointerForName(carbonBundle, + CFSTR("TransitionWindowWithOptions")); + } +#endif + } + } + if (mWindowType == eWindowType_popup && transitionFunc) { + mDeathGripDuringTransition = this; + TransitionWindowOptions transitionOptions = { version : 0, + duration : 0.2, + window : nsnull, + userData : nsnull }; + transitionFunc(mWindowPtr, kWindowFadeTransitionEffect, + kWindowHideTransitionAction, nsnull, + PR_TRUE, &transitionOptions); + } + else + ::HideWindow(mWindowPtr); + } mShown = PR_FALSE; } } diff --git a/widget/src/mac/nsMacWindow.h b/widget/src/mac/nsMacWindow.h index 780b44d771c3..4627d482c348 100644 --- a/widget/src/mac/nsMacWindow.h +++ b/widget/src/mac/nsMacWindow.h @@ -136,9 +136,6 @@ public: protected: - void InstallBorderlessDefProc ( WindowPtr inWindow ) ; - void RemoveBorderlessDefProc ( WindowPtr inWindow ) ; - pascal static OSErr DragTrackingHandler ( DragTrackingMessage theMessage, WindowPtr theWindow, void *handlerRefCon, DragReference theDrag ); pascal static OSErr DragReceiveHandler (WindowPtr theWindow, @@ -168,6 +165,7 @@ protected: Point mBoundsOffset; // offset from window structure to content auto_ptr mMacEventHandler; nsIWidget *mOffsetParent; + nsCOMPtr mDeathGripDuringTransition; #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_3 PRPackedBool mNeedsResize; diff --git a/widget/src/xpwidgets/nsXPLookAndFeel.cpp b/widget/src/xpwidgets/nsXPLookAndFeel.cpp index 6372681f7aef..46840379dd5a 100644 --- a/widget/src/xpwidgets/nsXPLookAndFeel.cpp +++ b/widget/src/xpwidgets/nsXPLookAndFeel.cpp @@ -202,6 +202,7 @@ const char nsXPLookAndFeel::sColorPrefs[][38] = "ui.-moz-mac-focusring", "ui.-moz-mac-menuselect", "ui.-moz-mac-menushadow", + "ui.-moz-mac-menutextdisable", "ui.-moz-mac-menutextselect", "ui.-moz-mac-accentlightesthighlight", "ui.-moz-mac-accentregularhighlight",