From f908c73507d04248438e3517e46626b497d98070 Mon Sep 17 00:00:00 2001 From: "smichaud@pobox.com" Date: Wed, 23 Apr 2008 09:08:00 -0700 Subject: [PATCH] "Default browser" or proxy auth dialog (sheet) appears mostly off-screen. b=424266 r=josh sr=roc a=dsicore --- widget/src/cocoa/nsMenuItemIconX.h | 4 -- widget/src/cocoa/nsMenuItemIconX.mm | 84 ----------------------------- 2 files changed, 88 deletions(-) diff --git a/widget/src/cocoa/nsMenuItemIconX.h b/widget/src/cocoa/nsMenuItemIconX.h index b32f7631076a..e774ad4ffdd5 100644 --- a/widget/src/cocoa/nsMenuItemIconX.h +++ b/widget/src/cocoa/nsMenuItemIconX.h @@ -83,10 +83,6 @@ public: // icon. The request may not complete until after LoadIcon returns. nsresult LoadIcon(nsIURI* aIconURI); - // ShouldLoadSync returns PR_TRUE if the LoadIcon should load the icon - // synchronously. - PRBool ShouldLoadSync(nsIURI* aURI); - protected: nsCOMPtr mContent; nsCOMPtr mIconRequest; diff --git a/widget/src/cocoa/nsMenuItemIconX.mm b/widget/src/cocoa/nsMenuItemIconX.mm index a8f00d3eaa9a..a756b4ecc812 100644 --- a/widget/src/cocoa/nsMenuItemIconX.mm +++ b/widget/src/cocoa/nsMenuItemIconX.mm @@ -279,96 +279,12 @@ nsMenuItemIconX::LoadIcon(nsIURI* aIconURI) nsnull, getter_AddRefs(mIconRequest)); if (NS_FAILED(rv)) return rv; - // The icon will be picked up in OnStopFrame, which may be called after - // LoadImage returns. If the load is to be synchronous, ensure that - // it completes now. - - if (ShouldLoadSync(aIconURI)) { - // If there are any failures at this point, just return NS_OK and let - // the image load asynchronously to completion. - - nsCOMPtr thread = NS_GetCurrentThread(); - if (!thread) return NS_OK; - - rv = NS_OK; - while (!mLoadedIcon && mIconRequest && NS_SUCCEEDED(rv)) { - PRBool processed; - rv = thread->ProcessNextEvent(PR_TRUE, &processed); - if (NS_SUCCEEDED(rv) && !processed) - rv = NS_ERROR_UNEXPECTED; - } - } - return NS_OK; NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; } -PRBool -nsMenuItemIconX::ShouldLoadSync(nsIURI* aURI) -{ -#if 0 // bug 338225 - // Older menu managers are unable to cope with menu item icons changing - // while a menu is open in tracking. On Panther (10.3), the updated icon - // will not be displayed and highlighting of menu items in the affected - // menu will be incorrect until menu tracking ends and the menu is - // reopened. On Jaguar (10.2), the updated icon will not be displayed - // until the menu item is selected or deselected. Tiger (10.4) does - // not have these problems. - // - // Because icons are set in an imgIDecoderObserver notification, it's - // possible and even likely that some icons will not be set until after the - // menu is open. On systems where this is known to cause trouble, - // LoadIcon is made to set the icon on the menu item synchronously when - // the source of the icon is local, as determined by the URI scheme. -#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4 - return PR_FALSE; -#else - static PRBool sNeedsSync; - - static PRBool sInitialized; - if (!sInitialized) { - sInitialized = PR_TRUE; - sNeedsSync = (nsToolkit::OSXVersion() < MAC_OS_X_VERSION_10_4_HEX); - } - - if (sNeedsSync) { - PRBool isLocalScheme; - if (NS_SUCCEEDED(aURI->SchemeIs("chrome", &isLocalScheme)) && - isLocalScheme) - return PR_TRUE; - if (NS_SUCCEEDED(aURI->SchemeIs("data", &isLocalScheme)) && - isLocalScheme) - return PR_TRUE; - if (NS_SUCCEEDED(aURI->SchemeIs("moz-anno", &isLocalScheme)) && - isLocalScheme) - return PR_TRUE; - } - - return PR_FALSE; -#endif -#else // bug 338225 - // Bug 338225 prevents any Gecko events from being processed while - // MenuSelect is tracking the menu. Bug 346108 (duplicate) applies - // specifically to this issue. Make the load synchronous on any OS - // release if it's coming from a local scheme as a workaround. - PRBool isLocalScheme; - if (NS_SUCCEEDED(aURI->SchemeIs("chrome", &isLocalScheme)) && - isLocalScheme) - return PR_TRUE; - if (NS_SUCCEEDED(aURI->SchemeIs("data", &isLocalScheme)) && - isLocalScheme) - return PR_TRUE; - if (NS_SUCCEEDED(aURI->SchemeIs("moz-anno", &isLocalScheme)) && - isLocalScheme) - return PR_TRUE; - - return PR_FALSE; -#endif // bug 338225 -} - - // // imgIContainerObserver //