mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 674370 - Make browser windows (and other document-like windows) zoom on creation on OS X 10.7. r=mstange,dao sr=bzbarsky
This commit is contained in:
parent
8d23f9b616
commit
407103f6cc
@ -90,6 +90,7 @@
|
||||
lightweightthemes="true"
|
||||
lightweightthemesfooter="browser-bottombox"
|
||||
windowtype="navigator:browser"
|
||||
macanimationtype="document"
|
||||
screenX="4" screenY="4"
|
||||
browsingmode="normal"
|
||||
persist="screenX screenY width height sizemode">
|
||||
|
@ -3816,7 +3816,7 @@ SessionStoreService.prototype = {
|
||||
argString.data = "";
|
||||
|
||||
// Build feature string
|
||||
let features = "chrome,dialog=no,all";
|
||||
let features = "chrome,dialog=no,macsuppressanimation,all";
|
||||
let winState = aState.windows[0];
|
||||
WINDOW_ATTRIBUTES.forEach(function(aFeature) {
|
||||
// Use !isNaN as an easy way to ignore sizemode and check for numbers
|
||||
|
@ -51,6 +51,7 @@
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&window.title;"
|
||||
windowtype="devtools:scratchpad"
|
||||
macanimationtype="document"
|
||||
screenX="4" screenY="4"
|
||||
width="640" height="480"
|
||||
persist="screenX screenY width height sizemode">
|
||||
|
@ -47,7 +47,7 @@ interface nsIDocShellTreeItem;
|
||||
* containing an embedded Gecko web browser.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(BA434C60-9D52-11d3-AFB0-00A024FFC08C)]
|
||||
[scriptable, uuid(E8C414C4-DC38-4BA3-AB4E-EC4CBBE22907)]
|
||||
interface nsIWebBrowserChrome : nsISupports
|
||||
{
|
||||
const unsigned long STATUS_SCRIPT = 0x00000001;
|
||||
@ -96,6 +96,10 @@ interface nsIWebBrowserChrome : nsISupports
|
||||
const unsigned long CHROME_WINDOW_MIN = 0x00004000;
|
||||
const unsigned long CHROME_WINDOW_POPUP = 0x00008000;
|
||||
|
||||
// Prevents new window animations on Mac OS X Lion. Ignored on other
|
||||
// platforms.
|
||||
const unsigned long CHROME_MAC_SUPPRESS_ANIMATION = 0x01000000;
|
||||
|
||||
const unsigned long CHROME_WINDOW_RAISED = 0x02000000;
|
||||
const unsigned long CHROME_WINDOW_LOWERED = 0x04000000;
|
||||
const unsigned long CHROME_CENTER_SCREEN = 0x08000000;
|
||||
|
@ -1527,6 +1527,9 @@ PRUint32 nsWindowWatcher::CalculateChromeFlags(const char *aFeatures,
|
||||
else if (WinHasOption(aFeatures, "alwaysRaised", 0, nsnull))
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_WINDOW_RAISED;
|
||||
|
||||
chromeFlags |= WinHasOption(aFeatures, "macsuppressanimation", 0, nsnull) ?
|
||||
nsIWebBrowserChrome::CHROME_MAC_SUPPRESS_ANIMATION : 0;
|
||||
|
||||
chromeFlags |= WinHasOption(aFeatures, "chrome", 0, nsnull) ?
|
||||
nsIWebBrowserChrome::CHROME_OPENAS_CHROME : 0;
|
||||
chromeFlags |= WinHasOption(aFeatures, "extrachrome", 0, nsnull) ?
|
||||
|
@ -197,6 +197,21 @@ typedef struct _nsCocoaWindowList {
|
||||
- (void)setDrawsContentsIntoWindowFrame:(BOOL)aState;
|
||||
@end
|
||||
|
||||
#if !defined(MAC_OS_X_VERSION_10_7) || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7)
|
||||
enum {
|
||||
NSWindowAnimationBehaviorDefault = 0,
|
||||
NSWindowAnimationBehaviorNone = 2,
|
||||
NSWindowAnimationBehaviorDocumentWindow = 3,
|
||||
NSWindowAnimationBehaviorUtilityWindow = 4,
|
||||
NSWindowAnimationBehaviorAlertPanel = 5
|
||||
};
|
||||
typedef NSInteger NSWindowAnimationBehavior;
|
||||
|
||||
@interface NSWindow (LionWindowFeatures)
|
||||
- (void)setAnimationBehavior:(NSWindowAnimationBehavior)newAnimationBehavior;
|
||||
@end
|
||||
#endif
|
||||
|
||||
class nsCocoaWindow : public nsBaseWidget, public nsPIWidgetCocoa
|
||||
{
|
||||
private:
|
||||
@ -266,6 +281,7 @@ public:
|
||||
virtual void SetTransparencyMode(nsTransparencyMode aMode);
|
||||
NS_IMETHOD SetWindowShadowStyle(PRInt32 aStyle);
|
||||
virtual void SetShowsToolbarButton(bool aShow);
|
||||
virtual void SetWindowAnimationType(WindowAnimationType aType);
|
||||
NS_IMETHOD SetWindowTitlebarColor(nscolor aColor, bool aActive);
|
||||
virtual void SetDrawsInTitlebar(bool aState);
|
||||
virtual nsresult SynthesizeNativeMouseEvent(nsIntPoint aPoint,
|
||||
@ -335,12 +351,16 @@ protected:
|
||||
PRInt32 mShadowStyle;
|
||||
NSUInteger mWindowFilter;
|
||||
|
||||
WindowAnimationType mAnimationType;
|
||||
|
||||
bool mWindowMadeHere; // true if we created the window, false for embedding
|
||||
bool mSheetNeedsShow; // if this is a sheet, are we waiting to be shown?
|
||||
// this is used for sibling sheet contention only
|
||||
bool mFullScreen;
|
||||
bool mModal;
|
||||
|
||||
bool mIsAnimationSuppressed;
|
||||
|
||||
bool mInReportMoveEvent; // true if in a call to ReportMoveEvent().
|
||||
|
||||
PRInt32 mNumModalDescendents;
|
||||
|
@ -135,10 +135,12 @@ nsCocoaWindow::nsCocoaWindow()
|
||||
, mPopupContentView(nil)
|
||||
, mShadowStyle(NS_STYLE_WINDOW_SHADOW_DEFAULT)
|
||||
, mWindowFilter(0)
|
||||
, mAnimationType(nsIWidget::eGenericWindowAnimation)
|
||||
, mWindowMadeHere(false)
|
||||
, mSheetNeedsShow(false)
|
||||
, mFullScreen(false)
|
||||
, mModal(false)
|
||||
, mIsAnimationSuppressed(false)
|
||||
, mInReportMoveEvent(false)
|
||||
, mNumModalDescendents(0)
|
||||
{
|
||||
@ -304,6 +306,8 @@ nsresult nsCocoaWindow::Create(nsIWidget *aParent,
|
||||
return CreatePopupContentView(newBounds, aHandleEventFunction, aContext);
|
||||
}
|
||||
|
||||
mIsAnimationSuppressed = aInitData->mIsAnimationSuppressed;
|
||||
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
@ -745,6 +749,26 @@ NS_IMETHODIMP nsCocoaWindow::Show(bool bState)
|
||||
}
|
||||
else {
|
||||
NS_OBJC_BEGIN_TRY_LOGONLY_BLOCK;
|
||||
if (mWindowType == eWindowType_toplevel &&
|
||||
[mWindow respondsToSelector:@selector(setAnimationBehavior:)]) {
|
||||
NSWindowAnimationBehavior behavior;
|
||||
if (mIsAnimationSuppressed) {
|
||||
behavior = NSWindowAnimationBehaviorNone;
|
||||
} else {
|
||||
switch (mAnimationType) {
|
||||
case nsIWidget::eDocumentWindowAnimation:
|
||||
behavior = NSWindowAnimationBehaviorDocumentWindow;
|
||||
break;
|
||||
default:
|
||||
NS_NOTREACHED("unexpected mAnimationType value");
|
||||
// fall through
|
||||
case nsIWidget::eGenericWindowAnimation:
|
||||
behavior = NSWindowAnimationBehaviorDefault;
|
||||
break;
|
||||
}
|
||||
}
|
||||
[mWindow setAnimationBehavior:behavior];
|
||||
}
|
||||
[mWindow makeKeyAndOrderFront:nil];
|
||||
NS_OBJC_END_TRY_LOGONLY_BLOCK;
|
||||
SendSetZLevelEvent();
|
||||
@ -1618,6 +1642,11 @@ void nsCocoaWindow::SetShowsToolbarButton(bool aShow)
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK;
|
||||
}
|
||||
|
||||
void nsCocoaWindow::SetWindowAnimationType(nsIWidget::WindowAnimationType aType)
|
||||
{
|
||||
mAnimationType = aType;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsCocoaWindow::SetWindowTitlebarColor(nscolor aColor, bool aActive)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
@ -1017,6 +1017,20 @@ class nsIWidget : public nsISupports {
|
||||
*/
|
||||
virtual void SetShowsToolbarButton(bool aShow) = 0;
|
||||
|
||||
enum WindowAnimationType {
|
||||
eGenericWindowAnimation,
|
||||
eDocumentWindowAnimation
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the kind of top-level window animation this widget should have. On
|
||||
* Mac OS X, this causes a particular kind of animation to be shown when the
|
||||
* window is first made visible.
|
||||
*
|
||||
* Ignored on child widgets and on non-Mac platforms.
|
||||
*/
|
||||
virtual void SetWindowAnimationType(WindowAnimationType aType) = 0;
|
||||
|
||||
/**
|
||||
* Hide window chrome (borders, buttons) for this widget.
|
||||
*
|
||||
|
@ -133,7 +133,8 @@ struct nsWidgetInitData {
|
||||
mUnicode(true),
|
||||
mRTL(false),
|
||||
mNoAutoHide(false),
|
||||
mIsDragPopup(false)
|
||||
mIsDragPopup(false),
|
||||
mIsAnimationSuppressed(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -148,6 +149,8 @@ struct nsWidgetInitData {
|
||||
bool mRTL;
|
||||
bool mNoAutoHide; // true for noautohide panels
|
||||
bool mIsDragPopup; // true for drag feedback panels
|
||||
bool mIsAnimationSuppressed; // true if window creation animation is
|
||||
// suppressed, e.g. for session restore
|
||||
};
|
||||
|
||||
#endif // nsWidgetInitData_h__
|
||||
|
@ -123,6 +123,7 @@ public:
|
||||
virtual void GetWindowClipRegion(nsTArray<nsIntRect>* aRects);
|
||||
NS_IMETHOD SetWindowShadowStyle(PRInt32 aStyle);
|
||||
virtual void SetShowsToolbarButton(bool aShow) {}
|
||||
virtual void SetWindowAnimationType(WindowAnimationType aType) {}
|
||||
NS_IMETHOD HideWindowChrome(bool aShouldHide);
|
||||
NS_IMETHOD MakeFullScreen(bool aFullScreen);
|
||||
virtual nsDeviceContext* GetDeviceContext();
|
||||
|
@ -308,6 +308,9 @@ nsAppShellService::JustCreateTopWindow(nsIXULWindow *aParent,
|
||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_WINDOW_POPUP)
|
||||
widgetInitData.mWindowType = eWindowType_popup;
|
||||
|
||||
if (aChromeMask & nsIWebBrowserChrome::CHROME_MAC_SUPPRESS_ANIMATION)
|
||||
widgetInitData.mIsAnimationSuppressed = true;
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
// Mac OS X sheet support
|
||||
// Adding CHROME_OPENAS_CHROME to sheetMask makes modal windows opened from
|
||||
|
@ -1412,6 +1412,12 @@ void nsXULWindow::SyncAttributesToWidget()
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mWindow->SetShowsToolbarButton(attr.LowerCaseEqualsLiteral("true"));
|
||||
}
|
||||
|
||||
// "macanimationtype" attribute
|
||||
rv = windowElement->GetAttribute(NS_LITERAL_STRING("macanimationtype"), attr);
|
||||
if (NS_SUCCEEDED(rv) && attr.EqualsLiteral("document")) {
|
||||
mWindow->SetWindowAnimationType(nsIWidget::eDocumentWindowAnimation);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsXULWindow::SavePersistentAttributes()
|
||||
|
Loading…
Reference in New Issue
Block a user