зеркало из https://github.com/mozilla/gecko-dev.git
"Default browser" or proxy auth dialog (sheet) appears mostly off-screen. b=424266 r=josh sr=roc a=dsicore
This commit is contained in:
Родитель
b1b8b35cff
Коммит
f908c73507
|
@ -83,10 +83,6 @@ public:
|
||||||
// icon. The request may not complete until after LoadIcon returns.
|
// icon. The request may not complete until after LoadIcon returns.
|
||||||
nsresult LoadIcon(nsIURI* aIconURI);
|
nsresult LoadIcon(nsIURI* aIconURI);
|
||||||
|
|
||||||
// ShouldLoadSync returns PR_TRUE if the LoadIcon should load the icon
|
|
||||||
// synchronously.
|
|
||||||
PRBool ShouldLoadSync(nsIURI* aURI);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsCOMPtr<nsIContent> mContent;
|
nsCOMPtr<nsIContent> mContent;
|
||||||
nsCOMPtr<imgIRequest> mIconRequest;
|
nsCOMPtr<imgIRequest> mIconRequest;
|
||||||
|
|
|
@ -279,96 +279,12 @@ nsMenuItemIconX::LoadIcon(nsIURI* aIconURI)
|
||||||
nsnull, getter_AddRefs(mIconRequest));
|
nsnull, getter_AddRefs(mIconRequest));
|
||||||
if (NS_FAILED(rv)) return rv;
|
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<nsIThread> 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;
|
return NS_OK;
|
||||||
|
|
||||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
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
|
// imgIContainerObserver
|
||||||
//
|
//
|
||||||
|
|
Загрузка…
Ссылка в новой задаче