Bug 617539 - Fold in nsIDOMWindowUtils_MOZILLA_2_0_BRANCH, r=bz

This commit is contained in:
Benjamin Smedberg 2011-03-25 11:03:33 -04:00
Родитель f14dd68f32
Коммит ea881d6451
9 изменённых файлов: 49 добавлений и 79 удалений

Просмотреть файл

@ -2287,7 +2287,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN(WindowUtils, nsIDOMWindowUtils) DOM_CLASSINFO_MAP_BEGIN(WindowUtils, nsIDOMWindowUtils)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowUtils) DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowUtils)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMWindowUtils_MOZILLA_2_0_BRANCH)
DOM_CLASSINFO_MAP_END DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(Location, nsIDOMLocation) DOM_CLASSINFO_MAP_BEGIN(Location, nsIDOMLocation)

Просмотреть файл

@ -98,7 +98,6 @@ DOMCI_DATA(WindowUtils, nsDOMWindowUtils)
NS_INTERFACE_MAP_BEGIN(nsDOMWindowUtils) NS_INTERFACE_MAP_BEGIN(nsDOMWindowUtils)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMWindowUtils) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMWindowUtils)
NS_INTERFACE_MAP_ENTRY(nsIDOMWindowUtils) NS_INTERFACE_MAP_ENTRY(nsIDOMWindowUtils)
NS_INTERFACE_MAP_ENTRY(nsIDOMWindowUtils_MOZILLA_2_0_BRANCH)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WindowUtils) NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WindowUtils)
NS_INTERFACE_MAP_END NS_INTERFACE_MAP_END
@ -266,14 +265,6 @@ static void DestroyNsRect(void* aObject, nsIAtom* aPropertyName,
delete rect; 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 NS_IMETHODIMP
nsDOMWindowUtils::SetDisplayPortForElement(float aXPx, float aYPx, nsDOMWindowUtils::SetDisplayPortForElement(float aXPx, float aYPx,
float aWidthPx, float aHeightPx, float aWidthPx, float aHeightPx,

Просмотреть файл

@ -44,7 +44,6 @@ class nsGlobalWindow;
class nsIPresShell; class nsIPresShell;
class nsDOMWindowUtils : public nsIDOMWindowUtils, class nsDOMWindowUtils : public nsIDOMWindowUtils,
public nsIDOMWindowUtils_MOZILLA_2_0_BRANCH,
public nsSupportsWeakReference public nsSupportsWeakReference
{ {
public: public:
@ -52,7 +51,6 @@ public:
~nsDOMWindowUtils(); ~nsDOMWindowUtils();
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_NSIDOMWINDOWUTILS NS_DECL_NSIDOMWINDOWUTILS
NS_DECL_NSIDOMWINDOWUTILS_MOZILLA_2_0_BRANCH
protected: protected:
nsRefPtr<nsGlobalWindow> mWindow; nsRefPtr<nsGlobalWindow> mWindow;

Просмотреть файл

@ -8141,8 +8141,7 @@ nsGlobalWindow::GetInterface(const nsIID & aIID, void **aSink)
} }
} }
} }
else if (aIID.Equals(NS_GET_IID(nsIDOMWindowUtils)) || else if (aIID.Equals(NS_GET_IID(nsIDOMWindowUtils))) {
aIID.Equals(NS_GET_IID(nsIDOMWindowUtils_MOZILLA_2_0_BRANCH))) {
FORWARD_TO_OUTER(GetInterface, (aIID, aSink), NS_ERROR_NOT_INITIALIZED); FORWARD_TO_OUTER(GetInterface, (aIID, aSink), NS_ERROR_NOT_INITIALIZED);
nsCOMPtr<nsISupports> utils(do_QueryReferent(mWindowUtils)); nsCOMPtr<nsISupports> utils(do_QueryReferent(mWindowUtils));

Просмотреть файл

@ -54,6 +54,7 @@
[ref] native nsConstRect(const nsRect); [ref] native nsConstRect(const nsRect);
native nscolor(nscolor); native nscolor(nscolor);
[ptr] native gfxContext(gfxContext); [ptr] native gfxContext(gfxContext);
typedef unsigned long long nsViewID;
interface nsICycleCollectorListener; interface nsICycleCollectorListener;
interface nsIDOMNode; interface nsIDOMNode;
@ -65,7 +66,7 @@ interface nsITransferable;
interface nsIQueryContentEventResult; interface nsIQueryContentEventResult;
interface nsIDOMWindow; interface nsIDOMWindow;
[scriptable, uuid(85fa978a-fc91-4513-9f11-8911e671577f)] [scriptable, uuid(da529d62-ba27-480c-bb37-766ad083179a)]
interface nsIDOMWindowUtils : nsISupports { interface nsIDOMWindowUtils : nsISupports {
/** /**
@ -129,10 +130,34 @@ interface nsIDOMWindowUtils : nsISupports {
void setCSSViewport(in float aWidthPx, in float aHeightPx); 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
* <xPx, yPx, widthPx, heightPx> 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).
*
* <x, y> 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, void setDisplayPortForElement(in float aXPx, in float aYPx,
in float aWidthPx, in float aHeightPx); in float aWidthPx, in float aHeightPx,
in nsIDOMElement aElement);
/** /**
* Get/set the resolution at which rescalable web content is drawn. * Get/set the resolution at which rescalable web content is drawn.
@ -753,6 +778,19 @@ interface nsIDOMWindowUtils : nsISupports {
*/ */
[noscript] void leaveModalState(); [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()] * Is the window is in a modal state? [See enterModalState()]
*/ */
@ -797,12 +835,7 @@ interface nsIDOMWindowUtils : nsISupports {
in AString property, in AString property,
in AString value1, in AString value1,
in AString value2); 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. * 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); 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
* <xPx, yPx, widthPx, heightPx> 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).
*
* <x, y> 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 * Checks the layer tree for this window and returns true
* if all layers have transforms that are translations by integers, * if all layers have transforms that are translations by integers,

Просмотреть файл

@ -54,7 +54,7 @@ function registerMockPromptService()
// abusive pages. // abusive pages.
var winUtils = this.domWindow var winUtils = this.domWindow
.QueryInterface(Ci.nsIInterfaceRequestor) .QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils_MOZILLA_2_0_BRANCH); .getInterface(Ci.nsIDOMWindowUtils);
var w = winUtils.enterModalStateWithWindow(); var w = winUtils.enterModalStateWithWindow();
winUtils.leaveModalStateWithWindow(w); winUtils.leaveModalStateWithWindow(w);
}, },

