From 89e9e66fb70cc692a8944dc5e3226d80b9afe4e1 Mon Sep 17 00:00:00 2001 From: "cbarrett@mozilla.com" Date: Fri, 24 Aug 2007 18:55:28 -0700 Subject: [PATCH] Bug 393117 - Remove native resize API. r=josh r=mconnor sr+a1.9=pav --- dom/public/idl/base/nsIDOMChromeWindow.idl | 13 ++++------- dom/src/base/nsGlobalWindow.cpp | 24 -------------------- toolkit/content/widgets/preferences.xml | 12 ---------- widget/public/nsIWidget.h | 26 ++++------------------ widget/src/cocoa/nsChildView.h | 3 --- widget/src/cocoa/nsChildView.mm | 12 ---------- widget/src/cocoa/nsCocoaWindow.h | 5 +---- widget/src/cocoa/nsCocoaWindow.mm | 25 +-------------------- widget/src/xpwidgets/nsBaseWidget.cpp | 12 ---------- widget/src/xpwidgets/nsBaseWidget.h | 2 -- 10 files changed, 10 insertions(+), 124 deletions(-) diff --git a/dom/public/idl/base/nsIDOMChromeWindow.idl b/dom/public/idl/base/nsIDOMChromeWindow.idl index 014b6bba4094..4dc957f14d98 100644 --- a/dom/public/idl/base/nsIDOMChromeWindow.idl +++ b/dom/public/idl/base/nsIDOMChromeWindow.idl @@ -21,7 +21,6 @@ * * Contributor(s): * Johnny Stenback (original author) - * Josh Aas (animation API) * * Alternatively, the contents of this file may be used under the terms of * either of the GNU General Public License Version 2 or later (the "GPL"), @@ -41,26 +40,22 @@ interface nsIBrowserDOMWindow; -[scriptable, uuid(E3985A99-F9D6-4576-8EF8-9A5DCE42EFFA)] +[scriptable, uuid(847fac33-48a8-4360-bfbc-6bb96245404d)] interface nsIDOMChromeWindow : nsISupports { const unsigned short STATE_MAXIMIZED = 1; const unsigned short STATE_MINIMIZED = 2; const unsigned short STATE_NORMAL = 3; - const unsigned short RESIZE_ANIMATION_OFF = 0; - const unsigned short RESIZE_ANIMATION_SLIDE = 1; - - attribute unsigned short animatedResize; - attribute DOMString title; - readonly attribute unsigned short windowState; + attribute DOMString title; + readonly attribute unsigned short windowState; /** * browserDOMWindow provides access to yet another layer of * utility functions implemented by chrome script. It will be null * for DOMWindows not corresponding to browsers. */ - attribute nsIBrowserDOMWindow browserDOMWindow; + attribute nsIBrowserDOMWindow browserDOMWindow; void getAttention(); diff --git a/dom/src/base/nsGlobalWindow.cpp b/dom/src/base/nsGlobalWindow.cpp index 9e13c2ffcae5..e7f516faed25 100644 --- a/dom/src/base/nsGlobalWindow.cpp +++ b/dom/src/base/nsGlobalWindow.cpp @@ -7927,30 +7927,6 @@ nsGlobalChromeWindow::SetTitle(const nsAString& aTitle) return nsdoc->SetTitle(aTitle); } -// returns NS_ERROR_NOT_IMPLEMENTED if animation is not implemented on widget -// or platform -NS_IMETHODIMP -nsGlobalChromeWindow::SetAnimatedResize(PRUint16 aAnimation) -{ - nsCOMPtr widget = GetMainWidget(); - if (!widget) - return NS_ERROR_FAILURE; - - return widget->SetAnimatedResize(aAnimation); -} - -// returns NS_ERROR_NOT_IMPLEMENTED if animation is not implemented on widget -// or platform -NS_IMETHODIMP -nsGlobalChromeWindow::GetAnimatedResize(PRUint16* aAnimation) -{ - nsCOMPtr widget = GetMainWidget(); - if (!widget) - return NS_ERROR_FAILURE; - - return widget->GetAnimatedResize(aAnimation); -} - NS_IMETHODIMP nsGlobalChromeWindow::GetWindowState(PRUint16* aWindowState) { diff --git a/toolkit/content/widgets/preferences.xml b/toolkit/content/widgets/preferences.xml index f5821e2a599f..3d1d5f1ed55c 100644 --- a/toolkit/content/widgets/preferences.xml +++ b/toolkit/content/widgets/preferences.xml @@ -744,20 +744,8 @@ // Don't let the new pane content flex to the current window // height if we're animating aPaneElement.removeAttribute("flex"); -#ifdef XP_MACOSX - try { - window.animatedResize = window.RESIZE_ANIMATION_SLIDE; - // New height is the new pane's size plus the size of the pane selection bar - var newHeight = aPaneElement.contentHeight + (window.innerHeight - oldPane.contentHeight); - window.innerHeight = newHeight; - this._currentHeight = newHeight; - window.animatedResize = window.RESIZE_ANIMATION_OFF; - } - catch (e) { } -#else aPaneElement.style.opacity = 0.0; this.animate(oldPane, aPaneElement); -#endif } } break; diff --git a/widget/public/nsIWidget.h b/widget/public/nsIWidget.h index ca6b7f5bd7bd..82b453339068 100644 --- a/widget/public/nsIWidget.h +++ b/widget/public/nsIWidget.h @@ -95,11 +95,11 @@ typedef nsEventStatus (*PR_CALLBACK EVENT_CALLBACK)(nsGUIEvent *event); #define NS_NATIVE_PLUGIN_PORT_CG 101 #endif -// B3F10C8D-4C07-4B1E-A1CD-B38696426205 -#define NS_IWIDGET_IID \ -{ 0xB3F10C8D, 0x4C07, 0x4B1E, \ - { 0xA1, 0xCD, 0xB3, 0x86, 0x96, 0x42, 0x62, 0x05 } } +// f60fa720-a9bc-4fd3-b863-812496fa85e6 +#define NS_IWIDGET_IID \ +{ 0xf60fa720, 0xa9bc, 0x4fd3, \ + { 0xb8, 0x63, 0x81, 0x24, 0x96, 0xfa, 0x85, 0xe6 } } // Hide the native window systems real window type so as to avoid // including native window system types and api's. This is necessary @@ -1016,24 +1016,6 @@ class nsIWidget : public nsISupports { */ virtual gfxASurface *GetThebesSurface() = 0; - /** - * Set a flag that makes any window resizes use native window animation. - * Ignored on any OS that doesn't support native animation. - * - * @param aAnimate Whether or not you want resizes to be animated. - * @return NS_ERROR_NOT_IMPLEMENTED if not implemented on widget or platform - */ - NS_IMETHOD SetAnimatedResize(PRUint16 aAnimation) = 0; - - /** - * Get a flag that controls native window animation. - * Ignored on any OS that doesn't support native animation. - * - * @param aAnimate Whether or not resizes are animated. - * @return NS_ERROR_NOT_IMPLEMENTED if not implemented on widget or platform - */ - NS_IMETHOD GetAnimatedResize(PRUint16* aAnimation) = 0; - protected: // keep the list of children. We also keep track of our siblings. // The ownership model is as follows: parent holds a strong ref to diff --git a/widget/src/cocoa/nsChildView.h b/widget/src/cocoa/nsChildView.h index 2fdde7a5bdc6..86d26635d758 100644 --- a/widget/src/cocoa/nsChildView.h +++ b/widget/src/cocoa/nsChildView.h @@ -297,9 +297,6 @@ public: NS_IMETHOD GetAttention(PRInt32 aCycleCount); - NS_IMETHOD SetAnimatedResize(PRUint16 aAnimation); - NS_IMETHOD GetAnimatedResize(PRUint16* aAnimation); - // nsIPluginWidget NS_IMETHOD GetPluginClipRect(nsRect& outClipRect, nsPoint& outOrigin, PRBool& outWidgetVisible); NS_IMETHOD StartDrawPlugin(); diff --git a/widget/src/cocoa/nsChildView.mm b/widget/src/cocoa/nsChildView.mm index 2227281ca1ca..6a866cf7775f 100644 --- a/widget/src/cocoa/nsChildView.mm +++ b/widget/src/cocoa/nsChildView.mm @@ -1560,18 +1560,6 @@ NS_IMETHODIMP nsChildView::GetAttention(PRInt32 aCycleCount) } -NS_IMETHODIMP nsChildView::SetAnimatedResize(PRUint16 aAnimation) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - - -NS_IMETHODIMP nsChildView::GetAnimatedResize(PRUint16* aAnimation) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - - #pragma mark - diff --git a/widget/src/cocoa/nsCocoaWindow.h b/widget/src/cocoa/nsCocoaWindow.h index b468baecf7bb..64c68433c064 100644 --- a/widget/src/cocoa/nsCocoaWindow.h +++ b/widget/src/cocoa/nsCocoaWindow.h @@ -190,8 +190,6 @@ public: NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus) ; NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent); NS_IMETHOD GetAttention(PRInt32 aCycleCount); - NS_IMETHOD SetAnimatedResize(PRUint16 aAnimation); - NS_IMETHOD GetAnimatedResize(PRUint16* aAnimation); virtual gfxASurface* GetThebesSurface(); @@ -213,8 +211,7 @@ protected: WindowDelegate* mDelegate; // our delegate for processing window msgs [STRONG] nsCOMPtr 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 - PRUint16 mAnimation; // the type of animation we will use when resizing + nsChildView* mPopupContentView; // if this is a popup, this is its content widget PRPackedBool mIsResizing; // we originated the resize, prevent infinite recursion PRPackedBool mWindowMadeHere; // true if we created the window, false for embedding diff --git a/widget/src/cocoa/nsCocoaWindow.mm b/widget/src/cocoa/nsCocoaWindow.mm index 09e481e9fdc9..2c29c62c184d 100644 --- a/widget/src/cocoa/nsCocoaWindow.mm +++ b/widget/src/cocoa/nsCocoaWindow.mm @@ -51,8 +51,6 @@ #include "nsIXULWindow.h" #include "nsIPrefService.h" #include "nsIPrefBranch.h" -#include "nsIDOMChromeWindow.h" -#include "unistd.h" // defined in nsMenuBarX.mm extern NSMenu* sApplicationMenu; // Application menu shared by all menubars @@ -92,7 +90,6 @@ nsCocoaWindow::nsCocoaWindow() , mDelegate(nil) , mSheetWindowParent(nil) , mPopupContentView(nil) -, mAnimation(nsIDOMChromeWindow::RESIZE_ANIMATION_OFF) , mIsResizing(PR_FALSE) , mWindowMadeHere(PR_FALSE) , mVisible(PR_FALSE) @@ -772,14 +769,7 @@ NS_IMETHODIMP nsCocoaWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRep newFrame.size.height = newHeight; StartResizing(); - if (mAnimation == nsIDOMChromeWindow::RESIZE_ANIMATION_SLIDE) { - [[mWindow contentView] setHidden:YES]; - [mWindow setFrame:newFrame display:YES animate:YES]; - [[mWindow contentView] setHidden:NO]; - } - else { - [mWindow setFrame:newFrame display:NO]; - } + [mWindow setFrame:newFrame display:NO]; StopResizing(); } @@ -1069,19 +1059,6 @@ NS_IMETHODIMP nsCocoaWindow::GetAttention(PRInt32 aCycleCount) } -NS_IMETHODIMP nsCocoaWindow::SetAnimatedResize(PRUint16 aAnimation) -{ - mAnimation = aAnimation; - return NS_OK; -} - - -NS_IMETHODIMP nsCocoaWindow::GetAnimatedResize(PRUint16* aAnimation) -{ - *aAnimation = mAnimation; - return NS_OK; -} - gfxASurface* nsCocoaWindow::GetThebesSurface() { if (mPopupContentView) diff --git a/widget/src/xpwidgets/nsBaseWidget.cpp b/widget/src/xpwidgets/nsBaseWidget.cpp index 77fe430a325c..80daf219f0b4 100644 --- a/widget/src/xpwidgets/nsBaseWidget.cpp +++ b/widget/src/xpwidgets/nsBaseWidget.cpp @@ -846,18 +846,6 @@ nsBaseWidget::SetIcon(const nsAString&) return NS_OK; } -NS_IMETHODIMP -nsBaseWidget::SetAnimatedResize(PRUint16 aAnimation) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - -NS_IMETHODIMP -nsBaseWidget::GetAnimatedResize(PRUint16* aAnimation) -{ - return NS_ERROR_NOT_IMPLEMENTED; -} - /** * Modifies aFile to point at an icon file with the given name and suffix. The * suffix may correspond to a file extension with leading '.' if appropriate. diff --git a/widget/src/xpwidgets/nsBaseWidget.h b/widget/src/xpwidgets/nsBaseWidget.h index 16c4afe959a1..799f119954c0 100644 --- a/widget/src/xpwidgets/nsBaseWidget.h +++ b/widget/src/xpwidgets/nsBaseWidget.h @@ -131,8 +131,6 @@ public: NS_IMETHOD GetAttention(PRInt32 aCycleCount); NS_IMETHOD GetLastInputEventTime(PRUint32& aTime); NS_IMETHOD SetIcon(const nsAString &anIconSpec); - NS_IMETHOD SetAnimatedResize(PRUint16 aAnimation); - NS_IMETHOD GetAnimatedResize(PRUint16* aAnimation); virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) {} virtual void FreeNativeData(void * data, PRUint32 aDataType) {}//~~~