Bug 674370 - Make browser windows (and other document-like windows) zoom on creation on OS X 10.7. r=mstange,dao sr=bzbarsky
☠☠ backed out by 76506440478a ☠ ☠
authorCameron McCormack <cam@mcc.id.au>
Wed, 08 Feb 2012 11:44:45 +1100
changeset 86511 7a8b935ab5966debff24c02620c5ace7e65c95a0
parent 86510 fb59e7eae2a9f1b78ba66eeb52e8d9f9be127343
child 86512 d6f1d1fbe13a5901c329eab9b1c9cd6eb14b0421
push id102
push userMs2ger@gmail.com
push dateFri, 10 Feb 2012 20:38:19 +0000
reviewersmstange, dao, bzbarsky
bugs674370
milestone13.0a1
Bug 674370 - Make browser windows (and other document-like windows) zoom on creation on OS X 10.7. r=mstange,dao sr=bzbarsky
browser/base/content/browser.xul
browser/components/sessionstore/src/nsSessionStore.js
browser/devtools/scratchpad/scratchpad.xul
embedding/browser/webBrowser/nsIWebBrowserChrome.idl
embedding/components/windowwatcher/src/nsWindowWatcher.cpp
widget/cocoa/nsCocoaWindow.h
widget/cocoa/nsCocoaWindow.mm
widget/nsIWidget.h
widget/nsWidgetInitData.h
widget/xpwidgets/nsBaseWidget.h
xpfe/appshell/src/nsAppShellService.cpp
xpfe/appshell/src/nsXULWindow.cpp
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -85,16 +85,17 @@
         titlemodifier="&mainWindow.titlemodifier;@PRE_RELEASE_SUFFIX@"
         titlemodifier_normal="&mainWindow.titlemodifier;@PRE_RELEASE_SUFFIX@"
         titlemodifier_privatebrowsing="&mainWindow.titlemodifier;@PRE_RELEASE_SUFFIX@ &mainWindow.titlePrivateBrowsingSuffix;"
 #endif
         titlemenuseparator="&mainWindow.titlemodifiermenuseparator;"
         lightweightthemes="true"
         lightweightthemesfooter="browser-bottombox"
         windowtype="navigator:browser"
+        macanimationtype="document"
         screenX="4" screenY="4"
         browsingmode="normal"
         persist="screenX screenY width height sizemode">
 
 # All JS files which are not content (only) dependent that browser.xul
 # wishes to include *must* go into the global-scripts.inc file
 # so that they can be shared by macBrowserOverlay.xul.
 #include global-scripts.inc
--- a/browser/components/sessionstore/src/nsSessionStore.js
+++ b/browser/components/sessionstore/src/nsSessionStore.js
@@ -3805,17 +3805,17 @@ SessionStoreService.prototype = {
    *        Object containing session data
    */
   _openWindowWithState: function sss_openWindowWithState(aState) {
     var argString = Cc["@mozilla.org/supports-string;1"].
                     createInstance(Ci.nsISupportsString);
     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
       if (aFeature in winState && !isNaN(winState[aFeature]))
         features += "," + aFeature + "=" + winState[aFeature];
     });
 
     var window =
--- a/browser/devtools/scratchpad/scratchpad.xul
+++ b/browser/devtools/scratchpad/scratchpad.xul
@@ -46,16 +46,17 @@
 <?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
 <?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
 <?xul-overlay href="chrome://browser/content/source-editor-overlay.xul"?>
 
 <window id="main-window"
         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">
 
 <script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
 <script type="application/javascript" src="chrome://browser/content/scratchpad.js"/>
 
 <commandset id="editMenuCommands"/>
--- a/embedding/browser/webBrowser/nsIWebBrowserChrome.idl
+++ b/embedding/browser/webBrowser/nsIWebBrowserChrome.idl
@@ -42,17 +42,17 @@
 interface nsIWebBrowser;
 interface nsIDocShellTreeItem;
 
 /**
  * nsIWebBrowserChrome corresponds to the top-level, outermost window
  * 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;
     const unsigned long STATUS_SCRIPT_DEFAULT = 0x00000002;
     const unsigned long STATUS_LINK           = 0x00000003;
 
     /**
      * Called when the status text in the chrome needs to be updated.
@@ -70,53 +70,57 @@ interface nsIWebBrowserChrome : nsISuppo
      * as if it had created the WebBrowser itself.  This includes positioning
      * setting up listeners etc.
      */
     attribute nsIWebBrowser webBrowser;
 
     /**
      * Definitions for the chrome flags
      */