Просмотреть файл

@ -44,8 +44,7 @@
isnot(win.mozPaintCount, initialCount, "mozPaintCount has increased"); isnot(win.mozPaintCount, initialCount, "mozPaintCount has increased");
var utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor) var utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils) .getInterface(Components.interfaces.nsIDOMWindowUtils);
.QueryInterface(Components.interfaces.nsIDOMWindowUtils_MOZILLA_2_0_BRANCH);
ok(utils.leafLayersPartitionWindow(), ok(utils.leafLayersPartitionWindow(),
"Leaf layers should form a non-overlapping partition of the browser window"); "Leaf layers should form a non-overlapping partition of the browser window");

Просмотреть файл

@ -420,7 +420,7 @@ function openTabPrompt(domWin, tabPrompt, args) {
PromptUtils.fireDialogEvent(domWin, "DOMWillOpenModalDialog"); PromptUtils.fireDialogEvent(domWin, "DOMWillOpenModalDialog");
let winUtils = domWin.QueryInterface(Ci.nsIInterfaceRequestor) let winUtils = domWin.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils_MOZILLA_2_0_BRANCH); .getInterface(Ci.nsIDOMWindowUtils);
let callerWin = winUtils.enterModalStateWithWindow(); let callerWin = winUtils.enterModalStateWithWindow();
// We provide a callback so the prompt can close itself. We don't want to // We provide a callback so the prompt can close itself. We don't want to

Просмотреть файл

@ -119,12 +119,6 @@ SimpleTest.waitForExplicitFinish();
var gUtils = window. var gUtils = window.
QueryInterface(Components.interfaces.nsIInterfaceRequestor). QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils); 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"]. var gFM = Components.classes["@mozilla.org/focus-manager;1"].
getService(Components.interfaces.nsIFocusManager); getService(Components.interfaces.nsIFocusManager);
const kIMEEnabledSupported = navigator.platform.indexOf("Mac") == 0 || const kIMEEnabledSupported = navigator.platform.indexOf("Mac") == 0 ||
@ -197,7 +191,7 @@ function runBasicTest(aIsEditable, aInDesignMode, aDescription)
return; return;
} }
enabled = gUtils.IMEStatus; enabled = gUtils.IMEStatus;
inputtype = gUtils2.focusedInputType; inputtype = gUtils.focusedInputType;
is(enabled, aTest.expectedEnabled, is(enabled, aTest.expectedEnabled,
aDescription + ": " + aTest.description + ", wrong enabled state"); aDescription + ": " + aTest.description + ", wrong enabled state");
if (aTest.expectedType && !aInDesignMode) { if (aTest.expectedType && !aInDesignMode) {
@ -789,7 +783,7 @@ function runTypeChangingTest()
is(gUtils.IMEStatus, kInput.expected, is(gUtils.IMEStatus, kInput.expected,
"type attr changing test (IMEStatus): " + typeChangingDescription + "type attr changing test (IMEStatus): " + typeChangingDescription +
" (" + kInput.description + ")"); " (" + kInput.description + ")");
is(gUtils2.focusedInputType, kInput.type, is(gUtils.focusedInputType, kInput.type,
"type attr changing test (type): " + typeChangingDescription + "type attr changing test (type): " + typeChangingDescription +
" (" + kInput.description + ")"); " (" + kInput.description + ")");
@ -810,7 +804,7 @@ function runTypeChangingTest()
is(gUtils.IMEStatus, getExpectedIMEEnabled(kType, kInput), is(gUtils.IMEStatus, getExpectedIMEEnabled(kType, kInput),
"type attr changing test (IMEStatus): " + typeChangingDescription + "type attr changing test (IMEStatus): " + typeChangingDescription +
" (" + kInput.description + ")"); " (" + kInput.description + ")");
is(gUtils2.focusedInputType, kType.type, is(gUtils.focusedInputType, kType.type,
"type attr changing test (type): " + typeChangingDescription + "type attr changing test (type): " + typeChangingDescription +
" (" + kInput.description + ")"); " (" + kInput.description + ")");
if (kTestOpenState && gUtils.IMEStatus == gUtils.IME_STATUS_ENABLED) { if (kTestOpenState && gUtils.IMEStatus == gUtils.IME_STATUS_ENABLED) {