Fixing bug 316794. Moving HandleDOMEvent() and Get/SetDocShell from nsIScriptGlobalObject to nsPIDOMWindow. r=mrbkap@gmail.com, sr=peterv@propagandism.org
git-svn-id: svn://10.0.0.236/trunk@185351 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
e4c5fe4567
commit
895df6e6ca
@ -52,7 +52,6 @@
|
||||
#include "nsIDOMDocumentView.h"
|
||||
#include "nsIDOMAbstractView.h"
|
||||
#include "nsIDOM3Node.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsHTMLLinkAccessible.h"
|
||||
@ -85,7 +84,6 @@
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIFocusController.h"
|
||||
#include "nsAccessibleTreeWalker.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
#include "nsIDOMNSDocument.h"
|
||||
#include "nsIDOMNSHTMLDocument.h"
|
||||
#include "nsIDOMMutationEvent.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMXULPopupElement.h"
|
||||
#include "nsIEditingSession.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
@ -66,7 +66,6 @@
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIPlaintextEditor.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
@ -335,12 +334,12 @@ NS_IMETHODIMP nsDocAccessible::GetWindow(nsIDOMWindow **aDOMWin)
|
||||
if (!mDocument) {
|
||||
return NS_ERROR_FAILURE; // Accessible is Shutdown()
|
||||
}
|
||||
nsCOMPtr<nsIDOMWindow> domWindow(do_QueryInterface(mDocument->GetScriptGlobalObject()));
|
||||
*aDOMWin = mDocument->GetWindow();
|
||||
|
||||
if (!domWindow)
|
||||
if (!*aDOMWin)
|
||||
return NS_ERROR_FAILURE; // No DOM Window
|
||||
|
||||
NS_ADDREF(*aDOMWin = domWindow);
|
||||
NS_ADDREF(*aDOMWin);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -366,16 +365,14 @@ void nsDocAccessible::CheckForEditor()
|
||||
if (!mDocument) {
|
||||
return; // No document -- we've been shut down
|
||||
}
|
||||
nsCOMPtr<nsIDOMWindow> domWindow(do_QueryInterface(mDocument->GetScriptGlobalObject()));
|
||||
if (!domWindow)
|
||||
return; // No DOM Window
|
||||
|
||||
nsCOMPtr<nsISupports> container = mDocument->GetContainer();
|
||||
nsCOMPtr<nsIEditingSession> editingSession(do_GetInterface(container));
|
||||
if (!editingSession)
|
||||
return; // No editing session interface
|
||||
|
||||
editingSession->GetEditorForWindow(domWindow, getter_AddRefs(mEditor));
|
||||
editingSession->GetEditorForWindow(mDocument->GetWindow(),
|
||||
getter_AddRefs(mEditor));
|
||||
if (mEditor) {
|
||||
// State readonly is now clear
|
||||
#ifdef MOZ_ACCESSIBILITY_ATK
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMXULMenuListElement.h"
|
||||
#include "nsIDOMXULMultSelectCntrlEl.h"
|
||||
#include "nsIDOMXULSelectCntrlItemEl.h"
|
||||
@ -60,12 +60,10 @@
|
||||
#include "nsIFocusController.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsRootAccessible.h"
|
||||
#include "nsIDocShell.h"
|
||||
@ -132,10 +130,10 @@ NS_IMETHODIMP nsRootAccessible::GetName(nsAString& aName)
|
||||
}
|
||||
}
|
||||
|
||||
nsIScriptGlobalObject *globalScript = mDocument->GetScriptGlobalObject();
|
||||
nsPIDOMWindow *window = mDocument->GetWindow();
|
||||
nsIDocShell *docShell = nsnull;
|
||||
if (globalScript) {
|
||||
docShell = globalScript->GetDocShell();
|
||||
if (window) {
|
||||
docShell = window->GetDocShell();
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(docShell));
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
@ -272,7 +272,7 @@ NS_IMETHODIMP nsAccessNodeWrap::GetComputedStyleDeclaration(nsIDOMCSSStyleDeclar
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMViewCSS> viewCSS(do_QueryInterface(doc->GetScriptGlobalObject()));
|
||||
nsCOMPtr<nsIDOMViewCSS> viewCSS(do_QueryInterface(doc->GetWindow()));
|
||||
|
||||
if (!viewCSS)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -68,7 +68,7 @@
|
||||
#include "nsIPluginInstance.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIPrompt.h"
|
||||
@ -1525,12 +1525,13 @@ nsScriptSecurityManager::GetRootDocShell(JSContext *cx, nsIDocShell **result)
|
||||
if (!scriptContext)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIScriptGlobalObject *globalObject = scriptContext->GetGlobalObject();
|
||||
if (!globalObject)
|
||||
nsCOMPtr<nsPIDOMWindow> window =
|
||||
do_QueryInterface(scriptContext->GetGlobalObject());
|
||||
if (!window)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docshellTreeItem =
|
||||
do_QueryInterface(globalObject->GetDocShell(), &rv);
|
||||
do_QueryInterface(window->GetDocShell(), &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> rootItem;
|
||||
@ -1557,11 +1558,12 @@ nsScriptSecurityManager::CanExecuteScripts(JSContext* cx,
|
||||
//-- See if the current window allows JS execution
|
||||
nsIScriptContext *scriptContext = GetScriptContext(cx);
|
||||
if (!scriptContext) return NS_ERROR_FAILURE;
|
||||
nsIScriptGlobalObject *globalObject = scriptContext->GetGlobalObject();
|
||||
if (!globalObject) return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsPIDOMWindow> window =
|
||||
do_QueryInterface(scriptContext->GetGlobalObject());
|
||||
if (!window) return NS_ERROR_FAILURE;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDocShell> docshell = globalObject->GetDocShell();
|
||||
nsCOMPtr<nsIDocShell> docshell = window->GetDocShell();
|
||||
nsCOMPtr<nsIDocShellTreeItem> globalObjTreeItem = do_QueryInterface(docshell);
|
||||
if (globalObjTreeItem)
|
||||
{
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
|
||||
//XXXtw sadly, this makes consumers of nsContentPolicyUtils depend on widget
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
#define NS_CONTENTPOLICY_CONTRACTID "@mozilla.org/layout/content-policy;1"
|
||||
#define NS_CONTENTPOLICY_CATEGORY "content-policy"
|
||||
@ -221,9 +221,9 @@ NS_CP_GetDocShellFromContext(nsISupports *aContext)
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptGlobal = do_QueryInterface(aContext);
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aContext);
|
||||
|
||||
if (!scriptGlobal) {
|
||||
if (!window) {
|
||||
// our context might be a document (which also QIs to nsIDOMNode), so
|
||||
// try that first
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aContext);
|
||||
@ -237,15 +237,15 @@ NS_CP_GetDocShellFromContext(nsISupports *aContext)
|
||||
}
|
||||
|
||||
if (doc) {
|
||||
scriptGlobal = doc->GetScriptGlobalObject();
|
||||
window = doc->GetWindow();
|
||||
}
|
||||
}
|
||||
|
||||
if (!scriptGlobal) {
|
||||
if (!window) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
return scriptGlobal->GetDocShell();
|
||||
return window->GetDocShell();
|
||||
}
|
||||
|
||||
#endif /* __nsContentPolicyUtils_h__ */
|
||||
|
||||
@ -55,7 +55,7 @@
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIDOMAbstractView.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentRange.h"
|
||||
#include "nsIDOMRange.h"
|
||||
@ -89,7 +89,6 @@
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
@ -356,16 +355,14 @@ nsContentAreaDragDrop::DragOver(nsIDOMEvent* inEvent)
|
||||
NS_ASSERTION(sourceDocument, "Confused document object");
|
||||
NS_ASSERTION(eventDocument, "Confused document object");
|
||||
|
||||
nsIScriptGlobalObject * sourceGlobal =
|
||||
sourceDocument->GetScriptGlobalObject();
|
||||
nsIScriptGlobalObject* eventGlobal =
|
||||
eventDocument->GetScriptGlobalObject();
|
||||
nsPIDOMWindow* sourceWindow = sourceDocument->GetWindow();
|
||||
nsPIDOMWindow* eventWindow = eventDocument->GetWindow();
|
||||
|
||||
if (sourceGlobal && eventGlobal) {
|
||||
if (sourceWindow && eventWindow) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> sourceShell =
|
||||
do_QueryInterface(sourceGlobal->GetDocShell());
|
||||
do_QueryInterface(sourceWindow->GetDocShell());
|
||||
nsCOMPtr<nsIDocShellTreeItem> eventShell =
|
||||
do_QueryInterface(eventGlobal->GetDocShell());
|
||||
do_QueryInterface(eventWindow->GetDocShell());
|
||||
|
||||
if (sourceShell && eventShell) {
|
||||
// Whew. Almost there. Get the roots that are of the same type
|
||||
|
||||
@ -889,9 +889,10 @@ nsContentUtils::GetDocShellFromCaller()
|
||||
|
||||
if (cx) {
|
||||
nsIScriptGlobalObject *sgo = nsJSUtils::GetDynamicScriptGlobal(cx);
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(sgo));
|
||||
|
||||
if (sgo) {
|
||||
return sgo->GetDocShell();
|
||||
if (win) {
|
||||
return win->GetDocShell();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2135,9 +2135,10 @@ nsDocument::DispatchContentLoadedEvents()
|
||||
// loading.
|
||||
nsCOMPtr<nsIDOMEventTarget> target_frame;
|
||||
|
||||
if (mScriptGlobalObject) {
|
||||
nsPIDOMWindow *win = GetWindow();
|
||||
if (win) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem =
|
||||
do_QueryInterface(mScriptGlobalObject->GetDocShell());
|
||||
do_QueryInterface(win->GetDocShell());
|
||||
|
||||
if (docShellAsItem) {
|
||||
docShellAsItem->GetSameTypeParent(getter_AddRefs(docShellParent));
|
||||
@ -4183,11 +4184,12 @@ nsDocument::HandleDOMEvent(nsPresContext* aPresContext, nsEvent* aEvent,
|
||||
aFlags |= NS_EVENT_FLAG_BUBBLE | NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
|
||||
nsPIDOMWindow *window = GetWindow();
|
||||
|
||||
// Capturing stage
|
||||
if (NS_EVENT_FLAG_CAPTURE & aFlags && mScriptGlobalObject) {
|
||||
mScriptGlobalObject->HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags & NS_EVENT_CAPTURE_MASK,
|
||||
aEventStatus);
|
||||
if (NS_EVENT_FLAG_CAPTURE & aFlags && window) {
|
||||
window->HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags & NS_EVENT_CAPTURE_MASK, aEventStatus);
|
||||
}
|
||||
|
||||
// Local handling stage
|
||||
@ -4205,10 +4207,9 @@ nsDocument::HandleDOMEvent(nsPresContext* aPresContext, nsEvent* aEvent,
|
||||
}
|
||||
|
||||
// Bubbling stage
|
||||
if (NS_EVENT_FLAG_BUBBLE & aFlags && mScriptGlobalObject) {
|
||||
mScriptGlobalObject->HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags & NS_EVENT_BUBBLE_MASK,
|
||||
aEventStatus);
|
||||
if (NS_EVENT_FLAG_BUBBLE & aFlags && window) {
|
||||
window->HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
|
||||
aFlags & NS_EVENT_BUBBLE_MASK, aEventStatus);
|
||||
}
|
||||
|
||||
if (NS_EVENT_FLAG_INIT & aFlags) {
|
||||
@ -4406,8 +4407,10 @@ nsDocument::CreateEventGroup(nsIDOMEventGroup **aInstancePtrResult)
|
||||
void
|
||||
nsDocument::FlushPendingNotifications(mozFlushType aType)
|
||||
{
|
||||
nsPIDOMWindow *window = GetWindow();
|
||||
|
||||
if (aType == (aType & (Flush_Content | Flush_SinkNotifications)) ||
|
||||
!mScriptGlobalObject) {
|
||||
!window) {
|
||||
// Nothing to do here
|
||||
return;
|
||||
}
|
||||
@ -4417,17 +4420,17 @@ nsDocument::FlushPendingNotifications(mozFlushType aType)
|
||||
// the current code!
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem =
|
||||
do_QueryInterface(mScriptGlobalObject->GetDocShell());
|
||||
do_QueryInterface(window->GetDocShell());
|
||||
|
||||
if (docShellAsItem) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellParent;
|
||||
docShellAsItem->GetSameTypeParent(getter_AddRefs(docShellParent));
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> win(do_GetInterface(docShellParent));
|
||||
nsCOMPtr<nsIDOMWindow> parentWin(do_GetInterface(docShellParent));
|
||||
|
||||
if (win) {
|
||||
if (parentWin) {
|
||||
nsCOMPtr<nsIDOMDocument> dom_doc;
|
||||
win->GetDocument(getter_AddRefs(dom_doc));
|
||||
parentWin->GetDocument(getter_AddRefs(dom_doc));
|
||||
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(dom_doc));
|
||||
|
||||
@ -5254,8 +5257,8 @@ nsDocument::DoUnblockOnload()
|
||||
void
|
||||
nsDocument::DispatchEventToWindow(nsEvent *aEvent)
|
||||
{
|
||||
nsIScriptGlobalObject *sgo = GetScriptGlobalObject();
|
||||
if (!sgo)
|
||||
nsPIDOMWindow *window = GetWindow();
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
@ -5279,7 +5282,8 @@ nsDocument::DispatchEventToWindow(nsEvent *aEvent)
|
||||
privEvt->SetTarget(this);
|
||||
|
||||
nsIDOMEvent *domEvtPtr = domEvt;
|
||||
sgo->HandleDOMEvent(nsnull, aEvent, &domEvtPtr, NS_EVENT_FLAG_INIT, &status);
|
||||
window->HandleDOMEvent(nsnull, aEvent, &domEvtPtr, NS_EVENT_FLAG_INIT,
|
||||
&status);
|
||||
|
||||
NS_ASSERTION(domEvtPtr == domEvt, "event modified during dipatch");
|
||||
}
|
||||
|
||||
@ -532,7 +532,8 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement,
|
||||
nsCOMPtr<nsILoadGroup> loadGroup = mDocument->GetDocumentLoadGroup();
|
||||
nsCOMPtr<nsIStreamLoader> loader;
|
||||
|
||||
nsIDocShell *docshell = globalObject->GetDocShell();
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(globalObject));
|
||||
nsIDocShell *docshell = window->GetDocShell();
|
||||
|
||||
nsCOMPtr<nsIInterfaceRequestor> prompter(do_QueryInterface(docshell));
|
||||
|
||||
|
||||
@ -69,12 +69,11 @@
|
||||
#include "nsGfxCIID.h"
|
||||
#include "nsIDrawingSurface.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsIScrollableView.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
#include "cairo.h"
|
||||
#include "imgIEncoder.h"
|
||||
@ -1832,9 +1831,9 @@ nsCanvasRenderingContext2D::DrawWindow(nsIDOMWindow* aWindow, PRInt32 aX, PRInt3
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPresContext> presContext;
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(aWindow);
|
||||
if (sgo) {
|
||||
nsIDocShell* docshell = sgo->GetDocShell();
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(aWindow);
|
||||
if (win) {
|
||||
nsIDocShell* docshell = win->GetDocShell();
|
||||
if (docshell) {
|
||||
docshell->GetPresContext(getter_AddRefs(presContext));
|
||||
}
|
||||
|
||||
@ -733,17 +733,16 @@ nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener,
|
||||
// Otherwise we won't actually fire the mutation event.
|
||||
if (aType == eEventArrayType_Mutation) {
|
||||
// Go from our target to the nearest enclosing DOM window.
|
||||
nsCOMPtr<nsIScriptGlobalObject> global;
|
||||
nsCOMPtr<nsPIDOMWindow> window;
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mTarget));
|
||||
if (content)
|
||||
document = content->GetOwnerDoc();
|
||||
else document = do_QueryInterface(mTarget);
|
||||
if (document)
|
||||
global = document->GetScriptGlobalObject();
|
||||
else global = do_QueryInterface(mTarget);
|
||||
if (global) {
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(global));
|
||||
window = document->GetWindow();
|
||||
else window = do_QueryInterface(mTarget);
|
||||
if (window) {
|
||||
NS_ASSERTION(window->IsInnerWindow(),
|
||||
"Setting mutation listener bits on outer window?");
|
||||
window->SetMutationListeners(aSubType);
|
||||
|
||||
@ -78,7 +78,6 @@
|
||||
#include "nsISelection.h"
|
||||
#include "nsIFrameSelection.h"
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
@ -618,10 +617,9 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
// Now we should fire the focus event. We fire it on the document,
|
||||
// then the content node, then the window.
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObject =
|
||||
do_QueryInterface(mDocument->GetWindow());
|
||||
nsCOMPtr<nsPIDOMWindow> window(mDocument->GetWindow());
|
||||
|
||||
if (globalObject) {
|
||||
if (window) {
|
||||
// We don't want there to be a focused content node while we're
|
||||
// dispatching the focus event.
|
||||
|
||||
@ -643,8 +641,8 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
|
||||
globalObject->HandleDOMEvent(aPresContext, &focusevent, nsnull,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
window->HandleDOMEvent(aPresContext, &focusevent, nsnull,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
|
||||
SetFocusedContent(currentFocus); // we kept this reference above
|
||||
NS_IF_RELEASE(gLastFocusedContent);
|
||||
@ -740,17 +738,16 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
// get the window here, in case the event causes
|
||||
// gLastFocusedDocument to change.
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObject =
|
||||
do_QueryInterface(gLastFocusedDocument->GetWindow());
|
||||
nsCOMPtr<nsPIDOMWindow> window(gLastFocusedDocument->GetWindow());
|
||||
|
||||
gLastFocusedDocument->HandleDOMEvent(gLastFocusedPresContext,
|
||||
&event, nsnull,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
|
||||
if (globalObject)
|
||||
globalObject->HandleDOMEvent(gLastFocusedPresContext, &event,
|
||||
nsnull, NS_EVENT_FLAG_INIT,
|
||||
&status);
|
||||
if (window) {
|
||||
window->HandleDOMEvent(gLastFocusedPresContext, &event, nsnull,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
}
|
||||
|
||||
// Now clear our our global variables
|
||||
@ -848,8 +845,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
{
|
||||
EnsureDocument(aPresContext);
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> ourGlobal =
|
||||
do_QueryInterface(mDocument->GetWindow());
|
||||
nsCOMPtr<nsPIDOMWindow> ourWindow(mDocument->GetWindow());
|
||||
|
||||
// Suppress the focus controller for the duration of the
|
||||
// de-activation. This will cause it to remember the last
|
||||
@ -898,8 +894,8 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
mDocument->HandleDOMEvent(aPresContext, &event, nsnull,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
|
||||
if (ourGlobal)
|
||||
ourGlobal->HandleDOMEvent(aPresContext, &event, nsnull,
|
||||
if (ourWindow)
|
||||
ourWindow->HandleDOMEvent(aPresContext, &event, nsnull,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
|
||||
// Now clear our our global variables
|
||||
@ -3017,7 +3013,7 @@ nsEventStateManager::ChangeFocusWith(nsIContent* aFocusContent,
|
||||
// Get focus controller.
|
||||
EnsureDocument(mPresContext);
|
||||
nsCOMPtr<nsIFocusController> focusController = nsnull;
|
||||
nsCOMPtr<nsPIDOMWindow> window = mDocument->GetWindow();
|
||||
nsCOMPtr<nsPIDOMWindow> window(mDocument->GetWindow());
|
||||
if (window)
|
||||
focusController = window->GetRootFocusController();
|
||||
|
||||
@ -3844,7 +3840,7 @@ nsEventStateManager::SetContentState(nsIContent *aContent, PRInt32 aState)
|
||||
}
|
||||
|
||||
#ifdef DEBUG_aleventhal
|
||||
nsCOMPtr<nsPIDOMWindow> currentWindow = mDocument->GetWindow();
|
||||
nsPIDOMWindow *currentWindow = mDocument->GetWindow();
|
||||
if (currentWindow) {
|
||||
nsIFocusController *fc = currentWindow->GetRootFocusController();
|
||||
if (fc) {
|
||||
@ -4103,14 +4099,15 @@ nsEventStateManager::SendFocusBlur(nsPresContext* aPresContext,
|
||||
// Make sure we're not switching command dispatchers, if so,
|
||||
// surpress the blurred one
|
||||
if(gLastFocusedDocument && mDocument) {
|
||||
nsCOMPtr<nsPIDOMWindow> newWindow = mDocument->GetWindow();
|
||||
nsPIDOMWindow *newWindow = mDocument->GetWindow();
|
||||
if (newWindow) {
|
||||
nsIFocusController *newFocusController =
|
||||
newFocusController = newWindow->GetRootFocusController();
|
||||
nsCOMPtr<nsPIDOMWindow> oldWindow =
|
||||
gLastFocusedDocument->GetWindow();
|
||||
newWindow->GetRootFocusController();
|
||||
nsPIDOMWindow *oldWindow = gLastFocusedDocument->GetWindow();
|
||||
if (oldWindow) {
|
||||
nsIFocusController *suppressed = oldWindow->GetRootFocusController();
|
||||
nsIFocusController *suppressed =
|
||||
oldWindow->GetRootFocusController();
|
||||
|
||||
if (suppressed != newFocusController) {
|
||||
oldFocusSuppressor.Suppress(suppressed, "SendFocusBlur Window Switch #1");
|
||||
}
|
||||
@ -4147,27 +4144,30 @@ nsEventStateManager::SendFocusBlur(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
// Go ahead and fire a blur on the window.
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObject;
|
||||
nsCOMPtr<nsPIDOMWindow> window;
|
||||
|
||||
if(gLastFocusedDocument)
|
||||
globalObject = do_QueryInterface(gLastFocusedDocument->GetWindow());
|
||||
window = gLastFocusedDocument->GetWindow();
|
||||
|
||||
EnsureDocument(presShell);
|
||||
|
||||
if (gLastFocusedDocument && (gLastFocusedDocument != mDocument) && globalObject) {
|
||||
if (gLastFocusedDocument && (gLastFocusedDocument != mDocument) &&
|
||||
window) {
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsEvent event(PR_TRUE, NS_BLUR_CONTENT);
|
||||
|
||||
// Make sure we're not switching command dispatchers, if so,
|
||||
// suppress the blurred one if it isn't already suppressed
|
||||
if (mDocument && !oldFocusSuppressor.Suppressing()) {
|
||||
nsCOMPtr<nsPIDOMWindow> newWindow = mDocument->GetWindow();
|
||||
nsCOMPtr<nsPIDOMWindow> newWindow(mDocument->GetWindow());
|
||||
|
||||
if (newWindow) {
|
||||
nsCOMPtr<nsPIDOMWindow> oldWindow = do_QueryInterface(globalObject);
|
||||
nsIFocusController *newFocusController = newWindow->GetRootFocusController();
|
||||
nsCOMPtr<nsPIDOMWindow> oldWindow(gLastFocusedDocument->GetWindow());
|
||||
nsIFocusController *newFocusController =
|
||||
newWindow->GetRootFocusController();
|
||||
if (oldWindow) {
|
||||
nsIFocusController *suppressed = oldWindow->GetRootFocusController();
|
||||
nsIFocusController *suppressed =
|
||||
oldWindow->GetRootFocusController();
|
||||
if (suppressed != newFocusController) {
|
||||
oldFocusSuppressor.Suppress(suppressed, "SendFocusBlur Window Switch #2");
|
||||
}
|
||||
@ -4193,8 +4193,9 @@ nsEventStateManager::SendFocusBlur(nsPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
pusher.Push(globalObject);
|
||||
globalObject->HandleDOMEvent(gLastFocusedPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
|
||||
pusher.Push(window);
|
||||
window->HandleDOMEvent(gLastFocusedPresContext, &event, nsnull,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
|
||||
if (previousFocus && mCurrentFocus != previousFocus) {
|
||||
// The window's blur handler focused something else.
|
||||
@ -4313,7 +4314,7 @@ void nsEventStateManager::EnsureFocusSynchronization()
|
||||
// cannot get out of sync.
|
||||
// See Bug 304751, calling FireOnChange() inside
|
||||
// nsComboboxControlFrame::SetFocus() is bad
|
||||
nsCOMPtr<nsPIDOMWindow> currentWindow = mDocument->GetWindow();
|
||||
nsPIDOMWindow *currentWindow = mDocument->GetWindow();
|
||||
if (currentWindow) {
|
||||
nsIFocusController *fc = currentWindow->GetRootFocusController();
|
||||
if (fc) {
|
||||
@ -4536,7 +4537,7 @@ nsEventStateManager::DispatchNewEvent(nsISupports* aTarget,
|
||||
}
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsCOMPtr<nsIScriptGlobalObject> target(do_QueryInterface(aTarget));
|
||||
nsCOMPtr<nsPIDOMWindow> target(do_QueryInterface(aTarget));
|
||||
if (target) {
|
||||
ret = target->HandleDOMEvent(mPresContext, innerEvent, &aEvent,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
@ -5169,7 +5170,7 @@ nsEventStateManager::IsIFrameDoc(nsIDocShell* aDocShell)
|
||||
{
|
||||
NS_ASSERTION(aDocShell, "docshell is null");
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> domWindow = do_GetInterface(aDocShell);
|
||||
nsCOMPtr<nsPIDOMWindow> domWindow(do_GetInterface(aDocShell));
|
||||
if (!domWindow) {
|
||||
NS_ERROR("We're a child of a docshell without a window?");
|
||||
return PR_FALSE;
|
||||
|
||||
@ -46,7 +46,6 @@
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
|
||||
@ -85,7 +85,6 @@
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScriptLoader.h"
|
||||
#include "nsRuleData.h"
|
||||
|
||||
@ -1531,8 +1530,7 @@ nsGenericHTMLElement::HandleDOMEventForAnchors(nsPresContext* aPresContext,
|
||||
// If the window is not active, do not allow the focus to bring the
|
||||
// window to the front. We update the focus controller, but do
|
||||
// nothing else.
|
||||
nsCOMPtr<nsPIDOMWindow> win =
|
||||
do_QueryInterface(document->GetScriptGlobalObject());
|
||||
nsPIDOMWindow *win = document->GetWindow();
|
||||
if (win) {
|
||||
nsIFocusController *focusController =
|
||||
win->GetRootFocusController();
|
||||
@ -1737,7 +1735,7 @@ nsGenericHTMLElement::GetEventListenerManagerForAttr(nsIEventListenerManager** a
|
||||
// Attributes on the body and frameset tags get set on the global object
|
||||
if (mNodeInfo->Equals(nsHTMLAtoms::body) ||
|
||||
mNodeInfo->Equals(nsHTMLAtoms::frameset)) {
|
||||
nsIScriptGlobalObject *sgo;
|
||||
nsPIDOMWindow *win;
|
||||
|
||||
// If we have a document, and it has a script global, add the
|
||||
// event listener on the global. If not, proceed as normal.
|
||||
@ -1745,14 +1743,14 @@ nsGenericHTMLElement::GetEventListenerManagerForAttr(nsIEventListenerManager** a
|
||||
// override BindToTree for those classes and munge event listeners there?
|
||||
nsIDocument *document = GetOwnerDoc();
|
||||
nsresult rv = NS_OK;
|
||||
if (document && (sgo = document->GetScriptGlobalObject())) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(sgo));
|
||||
if (document && (win = document->GetWindow())) {
|
||||
nsCOMPtr<nsIDOMEventReceiver> receiver(do_QueryInterface(win));
|
||||
NS_ENSURE_TRUE(receiver, NS_ERROR_FAILURE);
|
||||
|
||||
rv = receiver->GetListenerManager(aManager);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
NS_ADDREF(*aTarget = sgo);
|
||||
NS_ADDREF(*aTarget = win);
|
||||
}
|
||||
*aDefer = PR_FALSE;
|
||||
} else {
|
||||
|
||||
@ -52,7 +52,6 @@
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIFormControlFrame.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
@ -67,7 +66,6 @@
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsCategoryManagerUtils.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsRange.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
@ -853,8 +851,7 @@ nsHTMLFormElement::DoSubmit(nsEvent* aEvent)
|
||||
|
||||
// XXXbz if the script global is that for an sXBL/XBL2 doc, it won't
|
||||
// be a window...
|
||||
nsCOMPtr<nsPIDOMWindow> window =
|
||||
do_QueryInterface(GetOwnerDoc()->GetScriptGlobalObject());
|
||||
nsPIDOMWindow *window = GetOwnerDoc()->GetWindow();
|
||||
|
||||
if (window) {
|
||||
mSubmitPopupState = window->GetPopupControlState();
|
||||
@ -1037,8 +1034,7 @@ nsHTMLFormElement::NotifySubmitObservers(nsIURI* aActionURL,
|
||||
// XXXbz what do the submit observers actually want? The window
|
||||
// of the document this is shown in? Or something else?
|
||||
// sXBL/XBL2 issue
|
||||
nsCOMPtr<nsIDOMWindowInternal> window =
|
||||
do_QueryInterface(GetOwnerDoc()->GetScriptGlobalObject());
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetOwnerDoc()->GetWindow();
|
||||
|
||||
PRBool loop = PR_TRUE;
|
||||
while (NS_SUCCEEDED(theEnum->HasMoreElements(&loop)) && loop) {
|
||||
|
||||
@ -50,7 +50,6 @@
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIIOService.h"
|
||||
#include "nsIURL.h"
|
||||
|
||||
@ -47,7 +47,6 @@
|
||||
#include "nsIControllers.h"
|
||||
#include "nsIFocusController.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsContentCID.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
@ -1057,8 +1056,7 @@ nsHTMLInputElement::SetFocus(nsPresContext* aPresContext)
|
||||
// If the window is not active, do not allow the focus to bring the
|
||||
// window to the front. We update the focus controller, but do
|
||||
// nothing else.
|
||||
nsCOMPtr<nsPIDOMWindow> win =
|
||||
do_QueryInterface(doc->GetScriptGlobalObject());
|
||||
nsCOMPtr<nsPIDOMWindow> win = doc->GetWindow();
|
||||
if (win) {
|
||||
nsIFocusController *focusController = win->GetRootFocusController();
|
||||
PRBool isActive = PR_FALSE;
|
||||
@ -1104,8 +1102,7 @@ nsHTMLInputElement::Select()
|
||||
// If the window is not active, do not allow the select to bring the
|
||||
// window to the front. We update the focus controller, but do
|
||||
// nothing else.
|
||||
nsCOMPtr<nsPIDOMWindow> win =
|
||||
do_QueryInterface(doc->GetScriptGlobalObject());
|
||||
nsPIDOMWindow *win = doc->GetWindow();
|
||||
if (win) {
|
||||
nsIFocusController *focusController = win->GetRootFocusController();
|
||||
PRBool isActive = PR_FALSE;
|
||||
|
||||
@ -45,7 +45,6 @@
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsIFocusController.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
@ -258,11 +257,12 @@ nsHTMLLegendElement::SetFocus(nsPresContext* aPresContext)
|
||||
} else {
|
||||
// If the legend isn't focusable (no tabindex) we focus whatever is
|
||||
// focusable following the legend instead, bug 81481.
|
||||
nsCOMPtr<nsPIDOMWindow> ourWindow = do_QueryInterface(document->GetScriptGlobalObject());
|
||||
nsCOMPtr<nsPIDOMWindow> ourWindow = document->GetWindow();
|
||||
if (ourWindow) {
|
||||
nsIFocusController* focusController = ourWindow->GetRootFocusController();
|
||||
nsIDOMElement* domElement = nsnull;
|
||||
CallQueryInterface(this, &domElement);
|
||||
nsIFocusController* focusController =
|
||||
ourWindow->GetRootFocusController();
|
||||
nsCOMPtr<nsIDOMElement> domElement =
|
||||
do_QueryInterface(NS_STATIC_CAST(nsIContent *, this));
|
||||
if (focusController && domElement) {
|
||||
focusController->MoveFocus(PR_TRUE, domElement);
|
||||
}
|
||||
|
||||
@ -58,7 +58,6 @@
|
||||
#include "nsParserUtils.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
||||
class nsHTMLLinkElement : public nsGenericHTMLElement,
|
||||
public nsIDOMHTMLLinkElement,
|
||||
|
||||
@ -77,7 +77,6 @@
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIWebShellServices.h"
|
||||
#include "nsIDocumentLoader.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIXPConnect.h"
|
||||
#include "nsContentList.h"
|
||||
@ -1830,8 +1829,7 @@ nsHTMLDocument::SetCookie(const nsAString& aCookie)
|
||||
nsCOMPtr<nsICookieService> service = do_GetService(kCookieServiceCID);
|
||||
if (service && mDocumentURI) {
|
||||
nsCOMPtr<nsIPrompt> prompt;
|
||||
nsCOMPtr<nsIDOMWindowInternal> window =
|
||||
do_QueryInterface(GetScriptGlobalObject());
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetWindow();
|
||||
if (window) {
|
||||
window->GetPrompter(getter_AddRefs(prompt));
|
||||
}
|
||||
@ -3559,10 +3557,11 @@ NS_IMETHODIMP
|
||||
nsHTMLDocument::SetDesignMode(const nsAString & aDesignMode)
|
||||
{
|
||||
// get editing session
|
||||
if (!mScriptGlobalObject)
|
||||
nsPIDOMWindow *window = GetWindow();
|
||||
if (!window)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIDocShell *docshell = mScriptGlobalObject->GetDocShell();
|
||||
nsIDocShell *docshell = window->GetDocShell();
|
||||
if (!docshell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -3584,9 +3583,6 @@ nsHTMLDocument::SetDesignMode(const nsAString & aDesignMode)
|
||||
if (!editSession)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIDOMWindow *window = GetWindow();
|
||||
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
|
||||
|
||||
if (aDesignMode.LowerCaseEqualsLiteral("on") && !mEditingIsOn) {
|
||||
rv = editSession->MakeWindowEditable(window, "html", PR_FALSE);
|
||||
|
||||
@ -3634,10 +3630,12 @@ nsHTMLDocument::GetMidasCommandManager(nsICommandManager** aCmdMgr)
|
||||
}
|
||||
|
||||
*aCmdMgr = nsnull;
|
||||
if (!mScriptGlobalObject)
|
||||
|
||||
nsPIDOMWindow *window = GetWindow();
|
||||
if (!window)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIDocShell *docshell = mScriptGlobalObject->GetDocShell();
|
||||
nsIDocShell *docshell = window->GetDocShell();
|
||||
if (!docshell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
||||
@ -73,16 +73,9 @@ public:
|
||||
nsISupports *aState,
|
||||
PRBool aRemoveEventListeners,
|
||||
PRBool aClearScope);
|
||||
virtual void SetDocShell(nsIDocShell *aDocShell);
|
||||
virtual nsIDocShell *GetDocShell();
|
||||
virtual void SetOpenerWindow(nsIDOMWindowInternal *aOpener);
|
||||
virtual void SetGlobalObjectOwner(nsIScriptGlobalObjectOwner* aOwner);
|
||||
virtual nsIScriptGlobalObjectOwner *GetGlobalObjectOwner();
|
||||
virtual nsresult HandleDOMEvent(nsPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus);
|
||||
virtual JSObject *GetGlobalJSObject();
|
||||
virtual void OnFinalize(JSObject *aObject);
|
||||
virtual void SetScriptsEnabled(PRBool aEnabled, PRBool aFireTimeouts);
|
||||
@ -294,20 +287,6 @@ nsXBLDocGlobalObject::SetNewDocument(nsIDOMDocument *aDocument,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsXBLDocGlobalObject::SetDocShell(nsIDocShell *aDocShell)
|
||||
{
|
||||
NS_NOTREACHED("waaah!");
|
||||
}
|
||||
|
||||
|
||||
nsIDocShell *
|
||||
nsXBLDocGlobalObject::GetDocShell()
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsXBLDocGlobalObject::SetOpenerWindow(nsIDOMWindowInternal *aOpener)
|
||||
{
|
||||
@ -329,17 +308,6 @@ nsXBLDocGlobalObject::GetGlobalObjectOwner()
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsXBLDocGlobalObject::HandleDOMEvent(nsPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
NS_NOTREACHED("waaah!");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
JSObject *
|
||||
nsXBLDocGlobalObject::GetGlobalJSObject()
|
||||
{
|
||||
|
||||
@ -43,9 +43,8 @@
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsPIWindowRoot.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIFocusController.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDOMElement.h"
|
||||
@ -224,8 +223,8 @@ nsXBLWindowHandler :: IsEditor()
|
||||
if (!focusedWindow)
|
||||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> obj(do_QueryInterface(focusedWindow));
|
||||
nsIDocShell *docShell = obj->GetDocShell();
|
||||
nsCOMPtr<nsPIDOMWindow> piwin(do_QueryInterface(focusedWindow));
|
||||
nsIDocShell *docShell = piwin->GetDocShell();
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
if (docShell)
|
||||
docShell->GetPresShell(getter_AddRefs(presShell));
|
||||
|
||||
@ -45,7 +45,6 @@
|
||||
#include "nsIDOMDOMImplementation.h"
|
||||
#include "nsIDOMNSDocument.h"
|
||||
#include "nsIXMLContent.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
||||
@ -47,8 +47,7 @@
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIXSLTProcessor.h"
|
||||
#include "nsISyncLoadDOMService.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIServiceManager.h"
|
||||
@ -79,7 +78,7 @@ nsXMLPrettyPrinter::PrettyPrint(nsIDocument* aDocument)
|
||||
}
|
||||
|
||||
// check if we're in an invisible iframe
|
||||
nsCOMPtr<nsIDOMWindowInternal> internalWin = do_QueryInterface(aDocument->GetScriptGlobalObject());
|
||||
nsPIDOMWindow *internalWin = aDocument->GetWindow();
|
||||
nsCOMPtr<nsIDOMElement> frameElem;
|
||||
if (internalWin) {
|
||||
internalWin->GetFrameElement(getter_AddRefs(frameElem));
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
#include "nsIDOMNSDocument.h"
|
||||
#include "nsIParser.h"
|
||||
#include "nsIRefreshURI.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsITextContent.h"
|
||||
#include "nsIXMLContent.h"
|
||||
#include "nsContentCID.h"
|
||||
@ -212,10 +212,10 @@ void txMozillaXMLOutput::endDocument(nsresult aResult)
|
||||
|
||||
if (!mRefreshString.IsEmpty()) {
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(mDocument);
|
||||
nsIScriptGlobalObject *sgo = doc->GetScriptGlobalObject();
|
||||
if (sgo) {
|
||||
nsPIDOMWindow *win = doc->GetWindow();
|
||||
if (win) {
|
||||
nsCOMPtr<nsIRefreshURI> refURI =
|
||||
do_QueryInterface(sgo->GetDocShell());
|
||||
do_QueryInterface(win->GetDocShell());
|
||||
if (refURI) {
|
||||
refURI->SetupRefreshURIFromHeader(doc->GetBaseURI(),
|
||||
mRefreshString);
|
||||
|
||||
@ -565,15 +565,15 @@ nsXULElement::GetEventListenerManagerForAttr(nsIEventListenerManager** aManager,
|
||||
|
||||
nsIContent *root = doc->GetRootContent();
|
||||
if ((!root || root == this) && !mNodeInfo->Equals(nsXULAtoms::overlay)) {
|
||||
nsIScriptGlobalObject *global = doc->GetScriptGlobalObject();
|
||||
nsPIDOMWindow *window = doc->GetWindow();
|
||||
|
||||
nsCOMPtr<nsIDOMEventReceiver> receiver = do_QueryInterface(global);
|
||||
if (! receiver)
|
||||
nsCOMPtr<nsIDOMEventReceiver> receiver = do_QueryInterface(window);
|
||||
if (!receiver)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
|
||||
nsresult rv = receiver->GetListenerManager(aManager);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
NS_ADDREF(*aTarget = global);
|
||||
NS_ADDREF(*aTarget = window);
|
||||
}
|
||||
*aDefer = PR_FALSE;
|
||||
return rv;
|
||||
|
||||
@ -57,7 +57,6 @@
|
||||
#include "nsContentCID.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIDOMXULDocument.h"
|
||||
@ -375,8 +374,7 @@ XULPopupListenerImpl::FireFocusOnTargetContent(nsIDOMNode* aTargetNode)
|
||||
// Lock to scroll by SetFocus. See bug 309075.
|
||||
nsCOMPtr<nsIFocusController> focusController = nsnull;
|
||||
PRBool isAlreadySuppressed = PR_FALSE;
|
||||
nsCOMPtr<nsPIDOMWindow> ourWindow =
|
||||
do_QueryInterface(doc->GetScriptGlobalObject());
|
||||
nsPIDOMWindow *ourWindow = doc->GetWindow();
|
||||
if (ourWindow) {
|
||||
focusController = ourWindow->GetRootFocusController();
|
||||
if (focusController) {
|
||||
@ -599,8 +597,7 @@ XULPopupListenerImpl::LaunchPopup(PRInt32 aClientX, PRInt32 aClientY)
|
||||
return NS_OK;
|
||||
|
||||
// We have some popup content. Obtain our window.
|
||||
nsCOMPtr<nsIDOMWindowInternal> domWindow =
|
||||
do_QueryInterface(document->GetScriptGlobalObject());
|
||||
nsPIDOMWindow *domWindow = document->GetWindow();
|
||||
|
||||
if (domWindow) {
|
||||
// Find out if we're anchored.
|
||||
|
||||
@ -55,7 +55,6 @@ class nsString;
|
||||
class nsVoidArray;
|
||||
class nsXULPrototypeElement;
|
||||
class nsIXULDocument;
|
||||
class nsIScriptGlobalObject;
|
||||
class nsNodeInfoManager;
|
||||
class nsISupportsArray;
|
||||
|
||||
|
||||
@ -92,16 +92,9 @@ public:
|
||||
nsISupports *aState,
|
||||
PRBool aRemoveEventListeners,
|
||||
PRBool aClearScope);
|
||||
virtual void SetDocShell(nsIDocShell *aDocShell);
|
||||
virtual nsIDocShell *GetDocShell();
|
||||
virtual void SetOpenerWindow(nsIDOMWindowInternal *aOpener);
|
||||
virtual void SetGlobalObjectOwner(nsIScriptGlobalObjectOwner* aOwner);
|
||||
virtual nsIScriptGlobalObjectOwner *GetGlobalObjectOwner();
|
||||
virtual nsresult HandleDOMEvent(nsPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus);
|
||||
virtual JSObject *GetGlobalJSObject();
|
||||
virtual void OnFinalize(JSObject *aObject);
|
||||
virtual void SetScriptsEnabled(PRBool aEnabled, PRBool aFireTimeouts);
|
||||
@ -856,20 +849,6 @@ nsXULPDGlobalObject::SetNewDocument(nsIDOMDocument *aDocument,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsXULPDGlobalObject::SetDocShell(nsIDocShell *aDocShell)
|
||||
{
|
||||
NS_NOTREACHED("waaah!");
|
||||
}
|
||||
|
||||
|
||||
nsIDocShell *
|
||||
nsXULPDGlobalObject::GetDocShell()
|
||||
{
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsXULPDGlobalObject::SetOpenerWindow(nsIDOMWindowInternal *aOpener)
|
||||
{
|
||||
@ -891,17 +870,6 @@ nsXULPDGlobalObject::GetGlobalObjectOwner()
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsXULPDGlobalObject::HandleDOMEvent(nsPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
NS_NOTREACHED("waaah!");
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
JSObject *
|
||||
nsXULPDGlobalObject::GetGlobalJSObject()
|
||||
{
|
||||
|
||||
@ -1174,13 +1174,13 @@ nsresult nsDocShell::FindTarget(const PRUnichar *aWindowTarget,
|
||||
}
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Get the DocShell from the new window...
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo;
|
||||
sgo = do_QueryInterface(newWindow, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
{
|
||||
// Get the DocShell from the new window...
|
||||
nsCOMPtr<nsPIDOMWindow> piwindow(do_QueryInterface(newWindow));
|
||||
|
||||
// This will AddRef() aResult...
|
||||
*aResult = sgo->GetDocShell();
|
||||
// *aResult will be AddRef()'ed below...
|
||||
*aResult = piwindow->GetDocShell();
|
||||
}
|
||||
|
||||
// If all went well, indicate that a new window has been created.
|
||||
if (*aResult) {
|
||||
@ -2203,8 +2203,7 @@ PrintDocTree(nsIDocShellTreeNode * aParentNode, int aLevel)
|
||||
parentAsDocShell->GetPresContext(getter_AddRefs(presContext));
|
||||
nsIDocument *doc = presShell->GetDocument();
|
||||
|
||||
nsIScriptGlobalObject* sgo = doc->GetScriptGlobalObject();
|
||||
nsCOMPtr<nsIDOMWindowInternal> domwin(do_QueryInterface(sgo));
|
||||
nsCOMPtr<nsIDOMWindowInternal> domwin(doc->GetWindow());
|
||||
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
nsIViewManager* vm = presShell->GetViewManager();
|
||||
@ -3537,7 +3536,9 @@ nsDocShell::Destroy()
|
||||
mCurrentURI = nsnull;
|
||||
|
||||
if (mScriptGlobal) {
|
||||
mScriptGlobal->SetDocShell(nsnull);
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(mScriptGlobal));
|
||||
win->SetDocShell(nsnull);
|
||||
|
||||
mScriptGlobal->SetGlobalObjectOwner(nsnull);
|
||||
mScriptGlobal = nsnull;
|
||||
}
|
||||
@ -6150,10 +6151,10 @@ nsDocShell::CheckLoadingPermissions()
|
||||
|
||||
nsIScriptContext *currentCX = GetScriptContextFromJSContext(cx);
|
||||
nsCOMPtr<nsIDocShellTreeItem> callerTreeItem;
|
||||
nsIScriptGlobalObject *sgo;
|
||||
nsCOMPtr<nsPIDOMWindow> win;
|
||||
if (currentCX &&
|
||||
(sgo = currentCX->GetGlobalObject()) &&
|
||||
(callerTreeItem = do_QueryInterface(sgo->GetDocShell()))) {
|
||||
(win = do_QueryInterface(currentCX->GetGlobalObject())) &&
|
||||
(callerTreeItem = do_QueryInterface(win->GetDocShell()))) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> callerRoot;
|
||||
callerTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(callerRoot));
|
||||
|
||||
@ -8230,7 +8231,8 @@ nsDocShell::EnsureScriptEnvironment()
|
||||
getter_AddRefs(mScriptGlobal));
|
||||
NS_ENSURE_TRUE(mScriptGlobal, NS_ERROR_FAILURE);
|
||||
|
||||
mScriptGlobal->SetDocShell(NS_STATIC_CAST(nsIDocShell *, this));
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(mScriptGlobal));
|
||||
win->SetDocShell(NS_STATIC_CAST(nsIDocShell *, this));
|
||||
mScriptGlobal->
|
||||
SetGlobalObjectOwner(NS_STATIC_CAST
|
||||
(nsIScriptGlobalObjectOwner *, this));
|
||||
|
||||
@ -53,8 +53,6 @@
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIRefreshURI.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScriptGlobalObjectOwner.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
@ -77,8 +77,8 @@ class nsIDocument;
|
||||
struct nsTimeout;
|
||||
|
||||
#define NS_PIDOMWINDOW_IID \
|
||||
{ 0x55f987bc, 0xca30, 0x494c, \
|
||||
{ 0xa9, 0x85, 0xf1, 0xf3, 0x4b, 0x9d, 0x47, 0xd8 } }
|
||||
{ 0x96138335, 0x51be, 0x4b2e, \
|
||||
{ 0x81, 0xd4, 0x35, 0x8a, 0xaf, 0x5b, 0x17, 0xfa } }
|
||||
|
||||
class nsPIDOMWindow : public nsIDOMWindowInternal
|
||||
{
|
||||
@ -292,16 +292,32 @@ public:
|
||||
|
||||
virtual PRBool WouldReuseInnerWindow(nsIDocument *aNewDocument) = 0;
|
||||
|
||||
virtual nsresult HandleDOMEvent(nsPresContext *aPresContext, nsEvent *aEvent,
|
||||
nsIDOMEvent **aDOMEvent, PRUint32 aFlags,
|
||||
nsEventStatus *aEventStatus) = 0;
|
||||
|
||||
nsIDocShell *GetDocShell()
|
||||
{
|
||||
if (mOuterWindow) {
|
||||
return mOuterWindow->mDocShell;
|
||||
}
|
||||
|
||||
return mDocShell;
|
||||
}
|
||||
|
||||
virtual void SetDocShell(nsIDocShell *aDocShell) = 0;
|
||||
|
||||
|
||||
protected:
|
||||
// The nsPIDOMWindow constructor. The aOuterWindow argument should
|
||||
// be null if and only if the created window itself is an outer
|
||||
// window. In all other cases aOuterWindow should be the outer
|
||||
// window for the inner window that is being created.
|
||||
nsPIDOMWindow(nsPIDOMWindow *aOuterWindow)
|
||||
: mFrameElement(nsnull), mRunningTimeout(nsnull), mMutationBits(0),
|
||||
mIsDocumentLoaded(PR_FALSE), mIsHandlingResizeEvent(PR_FALSE),
|
||||
mIsInnerWindow(aOuterWindow != nsnull), mInnerWindow(nsnull),
|
||||
mOuterWindow(aOuterWindow)
|
||||
: mFrameElement(nsnull), mDocShell(nsnull), mRunningTimeout(nsnull),
|
||||
mMutationBits(0), mIsDocumentLoaded(PR_FALSE),
|
||||
mIsHandlingResizeEvent(PR_FALSE), mIsInnerWindow(aOuterWindow != nsnull),
|
||||
mInnerWindow(nsnull), mOuterWindow(aOuterWindow)
|
||||
{
|
||||
}
|
||||
|
||||
@ -314,6 +330,7 @@ protected:
|
||||
// These members are only used on outer windows.
|
||||
nsIDOMElement *mFrameElement; // weak
|
||||
nsCOMPtr<nsIURI> mOpenerScriptURL; // strong; used to determine whether to clear scope
|
||||
nsIDocShell *mDocShell; // Weak Reference
|
||||
|
||||
// These variables are only used on inner windows.
|
||||
nsTimeout *mRunningTimeout;
|
||||
|
||||
@ -52,8 +52,8 @@ class nsIScriptGlobalObjectOwner;
|
||||
struct JSObject;
|
||||
|
||||
#define NS_ISCRIPTGLOBALOBJECT_IID \
|
||||
{ 0xd326a211, 0xdc31, 0x45c6, \
|
||||
{ 0x98, 0x97, 0x22, 0x11, 0xea, 0xbc, 0xd0, 0x1c } }
|
||||
{ 0x3a09462f, 0xe0f7, 0x4c54, \
|
||||
{ 0xaa, 0x08, 0x69, 0x25, 0x51, 0xe0, 0xcc, 0x8d } }
|
||||
|
||||
/**
|
||||
* The JavaScript specific global object. This often used to store
|
||||
@ -71,8 +71,6 @@ public:
|
||||
nsISupports *aState,
|
||||
PRBool aRemoveEventListeners,
|
||||
PRBool aClearScope) = 0;
|
||||
virtual void SetDocShell(nsIDocShell *aDocShell) = 0;
|
||||
virtual nsIDocShell *GetDocShell() = 0;
|
||||
virtual void SetOpenerWindow(nsIDOMWindowInternal *aOpener)=0;
|
||||
|
||||
/**
|
||||
@ -91,12 +89,6 @@ public:
|
||||
*/
|
||||
virtual nsIScriptGlobalObjectOwner *GetGlobalObjectOwner() = 0;
|
||||
|
||||
virtual nsresult HandleDOMEvent(nsPresContext* aPresContext,
|
||||
nsEvent* aEvent,
|
||||
nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus)=0;
|
||||
|
||||
virtual JSObject *GetGlobalJSObject() = 0;
|
||||
|
||||
/**
|
||||
|
||||
@ -152,24 +152,19 @@ nsFocusController::RewindFocusState()
|
||||
NS_IMETHODIMP
|
||||
nsFocusController::SetFocusedWindow(nsIDOMWindowInternal* aWindow)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> pwin = do_QueryInterface(aWindow);
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(aWindow);
|
||||
|
||||
if (pwin) {
|
||||
pwin = pwin->GetOuterWindow();
|
||||
if (win) {
|
||||
win = win->GetOuterWindow();
|
||||
}
|
||||
|
||||
NS_ASSERTION(!pwin || !pwin->IsInnerWindow(),
|
||||
NS_ASSERTION(!win || !win->IsInnerWindow(),
|
||||
"Uh, inner window can't have focus!");
|
||||
|
||||
nsCOMPtr<nsIDOMWindowInternal> win = do_QueryInterface(pwin);
|
||||
|
||||
if (win && (mCurrentWindow != win)) {
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(win);
|
||||
if (sgo) {
|
||||
nsCOMPtr<nsIBaseWindow> basewin = do_QueryInterface(sgo->GetDocShell());
|
||||
if (basewin)
|
||||
basewin->SetFocus();
|
||||
}
|
||||
nsCOMPtr<nsIBaseWindow> basewin = do_QueryInterface(win->GetDocShell());
|
||||
if (basewin)
|
||||
basewin->SetFocus();
|
||||
}
|
||||
|
||||
if (mCurrentWindow) {
|
||||
@ -561,10 +556,8 @@ nsFocusController::UpdateWWActiveWindow()
|
||||
if (!wwatch) return;
|
||||
|
||||
// This gets the toplevel DOMWindow
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(mCurrentWindow);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem =
|
||||
do_QueryInterface(sgo->GetDocShell());
|
||||
do_QueryInterface(mCurrentWindow->GetDocShell());
|
||||
if (!docShellAsItem) return;
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> rootItem;
|
||||
|
||||
@ -112,8 +112,8 @@ public:
|
||||
protected:
|
||||
nsCOMPtr<nsIDOMElement> mCurrentElement; // [OWNER]
|
||||
nsCOMPtr<nsIDOMElement> mPreviousElement; // [OWNER]
|
||||
nsCOMPtr<nsIDOMWindowInternal> mCurrentWindow; // [OWNER]
|
||||
nsCOMPtr<nsIDOMWindowInternal> mPreviousWindow; // [OWNER]
|
||||
nsCOMPtr<nsPIDOMWindow> mCurrentWindow; // [OWNER]
|
||||
nsCOMPtr<nsPIDOMWindow> mPreviousWindow; // [OWNER]
|
||||
nsCOMPtr<nsIDOMNode> mPopupNode; // [OWNER]
|
||||
|
||||
PRUint32 mSuppressFocus;
|
||||
|
||||
@ -298,7 +298,6 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
|
||||
mIsPopupSpam(PR_FALSE),
|
||||
mArguments(nsnull),
|
||||
mGlobalObjectOwner(nsnull),
|
||||
mDocShell(nsnull),
|
||||
mTimeouts(nsnull),
|
||||
mTimeoutInsertionPoint(&mTimeouts),
|
||||
mTimeoutPublicIdCounter(1),
|
||||
@ -1414,12 +1413,6 @@ nsGlobalWindow::SetDocShell(nsIDocShell* aDocShell)
|
||||
}
|
||||
}
|
||||
|
||||
nsIDocShell *
|
||||
nsGlobalWindow::GetDocShell()
|
||||
{
|
||||
return GetDocShellInternal();
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::SetOpenerWindow(nsIDOMWindowInternal* aOpener)
|
||||
{
|
||||
@ -1591,7 +1584,7 @@ nsGlobalWindow::HandleDOMEvent(nsPresContext* aPresContext, nsEvent* aEvent,
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(GetFrameElementInternal()));
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem =
|
||||
do_QueryInterface(GetDocShellInternal());
|
||||
do_QueryInterface(GetDocShell());
|
||||
|
||||
PRInt32 itemType = nsIDocShellTreeItem::typeChrome;
|
||||
|
||||
@ -1770,8 +1763,8 @@ nsGlobalWindow::GetDocument(nsIDOMDocument** aDocument)
|
||||
{
|
||||
// This method *should* forward calls to the outer window, but since
|
||||
// there's nothing here that *depends* on anything in the outer
|
||||
// (GetDocShellInternal() eliminates that dependency), we won't do
|
||||
// that to avoid the extra virtual function call.
|
||||
// (GetDocShell() eliminates that dependency), we won't do that to
|
||||
// avoid the extra virtual function call.
|
||||
|
||||
// lazily instantiate an about:blank document if necessary, and if
|
||||
// we have what it takes to do so. Note that domdoc here is the same
|
||||
@ -1779,7 +1772,7 @@ nsGlobalWindow::GetDocument(nsIDOMDocument** aDocument)
|
||||
// member variable because the docshell has already called
|
||||
// SetNewDocument().
|
||||
nsIDocShell *docShell;
|
||||
if (!mDocument && (docShell = GetDocShellInternal()))
|
||||
if (!mDocument && (docShell = GetDocShell()))
|
||||
nsCOMPtr<nsIDOMDocument> domdoc(do_GetInterface(docShell));
|
||||
|
||||
NS_IF_ADDREF(*aDocument = mDocument);
|
||||
@ -2226,10 +2219,10 @@ nsGlobalWindow::GetOpener(nsIDOMWindowInternal** aOpener)
|
||||
// We don't want to reveal the opener if the opener is a mail window,
|
||||
// because opener can be used to spoof the contents of a message (bug 105050).
|
||||
// So, we look in the opener's root docshell to see if it's a mail window.
|
||||
nsCOMPtr<nsIScriptGlobalObject> openerSGO(do_QueryInterface(mOpener));
|
||||
if (openerSGO) {
|
||||
nsCOMPtr<nsPIDOMWindow> openerPwin(do_QueryInterface(mOpener));
|
||||
if (openerPwin) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem =
|
||||
do_QueryInterface(openerSGO->GetDocShell());
|
||||
do_QueryInterface(openerPwin->GetDocShell());
|
||||
|
||||
if (docShellAsItem) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> openerRootItem;
|
||||
@ -2938,11 +2931,11 @@ nsGlobalWindow::WindowExists(const nsAString& aName)
|
||||
|
||||
if (!caller) {
|
||||
// If we can't reach a caller, try to use our own docshell
|
||||
caller = do_QueryInterface(GetDocShellInternal());
|
||||
caller = do_QueryInterface(GetDocShell());
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShell =
|
||||
do_QueryInterface(GetDocShellInternal());
|
||||
do_QueryInterface(GetDocShell());
|
||||
|
||||
if (docShell) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> namedItem;
|
||||
@ -5243,15 +5236,15 @@ nsGlobalWindow::GetPrivateRoot()
|
||||
{
|
||||
FORWARD_TO_OUTER(GetPrivateRoot, (), nsnull);
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> parent;
|
||||
GetTop(getter_AddRefs(parent));
|
||||
nsCOMPtr<nsIDOMWindow> top;
|
||||
GetTop(getter_AddRefs(top));
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> parentTop = do_QueryInterface(parent);
|
||||
NS_ASSERTION(parentTop, "cannot get parentTop");
|
||||
if (!parentTop)
|
||||
nsCOMPtr<nsPIDOMWindow> ptop = do_QueryInterface(top);
|
||||
NS_ASSERTION(ptop, "cannot get ptop");
|
||||
if (!ptop)
|
||||
return nsnull;
|
||||
|
||||
nsIDocShell *docShell = parentTop->GetDocShell();
|
||||
nsIDocShell *docShell = ptop->GetDocShell();
|
||||
|
||||
// Get the chrome event handler from the doc shell, since we only
|
||||
// want to deal with XUL chrome handlers and not the new kind of
|
||||
@ -5263,17 +5256,15 @@ nsGlobalWindow::GetPrivateRoot()
|
||||
if (chromeElement) {
|
||||
nsIDocument* doc = chromeElement->GetDocument();
|
||||
if (doc) {
|
||||
parent = do_QueryInterface(doc->GetScriptGlobalObject());
|
||||
nsIDOMWindow *parent = doc->GetWindow();
|
||||
if (parent) {
|
||||
nsCOMPtr<nsIDOMWindow> tempParent;
|
||||
parent->GetTop(getter_AddRefs(tempParent));
|
||||
tempParent.swap(parent);
|
||||
parent->GetTop(getter_AddRefs(top));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_STATIC_CAST(nsGlobalWindow *,
|
||||
NS_STATIC_CAST(nsIDOMWindow *, parent));
|
||||
NS_STATIC_CAST(nsIDOMWindow *, top));
|
||||
}
|
||||
|
||||
|
||||
@ -6917,8 +6908,7 @@ nsGlobalWindow::SuspendTimeouts()
|
||||
}
|
||||
|
||||
// Suspend our children as well.
|
||||
nsCOMPtr<nsIDocShellTreeNode> node =
|
||||
do_QueryInterface(GetDocShellInternal());
|
||||
nsCOMPtr<nsIDocShellTreeNode> node(do_QueryInterface(GetDocShell()));
|
||||
if (node) {
|
||||
PRInt32 childCount = 0;
|
||||
node->GetChildCount(&childCount);
|
||||
@ -6971,7 +6961,7 @@ nsGlobalWindow::ResumeTimeouts()
|
||||
|
||||
// Resume our children as well.
|
||||
nsCOMPtr<nsIDocShellTreeNode> node =
|
||||
do_QueryInterface(GetDocShellInternal());
|
||||
do_QueryInterface(GetDocShell());
|
||||
if (node) {
|
||||
PRInt32 childCount = 0;
|
||||
node->GetChildCount(&childCount);
|
||||
|
||||
@ -158,7 +158,6 @@ public:
|
||||
PRBool aRemoveEventListeners,
|
||||
PRBool aClearScopeHint);
|
||||
virtual void SetDocShell(nsIDocShell* aDocShell);
|
||||
virtual nsIDocShell *GetDocShell();
|
||||
virtual void SetOpenerWindow(nsIDOMWindowInternal *aOpener);
|
||||
virtual void SetGlobalObjectOwner(nsIScriptGlobalObjectOwner* aOwner);
|
||||
virtual nsIScriptGlobalObjectOwner *GetGlobalObjectOwner();
|
||||
@ -261,15 +260,6 @@ public:
|
||||
return NS_STATIC_CAST(nsGlobalWindow *, mInnerWindow);
|
||||
}
|
||||
|
||||
nsIDocShell *GetDocShellInternal()
|
||||
{
|
||||
if (mOuterWindow) {
|
||||
return GetOuterWindowInternal()->mDocShell;
|
||||
}
|
||||
|
||||
return mDocShell;
|
||||
}
|
||||
|
||||
PRBool IsFrozen() const
|
||||
{
|
||||
return mIsFrozen;
|
||||
@ -455,7 +445,6 @@ protected:
|
||||
nsString mDefaultStatus;
|
||||
|
||||
nsIScriptGlobalObjectOwner* mGlobalObjectOwner; // Weak Reference
|
||||
nsIDocShell* mDocShell; // Weak Reference
|
||||
nsCOMPtr<nsIDOMCrypto> mCrypto;
|
||||
nsCOMPtr<nsIDOMPkcs11> mPkcs11;
|
||||
|
||||
|
||||
@ -48,10 +48,9 @@
|
||||
#include "nsIControllerCommandTable.h"
|
||||
#include "nsICommandParams.h"
|
||||
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
@ -204,10 +203,10 @@ nsSelectionCommandsBase::GetPresShellFromWindow(nsIDOMWindow *aWindow, nsIPresSh
|
||||
{
|
||||
*aPresShell = nsnull;
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryInterface(aWindow));
|
||||
NS_ENSURE_TRUE(sgo, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(aWindow));
|
||||
NS_ENSURE_TRUE(win, NS_ERROR_FAILURE);
|
||||
|
||||
nsIDocShell *docShell = sgo->GetDocShell();
|
||||
nsIDocShell *docShell = win->GetDocShell();
|
||||
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
|
||||
|
||||
return docShell->GetPresShell(aPresShell);
|
||||
@ -481,13 +480,10 @@ nsClipboardBaseCommand::GetContentViewerEditFromContext(nsISupports *aContext,
|
||||
NS_ENSURE_ARG(aEditInterface);
|
||||
*aEditInterface = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(aContext);
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aContext);
|
||||
NS_ENSURE_TRUE(window, NS_ERROR_INVALID_ARG);
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryInterface(window));
|
||||
NS_ENSURE_TRUE(sgo, NS_ERROR_FAILURE);
|
||||
|
||||
nsIDocShell *docShell = sgo->GetDocShell();
|
||||
nsIDocShell *docShell = window->GetDocShell();
|
||||
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIContentViewer> viewer;
|
||||
@ -843,11 +839,10 @@ nsClipboardDragDropHookCommand::DoCommandParams(const char *aCommandName,
|
||||
{
|
||||
NS_ENSURE_ARG(aParams);
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(aCommandContext);
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(window);
|
||||
NS_ENSURE_TRUE(sgo, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aCommandContext);
|
||||
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
|
||||
|
||||
nsIDocShell *docShell = sgo->GetDocShell();
|
||||
nsIDocShell *docShell = window->GetDocShell();
|
||||
|
||||
nsCOMPtr<nsIClipboardDragDropHookList> obj = do_GetInterface(docShell);
|
||||
if (!obj) return NS_ERROR_INVALID_ARG;
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsIDOMChromeWindow.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
@ -168,9 +168,9 @@ NS_ScriptErrorReporter(JSContext *cx,
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
|
||||
if (context) {
|
||||
nsIScriptGlobalObject *globalObject = context->GetGlobalObject();
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(context->GetGlobalObject()));
|
||||
|
||||
if (globalObject) {
|
||||
if (win) {
|
||||
nsAutoString fileName, msg;
|
||||
|
||||
if (report) {
|
||||
@ -195,7 +195,7 @@ NS_ScriptErrorReporter(JSContext *cx,
|
||||
* then we'd need to generate a new OOM event for that
|
||||
* new OOM instance -- this isn't pretty.
|
||||
*/
|
||||
nsIDocShell *docShell = globalObject->GetDocShell();
|
||||
nsIDocShell *docShell = win->GetDocShell();
|
||||
if (docShell &&
|
||||
(!report ||
|
||||
(report->errorNumber != JSMSG_OUT_OF_MEMORY &&
|
||||
@ -215,8 +215,8 @@ NS_ScriptErrorReporter(JSContext *cx,
|
||||
|
||||
// HandleDOMEvent() must be synchronous for the recursion block
|
||||
// (errorDepth) to work.
|
||||
globalObject->HandleDOMEvent(presContext, &errorevent, nsnull,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
win->HandleDOMEvent(presContext, &errorevent, nsnull,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
|
||||
--errorDepth;
|
||||
@ -233,7 +233,7 @@ NS_ScriptErrorReporter(JSContext *cx,
|
||||
|
||||
// Set category to chrome or content
|
||||
nsCOMPtr<nsIScriptObjectPrincipal> scriptPrincipal =
|
||||
do_QueryInterface(globalObject);
|
||||
do_QueryInterface(win);
|
||||
NS_ASSERTION(scriptPrincipal, "Global objects must implement "
|
||||
"nsIScriptObjectPrincipal");
|
||||
nsCOMPtr<nsIPrincipal> systemPrincipal;
|
||||
@ -536,10 +536,10 @@ nsJSContext::DOMBranchCallback(JSContext *cx, JSScript *script)
|
||||
// If we get here we're most likely executing an infinite loop in JS,
|
||||
// we'll tell the user about this and we'll give the user the option
|
||||
// of stopping the execution of the script.
|
||||
nsIScriptGlobalObject *global = ctx->GetGlobalObject();
|
||||
NS_ENSURE_TRUE(global, JS_TRUE);
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(ctx->GetGlobalObject()));
|
||||
NS_ENSURE_TRUE(win, JS_TRUE);
|
||||
|
||||
nsIDocShell *docShell = global->GetDocShell();
|
||||
nsIDocShell *docShell = win->GetDocShell();
|
||||
NS_ENSURE_TRUE(docShell, JS_TRUE);
|
||||
|
||||
nsCOMPtr<nsIInterfaceRequestor> ireq(do_QueryInterface(docShell));
|
||||
|
||||
@ -39,12 +39,11 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsComposerCommandsUpdater.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsString.h"
|
||||
@ -246,10 +245,10 @@ nsComposerCommandsUpdater::Init(nsIDOMWindow* aDOMWindow)
|
||||
NS_ENSURE_ARG(aDOMWindow);
|
||||
mDOMWindow = aDOMWindow;
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptObject(do_QueryInterface(aDOMWindow));
|
||||
if (scriptObject)
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(aDOMWindow));
|
||||
if (window)
|
||||
{
|
||||
mDocShell = scriptObject->GetDocShell();
|
||||
mDocShell = window->GetDocShell();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMWindowUtils.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIDOMNSHTMLDocument.h"
|
||||
@ -47,7 +47,6 @@
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsISelectionPrivate.h"
|
||||
#include "nsITransactionManager.h"
|
||||
|
||||
@ -1230,11 +1229,11 @@ nsEditingSession::EndPageLoad(nsIWebProgress *aWebProgress,
|
||||
nsIDocShell *
|
||||
nsEditingSession::GetDocShellFromWindow(nsIDOMWindow *aWindow)
|
||||
{
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptGO = do_QueryInterface(aWindow);
|
||||
if (!scriptGO)
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aWindow);
|
||||
if (!window)
|
||||
return nsnull;
|
||||
|
||||
return scriptGO->GetDocShell();
|
||||
return window->GetDocShell();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
#include "nsIDocumentObserver.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
#include "nsHTMLEditor.h"
|
||||
#include "nsEditor.h"
|
||||
@ -397,19 +397,18 @@ nsHTMLEditor::ShowResizers(nsIDOMElement *aResizedElement)
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
|
||||
// and listen to the "resize" event on the window
|
||||
// first, get the script global object from the document...
|
||||
// and listen to the "resize" event on the window first, get the
|
||||
// window from the document...
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
GetDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
|
||||
if (!doc) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsIScriptGlobalObject *global = doc->GetScriptGlobalObject();
|
||||
if (!global) { return NS_ERROR_NULL_POINTER; }
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(doc->GetWindow());
|
||||
if (!target) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
mResizeEventListenerP = new DocumentResizeEventListener(this);
|
||||
if (!mResizeEventListenerP) { return NS_ERROR_OUT_OF_MEMORY; }
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(global);
|
||||
res = target->AddEventListener(NS_LITERAL_STRING("resize"), mResizeEventListenerP, PR_FALSE);
|
||||
|
||||
aResizedElement->SetAttribute(NS_LITERAL_STRING("_moz_resizing"), NS_LITERAL_STRING("true"));
|
||||
@ -473,11 +472,10 @@ nsHTMLEditor::HideResizers(void)
|
||||
GetDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
|
||||
if (!doc) { return NS_ERROR_NULL_POINTER; }
|
||||
nsIScriptGlobalObject *global = doc->GetScriptGlobalObject();
|
||||
if (!global) { return NS_ERROR_NULL_POINTER; }
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(doc->GetWindow());
|
||||
if (!target) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(global);
|
||||
if (target && mResizeEventListenerP) {
|
||||
if (mResizeEventListenerP) {
|
||||
res = target->RemoveEventListener(NS_LITERAL_STRING("resize"), mResizeEventListenerP, PR_FALSE);
|
||||
NS_ASSERTION(NS_SUCCEEDED(res), "failed to remove resize event listener");
|
||||
}
|
||||
|
||||
@ -53,8 +53,7 @@
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIDOMHTMLOptionElement.h"
|
||||
#include "nsIDOMHTMLOptionsCollection.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsString.h"
|
||||
|
||||
@ -200,8 +199,7 @@ CHClickListener::MouseDown(nsIDOMEvent* aEvent)
|
||||
// I'm going to assume that if we got a mousedown for a content node,
|
||||
// it's actually in a document.
|
||||
|
||||
nsIScriptGlobalObject* sgo = doc->GetScriptGlobalObject();
|
||||
nsCOMPtr<nsIDOMWindow> window = do_QueryInterface(sgo);
|
||||
nsCOMPtr<nsIDOMWindow> window = doc->GetWindow();
|
||||
if (!window)
|
||||
return NS_OK;
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
#include "nsDocShellTreeOwner.h"
|
||||
|
||||
#include "nsIAllocator.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
nsCommandHandler::nsCommandHandler() :
|
||||
mWindow(nsnull)
|
||||
@ -63,8 +63,8 @@ nsresult nsCommandHandler::GetCommandHandler(nsICommandHandler **aCommandHandler
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObj( do_QueryInterface(mWindow) );
|
||||
if (!globalObj)
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(mWindow));
|
||||
if (!window)
|
||||
{
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -72,7 +72,7 @@ nsresult nsCommandHandler::GetCommandHandler(nsICommandHandler **aCommandHandler
|
||||
// Get the document tree owner
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsTreeItem =
|
||||
do_QueryInterface(globalObj->GetDocShell());
|
||||
do_QueryInterface(window->GetDocShell());
|
||||
nsIDocShellTreeOwner *treeOwner = nsnull;
|
||||
docShellAsTreeItem->GetTreeOwner(&treeOwner);
|
||||
|
||||
|
||||
@ -80,8 +80,6 @@
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMWindowCollection.h"
|
||||
#include "nsIFocusController.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
#include "nsPIWindowWatcher.h"
|
||||
#include "nsIPrompt.h"
|
||||
@ -304,20 +302,18 @@ nsDocShellTreeOwner::FindChildWithName(const PRUnichar *aName, PRBool aRecurse,
|
||||
for (ctr = 0; ctr < count; ctr++) {
|
||||
nsCOMPtr<nsIDOMWindow> frame;
|
||||
frames->Item(ctr, getter_AddRefs(frame));
|
||||
if (frame) {
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryInterface(frame));
|
||||
if (sgo) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> item =
|
||||
do_QueryInterface(sgo->GetDocShell());
|
||||
if (item && item != aRequestor) {
|
||||
rv = item->FindItemWithName(aName, mWebBrowser->mDocShellAsItem,
|
||||
aOriginalRequestor, aFoundItem);
|
||||
if (NS_FAILED(rv) || *aFoundItem)
|
||||
break;
|
||||
}
|
||||
nsCOMPtr<nsPIDOMWindow> w(do_QueryInterface(frame));
|
||||
if (w) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> item = do_QueryInterface(w->GetDocShell());
|
||||
if (item && item != aRequestor) {
|
||||
rv = item->FindItemWithName(aName, mWebBrowser->mDocShellAsItem,
|
||||
aOriginalRequestor, aFoundItem);
|
||||
if (NS_FAILED(rv) || *aFoundItem)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@ -38,7 +38,6 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsWebBrowserContentPolicy.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsContentPolicyUtils.h"
|
||||
|
||||
@ -46,12 +46,9 @@
|
||||
#include "nsFind.h"
|
||||
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIDocShell.h"
|
||||
@ -372,8 +369,7 @@ static void
|
||||
FocusElementButNotDocument(nsIDocument* aDocument, nsIContent* aContent)
|
||||
{
|
||||
nsIFocusController *focusController = nsnull;
|
||||
nsCOMPtr<nsPIDOMWindow> ourWindow =
|
||||
do_QueryInterface(aDocument->GetScriptGlobalObject());
|
||||
nsPIDOMWindow *ourWindow = aDocument->GetWindow();
|
||||
if (ourWindow)
|
||||
focusController = ourWindow->GetRootFocusController();
|
||||
if (!focusController)
|
||||
@ -819,55 +815,54 @@ void
|
||||
nsWebBrowserFind::GetFrameSelection(nsIDOMWindow* aWindow,
|
||||
nsISelection** aSel)
|
||||
{
|
||||
*aSel = nsnull;
|
||||
*aSel = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
aWindow->GetDocument(getter_AddRefs(domDoc));
|
||||
if (!domDoc) return;
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
aWindow->GetDocument(getter_AddRefs(domDoc));
|
||||
if (!domDoc) return;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
|
||||
nsIPresShell* presShell = doc->GetShellAt(0);
|
||||
if (!presShell) return;
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
|
||||
nsIPresShell* presShell = doc->GetShellAt(0);
|
||||
if (!presShell) return;
|
||||
|
||||
// text input controls have their independent selection controllers
|
||||
// that we must use when they have focus.
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
// text input controls have their independent selection controllers
|
||||
// that we must use when they have focus.
|
||||
nsPresContext *presContext = presShell->GetPresContext();
|
||||
|
||||
nsIFrame *frame = nsnull;
|
||||
presContext->EventStateManager()->GetFocusedFrame(&frame);
|
||||
if (!frame) {
|
||||
nsCOMPtr<nsPIDOMWindow> ourWindow =
|
||||
do_QueryInterface(doc->GetScriptGlobalObject());
|
||||
if (ourWindow) {
|
||||
nsIFocusController *focusController =
|
||||
ourWindow->GetRootFocusController();
|
||||
if (focusController) {
|
||||
nsCOMPtr<nsIDOMElement> focusedElement;
|
||||
focusController->GetFocusedElement(getter_AddRefs(focusedElement));
|
||||
if (focusedElement) {
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(focusedElement));
|
||||
frame = presShell->GetPrimaryFrameFor(content);
|
||||
nsIFrame *frame = nsnull;
|
||||
presContext->EventStateManager()->GetFocusedFrame(&frame);
|
||||
if (!frame) {
|
||||
nsPIDOMWindow *ourWindow = doc->GetWindow();
|
||||
if (ourWindow) {
|
||||
nsIFocusController *focusController =
|
||||
ourWindow->GetRootFocusController();
|
||||
if (focusController) {
|
||||
nsCOMPtr<nsIDOMElement> focusedElement;
|
||||
focusController->GetFocusedElement(getter_AddRefs(focusedElement));
|
||||
if (focusedElement) {
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(focusedElement));
|
||||
frame = presShell->GetPrimaryFrameFor(content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
if (frame) {
|
||||
frame->GetSelectionController(presContext, getter_AddRefs(selCon));
|
||||
nsCOMPtr<nsISelectionController> selCon;
|
||||
if (frame) {
|
||||
frame->GetSelectionController(presContext, getter_AddRefs(selCon));
|
||||
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, aSel);
|
||||
if (*aSel) {
|
||||
PRInt32 count = -1;
|
||||
(*aSel)->GetRangeCount(&count);
|
||||
if (count > 0) {
|
||||
return;
|
||||
}
|
||||
NS_RELEASE(*aSel);
|
||||
}
|
||||
}
|
||||
|
||||
selCon = do_QueryInterface(presShell);
|
||||
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, aSel);
|
||||
if (*aSel) {
|
||||
PRInt32 count = -1;
|
||||
(*aSel)->GetRangeCount(&count);
|
||||
if (count > 0) {
|
||||
return;
|
||||
}
|
||||
NS_RELEASE(*aSel);
|
||||
}
|
||||
}
|
||||
|
||||
selCon = do_QueryInterface(presShell);
|
||||
selCon->GetSelection(nsISelectionController::SELECTION_NORMAL, aSel);
|
||||
}
|
||||
|
||||
nsresult nsWebBrowserFind::ClearFrameSelection(nsIDOMWindow *aWindow)
|
||||
@ -915,9 +910,9 @@ nsresult nsWebBrowserFind::OnFind(nsIDOMWindow *aFoundWindow)
|
||||
nsIDocShell *
|
||||
nsWebBrowserFind::GetDocShellFromWindow(nsIDOMWindow *inWindow)
|
||||
{
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptGO(do_QueryInterface(inWindow));
|
||||
if (!scriptGO) return nsnull;
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(inWindow));
|
||||
if (!window) return nsnull;
|
||||
|
||||
return scriptGO->GetDocShell();
|
||||
return window->GetDocShell();
|
||||
}
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@
|
||||
#include "nsPrintingPromptService.h"
|
||||
#include "nsIPrintingPromptService.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIEmbeddingSiteWindow.h"
|
||||
#include "nsIServiceManager.h"
|
||||
@ -65,7 +65,6 @@
|
||||
#include "nsIWebBrowserChrome.h"
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
|
||||
@ -153,10 +152,10 @@ nsPrintingPromptService::GetHWNDForDOMWindow(nsIDOMWindow *aWindow)
|
||||
}
|
||||
|
||||
// Now we might be the Browser so check this path
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptGlobal(do_QueryInterface(aWindow));
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(aWindow));
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem =
|
||||
do_QueryInterface(scriptGlobal->GetDocShell());
|
||||
do_QueryInterface(window->GetDocShell());
|
||||
if (!treeItem) return nsnull;
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
|
||||
|
||||
@ -726,9 +726,9 @@ nsWindowWatcher::OpenWindowJS(nsIDOMWindow *aParent,
|
||||
// charset of its opener as a fallback in the event the document being loaded
|
||||
// does not specify a charset. Failing to set this charset is not fatal, so we
|
||||
// want to continue in the face of errors.
|
||||
nsCOMPtr<nsIScriptGlobalObject> parentSGO(do_QueryInterface(aParent));
|
||||
if (parentSGO) {
|
||||
nsIDocShell *parentDocshell = parentSGO->GetDocShell();
|
||||
nsCOMPtr<nsPIDOMWindow> parentWin(do_QueryInterface(aParent));
|
||||
if (parentWin) {
|
||||
nsIDocShell *parentDocshell = parentWin->GetDocShell();
|
||||
// parentDocshell may be null if the parent got closed in the meantime
|
||||
if (parentDocshell) {
|
||||
nsCOMPtr<nsIContentViewer> parentContentViewer;
|
||||
@ -2057,9 +2057,9 @@ nsWindowWatcher::GetWindowTreeItem(nsIDOMWindow *inWindow,
|
||||
{
|
||||
*outTreeItem = 0;
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> sgo(do_QueryInterface(inWindow));
|
||||
if (sgo) {
|
||||
nsIDocShell *docshell = sgo->GetDocShell();
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(inWindow));
|
||||
if (window) {
|
||||
nsIDocShell *docshell = window->GetDocShell();
|
||||
if (docshell)
|
||||
CallQueryInterface(docshell, outTreeItem);
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
@ -81,10 +81,10 @@ inLayoutUtils::GetWindowFor(nsIDOMDocument* aDoc)
|
||||
nsIPresShell*
|
||||
inLayoutUtils::GetPresShellFor(nsISupports* aThing)
|
||||
{
|
||||
nsCOMPtr<nsIScriptGlobalObject> so = do_QueryInterface(aThing);
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aThing);
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
so->GetDocShell()->GetPresShell(getter_AddRefs(presShell));
|
||||
window->GetDocShell()->GetPresShell(getter_AddRefs(presShell));
|
||||
|
||||
return presShell;
|
||||
}
|
||||
|
||||
@ -42,8 +42,7 @@
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeNode.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
@ -150,10 +149,10 @@ NS_IMETHODIMP
|
||||
nsLayoutDebuggingTools::Init(nsIDOMWindow *aWin)
|
||||
{
|
||||
{
|
||||
nsCOMPtr<nsIScriptGlobalObject> global = do_QueryInterface(aWin);
|
||||
if (!global)
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aWin);
|
||||
if (!window)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
mDocShell = global->GetDocShell();
|
||||
mDocShell = window->GetDocShell();
|
||||
}
|
||||
|
||||
mPrefs = do_GetService(NS_PREF_CONTRACTID);
|
||||
|
||||
@ -45,14 +45,13 @@
|
||||
#include "prmem.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDocShellTreeNode.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIDOMHTMLDocument.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIFrameDebug.h"
|
||||
#include "nsIFrame.h"
|
||||
@ -170,10 +169,10 @@ nsRegressionTester::CompareFrameModels(nsILocalFile *aBaseFile, nsILocalFile *aV
|
||||
nsresult
|
||||
nsRegressionTester::GetDocShellFromWindow(nsIDOMWindow* inWindow, nsIDocShell** outShell)
|
||||
{
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptObj(do_QueryInterface(inWindow));
|
||||
if (!scriptObj) return NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(inWindow));
|
||||
if (!window) return NS_ERROR_FAILURE;
|
||||
|
||||
*outShell = scriptObj->GetDocShell();
|
||||
*outShell = window->GetDocShell();
|
||||
NS_IF_ADDREF(*outShell);
|
||||
|
||||
return NS_OK;
|
||||
|
||||
@ -38,9 +38,6 @@
|
||||
#include "nsIContent.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
|
||||
@ -37,7 +37,6 @@
|
||||
#include "nsMailnewsContentBlocker.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIPrefService.h"
|
||||
|
||||
@ -50,8 +50,6 @@
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
#include "nsIEditorDocShell.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMNSUIEvent.h"
|
||||
@ -86,7 +84,6 @@
|
||||
#include "nsILookAndFeel.h"
|
||||
|
||||
#include "nsICaret.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
@ -2479,7 +2476,7 @@ nsTypeAheadFind::GetTargetIfTypeAheadOkay(nsIDOMEvent *aEvent,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> domWin(do_QueryInterface(doc->GetScriptGlobalObject()));
|
||||
nsIDOMWindow *domWin = doc->GetWindow();
|
||||
nsCOMPtr<nsIDOMWindow> topContentWin;
|
||||
GetStartWindow(domWin, getter_AddRefs(topContentWin));
|
||||
|
||||
|
||||
@ -45,7 +45,6 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsWalletEditor.h"
|
||||
#include "nsString.h"
|
||||
|
||||
|
||||
@ -45,7 +45,6 @@
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsSignonViewer.h"
|
||||
#include "nsString.h"
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIPrompt.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
@ -65,7 +65,6 @@
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
// for making the leap from nsIDOMWindowInternal -> nsIPresShell
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
||||
static NS_DEFINE_IID(kDocLoaderServiceCID, NS_DOCUMENTLOADER_SERVICE_CID);
|
||||
|
||||
@ -118,9 +117,8 @@ nsWalletlibService::WALLET_RequestToCapture(nsIDOMWindowInternal* aWin,
|
||||
PRUint32* status)
|
||||
{
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptGlobalObject;
|
||||
scriptGlobalObject = do_QueryInterface(aWin);
|
||||
nsIDocShell *docShell = scriptGlobalObject->GetDocShell();
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(aWin));
|
||||
nsIDocShell *docShell = window->GetDocShell();
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
if(docShell)
|
||||
@ -145,9 +143,8 @@ nsWalletlibService::WALLET_Prefill(PRBool quick,
|
||||
nsIDOMWindowInternal* aWin,
|
||||
PRBool* status)
|
||||
{
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptGlobalObject;
|
||||
scriptGlobalObject = do_QueryInterface(aWin);
|
||||
nsIDocShell *docShell = scriptGlobalObject->GetDocShell();
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(aWin));
|
||||
nsIDocShell *docShell = window->GetDocShell();
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
if(docShell)
|
||||
|
||||
@ -51,6 +51,8 @@ REQUIRES = xpcom \
|
||||
string \
|
||||
wallet \
|
||||
dom \
|
||||
layout \
|
||||
necko \
|
||||
widget \
|
||||
docshell \
|
||||
$(NULL)
|
||||
|
||||
@ -42,9 +42,8 @@
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIWalletService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsWalletPreview.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
@ -92,10 +91,10 @@ static void DOMWindowToTreeOwner(
|
||||
if (!DOMWindow) {
|
||||
return; // with webWindow unchanged -- its constructor gives it a null ptr
|
||||
}
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalScript(do_QueryInterface(DOMWindow));
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(DOMWindow));
|
||||
nsIDocShell *docShell = nsnull;
|
||||
if (globalScript) {
|
||||
docShell = globalScript->GetDocShell();
|
||||
if (window) {
|
||||
docShell = window->GetDocShell();
|
||||
}
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(docShell));
|
||||
if(!docShellAsItem)
|
||||
|
||||
@ -51,7 +51,6 @@
|
||||
#include "nsXFormsModelElement.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIFocusController.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsIContent.h"
|
||||
@ -395,15 +394,13 @@ nsXFormsControlStubBase::HandleDefault(nsIDOMEvent *aEvent,
|
||||
// element isn't in a document, yet? Odd, indeed. Well, if not in
|
||||
// document, these two events have no meaning.
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_UNEXPECTED);
|
||||
nsCOMPtr<nsPIDOMWindow> win =
|
||||
do_QueryInterface(doc->GetScriptGlobalObject());
|
||||
|
||||
|
||||
// An inelegant way to retrieve this to be sure, but we are
|
||||
// guaranteed that the focus controller outlives us, so it
|
||||
// is safe to hold on to it (since we can't die until it has
|
||||
// died).
|
||||
nsIFocusController *focusController = win->GetRootFocusController();
|
||||
nsIFocusController *focusController =
|
||||
doc->GetWindow()->GetRootFocusController();
|
||||
if (focusController &&
|
||||
type.EqualsASCII(sXFormsEventsEntries[eEvent_Next].name)) {
|
||||
focusController->MoveFocus(PR_TRUE, nsnull);
|
||||
|
||||
@ -58,7 +58,6 @@
|
||||
#include "nsIXFormsXPathEvaluator.h"
|
||||
#include "nsIDOMXPathNSResolver.h"
|
||||
#include "nsIDOMNSXPathExpression.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
@ -46,7 +46,6 @@
|
||||
// For focus control
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIFocusController.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
||||
#include "nsIXTFXMLVisualWrapper.h"
|
||||
|
||||
@ -304,7 +303,7 @@ nsXFormsSwitchElement::SetFocus(nsIDOMElement* aDeselected,
|
||||
if (!doc)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(doc->GetScriptGlobalObject());
|
||||
nsCOMPtr<nsPIDOMWindow> win = doc->GetWindow();
|
||||
if (!win)
|
||||
return;
|
||||
|
||||
|
||||
@ -53,7 +53,6 @@
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
@ -61,7 +60,7 @@
|
||||
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
#include "mozXMLT.h"
|
||||
#include "mozLineTerm.h"
|
||||
@ -266,12 +265,11 @@ mozXMLTermShell::Init(nsIDOMWindowInternal* aContentWin,
|
||||
|
||||
mContentWindow = aContentWin; // no addref
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObj = do_QueryInterface(mContentWindow,
|
||||
&result);
|
||||
if (NS_FAILED(result) || !globalObj)
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(mContentWindow);
|
||||
if (!window)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIDocShell *docShell = globalObj->GetDocShell();
|
||||
nsIDocShell *docShell = window->GetDocShell();
|
||||
if (!docShell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
||||
@ -59,9 +59,6 @@
|
||||
#include "nsIDeviceContext.h"
|
||||
#include "nsIFrame.h"
|
||||
|
||||
#include "nsIScriptContextOwner.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
||||
#include "nsICategoryManager.h"
|
||||
#include "nsXPCOMCID.h"
|
||||
|
||||
|
||||
@ -79,14 +79,11 @@ mozXMLTermUtils::ConvertDocShellToDOMWindow(nsIDocShell* aDocShell,
|
||||
|
||||
*aDOMWindow = nsnull;
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptGlobalObject(do_GetInterface(aDocShell));
|
||||
|
||||
nsCOMPtr<nsIDOMWindowInternal> domWindow(do_QueryInterface(scriptGlobalObject));
|
||||
nsCOMPtr<nsIDOMWindowInternal> domWindow(do_GetInterface(aDocShell));
|
||||
if (!domWindow)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aDOMWindow = domWindow.get();
|
||||
NS_ADDREF(*aDOMWindow);
|
||||
domWindow.swap(*aDOMWindow);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -103,11 +100,11 @@ mozXMLTermUtils::ConvertDOMWindowToDocShell(nsIDOMWindowInternal* aDOMWindow,
|
||||
{
|
||||
XMLT_LOG(mozXMLTermUtils::ConvertDOMWindowToDocShell,30,("\n"));
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObject = do_QueryInterface(aDOMWindow);
|
||||
if (!globalObject)
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aDOMWindow);
|
||||
if (!window)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aDocShell = globalObject->GetDocShell();
|
||||
*aDocShell = window->GetDocShell();
|
||||
if (!*aDocShell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
||||
@ -988,11 +988,11 @@ DocumentViewerImpl::LoadComplete(nsresult aStatus)
|
||||
nsresult rv = NS_OK;
|
||||
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
// First, get the script global object from the document...
|
||||
nsIScriptGlobalObject *global = mDocument->GetScriptGlobalObject();
|
||||
// First, get the window from the document...
|
||||
nsPIDOMWindow *window = mDocument->GetWindow();
|
||||
|
||||
// Fail if no ScriptGlobalObject is available...
|
||||
NS_ENSURE_TRUE(global, NS_ERROR_NULL_POINTER);
|
||||
// Fail if no window is available...
|
||||
NS_ENSURE_TRUE(window, NS_ERROR_NULL_POINTER);
|
||||
|
||||
mLoaded = PR_TRUE;
|
||||
|
||||
@ -1013,12 +1013,12 @@ DocumentViewerImpl::LoadComplete(nsresult aStatus)
|
||||
// onload to the document content since that would likely confuse scripts
|
||||
// on the page.
|
||||
|
||||
nsIDocShell *docShell = global->GetDocShell();
|
||||
nsIDocShell *docShell = window->GetDocShell();
|
||||
NS_ENSURE_TRUE(docShell, NS_ERROR_UNEXPECTED);
|
||||
|
||||
docShell->GetRestoringDocument(&restoring);
|
||||
if (!restoring) {
|
||||
rv = global->HandleDOMEvent(mPresContext, &event, nsnull,
|
||||
rv = window->HandleDOMEvent(mPresContext, &event, nsnull,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
#ifdef MOZ_TIMELINE
|
||||
// if navigator.xul's load is complete, the main nav window is visible
|
||||
@ -1090,11 +1090,11 @@ DocumentViewerImpl::PermitUnload(PRBool *aPermitUnload)
|
||||
}
|
||||
|
||||
// First, get the script global object from the document...
|
||||
nsIScriptGlobalObject *global = mDocument->GetScriptGlobalObject();
|
||||
nsPIDOMWindow *window = mDocument->GetWindow();
|
||||
|
||||
if (!global) {
|
||||
if (!window) {
|
||||
// This is odd, but not fatal
|
||||
NS_WARNING("nsIScriptGlobalObject not set for document!");
|
||||
NS_WARNING("window not set for document!");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1114,7 +1114,7 @@ DocumentViewerImpl::PermitUnload(PRBool *aPermitUnload)
|
||||
nsRefPtr<DocumentViewerImpl> kungFuDeathGrip(this);
|
||||
|
||||
mInPermitUnload = PR_TRUE;
|
||||
rv = global->HandleDOMEvent(mPresContext, &event, nsnull,
|
||||
rv = window->HandleDOMEvent(mPresContext, &event, nsnull,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
mInPermitUnload = PR_FALSE;
|
||||
}
|
||||
@ -1194,12 +1194,12 @@ DocumentViewerImpl::PageHide(PRBool aIsUnload)
|
||||
if (!aIsUnload)
|
||||
return NS_OK;
|
||||
|
||||
// First, get the script global object from the document...
|
||||
nsIScriptGlobalObject *global = mDocument->GetScriptGlobalObject();
|
||||
// First, get the window from the document...
|
||||
nsPIDOMWindow *window = mDocument->GetWindow();
|
||||
|
||||
if (!global) {
|
||||
// Fail if no ScriptGlobalObject is available...
|
||||
NS_ERROR("nsIScriptGlobalObject not set for document!");
|
||||
if (!window) {
|
||||
// Fail if no window is available...
|
||||
NS_ERROR("window not set for document!");
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
@ -1211,7 +1211,7 @@ DocumentViewerImpl::PageHide(PRBool aIsUnload)
|
||||
// here.
|
||||
nsAutoPopupStatePusher popupStatePusher(openAbused, PR_TRUE);
|
||||
|
||||
return global->HandleDOMEvent(mPresContext, &event, nsnull,
|
||||
return window->HandleDOMEvent(mPresContext, &event, nsnull,
|
||||
NS_EVENT_FLAG_INIT, &status);
|
||||
}
|
||||
|
||||
@ -3147,8 +3147,8 @@ DocumentViewerImpl::GetPopupNode(nsIDOMNode** aNode)
|
||||
|
||||
|
||||
// get the private dom window
|
||||
nsCOMPtr<nsPIDOMWindow> privateWin(do_QueryInterface(document->GetScriptGlobalObject(), &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsPIDOMWindow *privateWin = document->GetWindow();
|
||||
NS_ENSURE_TRUE(privateWin, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
// get the focus controller
|
||||
nsIFocusController *focusController = privateWin->GetRootFocusController();
|
||||
@ -3309,7 +3309,7 @@ NS_IMETHODIMP nsDocViewerSelectionListener::NotifySelectionChanged(nsIDOMDocumen
|
||||
mDocViewer->GetDocument(getter_AddRefs(theDoc));
|
||||
if (!theDoc) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMWindowInternal> domWindow = do_QueryInterface(theDoc->GetScriptGlobalObject());
|
||||
nsPIDOMWindow *domWindow = theDoc->GetWindow();
|
||||
if (!domWindow) return NS_ERROR_FAILURE;
|
||||
|
||||
domWindow->UpdateCommands(NS_LITERAL_STRING("select"));
|
||||
|
||||
@ -62,14 +62,12 @@
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsContentPolicyUtils.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIWeakReferenceUtils.h"
|
||||
#include "nsCSSRendering.h"
|
||||
#include "prprf.h"
|
||||
#include "nsContentPolicyUtils.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsEventStateManager.h"
|
||||
|
||||
@ -148,8 +148,6 @@
|
||||
|
||||
#include "nsIReflowCallback.h"
|
||||
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIFocusController.h"
|
||||
#include "nsIPluginInstance.h"
|
||||
@ -2063,14 +2061,14 @@ PresShell::SetPreferenceStyleRules(PRBool aForceReflow)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
nsIScriptGlobalObject *globalObj = mDocument->GetScriptGlobalObject();
|
||||
nsPIDOMWindow *window = mDocument->GetWindow();
|
||||
|
||||
// If the document doesn't have a global object there's no need to
|
||||
// notify its presshell about changes to preferences since the
|
||||
// document is in a state where it doesn't matter any more (see
|
||||
// If the document doesn't have a window there's no need to notify
|
||||
// its presshell about changes to preferences since the document is
|
||||
// in a state where it doesn't matter any more (see
|
||||
// DocumentViewerImpl::Close()).
|
||||
|
||||
if (!globalObj) {
|
||||
if (!window) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
@ -2999,9 +2997,10 @@ PresShell::FireResizeEvent()
|
||||
nsEvent event(PR_TRUE, NS_RESIZE_EVENT);
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObj = mDocument->GetScriptGlobalObject();
|
||||
if (globalObj) {
|
||||
globalObj->HandleDOMEvent(mPresContext, &event, nsnull, NS_EVENT_FLAG_INIT, &status);
|
||||
nsPIDOMWindow *window = mDocument->GetWindow();
|
||||
if (window) {
|
||||
window->HandleDOMEvent(mPresContext, &event, nsnull, NS_EVENT_FLAG_INIT,
|
||||
&status);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4183,7 +4182,7 @@ PresShell::ScrollFrameIntoView(nsIFrame *aFrame,
|
||||
if (content) {
|
||||
nsIDocument* document = content->GetDocument();
|
||||
if (document){
|
||||
nsCOMPtr<nsPIDOMWindow> ourWindow = do_QueryInterface(document->GetScriptGlobalObject());
|
||||
nsPIDOMWindow *ourWindow = document->GetWindow();
|
||||
if(ourWindow) {
|
||||
nsIFocusController *focusController =
|
||||
ourWindow->GetRootFocusController();
|
||||
@ -4375,7 +4374,7 @@ PresShell::GetSelectionForCopy(nsISelection** outSelection)
|
||||
if (!mDocument) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIContent> content;
|
||||
nsCOMPtr<nsPIDOMWindow> ourWindow = do_QueryInterface(mDocument->GetScriptGlobalObject());
|
||||
nsPIDOMWindow *ourWindow = mDocument->GetWindow();
|
||||
if (ourWindow) {
|
||||
nsIFocusController *focusController = ourWindow->GetRootFocusController();
|
||||
if (focusController) {
|
||||
@ -4466,8 +4465,7 @@ PresShell::DoCopy()
|
||||
return rv;
|
||||
|
||||
// Now that we have copied, update the Paste menu item
|
||||
nsCOMPtr<nsIDOMWindowInternal> domWindow =
|
||||
do_QueryInterface(mDocument->GetScriptGlobalObject());
|
||||
nsPIDOMWindow *domWindow = mDocument->GetWindow();
|
||||
if (domWindow)
|
||||
{
|
||||
domWindow->UpdateCommands(NS_LITERAL_STRING("clipboard"));
|
||||
@ -5573,7 +5571,7 @@ PRBool PresShell::InZombieDocument(nsIContent *aContent)
|
||||
// It might actually be in a node not attached to any document,
|
||||
// in which case there is not parent presshell to retarget it to.
|
||||
nsIDocument *doc = aContent->GetDocument();
|
||||
return !doc || !doc->GetScriptGlobalObject();
|
||||
return !doc || !doc->GetWindow();
|
||||
}
|
||||
|
||||
nsresult PresShell::RetargetEventToParent(nsIView *aView,
|
||||
@ -5749,7 +5747,7 @@ PresShell::HandleEvent(nsIView *aView,
|
||||
// doesn't have focus and event is key event or IME event, we should
|
||||
// send the events to pre-focused element.
|
||||
#endif /* defined(MOZ_X11) */
|
||||
nsCOMPtr<nsPIDOMWindow> ourWindow = do_QueryInterface(mDocument->GetScriptGlobalObject());
|
||||
nsPIDOMWindow *ourWindow = mDocument->GetWindow();
|
||||
if (ourWindow) {
|
||||
nsIFocusController *focusController =
|
||||
ourWindow->GetRootFocusController();
|
||||
|
||||
@ -61,12 +61,11 @@
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIFilePicker.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsINodeInfo.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsITextControlElement.h"
|
||||
#include "nsNodeInfoManager.h"
|
||||
@ -315,9 +314,6 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
|
||||
if (!doc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> parentWindow =
|
||||
do_QueryInterface(doc->GetScriptGlobalObject());
|
||||
|
||||
// Get Loc title
|
||||
nsXPIDLString title;
|
||||
nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
|
||||
@ -327,7 +323,7 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
|
||||
if (!filePicker)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
result = filePicker->Init(parentWindow, title, nsIFilePicker::modeOpen);
|
||||
result = filePicker->Init(doc->GetWindow(), title, nsIFilePicker::modeOpen);
|
||||
if (NS_FAILED(result))
|
||||
return result;
|
||||
|
||||
|
||||
@ -105,8 +105,7 @@
|
||||
#include "nsIDOMCharacterData.h" //for selection setting helper func
|
||||
#include "nsIDOMNodeList.h" //for selection setting helper func
|
||||
#include "nsIDOMRange.h" //for selection setting helper func
|
||||
#include "nsIScriptGlobalObject.h" //needed for notify selection changed to update the menus etc.
|
||||
#include "nsIDOMWindowInternal.h" //needed for notify selection changed to update the menus etc.
|
||||
#include "nsPIDOMWindow.h" //needed for notify selection changed to update the menus ect.
|
||||
#include "nsITextContent.h" //needed to create initial text control content
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessibilityService.h"
|
||||
@ -494,7 +493,7 @@ nsTextInputListener::UpdateTextInputCommands(const nsAString& commandsToUpdate)
|
||||
nsCOMPtr<nsIDocument> doc = content->GetDocument();
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDOMWindowInternal> domWindow = do_QueryInterface(doc->GetScriptGlobalObject());
|
||||
nsPIDOMWindow *domWindow = doc->GetWindow();
|
||||
NS_ENSURE_TRUE(domWindow, NS_ERROR_FAILURE);
|
||||
|
||||
return domWindow->UpdateCommands(commandsToUpdate);
|
||||
|
||||
@ -61,7 +61,6 @@
|
||||
|
||||
// for focus
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIFocusController.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsIScrollableView.h"
|
||||
|
||||
@ -91,9 +91,6 @@
|
||||
#include "plevent.h"
|
||||
|
||||
#include "nsContentPolicyUtils.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsIPrefBranch2.h"
|
||||
#include "nsIPrefService.h"
|
||||
|
||||
@ -43,7 +43,6 @@
|
||||
#include "nsCRT.h"
|
||||
|
||||
#include "nsISelection.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
|
||||
#include "nsISelection.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIURI.h"
|
||||
|
||||
@ -731,7 +731,7 @@ nsPrintEngine::Print(nsIPrintSettings* aPrintSettings,
|
||||
if (!printSilently) {
|
||||
nsCOMPtr<nsIPrintingPromptService> printPromptService(do_GetService(kPrintingPromptService));
|
||||
if (printPromptService) {
|
||||
nsCOMPtr<nsIDOMWindow> domWin = do_QueryInterface(mDocument->GetScriptGlobalObject());
|
||||
nsIDOMWindow *domWin = mDocument->GetWindow();
|
||||
NS_ENSURE_TRUE(domWin, NS_ERROR_FAILURE);
|
||||
|
||||
// Platforms not implementing a given dialog for the service may
|
||||
@ -1647,7 +1647,7 @@ nsPrintEngine::ShowPrintProgress(PRBool aIsForPrinting, PRBool& aDoNotify)
|
||||
if (mPrt->mShowProgressDialog) {
|
||||
nsCOMPtr<nsIPrintingPromptService> printPromptService(do_GetService(kPrintingPromptService));
|
||||
if (printPromptService) {
|
||||
nsCOMPtr<nsIDOMWindow> domWin = do_QueryInterface(mDocument->GetScriptGlobalObject());
|
||||
nsPIDOMWindow *domWin = mDocument->GetWindow();
|
||||
if (!domWin) return;
|
||||
|
||||
nsCOMPtr<nsIWebBrowserPrint> wbp(do_QueryInterface(mDocViewerPrint));
|
||||
@ -1676,8 +1676,8 @@ nsPrintEngine::IsThereARangeSelection(nsIDOMWindow* aDOMWin)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> presShell;
|
||||
if (aDOMWin) {
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptObj(do_QueryInterface(aDOMWin));
|
||||
scriptObj->GetDocShell()->GetPresShell(getter_AddRefs(presShell));
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(aDOMWin));
|
||||
window->GetDocShell()->GetPresShell(getter_AddRefs(presShell));
|
||||
}
|
||||
|
||||
// check here to see if there is a range selection
|
||||
@ -3948,8 +3948,7 @@ nsPrintEngine::FindFocusedDOMWindow()
|
||||
|
||||
mDocViewer->GetDocument(getter_AddRefs(theDoc));
|
||||
if(theDoc){
|
||||
nsIScriptGlobalObject* theSGO = theDoc->GetScriptGlobalObject();
|
||||
nsCOMPtr<nsPIDOMWindow> theDOMWindow = do_QueryInterface(theSGO);
|
||||
nsPIDOMWindow *theDOMWindow = theDoc->GetWindow();
|
||||
if(theDOMWindow){
|
||||
nsIFocusController *focusController =
|
||||
theDOMWindow->GetRootFocusController();
|
||||
@ -3973,10 +3972,10 @@ nsPrintEngine::IsWindowsInOurSubTree(nsIDOMWindow * aDOMWindow)
|
||||
PRBool found = PR_FALSE;
|
||||
|
||||
// now check to make sure it is in "our" tree of docshells
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptObj(do_QueryInterface(aDOMWindow));
|
||||
if (scriptObj) {
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(aDOMWindow));
|
||||
if (window) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem =
|
||||
do_QueryInterface(scriptObj->GetDocShell());
|
||||
do_QueryInterface(window->GetDocShell());
|
||||
|
||||
if (docShellAsItem) {
|
||||
// get this DocViewer docshell
|
||||
@ -4427,7 +4426,9 @@ nsPrintEngine::TurnScriptingOn(PRBool aDoTurnOn)
|
||||
NS_ASSERTION(po, "nsPrintObject can't be null!");
|
||||
|
||||
// get the script global object
|
||||
nsIScriptGlobalObject *scriptGlobalObj = po->mDocument->GetScriptGlobalObject();
|
||||
nsIScriptGlobalObject *scriptGlobalObj =
|
||||
po->mDocument->GetScriptGlobalObject();
|
||||
|
||||
if (scriptGlobalObj) {
|
||||
nsIScriptContext *scx = scriptGlobalObj->GetContext();
|
||||
NS_ASSERTION(scx, "Can't get nsIScriptContext");
|
||||
|
||||
@ -62,7 +62,6 @@
|
||||
#include "nsCRT.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsContentPolicyUtils.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsITimelineService.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIScriptError.h"
|
||||
|
||||
@ -54,9 +54,8 @@
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsMenuFrame.h"
|
||||
#include "nsIPopupSetFrame.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMScreen.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsFrameManager.h"
|
||||
#include "nsIDocument.h"
|
||||
@ -827,7 +826,7 @@ nsMenuPopupFrame::SyncViewWithFrame(nsPresContext* aPresContext,
|
||||
// Compute info about the screen dimensions. Because of multiple monitor systems,
|
||||
// the left or top sides of the screen may be in negative space (main monitor is on the
|
||||
// right, etc). We need to be sure to do the right thing.
|
||||
nsCOMPtr<nsIDOMWindowInternal> window(do_QueryInterface(document->GetScriptGlobalObject()));
|
||||
nsPIDOMWindow *window = document->GetWindow();
|
||||
if (!window)
|
||||
return NS_OK;
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsXULAtoms.h"
|
||||
#include "nsGUIEvent.h"
|
||||
@ -68,9 +68,9 @@ NS_NewResizerFrame(nsIPresShell* aPresShell)
|
||||
} // NS_NewResizerFrame
|
||||
|
||||
nsResizerFrame::nsResizerFrame(nsIPresShell* aPresShell)
|
||||
:nsTitleBarFrame(aPresShell)
|
||||
:nsTitleBarFrame(aPresShell)
|
||||
{
|
||||
mDirection = topleft; // by default...
|
||||
mDirection = topleft; // by default...
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsResizerFrame::Init(nsPresContext* aPresContext,
|
||||
@ -79,16 +79,16 @@ NS_IMETHODIMP nsResizerFrame::Init(nsPresContext* aPresContext,
|
||||
nsStyleContext* aContext,
|
||||
nsIFrame* asPrevInFlow)
|
||||
{
|
||||
nsresult rv = nsTitleBarFrame::Init(aPresContext, aContent, aParent, aContext, asPrevInFlow);
|
||||
nsresult rv = nsTitleBarFrame::Init(aPresContext, aContent, aParent, aContext, asPrevInFlow);
|
||||
|
||||
GetInitialDirection(mDirection);
|
||||
GetInitialDirection(mDirection);
|
||||
|
||||
return rv;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
@ -96,54 +96,52 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
|
||||
switch (aEvent->message) {
|
||||
|
||||
case NS_MOUSE_LEFT_BUTTON_DOWN: {
|
||||
|
||||
// we're tracking.
|
||||
mTrackingMouseMove = PR_TRUE;
|
||||
|
||||
// start capture.
|
||||
aEvent->widget->CaptureMouse(PR_TRUE);
|
||||
CaptureMouseEvents(aPresContext,PR_TRUE);
|
||||
case NS_MOUSE_LEFT_BUTTON_DOWN: {
|
||||
|
||||
// we're tracking.
|
||||
mTrackingMouseMove = PR_TRUE;
|
||||
|
||||
// start capture.
|
||||
aEvent->widget->CaptureMouse(PR_TRUE);
|
||||
CaptureMouseEvents(aPresContext,PR_TRUE);
|
||||
|
||||
// remember current mouse coordinates.
|
||||
mLastPoint = aEvent->refPoint;
|
||||
aEvent->widget->GetScreenBounds(mWidgetRect);
|
||||
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
doDefault = PR_FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
// remember current mouse coordinates.
|
||||
mLastPoint = aEvent->refPoint;
|
||||
aEvent->widget->GetScreenBounds(mWidgetRect);
|
||||
case NS_MOUSE_LEFT_BUTTON_UP: {
|
||||
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
doDefault = PR_FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
if(mTrackingMouseMove)
|
||||
{
|
||||
// we're done tracking.
|
||||
mTrackingMouseMove = PR_FALSE;
|
||||
|
||||
case NS_MOUSE_LEFT_BUTTON_UP: {
|
||||
// end capture
|
||||
aEvent->widget->CaptureMouse(PR_FALSE);
|
||||
CaptureMouseEvents(aPresContext,PR_FALSE);
|
||||
|
||||
if(mTrackingMouseMove)
|
||||
{
|
||||
// we're done tracking.
|
||||
mTrackingMouseMove = PR_FALSE;
|
||||
|
||||
// end capture
|
||||
aEvent->widget->CaptureMouse(PR_FALSE);
|
||||
CaptureMouseEvents(aPresContext,PR_FALSE);
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
doDefault = PR_FALSE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
doDefault = PR_FALSE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_MOUSE_MOVE: {
|
||||
if(mTrackingMouseMove)
|
||||
{
|
||||
// get the document and the global script object - should this be cached?
|
||||
nsIScriptGlobalObject *scriptGlobalObject =
|
||||
aPresContext->PresShell()->GetDocument()->GetScriptGlobalObject();
|
||||
NS_ENSURE_TRUE(scriptGlobalObject, NS_ERROR_FAILURE);
|
||||
case NS_MOUSE_MOVE: {
|
||||
if(mTrackingMouseMove)
|
||||
{
|
||||
// get the document and the window - should this be cached?
|
||||
nsPIDOMWindow *domWindow =
|
||||
aPresContext->PresShell()->GetDocument()->GetWindow();
|
||||
NS_ENSURE_TRUE(domWindow, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem =
|
||||
do_QueryInterface(scriptGlobalObject->GetDocShell());
|
||||
do_QueryInterface(domWindow->GetDocShell());
|
||||
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
|
||||
@ -155,81 +153,76 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsPoint nsMoveBy(0,0),nsSizeBy(0,0);
|
||||
nsPoint nsMouseMove(aEvent->refPoint - mLastPoint);
|
||||
|
||||
nsPoint nsMoveBy(0,0),nsSizeBy(0,0);
|
||||
nsPoint nsMouseMove(aEvent->refPoint - mLastPoint);
|
||||
|
||||
switch(mDirection)
|
||||
{
|
||||
case topleft:
|
||||
nsMoveBy = nsMouseMove;
|
||||
nsSizeBy -= nsMouseMove;
|
||||
break;
|
||||
case top:
|
||||
nsMoveBy.y = nsMouseMove.y;
|
||||
nsSizeBy.y = - nsMouseMove.y;
|
||||
break;
|
||||
case topright:
|
||||
nsMoveBy.y = nsMouseMove.y;
|
||||
nsSizeBy.x = nsMouseMove.x;
|
||||
mLastPoint.x += nsMouseMove.x;
|
||||
nsSizeBy.y = -nsMouseMove.y;
|
||||
break;
|
||||
case left:
|
||||
nsMoveBy.x = nsMouseMove.x;
|
||||
nsSizeBy.x = -nsMouseMove.x;
|
||||
break;
|
||||
case right:
|
||||
nsSizeBy.x = nsMouseMove.x;
|
||||
mLastPoint.x += nsMouseMove.x;
|
||||
break;
|
||||
case bottomleft:
|
||||
nsMoveBy.x = nsMouseMove.x;
|
||||
nsSizeBy.y = nsMouseMove.y;
|
||||
nsSizeBy.x = -nsMouseMove.x;
|
||||
mLastPoint.y += nsMouseMove.y;
|
||||
break;
|
||||
case bottom:
|
||||
nsSizeBy.y = nsMouseMove.y;
|
||||
mLastPoint.y += nsMouseMove.y;
|
||||
break;
|
||||
case bottomright:
|
||||
nsSizeBy = nsMouseMove;
|
||||
mLastPoint += nsMouseMove;
|
||||
break;
|
||||
}
|
||||
switch(mDirection)
|
||||
{
|
||||
case topleft:
|
||||
nsMoveBy = nsMouseMove;
|
||||
nsSizeBy -= nsMouseMove;
|
||||
break;
|
||||
case top:
|
||||
nsMoveBy.y = nsMouseMove.y;
|
||||
nsSizeBy.y = - nsMouseMove.y;
|
||||
break;
|
||||
case topright:
|
||||
nsMoveBy.y = nsMouseMove.y;
|
||||
nsSizeBy.x = nsMouseMove.x;
|
||||
mLastPoint.x += nsMouseMove.x;
|
||||
nsSizeBy.y = -nsMouseMove.y;
|
||||
break;
|
||||
case left:
|
||||
nsMoveBy.x = nsMouseMove.x;
|
||||
nsSizeBy.x = -nsMouseMove.x;
|
||||
break;
|
||||
case right:
|
||||
nsSizeBy.x = nsMouseMove.x;
|
||||
mLastPoint.x += nsMouseMove.x;
|
||||
break;
|
||||
case bottomleft:
|
||||
nsMoveBy.x = nsMouseMove.x;
|
||||
nsSizeBy.y = nsMouseMove.y;
|
||||
nsSizeBy.x = -nsMouseMove.x;
|
||||
mLastPoint.y += nsMouseMove.y;
|
||||
break;
|
||||
case bottom:
|
||||
nsSizeBy.y = nsMouseMove.y;
|
||||
mLastPoint.y += nsMouseMove.y;
|
||||
break;
|
||||
case bottomright:
|
||||
nsSizeBy = nsMouseMove;
|
||||
mLastPoint += nsMouseMove;
|
||||
break;
|
||||
}
|
||||
|
||||
PRInt32 x,y,cx,cy;
|
||||
window->GetPositionAndSize(&x,&y,&cx,&cy);
|
||||
|
||||
x+=nsMoveBy.x;
|
||||
y+=nsMoveBy.y;
|
||||
cx+=nsSizeBy.x;
|
||||
cy+=nsSizeBy.y;
|
||||
|
||||
PRInt32 x,y,cx,cy;
|
||||
window->GetPositionAndSize(&x,&y,&cx,&cy);
|
||||
window->SetPositionAndSize(x,y,cx,cy,PR_TRUE); // do the repaint.
|
||||
|
||||
x+=nsMoveBy.x;
|
||||
y+=nsMoveBy.y;
|
||||
cx+=nsSizeBy.x;
|
||||
cy+=nsSizeBy.y;
|
||||
/*
|
||||
if(nsSizeBy.x || nsSizeBy.y)
|
||||
{
|
||||
window->ResizeBy(nsSizeBy.x,nsSizeBy.y);
|
||||
}
|
||||
|
||||
window->SetPositionAndSize(x,y,cx,cy,PR_TRUE); // do the repaint.
|
||||
if(nsMoveBy.x || nsMoveBy.y)
|
||||
{
|
||||
window->MoveBy(nsMoveBy.x,nsMoveBy.y);
|
||||
} */
|
||||
|
||||
/*
|
||||
if(nsSizeBy.x || nsSizeBy.y)
|
||||
{
|
||||
window->ResizeBy(nsSizeBy.x,nsSizeBy.y);
|
||||
}
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
|
||||
if(nsMoveBy.x || nsMoveBy.y)
|
||||
{
|
||||
window->MoveBy(nsMoveBy.x,nsMoveBy.y);
|
||||
} */
|
||||
|
||||
|
||||
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
|
||||
doDefault = PR_FALSE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
doDefault = PR_FALSE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
@ -237,60 +230,60 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
MouseClicked(aPresContext, aEvent);
|
||||
break;
|
||||
}
|
||||
|
||||
if ( doDefault )
|
||||
return nsTitleBarFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
|
||||
if ( doDefault )
|
||||
return nsTitleBarFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
else
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* returns true if aText represented a valid direction
|
||||
/* returns true if aText represented a valid direction
|
||||
*/
|
||||
PRBool
|
||||
PRBool
|
||||
nsResizerFrame::EvalDirection(nsAutoString& aText,eDirection& aDir)
|
||||
{
|
||||
PRBool aResult = PR_TRUE;
|
||||
|
||||
if( aText.Equals( NS_LITERAL_STRING("topleft") ) )
|
||||
{
|
||||
aDir = topleft;
|
||||
}
|
||||
else if( aText.Equals( NS_LITERAL_STRING("top") ) )
|
||||
{
|
||||
aDir = top;
|
||||
}
|
||||
else if( aText.Equals( NS_LITERAL_STRING("topright") ) )
|
||||
{
|
||||
aDir = topright;
|
||||
}
|
||||
else if( aText.Equals( NS_LITERAL_STRING("left") ) )
|
||||
{
|
||||
aDir = left;
|
||||
}
|
||||
else if( aText.Equals( NS_LITERAL_STRING("right") ) )
|
||||
{
|
||||
aDir = right;
|
||||
}
|
||||
else if( aText.Equals( NS_LITERAL_STRING("bottomleft") ) )
|
||||
{
|
||||
aDir = bottomleft;
|
||||
}
|
||||
else if( aText.Equals( NS_LITERAL_STRING("bottom") ) )
|
||||
{
|
||||
aDir = bottom;
|
||||
}
|
||||
else if( aText.Equals( NS_LITERAL_STRING("bottomright") ) )
|
||||
{
|
||||
aDir = bottomright;
|
||||
}
|
||||
else
|
||||
{
|
||||
aResult = PR_FALSE;
|
||||
}
|
||||
|
||||
return aResult;
|
||||
PRBool aResult = PR_TRUE;
|
||||
|
||||
if( aText.Equals( NS_LITERAL_STRING("topleft") ) )
|
||||
{
|
||||
aDir = topleft;
|
||||
}
|
||||
else if( aText.Equals( NS_LITERAL_STRING("top") ) )
|
||||
{
|
||||
aDir = top;
|
||||
}
|
||||
else if( aText.Equals( NS_LITERAL_STRING("topright") ) )
|
||||
{
|
||||
aDir = topright;
|
||||
}
|
||||
else if( aText.Equals( NS_LITERAL_STRING("left") ) )
|
||||
{
|
||||
aDir = left;
|
||||
}
|
||||
else if( aText.Equals( NS_LITERAL_STRING("right") ) )
|
||||
{
|
||||
aDir = right;
|
||||
}
|
||||
else if( aText.Equals( NS_LITERAL_STRING("bottomleft") ) )
|
||||
{
|
||||
aDir = bottomleft;
|
||||
}
|
||||
else if( aText.Equals( NS_LITERAL_STRING("bottom") ) )
|
||||
{
|
||||
aDir = bottom;
|
||||
}
|
||||
else if( aText.Equals( NS_LITERAL_STRING("bottomright") ) )
|
||||
{
|
||||
aDir = bottomright;
|
||||
}
|
||||
else
|
||||
{
|
||||
aResult = PR_FALSE;
|
||||
}
|
||||
|
||||
return aResult;
|
||||
}
|
||||
|
||||
|
||||
@ -309,8 +302,8 @@ nsResizerFrame::GetInitialDirection(eDirection& aDirection)
|
||||
return PR_FALSE;
|
||||
|
||||
if (content->GetAttr(kNameSpaceID_None, nsXULAtoms::dir, value)) {
|
||||
return EvalDirection(value,aDirection);
|
||||
}
|
||||
return EvalDirection(value,aDirection);
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
@ -321,22 +314,20 @@ nsResizerFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
PRInt32 aModType)
|
||||
{
|
||||
nsresult rv = nsTitleBarFrame::AttributeChanged(aNameSpaceID, aAttribute,
|
||||
aModType);
|
||||
nsresult rv = nsTitleBarFrame::AttributeChanged(aNameSpaceID, aAttribute,
|
||||
aModType);
|
||||
|
||||
if (aAttribute == nsXULAtoms::dir) {
|
||||
GetInitialDirection(mDirection);
|
||||
}
|
||||
|
||||
if (aAttribute == nsXULAtoms::dir )
|
||||
{
|
||||
|
||||
GetInitialDirection(mDirection);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
nsResizerFrame::MouseClicked(nsPresContext* aPresContext, nsGUIEvent *aEvent)
|
||||
void
|
||||
nsResizerFrame::MouseClicked(nsPresContext* aPresContext, nsGUIEvent *aEvent)
|
||||
{
|
||||
// Execute the oncommand event handler.
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
|
||||
@ -45,8 +45,7 @@
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsIWidget.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIViewManager.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
@ -62,9 +61,9 @@ NS_NewTitleBarFrame(nsIPresShell* aPresShell)
|
||||
} // NS_NewTitleBarFrame
|
||||
|
||||
nsTitleBarFrame::nsTitleBarFrame(nsIPresShell* aPresShell)
|
||||
:nsBoxFrame(aPresShell, PR_FALSE)
|
||||
:nsBoxFrame(aPresShell, PR_FALSE)
|
||||
{
|
||||
mTrackingMouseMove = PR_FALSE;
|
||||
mTrackingMouseMove = PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
@ -75,11 +74,11 @@ NS_IMETHODIMP nsTitleBarFrame::Init(nsPresContext* aPresContext,
|
||||
nsStyleContext* aContext,
|
||||
nsIFrame* asPrevInFlow)
|
||||
{
|
||||
nsresult rv = nsBoxFrame::Init(aPresContext, aContent, aParent, aContext, asPrevInFlow);
|
||||
nsresult rv = nsBoxFrame::Init(aPresContext, aContent, aParent, aContext, asPrevInFlow);
|
||||
|
||||
CreateViewForFrame(aPresContext,this,aContext,PR_TRUE);
|
||||
CreateViewForFrame(aPresContext,this,aContext,PR_TRUE);
|
||||
|
||||
return rv;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@ -101,7 +100,7 @@ nsTitleBarFrame::GetFrameForPoint(const nsPoint& aPoint,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTitleBarFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
nsTitleBarFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
nsGUIEvent* aEvent,
|
||||
nsEventStatus* aEventStatus)
|
||||
{
|
||||
@ -111,59 +110,59 @@ nsTitleBarFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
|
||||
switch (aEvent->message) {
|
||||
|
||||
case NS_MOUSE_LEFT_BUTTON_DOWN: {
|
||||
|
||||
// we're tracking.
|
||||
mTrackingMouseMove = PR_TRUE;
|
||||
|
||||
// start capture.
|
||||
CaptureMouseEvents(aPresContext,PR_TRUE);
|
||||
case NS_MOUSE_LEFT_BUTTON_DOWN: {
|
||||
|
||||
// we're tracking.
|
||||
mTrackingMouseMove = PR_TRUE;
|
||||
|
||||
// start capture.
|
||||
CaptureMouseEvents(aPresContext,PR_TRUE);
|
||||
|
||||
|
||||
|
||||
// remember current mouse coordinates.
|
||||
mLastPoint = aEvent->refPoint;
|
||||
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
doDefault = PR_FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
// remember current mouse coordinates.
|
||||
mLastPoint = aEvent->refPoint;
|
||||
|
||||
case NS_MOUSE_LEFT_BUTTON_UP: {
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
doDefault = PR_FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
if(mTrackingMouseMove)
|
||||
{
|
||||
// we're done tracking.
|
||||
mTrackingMouseMove = PR_FALSE;
|
||||
|
||||
// end capture
|
||||
CaptureMouseEvents(aPresContext,PR_FALSE);
|
||||
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
doDefault = PR_FALSE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NS_MOUSE_LEFT_BUTTON_UP: {
|
||||
|
||||
case NS_MOUSE_MOVE: {
|
||||
if(mTrackingMouseMove)
|
||||
{
|
||||
// get the document and the global script object - should this be cached?
|
||||
nsCOMPtr<nsIDOMWindowInternal>
|
||||
window(do_QueryInterface(aPresContext->PresShell()->GetDocument()->GetScriptGlobalObject()));
|
||||
if(mTrackingMouseMove)
|
||||
{
|
||||
// we're done tracking.
|
||||
mTrackingMouseMove = PR_FALSE;
|
||||
|
||||
// end capture
|
||||
CaptureMouseEvents(aPresContext,PR_FALSE);
|
||||
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
doDefault = PR_FALSE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_MOUSE_MOVE: {
|
||||
if(mTrackingMouseMove)
|
||||
{
|
||||
// get the document and the window - should this be cached?
|
||||
nsPIDOMWindow *window =
|
||||
aPresContext->PresShell()->GetDocument()->GetWindow();
|
||||
|
||||
if (window) {
|
||||
nsPoint nsMoveBy = aEvent->refPoint - mLastPoint;
|
||||
window->MoveBy(nsMoveBy.x,nsMoveBy.y);
|
||||
}
|
||||
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
|
||||
doDefault = PR_FALSE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
||||
|
||||
doDefault = PR_FALSE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
|
||||
@ -171,17 +170,17 @@ nsTitleBarFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
MouseClicked(aPresContext, aEvent);
|
||||
break;
|
||||
}
|
||||
|
||||
if ( doDefault )
|
||||
return nsBoxFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
|
||||
if ( doDefault )
|
||||
return nsBoxFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
else
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
nsTitleBarFrame::CaptureMouseEvents(nsPresContext* aPresContext,PRBool aGrabMouseEvents)
|
||||
{
|
||||
// get its view
|
||||
// get its view
|
||||
nsIView* view = GetView();
|
||||
PRBool result;
|
||||
|
||||
@ -207,8 +206,8 @@ nsTitleBarFrame::CaptureMouseEvents(nsPresContext* aPresContext,PRBool aGrabMous
|
||||
|
||||
|
||||
|
||||
void
|
||||
nsTitleBarFrame::MouseClicked(nsPresContext* aPresContext, nsGUIEvent* aEvent)
|
||||
void
|
||||
nsTitleBarFrame::MouseClicked(nsPresContext* aPresContext, nsGUIEvent* aEvent)
|
||||
{
|
||||
// Execute the oncommand event handler.
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
|
||||
@ -56,8 +56,7 @@
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -569,66 +568,66 @@ nsXULTooltipListener::GetTooltipFor(nsIContent* aTarget, nsIContent** aTooltip)
|
||||
NS_ERROR("Unable to retrieve the tooltip node document.");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsIScriptGlobalObject *global = document->GetScriptGlobalObject();
|
||||
if (global) {
|
||||
nsIScriptContext *context = global->GetContext();
|
||||
nsCOMPtr<nsPIDOMWindow> window = document->GetWindow();
|
||||
if (!window) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (context) {
|
||||
nsCOMPtr<nsIDOMWindowInternal> domWindow = do_QueryInterface(global);
|
||||
if (!domWindow)
|
||||
return NS_ERROR_FAILURE;
|
||||
else {
|
||||
nsAutoString tooltipText;
|
||||
aTarget->GetAttr(kNameSpaceID_None, nsXULAtoms::tooltiptext, tooltipText);
|
||||
if (!tooltipText.IsEmpty()) {
|
||||
// specifying tooltiptext means we will always use the default tooltip
|
||||
*aTooltip = mRootBox->GetDefaultTooltip();
|
||||
if (*aTooltip) {
|
||||
NS_ADDREF(*aTooltip);
|
||||
(*aTooltip)->SetAttr(kNameSpaceID_None, nsXULAtoms::label, tooltipText, PR_TRUE);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
nsAutoString tooltipId;
|
||||
aTarget->GetAttr(kNameSpaceID_None, nsXULAtoms::tooltip, tooltipId);
|
||||
PRBool closed;
|
||||
window->GetClosed(&closed);
|
||||
|
||||
// if tooltip == _child, look for first <tooltip> child
|
||||
if (tooltipId.EqualsLiteral("_child")) {
|
||||
GetImmediateChild(aTarget, nsXULAtoms::tooltip, aTooltip);
|
||||
return NS_OK;
|
||||
}
|
||||
if (!tooltipId.IsEmpty()) {
|
||||
// tooltip must be an id, use getElementById to find it
|
||||
nsCOMPtr<nsIDOMDocument> domDocument =
|
||||
do_QueryInterface(document);
|
||||
if (!domDocument) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (closed) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> tooltipEl;
|
||||
domDocument->GetElementById(tooltipId,
|
||||
getter_AddRefs(tooltipEl));
|
||||
nsAutoString tooltipText;
|
||||
aTarget->GetAttr(kNameSpaceID_None, nsXULAtoms::tooltiptext, tooltipText);
|
||||
if (!tooltipText.IsEmpty()) {
|
||||
// specifying tooltiptext means we will always use the default tooltip
|
||||
*aTooltip = mRootBox->GetDefaultTooltip();
|
||||
if (*aTooltip) {
|
||||
NS_ADDREF(*aTooltip);
|
||||
(*aTooltip)->SetAttr(kNameSpaceID_None, nsXULAtoms::label, tooltipText, PR_TRUE);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (tooltipEl) {
|
||||
nsAutoString tooltipId;
|
||||
aTarget->GetAttr(kNameSpaceID_None, nsXULAtoms::tooltip, tooltipId);
|
||||
|
||||
// if tooltip == _child, look for first <tooltip> child
|
||||
if (tooltipId.EqualsLiteral("_child")) {
|
||||
GetImmediateChild(aTarget, nsXULAtoms::tooltip, aTooltip);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!tooltipId.IsEmpty()) {
|
||||
// tooltip must be an id, use getElementById to find it
|
||||
nsCOMPtr<nsIDOMDocument> domDocument =
|
||||
do_QueryInterface(document);
|
||||
if (!domDocument) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> tooltipEl;
|
||||
domDocument->GetElementById(tooltipId, getter_AddRefs(tooltipEl));
|
||||
|
||||
if (tooltipEl) {
|
||||
#ifdef MOZ_XUL
|
||||
mNeedTitletip = PR_FALSE;
|
||||
mNeedTitletip = PR_FALSE;
|
||||
#endif
|
||||
CallQueryInterface(tooltipEl, aTooltip);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
// titletips should just use the default tooltip
|
||||
if (mIsSourceTree && mNeedTitletip) {
|
||||
NS_IF_ADDREF(*aTooltip = mRootBox->GetDefaultTooltip());
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
CallQueryInterface(tooltipEl, aTooltip);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
// titletips should just use the default tooltip
|
||||
if (mIsSourceTree && mNeedTitletip) {
|
||||
NS_IF_ADDREF(*aTooltip = mRootBox->GetDefaultTooltip());
|
||||
}
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -42,7 +42,6 @@
|
||||
#include "nsIAbCard.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAddrDatabase.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIContentHandler.h"
|
||||
#include "nsIStreamLoader.h"
|
||||
|
||||
@ -88,8 +88,7 @@
|
||||
#include "nsIWebBrowserPrint.h"
|
||||
|
||||
/* for access to docshell */
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellLoadInfo.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
@ -371,10 +370,10 @@ nsMessenger::SetWindow(nsIDOMWindowInternal *aWin, nsIMsgWindow *aMsgWindow)
|
||||
|
||||
mWindow = aWin;
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObj( do_QueryInterface(aWin) );
|
||||
NS_ENSURE_TRUE(globalObj, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsPIDOMWindow> win( do_QueryInterface(aWin) );
|
||||
NS_ENSURE_TRUE(win, NS_ERROR_FAILURE);
|
||||
|
||||
nsIDocShell *docShell = globalObj->GetDocShell();
|
||||
nsIDocShell *docShell = win->GetDocShell();
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(docShell));
|
||||
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
|
||||
|
||||
|
||||
@ -39,11 +39,10 @@
|
||||
#include "nsMessengerContentHandler.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIWebNavigation.h"
|
||||
#include "nsIMsgMailSession.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
|
||||
@ -56,7 +56,6 @@
|
||||
#include "nsIDOMChromeWindow.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIWidget.h"
|
||||
|
||||
@ -59,7 +59,6 @@
|
||||
#include "nsIWindowMediator.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIWidget.h"
|
||||
@ -105,12 +104,12 @@
|
||||
// begin shameless copying from nsNativeAppSupportWin
|
||||
HWND hwndForDOMWindow( nsISupports *window )
|
||||
{
|
||||
nsCOMPtr<nsIScriptGlobalObject> ppScriptGlobalObj( do_QueryInterface(window) );
|
||||
if ( !ppScriptGlobalObj )
|
||||
nsCOMPtr<nsPIDOMWindow> win( do_QueryInterface(window) );
|
||||
if ( !win )
|
||||
return 0;
|
||||
|
||||
nsCOMPtr<nsIBaseWindow> ppBaseWindow =
|
||||
do_QueryInterface( ppScriptGlobalObj->GetDocShell() );
|
||||
do_QueryInterface( win->GetDocShell() );
|
||||
if (!ppBaseWindow) return 0;
|
||||
|
||||
nsCOMPtr<nsIWidget> ppWidget;
|
||||
|
||||
@ -50,11 +50,10 @@
|
||||
#include "nsIDirectoryService.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIWindowMediator.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
||||
NS_IMPL_THREADSAFE_ADDREF(nsMsgMailSession)
|
||||
@ -338,11 +337,11 @@ nsresult nsMsgMailSession::GetTopmostMsgWindow(nsIMsgWindow* *aMsgWindow)
|
||||
// identified the top most window
|
||||
if (more)
|
||||
{
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObj = do_QueryInterface(topMostWindow, &rv);
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(topMostWindow, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// use this for the match
|
||||
nsIDocShell *topDocShell = globalObj->GetDocShell();
|
||||
nsIDocShell *topDocShell = win->GetDocShell();
|
||||
|
||||
// loop for the msgWindow array to find the match
|
||||
nsCOMPtr<nsIDocShell> docShell;
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
@ -268,11 +268,11 @@ nsMsgPrintEngine::SetWindow(nsIDOMWindowInternal *aWin)
|
||||
|
||||
mWindow = aWin;
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObj( do_QueryInterface(aWin) );
|
||||
NS_ENSURE_TRUE(globalObj, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsPIDOMWindow> win( do_QueryInterface(aWin) );
|
||||
NS_ENSURE_TRUE(win, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem =
|
||||
do_QueryInterface(globalObj->GetDocShell());
|
||||
do_QueryInterface(win->GetDocShell());
|
||||
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> rootAsItem;
|
||||
@ -309,12 +309,12 @@ nsMsgPrintEngine::ShowWindow(PRBool aShow)
|
||||
|
||||
NS_ENSURE_TRUE(mWindow, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsCOMPtr <nsIScriptGlobalObject> globalScript = do_QueryInterface(mWindow, &rv);
|
||||
nsCOMPtr <nsPIDOMWindow> win = do_QueryInterface(mWindow, &rv);
|
||||
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr <nsIDocShellTreeItem> treeItem =
|
||||
do_QueryInterface(globalScript->GetDocShell(), &rv);
|
||||
do_QueryInterface(win->GetDocShell(), &rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr <nsIDocShellTreeOwner> treeOwner;
|
||||
|
||||
@ -46,7 +46,6 @@
|
||||
#include "nsVoidArray.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIMsgPrintEngine.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsIMsgStatusFeedback.h"
|
||||
|
||||
@ -44,7 +44,6 @@
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIXULBrowserWindow.h"
|
||||
#include "nsMsgStatusFeedback.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDocumentViewer.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
@ -42,7 +42,6 @@
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDocShellTreeNode.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsTransactionManagerCID.h"
|
||||
@ -140,7 +139,7 @@ void nsMsgWindow::GetMessageWindowDocShell(nsIDocShell ** aDocShell)
|
||||
/* void SelectFolder (in string folderUri); */
|
||||
NS_IMETHODIMP nsMsgWindow::SelectFolder(const char *folderUri)
|
||||
{
|
||||
return mMsgWindowCommands->SelectFolder(folderUri);
|
||||
return mMsgWindowCommands->SelectFolder(folderUri);
|
||||
}
|
||||
|
||||
/* void SelectMessage (in string messasgeUri); */
|
||||
@ -186,12 +185,12 @@ NS_IMETHODIMP nsMsgWindow::CloseWindow()
|
||||
|
||||
NS_IMETHODIMP nsMsgWindow::GetStatusFeedback(nsIMsgStatusFeedback * *aStatusFeedback)
|
||||
{
|
||||
if(!aStatusFeedback)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if(!aStatusFeedback)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aStatusFeedback = mStatusFeedback;
|
||||
NS_IF_ADDREF(*aStatusFeedback);
|
||||
return NS_OK;
|
||||
*aStatusFeedback = mStatusFeedback;
|
||||
NS_IF_ADDREF(*aStatusFeedback);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgWindow::SetStatusFeedback(nsIMsgStatusFeedback * aStatusFeedback)
|
||||
@ -209,7 +208,7 @@ NS_IMETHODIMP nsMsgWindow::SetStatusFeedback(nsIMsgStatusFeedback * aStatusFeedb
|
||||
webProgress->AddProgressListener(webProgressListener, nsIWebProgress::NOTIFY_ALL);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgWindow::GetMessagePaneController(nsIMsgMessagePaneController * * aMsgPaneController)
|
||||
@ -217,56 +216,56 @@ NS_IMETHODIMP nsMsgWindow::GetMessagePaneController(nsIMsgMessagePaneController
|
||||
NS_ENSURE_ARG(aMsgPaneController);
|
||||
|
||||
*aMsgPaneController = mMsgPaneController;
|
||||
NS_IF_ADDREF(*aMsgPaneController);
|
||||
return NS_OK;
|
||||
NS_IF_ADDREF(*aMsgPaneController);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgWindow::SetMessagePaneController(nsIMsgMessagePaneController * aMsgPaneController)
|
||||
{
|
||||
mMsgPaneController = aMsgPaneController;
|
||||
return NS_OK;
|
||||
mMsgPaneController = aMsgPaneController;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgWindow::GetMsgHeaderSink(nsIMsgHeaderSink * *aMsgHdrSink)
|
||||
{
|
||||
if(!aMsgHdrSink)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if(!aMsgHdrSink)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
*aMsgHdrSink = mMsgHeaderSink;
|
||||
NS_IF_ADDREF(*aMsgHdrSink);
|
||||
return NS_OK;
|
||||
*aMsgHdrSink = mMsgHeaderSink;
|
||||
NS_IF_ADDREF(*aMsgHdrSink);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgWindow::SetMsgHeaderSink(nsIMsgHeaderSink * aMsgHdrSink)
|
||||
{
|
||||
mMsgHeaderSink = aMsgHdrSink;
|
||||
return NS_OK;
|
||||
mMsgHeaderSink = aMsgHdrSink;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgWindow::GetTransactionManager(nsITransactionManager * *aTransactionManager)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aTransactionManager);
|
||||
NS_IF_ADDREF(*aTransactionManager = mTransactionManager);
|
||||
return NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(aTransactionManager);
|
||||
NS_IF_ADDREF(*aTransactionManager = mTransactionManager);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgWindow::SetTransactionManager(nsITransactionManager * aTransactionManager)
|
||||
{
|
||||
mTransactionManager = aTransactionManager;
|
||||
return NS_OK;
|
||||
mTransactionManager = aTransactionManager;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgWindow::GetOpenFolder(nsIMsgFolder * *aOpenFolder)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aOpenFolder);
|
||||
NS_IF_ADDREF(*aOpenFolder = mOpenFolder);
|
||||
return NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(aOpenFolder);
|
||||
NS_IF_ADDREF(*aOpenFolder = mOpenFolder);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgWindow::SetOpenFolder(nsIMsgFolder * aOpenFolder)
|
||||
{
|
||||
mOpenFolder = aOpenFolder;
|
||||
return NS_OK;
|
||||
mOpenFolder = aOpenFolder;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgWindow::GetRootDocShell(nsIDocShell * *aDocShell)
|
||||
@ -291,9 +290,9 @@ NS_IMETHODIMP nsMsgWindow::SetRootDocShell(nsIDocShell * aDocShell)
|
||||
if (listener) {
|
||||
listener->SetParentContentListener(this);
|
||||
}
|
||||
// be sure to set the application flag on the root docshell
|
||||
// so it knows we are a mail application.
|
||||
aDocShell->SetAppType(nsIDocShell::APP_TYPE_MAIL);
|
||||
// be sure to set the application flag on the root docshell
|
||||
// so it knows we are a mail application.
|
||||
aDocShell->SetAppType(nsIDocShell::APP_TYPE_MAIL);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -342,15 +341,15 @@ NS_IMETHODIMP nsMsgWindow::SetCharsetOverride(PRBool aCharsetOverride)
|
||||
|
||||
NS_IMETHODIMP nsMsgWindow::SetDOMWindow(nsIDOMWindowInternal *aWindow)
|
||||
{
|
||||
if (!aWindow)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (!aWindow)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalScript(do_QueryInterface(aWindow));
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(aWindow));
|
||||
nsIDocShell *docShell = nsnull;
|
||||
if (globalScript)
|
||||
docShell = globalScript->GetDocShell();
|
||||
if (win)
|
||||
docShell = win->GetDocShell();
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(docShell));
|
||||
|
||||
@ -368,7 +367,7 @@ NS_IMETHODIMP nsMsgWindow::SetDOMWindow(nsIDOMWindowInternal *aWindow)
|
||||
SetStatusFeedback(mStatusFeedback);
|
||||
}
|
||||
|
||||
//Get nsIMsgWindowCommands object
|
||||
//Get nsIMsgWindowCommands object
|
||||
nsCOMPtr<nsISupports> xpConnectObj;
|
||||
nsCOMPtr<nsPIDOMWindow> piDOMWindow(do_QueryInterface(aWindow));
|
||||
if (piDOMWindow)
|
||||
|
||||
@ -51,6 +51,7 @@ REQUIRES = xpcom \
|
||||
xpcom_obsolete \
|
||||
string \
|
||||
dom \
|
||||
layout \
|
||||
js \
|
||||
editor \
|
||||
uriloader \
|
||||
|
||||
@ -50,6 +50,7 @@
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsIDOMHTMLLinkElement.h"
|
||||
#include "nsIDOMHTMLAnchorElement.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsISelection.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsIDOMNamedNodeMap.h"
|
||||
@ -506,8 +507,8 @@ nsMsgCompose::ConvertAndLoadComposeWindow(nsString& aPrefix,
|
||||
{
|
||||
// XXX see bug #206793
|
||||
nsIDocShell *docshell = nsnull;
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObj = do_QueryInterface(m_window);
|
||||
if (globalObj && (docshell = globalObj->GetDocShell()))
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(m_window);
|
||||
if (window && (docshell = window->GetDocShell()))
|
||||
docshell->SetAppType(nsIDocShell::APP_TYPE_EDITOR);
|
||||
|
||||
if (aHTMLEditor && !mCiteReference.IsEmpty())
|
||||
@ -675,19 +676,19 @@ nsMsgCompose::Initialize(nsIDOMWindowInternal *aWindow, nsIMsgComposeParams *par
|
||||
if (aWindow)
|
||||
{
|
||||
m_window = aWindow;
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObj(do_QueryInterface(aWindow));
|
||||
if (!globalObj)
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(aWindow));
|
||||
if (!window)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem =
|
||||
do_QueryInterface(globalObj->GetDocShell());
|
||||
do_QueryInterface(window->GetDocShell());
|
||||
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
|
||||
rv = treeItem->GetTreeOwner(getter_AddRefs(treeOwner));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
m_baseWindow = do_QueryInterface(treeOwner);
|
||||
|
||||
globalObj->GetDocShell()->SetAppType(nsIDocShell::APP_TYPE_EDITOR);
|
||||
window->GetDocShell()->SetAppType(nsIDocShell::APP_TYPE_EDITOR);
|
||||
}
|
||||
|
||||
MSG_ComposeFormat format;
|
||||
@ -1351,9 +1352,9 @@ NS_IMETHODIMP nsMsgCompose::InitEditor(nsIEditor* aEditor, nsIDOMWindow* aConten
|
||||
const nsDependentCString msgCharSet(m_compFields->GetCharacterSet());
|
||||
m_editor->SetDocumentCharacterSet(msgCharSet);
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObj = do_QueryInterface(m_window);
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(m_window);
|
||||
|
||||
nsIDocShell *docShell = globalObj->GetDocShell();
|
||||
nsIDocShell *docShell = window->GetDocShell();
|
||||
NS_ENSURE_TRUE(docShell, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsCOMPtr<nsIContentViewer> childCV;
|
||||
@ -2540,9 +2541,9 @@ QuotingOutputStreamListener::InsertToCompose(nsIEditor *aEditor,
|
||||
if (compose)
|
||||
compose->GetDomWindow(getter_AddRefs(domWindow));
|
||||
nsIDocShell *docshell = nsnull;
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObj = do_QueryInterface(domWindow);
|
||||
if (globalObj)
|
||||
docshell = globalObj->GetDocShell();
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(domWindow);
|
||||
if (window)
|
||||
docshell = window->GetDocShell();
|
||||
if (docshell)
|
||||
docshell->SetAppType(nsIDocShell::APP_TYPE_EDITOR);
|
||||
|
||||
|
||||
@ -38,7 +38,6 @@
|
||||
|
||||
#include "nsMsgComposeProgress.h"
|
||||
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
|
||||
@ -63,7 +63,7 @@
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIMsgWindow.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIXULWindow.h"
|
||||
@ -311,11 +311,11 @@ void nsMsgComposeService::CloseWindow(nsIDOMWindowInternal *domWindow)
|
||||
if (domWindow)
|
||||
{
|
||||
nsCOMPtr<nsIDocShell> docshell;
|
||||
nsCOMPtr<nsIScriptGlobalObject> globalObj(do_QueryInterface(domWindow));
|
||||
if (globalObj)
|
||||
nsCOMPtr<nsPIDOMWindow> window(do_QueryInterface(domWindow));
|
||||
if (window)
|
||||
{
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem =
|
||||
do_QueryInterface(globalObj->GetDocShell());
|
||||
do_QueryInterface(window->GetDocShell());
|
||||
|
||||
if (treeItem)
|
||||
{
|
||||
@ -658,12 +658,12 @@ nsresult nsMsgComposeService::OpenComposeWindowWithParams(const char *msgCompose
|
||||
// begin shameless copying from nsNativeAppSupportWin
|
||||
HWND hwndForComposeDOMWindow( nsISupports *window )
|
||||
{
|
||||
nsCOMPtr<nsIScriptGlobalObject> ppScriptGlobalObj( do_QueryInterface(window) );
|
||||
if ( !ppScriptGlobalObj )
|
||||
nsCOMPtr<nsPIDOMWindow> win( do_QueryInterface(window) );
|
||||
if ( !win )
|
||||
return 0;
|
||||
|
||||
nsCOMPtr<nsIBaseWindow> ppBaseWindow =
|
||||
do_QueryInterface( ppScriptGlobalObj->GetDocShell() );
|
||||
do_QueryInterface( win->GetDocShell() );
|
||||
if (!ppBaseWindow) return 0;
|
||||
|
||||
nsCOMPtr<nsIWidget> ppWidget;
|
||||
@ -1192,11 +1192,11 @@ nsresult nsMsgComposeService::ShowCachedComposeWindow(nsIDOMWindowInternal *aCom
|
||||
(do_GetService("@mozilla.org/observer-service;1", &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr <nsIScriptGlobalObject> globalScript = do_QueryInterface(aComposeWindow, &rv);
|
||||
nsCOMPtr <nsPIDOMWindow> window = do_QueryInterface(aComposeWindow, &rv);
|
||||
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsIDocShell *docShell = globalScript->GetDocShell();
|
||||
nsIDocShell *docShell = window->GetDocShell();
|
||||
|
||||
nsCOMPtr <nsIDocShellTreeItem> treeItem = do_QueryInterface(docShell, &rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
@ -46,9 +46,6 @@
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIJSContextStack.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "ProxyJNI.h"
|
||||
#include "nsCNullSecurityContext.h"
|
||||
|
||||
@ -46,8 +46,6 @@
|
||||
#include "nsISecurityContext.h"
|
||||
#include "nsCSecurityContext.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
@ -66,8 +66,7 @@
|
||||
// nsIWebBrowserChrome to send the "Starting Java" message to the status
|
||||
// bar.
|
||||
#include "nsIWindowWatcher.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsPresContext.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
@ -773,12 +772,12 @@ nsJVMManager::GetChrome(nsIWebBrowserChrome **theChrome)
|
||||
}
|
||||
nsCOMPtr<nsIDOMWindow> domWindow;
|
||||
windowWatcher->GetActiveWindow(getter_AddRefs(domWindow));
|
||||
nsCOMPtr<nsIScriptGlobalObject> scriptObject =
|
||||
nsCOMPtr<nsPIDOMWindow> window =
|
||||
do_QueryInterface(domWindow, &rv);
|
||||
if (!scriptObject) {
|
||||
if (!window) {
|
||||
return rv;
|
||||
}
|
||||
nsIDocShell *docShell = scriptObject->GetDocShell();
|
||||
nsIDocShell *docShell = window->GetDocShell();
|
||||
if (!docShell) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@
|
||||
#include "nsPIPluginInstancePeer.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScriptContext.h"
|
||||
|
||||
@ -50,10 +50,8 @@
|
||||
#include "nsPluginLogging.h"
|
||||
|
||||
#include "nsPIPluginInstancePeer.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
|
||||
#include "nsJSNPRuntime.h"
|
||||
|
||||
@ -880,11 +878,10 @@ NS_IMETHODIMP ns4xPluginInstance::Stop(void)
|
||||
|
||||
// Make sure the plugin didn't leave popups enabled.
|
||||
if (mPopupStates.Count() > 0) {
|
||||
nsCOMPtr<nsIDOMWindow> window = GetDOMWindow();
|
||||
nsCOMPtr<nsPIDOMWindow> piwindow = do_QueryInterface(window);
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetDOMWindow();
|
||||
|
||||
if (piwindow) {
|
||||
piwindow->PopPopupControlState(openAbused);
|
||||
if (window) {
|
||||
window->PopPopupControlState(openAbused);
|
||||
}
|
||||
}
|
||||
|
||||
@ -938,7 +935,7 @@ NS_IMETHODIMP ns4xPluginInstance::Stop(void)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDOMWindow>
|
||||
already_AddRefed<nsPIDOMWindow>
|
||||
ns4xPluginInstance::GetDOMWindow()
|
||||
{
|
||||
nsCOMPtr<nsPIPluginInstancePeer> pp (do_QueryInterface(mPeer));
|
||||
@ -960,16 +957,7 @@ ns4xPluginInstance::GetDOMWindow()
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIScriptGlobalObject *sgo = doc->GetScriptGlobalObject();
|
||||
|
||||
if (!sgo) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsIDOMWindow *window;
|
||||
CallQueryInterface(sgo, &window);
|
||||
|
||||
return window;
|
||||
return doc->GetWindow();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@ -1612,20 +1600,18 @@ ns4xPluginInstance::GetFormValue(nsAString& aValue)
|
||||
void
|
||||
ns4xPluginInstance::PushPopupsEnabledState(PRBool aEnabled)
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindow> window = GetDOMWindow();
|
||||
nsCOMPtr<nsPIDOMWindow> piwindow = do_QueryInterface(window);
|
||||
|
||||
if (!piwindow)
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetDOMWindow();
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
PopupControlState oldState =
|
||||
piwindow->PushPopupControlState(aEnabled ? openAllowed : openAbused,
|
||||
PR_TRUE);
|
||||
window->PushPopupControlState(aEnabled ? openAllowed : openAbused,
|
||||
PR_TRUE);
|
||||
|
||||
if (!mPopupStates.AppendElement(NS_INT32_TO_PTR(oldState))) {
|
||||
// Appending to our state stack failed, push what we just popped.
|
||||
|
||||
piwindow->PopPopupControlState(oldState);
|
||||
window->PopPopupControlState(oldState);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1640,16 +1626,14 @@ ns4xPluginInstance::PopPopupsEnabledState()
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> window = GetDOMWindow();
|
||||
nsCOMPtr<nsPIDOMWindow> piwindow = do_QueryInterface(window);
|
||||
|
||||
if (!piwindow)
|
||||
nsCOMPtr<nsPIDOMWindow> window = GetDOMWindow();
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
PopupControlState oldState =
|
||||
(PopupControlState)NS_PTR_TO_INT32(mPopupStates[last]);
|
||||
|
||||
piwindow->PopPopupControlState(oldState);
|
||||
window->PopPopupControlState(oldState);
|
||||
|
||||
mPopupStates.RemoveElementAt(last);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user