-    const unsigned long CHROME_DEFAULT          = 0x00000001;
-    const unsigned long CHROME_WINDOW_BORDERS   = 0x00000002;
-    const unsigned long CHROME_WINDOW_CLOSE     = 0x00000004;
-    const unsigned long CHROME_WINDOW_RESIZE    = 0x00000008;
-    const unsigned long CHROME_MENUBAR          = 0x00000010;
-    const unsigned long CHROME_TOOLBAR          = 0x00000020;
-    const unsigned long CHROME_LOCATIONBAR      = 0x00000040;
-    const unsigned long CHROME_STATUSBAR        = 0x00000080;
-    const unsigned long CHROME_PERSONAL_TOOLBAR = 0x00000100;
-    const unsigned long CHROME_SCROLLBARS       = 0x00000200;
-    const unsigned long CHROME_TITLEBAR         = 0x00000400;
-    const unsigned long CHROME_EXTRA            = 0x00000800;
+    const unsigned long CHROME_DEFAULT                = 0x00000001;
+    const unsigned long CHROME_WINDOW_BORDERS         = 0x00000002;
+    const unsigned long CHROME_WINDOW_CLOSE           = 0x00000004;
+    const unsigned long CHROME_WINDOW_RESIZE          = 0x00000008;
+    const unsigned long CHROME_MENUBAR                = 0x00000010;
+    const unsigned long CHROME_TOOLBAR                = 0x00000020;
+    const unsigned long CHROME_LOCATIONBAR            = 0x00000040;
+    const unsigned long CHROME_STATUSBAR              = 0x00000080;
+    const unsigned long CHROME_PERSONAL_TOOLBAR       = 0x00000100;
+    const unsigned long CHROME_SCROLLBARS             = 0x00000200;
+    const unsigned long CHROME_TITLEBAR               = 0x00000400;
+    const unsigned long CHROME_EXTRA                  = 0x00000800;
     
     // createBrowserWindow specific flags
-    const unsigned long CHROME_WITH_SIZE        = 0x00001000;
-    const unsigned long CHROME_WITH_POSITION    = 0x00002000;
+    const unsigned long CHROME_WITH_SIZE              = 0x00001000;
+    const unsigned long CHROME_WITH_POSITION          = 0x00002000;
 
     // special cases
-    const unsigned long CHROME_WINDOW_MIN       = 0x00004000;
-    const unsigned long CHROME_WINDOW_POPUP     = 0x00008000;
+    const unsigned long CHROME_WINDOW_MIN             = 0x00004000;
+    const unsigned long CHROME_WINDOW_POPUP           = 0x00008000;
 
-    const unsigned long CHROME_WINDOW_RAISED    = 0x02000000;
-    const unsigned long CHROME_WINDOW_LOWERED   = 0x04000000;
-    const unsigned long CHROME_CENTER_SCREEN    = 0x08000000;
+    // 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;
 
     // Make the new window dependent on the parent.  This flag is only
     // meaningful if CHROME_OPENAS_CHROME is set; content windows should not be
     // dependent.
-    const unsigned long CHROME_DEPENDENT        = 0x10000000;
+    const unsigned long CHROME_DEPENDENT              = 0x10000000;
 
     // Note: The modal style bit just affects the way the window looks and does
     //       mean it's actually modal.
-    const unsigned long CHROME_MODAL            = 0x20000000; 
-    const unsigned long CHROME_OPENAS_DIALOG    = 0x40000000;
-    const unsigned long CHROME_OPENAS_CHROME    = 0x80000000;
+    const unsigned long CHROME_MODAL                  = 0x20000000; 
+    const unsigned long CHROME_OPENAS_DIALOG          = 0x40000000;
+    const unsigned long CHROME_OPENAS_CHROME          = 0x80000000;
     
-    const unsigned long CHROME_ALL              = 0x00000ffe;
+    const unsigned long CHROME_ALL                    = 0x00000ffe;
     
     /**
      * The chrome flags for this browser chrome. The implementation should
      * reflect the value of this attribute by hiding or showing its chrome
      * appropriately.
      */
     attribute unsigned long chromeFlags;
 
