From ea881d6451e670282ef86478359bd07b3ead8436 Mon Sep 17 00:00:00 2001 From: Benjamin Smedberg Date: Fri, 25 Mar 2011 11:03:33 -0400 Subject: [PATCH] Bug 617539 - Fold in nsIDOMWindowUtils_MOZILLA_2_0_BRANCH, r=bz --- dom/base/nsDOMClassInfo.cpp | 1 - dom/base/nsDOMWindowUtils.cpp | 9 -- dom/base/nsDOMWindowUtils.h | 2 - dom/base/nsGlobalWindow.cpp | 3 +- dom/interfaces/base/nsIDOMWindowUtils.idl | 94 +++++++++---------- dom/tests/mochitest/bugs/test_bug61098.html | 2 +- ...t_leaf_layers_partition_browser_window.xul | 3 +- toolkit/components/prompts/src/nsPrompter.js | 2 +- widget/tests/test_imestate.html | 12 +-- 9 files changed, 49 insertions(+), 79 deletions(-) diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index f34e796acb6..b766ddb3817 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -2287,7 +2287,6 @@ nsDOMClassInfo::Init() DOM_CLASSINFO_MAP_BEGIN(WindowUtils, nsIDOMWindowUtils) DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowUtils) - DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowUtils_MOZILLA_2_0_BRANCH) DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_BEGIN(Location, nsIDOMLocation) diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 042e75fa2fd..f43cccabe45 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -98,7 +98,6 @@ DOMCI_DATA(WindowUtils, nsDOMWindowUtils) NS_INTERFACE_MAP_BEGIN(nsDOMWindowUtils) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMWindowUtils) NS_INTERFACE_MAP_ENTRY(nsIDOMWindowUtils) - NS_INTERFACE_MAP_ENTRY(nsIDOMWindowUtils_MOZILLA_2_0_BRANCH) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WindowUtils) NS_INTERFACE_MAP_END @@ -266,14 +265,6 @@ static void DestroyNsRect(void* aObject, nsIAtom* aPropertyName, delete rect; } -NS_IMETHODIMP -nsDOMWindowUtils::SetDisplayPort(float aXPx, float aYPx, - float aWidthPx, float aHeightPx) -{ - NS_ABORT_IF_FALSE(false, "This interface is deprecated."); - return NS_ERROR_FAILURE; -} - NS_IMETHODIMP nsDOMWindowUtils::SetDisplayPortForElement(float aXPx, float aYPx, float aWidthPx, float aHeightPx, diff --git a/dom/base/nsDOMWindowUtils.h b/dom/base/nsDOMWindowUtils.h index 7aad1478ea4..e1e7b84c8ab 100644 --- a/dom/base/nsDOMWindowUtils.h +++ b/dom/base/nsDOMWindowUtils.h @@ -44,7 +44,6 @@ class nsGlobalWindow; class nsIPresShell; class nsDOMWindowUtils : public nsIDOMWindowUtils, - public nsIDOMWindowUtils_MOZILLA_2_0_BRANCH, public nsSupportsWeakReference { public: @@ -52,7 +51,6 @@ public: ~nsDOMWindowUtils(); NS_DECL_ISUPPORTS NS_DECL_NSIDOMWINDOWUTILS - NS_DECL_NSIDOMWINDOWUTILS_MOZILLA_2_0_BRANCH protected: nsRefPtr mWindow; diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index e8f5dc1f313..25eaa68db48 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -8141,8 +8141,7 @@ nsGlobalWindow::GetInterface(const nsIID & aIID, void **aSink) } } } - else if (aIID.Equals(NS_GET_IID(nsIDOMWindowUtils)) || - aIID.Equals(NS_GET_IID(nsIDOMWindowUtils_MOZILLA_2_0_BRANCH))) { + else if (aIID.Equals(NS_GET_IID(nsIDOMWindowUtils))) { FORWARD_TO_OUTER(GetInterface, (aIID, aSink), NS_ERROR_NOT_INITIALIZED); nsCOMPtr utils(do_QueryReferent(mWindowUtils)); diff --git a/dom/interfaces/base/nsIDOMWindowUtils.idl b/dom/interfaces/base/nsIDOMWindowUtils.idl index 182a52f2711..d379029b659 100644 --- a/dom/interfaces/base/nsIDOMWindowUtils.idl +++ b/dom/interfaces/base/nsIDOMWindowUtils.idl @@ -54,6 +54,7 @@ [ref] native nsConstRect(const nsRect); native nscolor(nscolor); [ptr] native gfxContext(gfxContext); +typedef unsigned long long nsViewID; interface nsICycleCollectorListener; interface nsIDOMNode; @@ -65,7 +66,7 @@ interface nsITransferable; interface nsIQueryContentEventResult; interface nsIDOMWindow; -[scriptable, uuid(85fa978a-fc91-4513-9f11-8911e671577f)] +[scriptable, uuid(da529d62-ba27-480c-bb37-766ad083179a)] interface nsIDOMWindowUtils : nsISupports { /** @@ -129,10 +130,34 @@ interface nsIDOMWindowUtils : nsISupports { void setCSSViewport(in float aWidthPx, in float aHeightPx); /** - * @DEPRECATED See nsIDOMWindowUtils_MOZILLA_2_0_BRANCH. + * For any scrollable element, this allows you to override the + * visible region and draw more than what is visible, which is + * useful for asynchronous drawing. The "displayport" will be + * in units of CSS pixels, + * regardless of the size of the enclosing container. This + * will *not* trigger reflow. + * + * For the root scroll area, pass in the root document element. + * For scrollable elements, pass in the container element (for + * instance, the element with overflow: scroll). + * + * is relative to the top-left of what would normally be + * the visible area of the element. This means that the pixels + * rendered to the displayport take scrolling into account, + * for example. + * + * It's legal to set a displayport that extends beyond the overflow + * area in any direction (left/right/top/bottom). + * + * It's also legal to set a displayport that extends beyond the + * area's bounds. No pixels are rendered outside the area bounds. + * + * The caller of this method must have UniversalXPConnect + * privileges. */ - void setDisplayPort(in float aXPx, in float aYPx, - in float aWidthPx, in float aHeightPx); + void setDisplayPortForElement(in float aXPx, in float aYPx, + in float aWidthPx, in float aHeightPx, + in nsIDOMElement aElement); /** * Get/set the resolution at which rescalable web content is drawn. @@ -753,6 +778,19 @@ interface nsIDOMWindowUtils : nsISupports { */ [noscript] void leaveModalState(); + /** + * Same as enterModalState, but returns the window associated with the + * current JS context. + */ + nsIDOMWindow enterModalStateWithWindow(); + + /** + * Same as leaveModalState, but takes a window associated with the active + * context when enterModalStateWithWindow was called. The currently context + * might be different at the moment (see bug 621764). + */ + void leaveModalStateWithWindow(in nsIDOMWindow aWindow); + /** * Is the window is in a modal state? [See enterModalState()] */ @@ -797,12 +835,7 @@ interface nsIDOMWindowUtils : nsISupports { in AString property, in AString value1, in AString value2); -}; -typedef unsigned long long nsViewID; - -[scriptable, uuid(7ad49829-e631-4cdd-a237-95847d9bcbe6)] -interface nsIDOMWindowUtils_MOZILLA_2_0_BRANCH : nsISupports { /** * Get the type of the currently focused html input, if any. */ @@ -815,49 +848,6 @@ interface nsIDOMWindowUtils_MOZILLA_2_0_BRANCH : nsISupports { */ nsIDOMElement findElementWithViewId(in nsViewID aId); - /** - * For any scrollable element, this allows you to override the - * visible region and draw more than what is visible, which is - * useful for asynchronous drawing. The "displayport" will be - * in units of CSS pixels, - * regardless of the size of the enclosing container. This - * will *not* trigger reflow. - * - * For the root scroll area, pass in the root document element. - * For scrollable elements, pass in the container element (for - * instance, the element with overflow: scroll). - * - * is relative to the top-left of what would normally be - * the visible area of the element. This means that the pixels - * rendered to the displayport take scrolling into account, - * for example. - * - * It's legal to set a displayport that extends beyond the overflow - * area in any direction (left/right/top/bottom). - * - * It's also legal to set a displayport that extends beyond the - * area's bounds. No pixels are rendered outside the area bounds. - * - * The caller of this method must have UniversalXPConnect - * privileges. - */ - void setDisplayPortForElement(in float aXPx, in float aYPx, - in float aWidthPx, in float aHeightPx, - in nsIDOMElement aElement); - - /** - * Same as enterModalState, but returns the window associated with the - * current JS context. - */ - nsIDOMWindow enterModalStateWithWindow(); - - /** - * Same as leaveModalState, but takes a window associated with the active - * context when enterModalStateWithWindow was called. The currently context - * might be different at the moment (see bug 621764). - */ - void leaveModalStateWithWindow(in nsIDOMWindow aWindow); - /** * Checks the layer tree for this window and returns true * if all layers have transforms that are translations by integers, diff --git a/dom/tests/mochitest/bugs/test_bug61098.html b/dom/tests/mochitest/bugs/test_bug61098.html index 89a3b9227fa..911b94cd308 100644 --- a/dom/tests/mochitest/bugs/test_bug61098.html +++ b/dom/tests/mochitest/bugs/test_bug61098.html @@ -54,7 +54,7 @@ function registerMockPromptService() // abusive pages. var winUtils = this.domWindow .QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIDOMWindowUtils_MOZILLA_2_0_BRANCH); + .getInterface(Ci.nsIDOMWindowUtils); var w = winUtils.enterModalStateWithWindow(); winUtils.leaveModalStateWithWindow(w); }, diff --git a/layout/base/tests/chrome/test_leaf_layers_partition_browser_window.xul b/layout/base/tests/chrome/test_leaf_layers_partition_browser_window.xul index 79e684001f1..f2f9db61ac4 100644 --- a/layout/base/tests/chrome/test_leaf_layers_partition_browser_window.xul +++ b/layout/base/tests/chrome/test_leaf_layers_partition_browser_window.xul @@ -44,8 +44,7 @@ isnot(win.mozPaintCount, initialCount, "mozPaintCount has increased"); var utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor) - .getInterface(Components.interfaces.nsIDOMWindowUtils) - .QueryInterface(Components.interfaces.nsIDOMWindowUtils_MOZILLA_2_0_BRANCH); + .getInterface(Components.interfaces.nsIDOMWindowUtils); ok(utils.leafLayersPartitionWindow(), "Leaf layers should form a non-overlapping partition of the browser window"); diff --git a/toolkit/components/prompts/src/nsPrompter.js b/toolkit/components/prompts/src/nsPrompter.js index f3b44537a3d..59c92ce01e2 100644 --- a/toolkit/components/prompts/src/nsPrompter.js +++ b/toolkit/components/prompts/src/nsPrompter.js @@ -420,7 +420,7 @@ function openTabPrompt(domWin, tabPrompt, args) { PromptUtils.fireDialogEvent(domWin, "DOMWillOpenModalDialog"); let winUtils = domWin.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIDOMWindowUtils_MOZILLA_2_0_BRANCH); + .getInterface(Ci.nsIDOMWindowUtils); let callerWin = winUtils.enterModalStateWithWindow(); // We provide a callback so the prompt can close itself. We don't want to diff --git a/widget/tests/test_imestate.html b/widget/tests/test_imestate.html index 01859d352b3..5cdebc92f2a 100644 --- a/widget/tests/test_imestate.html +++ b/widget/tests/test_imestate.html @@ -119,12 +119,6 @@ SimpleTest.waitForExplicitFinish(); var gUtils = window. QueryInterface(Components.interfaces.nsIInterfaceRequestor). getInterface(Components.interfaces.nsIDOMWindowUtils); -var gUtils2 = gUtils.QueryInterface(Components.interfaces.nsIDOMWindowUtils_MOZILLA_2_0_BRANCH); -/* -var gUtils2 = window. - QueryInterface(Components.interfaces.nsIInterfaceRequestor). - getInterface(Components.interfaces.nsIDOMWindowUtils_MOZILLA_2_0_BRANCH); -*/ var gFM = Components.classes["@mozilla.org/focus-manager;1"]. getService(Components.interfaces.nsIFocusManager); const kIMEEnabledSupported = navigator.platform.indexOf("Mac") == 0 || @@ -197,7 +191,7 @@ function runBasicTest(aIsEditable, aInDesignMode, aDescription) return; } enabled = gUtils.IMEStatus; - inputtype = gUtils2.focusedInputType; + inputtype = gUtils.focusedInputType; is(enabled, aTest.expectedEnabled, aDescription + ": " + aTest.description + ", wrong enabled state"); if (aTest.expectedType && !aInDesignMode) { @@ -789,7 +783,7 @@ function runTypeChangingTest() is(gUtils.IMEStatus, kInput.expected, "type attr changing test (IMEStatus): " + typeChangingDescription + " (" + kInput.description + ")"); - is(gUtils2.focusedInputType, kInput.type, + is(gUtils.focusedInputType, kInput.type, "type attr changing test (type): " + typeChangingDescription + " (" + kInput.description + ")"); @@ -810,7 +804,7 @@ function runTypeChangingTest() is(gUtils.IMEStatus, getExpectedIMEEnabled(kType, kInput), "type attr changing test (IMEStatus): " + typeChangingDescription + " (" + kInput.description + ")"); - is(gUtils2.focusedInputType, kType.type, + is(gUtils.focusedInputType, kType.type, "type attr changing test (type): " + typeChangingDescription + " (" + kInput.description + ")"); if (kTestOpenState && gUtils.IMEStatus == gUtils.IME_STATUS_ENABLED) {