--- a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp
+++ b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp
@@ -1522,16 +1522,19 @@ PRUint32 nsWindowWatcher::CalculateChrom
      instructions. (Note modality implies dependence.) */
 
   if (WinHasOption(aFeatures, "alwaysLowered", 0, nsnull) ||
       WinHasOption(aFeatures, "z-lock", 0, nsnull))
     chromeFlags |= nsIWebBrowserChrome::CHROME_WINDOW_LOWERED;
   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) ?
     nsIWebBrowserChrome::CHROME_EXTRA : 0;
   chromeFlags |= WinHasOption(aFeatures, "centerscreen", 0, nsnull) ?
     nsIWebBrowserChrome::CHROME_CENTER_SCREEN : 0;
   chromeFlags |= WinHasOption(aFeatures, "dependent", 0, nsnull) ?
     nsIWebBrowserChrome::CHROME_DEPENDENT : 0;
--- a/widget/cocoa/nsCocoaWindow.h
+++ b/widget/cocoa/nsCocoaWindow.h
@@ -192,16 +192,31 @@ typedef struct _nsCocoaWindowList {
 - (float)unifiedToolbarHeight;
 - (float)titlebarHeight;
 - (NSRect)titlebarRect;
 - (void)setTitlebarNeedsDisplayInRect:(NSRect)aRect sync:(BOOL)aSync;
 - (void)setTitlebarNeedsDisplayInRect:(NSRect)aRect;
 - (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:
   
   typedef nsBaseWidget Inherited;
 
 public:
 
@@ -261,16 +276,17 @@ public:
     NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus) ;
     NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, bool aDoCapture, bool aConsumeRollupEvent);
     NS_IMETHOD GetAttention(PRInt32 aCycleCount);
     virtual bool HasPendingInputEvent();
     virtual nsTransparencyMode GetTransparencyMode();
     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,
                                                 PRUint32 aNativeMessage,
                                                 PRUint32 aModifierFlags);
 
     void DispatchSizeModeEvent();
 
@@ -330,21 +346,25 @@ protected:
   BaseWindow*          mWindow;         // our cocoa window [STRONG]
   WindowDelegate*      mDelegate;       // our delegate for processing window msgs [STRONG]
   nsRefPtr<nsMenuBarX> mMenuBar;
   NSWindow*            mSheetWindowParent; // if this is a sheet, this is the NSWindow it's attached to
   nsChildView*         mPopupContentView; // if this is a popup, this is its content widget
   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;
   InputContext         mInputContext;
 };
 
 #endif // nsCocoaWindow_h_
--- a/widget/cocoa/nsCocoaWindow.mm
+++ b/widget/cocoa/nsCocoaWindow.mm
@@ -130,20 +130,22 @@ static void RollUpPopups()
 nsCocoaWindow::nsCocoaWindow()
 : mParent(nsnull)
 , mWindow(nil)
 , mDelegate(nil)
 , mSheetWindowParent(nil)
 , 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)
 {
 
 }
 
 void nsCocoaWindow::DestroyNativeWindow()
 {
@@ -299,16 +301,18 @@ nsresult nsCocoaWindow::Create(nsIWidget
 
   if (mWindowType == eWindowType_popup) {
     if (aInitData->mIsDragPopup) {
       [mWindow setIgnoresMouseEvents:YES];
     }
     return CreatePopupContentView(newBounds, aHandleEventFunction, aContext);
   }
 
+  mIsAnimationSuppressed = aInitData->mIsAnimationSuppressed;
+
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 static unsigned int WindowMaskForBorderStyle(nsBorderStyle aBorderStyle)
 {
   bool allOrDefault = (aBorderStyle == eBorderStyle_all ||
@@ -740,16 +744,36 @@ NS_IMETHODIMP nsCocoaWindow::Show(bool b
       // needs to happen after the _setWindowNumber calls above, otherwise the
       // window doesn't focus properly.
       if (nativeParentWindow && mPopupLevel == ePopupLevelParent)
         [nativeParentWindow addChildWindow:mWindow
                             ordered:NSWindowAbove];
     }
     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();
     }
   }
   else {
     // roll up any popups if a top-level window is going away
     if (mWindowType == eWindowType_toplevel || mWindowType == eWindowType_dialog)
@@ -1602,16 +1626,21 @@ void nsCocoaWindow::SetShowsToolbarButto
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
 
   [mWindow setShowsToolbarButton: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;
 
   // If they pass a color with a complete transparent alpha component, use the
   // native titlebar appearance.
   if (NS_GET_A(aColor) == 0) {
     [mWindow setTitlebarColor:nil forActiveWindow:(BOOL)aActive]; 
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -1012,16 +1012,30 @@ class nsIWidget : public nsISupports {
     /*
      * On Mac OS X, this method shows or hides the pill button in the titlebar
      * that's used to collapse the toolbar.
      *
      * Ignored on child widgets and on non-Mac platforms.
      */
     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.
      *
      */
     NS_IMETHOD HideWindowChrome(bool aShouldHide) = 0;
 
     /**
      * Put the toplevel window into or out of fullscreen mode.
--- a/widget/nsWidgetInitData.h
+++ b/widget/nsWidgetInitData.h
@@ -128,26 +128,29 @@ struct nsWidgetInitData {
       mPopupLevel(ePopupLevelTop),
       clipChildren(false), 
       clipSiblings(false), 
       mDropShadow(false),
       mListenForResizes(false),
       mUnicode(true),
       mRTL(false),
       mNoAutoHide(false),
-      mIsDragPopup(false)
+      mIsDragPopup(false),
+      mIsAnimationSuppressed(false)
   {
   }
 
   nsWindowType  mWindowType;
   nsBorderStyle mBorderStyle;
   nsPopupType   mPopupHint;
   nsPopupLevel  mPopupLevel;
   // when painting exclude area occupied by child windows and sibling windows
   bool          clipChildren, clipSiblings, mDropShadow;
   bool          mListenForResizes;
   bool          mUnicode;
   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__
--- a/widget/xpwidgets/nsBaseWidget.h
+++ b/widget/xpwidgets/nsBaseWidget.h
@@ -118,16 +118,17 @@ public:
   NS_IMETHOD              SetCursor(imgIContainer* aCursor,
                                     PRUint32 aHotspotX, PRUint32 aHotspotY);
   NS_IMETHOD              GetWindowType(nsWindowType& aWindowType);
   virtual void            SetTransparencyMode(nsTransparencyMode aMode);
   virtual nsTransparencyMode GetTransparencyMode();
   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();
   virtual LayerManager*   GetLayerManager(PLayersChild* aShadowManager = nsnull,
                                           LayersBackend aBackendHint = LayerManager::LAYERS_NONE,
                                           LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
                                           bool* aAllowRetaining = nsnull);
 
--- a/xpfe/appshell/src/nsAppShellService.cpp
+++ b/xpfe/appshell/src/nsAppShellService.cpp
@@ -303,16 +303,19 @@ nsAppShellService::JustCreateTopWindow(n
     widgetInitData.mWindowType = eWindowType_invisible;
   else
     widgetInitData.mWindowType = aChromeMask & nsIWebBrowserChrome::CHROME_OPENAS_DIALOG ?
       eWindowType_dialog : eWindowType_toplevel;
 
   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
   // nsGlobalWindow::ShowModalDialog() be dialogs (not sheets), while modal
   // windows opened from nsPromptService::DoDialog() still are sheets.  This
   // fixes bmo bug 395465 (see nsCocoaWindow::StandardCreate() and
   // nsCocoaWindow::SetModal()).
   PRUint32 sheetMask = nsIWebBrowserChrome::CHROME_OPENAS_DIALOG |
--- a/xpfe/appshell/src/nsXULWindow.cpp
+++ b/xpfe/appshell/src/nsXULWindow.cpp
@@ -1407,16 +1407,22 @@ void nsXULWindow::SyncAttributesToWidget
   }
   mWindow->SetIcon(attr);
 
   // "toggletoolbar" attribute
   rv = windowElement->GetAttribute(NS_LITERAL_STRING("toggletoolbar"), attr);
   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()
 {
   // can happen when the persistence timer fires at an inopportune time
   // during window shutdown
   if (!mDocShell)
     return NS_ERROR_FAILURE;