Bug 655517 - Remove nsIDOMDocumentEvent; f=ehsan r=smaug

This commit is contained in:
Ms2ger 2011-05-23 18:46:36 +02:00
parent ef87572c02
commit fb6f5dd0ca
37 changed files with 79 additions and 184 deletions

View File

@ -35,6 +35,9 @@
*
* ***** END LICENSE BLOCK ***** */
#define CreateEvent CreateEventA
#include "nsIDOMDocument.h"
#include "States.h"
#include "nsAccessibilityService.h"
#include "nsApplicationAccessibleWrap.h"
@ -48,7 +51,6 @@
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeNode.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMEventListener.h"
#include "nsIDOMEventTarget.h"
@ -76,11 +78,8 @@
#include "nsReadableUtils.h"
#include "nsRootAccessible.h"
#include "nsIDOMNSEventTarget.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIPrivateDOMEvent.h"
#include "nsFocusManager.h"
#include "mozilla/dom/Element.h"
#ifdef MOZ_XUL
#include "nsXULTreeAccessible.h"
@ -415,11 +414,11 @@ nsRootAccessible::FireCurrentFocusEvent()
return; // No current focus
}
nsCOMPtr<nsIDOMDocumentEvent> docEvent = do_QueryInterface(mDocument);
if (docEvent) {
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(mDocument);
if (domDoc) {
nsCOMPtr<nsIDOMEvent> event;
if (NS_SUCCEEDED(docEvent->CreateEvent(NS_LITERAL_STRING("Events"),
getter_AddRefs(event))) &&
if (NS_SUCCEEDED(domDoc->CreateEvent(NS_LITERAL_STRING("Events"),
getter_AddRefs(event))) &&
NS_SUCCEEDED(event->InitEvent(NS_LITERAL_STRING("focus"), PR_TRUE, PR_TRUE))) {
nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));

View File

@ -928,7 +928,7 @@ public:
/**
* This method creates and dispatches a trusted event.
* Works only with events which can be created by calling
* nsIDOMDocumentEvent::CreateEvent() with parameter "Events".
* nsIDOMDocument::CreateEvent() with parameter "Events".
* @param aDoc The document which will be used to create the event.
* @param aTarget The target of the event, should be QIable to
* nsIDOMEventTarget.
@ -949,7 +949,7 @@ public:
* This method creates and dispatches a trusted event to the chrome
* event handler.
* Works only with events which can be created by calling
* nsIDOMDocumentEvent::CreateEvent() with parameter "Events".
* nsIDOMDocument::CreateEvent() with parameter "Events".
* @param aDocument The document which will be used to create the event,
* and whose window's chrome handler will be used to
* dispatch the event.

View File

@ -115,7 +115,6 @@
#include "nsIDOMEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMDocumentEvent.h"
#ifdef MOZ_XTF
#include "nsIXTFService.h"
static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
@ -3345,13 +3344,13 @@ nsresult GetEventAndTarget(nsIDocument* aDoc, nsISupports* aTarget,
nsIDOMEvent** aEvent,
nsIDOMEventTarget** aTargetOut)
{
nsCOMPtr<nsIDOMDocumentEvent> docEvent(do_QueryInterface(aDoc));
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(aDoc);
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(aTarget));
NS_ENSURE_TRUE(docEvent && target, NS_ERROR_INVALID_ARG);
NS_ENSURE_TRUE(domDoc && target, NS_ERROR_INVALID_ARG);
nsCOMPtr<nsIDOMEvent> event;
nsresult rv =
docEvent->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
domDoc->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));
@ -5530,11 +5529,11 @@ nsContentUtils::DispatchXULCommand(nsIContent* aTarget,
{
NS_ENSURE_STATE(aTarget);
nsIDocument* doc = aTarget->GetOwnerDoc();
nsCOMPtr<nsIDOMDocumentEvent> docEvent = do_QueryInterface(doc);
NS_ENSURE_STATE(docEvent);
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(doc);
NS_ENSURE_STATE(domDoc);
nsCOMPtr<nsIDOMEvent> event;
docEvent->CreateEvent(NS_LITERAL_STRING("xulcommandevent"),
getter_AddRefs(event));
domDoc->CreateEvent(NS_LITERAL_STRING("xulcommandevent"),
getter_AddRefs(event));
nsCOMPtr<nsIDOMXULCommandEvent> xulCommand = do_QueryInterface(event);
nsCOMPtr<nsIPrivateDOMEvent> pEvent = do_QueryInterface(xulCommand);
NS_ENSURE_STATE(pEvent);

View File

@ -4130,14 +4130,13 @@ nsDocument::DispatchContentLoadedEvents()
if (target_frame) {
nsCOMPtr<nsIDocument> parent = mParentDocument;
do {
nsCOMPtr<nsIDOMDocumentEvent> document_event =
do_QueryInterface(parent);
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(parent);
nsCOMPtr<nsIDOMEvent> event;
nsCOMPtr<nsIPrivateDOMEvent> privateEvent;
if (document_event) {
document_event->CreateEvent(NS_LITERAL_STRING("Events"),
getter_AddRefs(event));
if (domDoc) {
domDoc->CreateEvent(NS_LITERAL_STRING("Events"),
getter_AddRefs(event));
privateEvent = do_QueryInterface(event);
}

View File

@ -69,7 +69,6 @@
#include "nsIParser.h"
#include "nsBindingManager.h"
#include "nsINodeInfo.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOM3DocumentEvent.h"
#include "nsHashtable.h"
#include "nsInterfaceHashtable.h"
@ -493,7 +492,6 @@ protected:
class nsDocument : public nsIDocument,
public nsIDOMXMLDocument, // inherits nsIDOMDocument
public nsIDOMNSDocument,
public nsIDOMDocumentEvent,
public nsIDOM3DocumentEvent,
public nsIDOMNSDocumentStyle,
public nsIDOMDocumentXBL,
@ -798,9 +796,6 @@ public:
// nsIDOMNSDocument
NS_DECL_NSIDOMNSDOCUMENT
// nsIDOMDocumentEvent
NS_DECL_NSIDOMDOCUMENTEVENT
// nsIDOM3DocumentEvent
NS_DECL_NSIDOM3DOCUMENTEVENT
@ -1252,7 +1247,6 @@ protected:
NS_NODE_OFFSET_AND_INTERFACE_TABLE_BEGIN(_class) \
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMDocument, nsDocument) \
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMNSDocument, nsDocument) \
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMDocumentEvent, nsDocument) \
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMEventTarget, nsDocument) \
NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, nsIDOMNode, nsDocument)

View File

@ -50,7 +50,7 @@
#include "nsIDocShell.h"
#include "nsIDocument.h"
#include "nsIDOMDataContainerEvent.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMDocument.h"
#include "nsIDOMEventTarget.h"
#include "nsIExternalProtocolHandler.h"
#include "nsEventStates.h"
@ -257,16 +257,16 @@ nsPluginCrashedEvent::Run()
LOG(("OBJLC []: Firing plugin crashed event for content %p\n",
mContent.get()));
nsCOMPtr<nsIDOMDocumentEvent> domEventDoc =
nsCOMPtr<nsIDOMDocument> domDoc =
do_QueryInterface(mContent->GetDocument());
if (!domEventDoc) {
if (!domDoc) {
NS_WARNING("Couldn't get document for PluginCrashed event!");
return NS_OK;
}
nsCOMPtr<nsIDOMEvent> event;
domEventDoc->CreateEvent(NS_LITERAL_STRING("datacontainerevents"),
getter_AddRefs(event));
domDoc->CreateEvent(NS_LITERAL_STRING("datacontainerevents"),
getter_AddRefs(event));
nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));
nsCOMPtr<nsIDOMDataContainerEvent> containerEvent(do_QueryInterface(event));
if (!privateEvent || !containerEvent) {

View File

@ -39,6 +39,7 @@
* ***** END LICENSE BLOCK ***** */
#include "nsWebSocket.h"
#include "nsIScriptGlobalObject.h"
#include "nsIDOMWindow.h"
#include "nsIDocument.h"
@ -57,7 +58,6 @@
#include "nsICharsetConverterManager.h"
#include "nsIUnicodeEncoder.h"
#include "nsThreadUtils.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMMessageEvent.h"
#include "nsIPromptFactory.h"
#include "nsIWindowWatcher.h"

View File

@ -53,7 +53,6 @@
#include "nsIVariant.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsIPrivateDOMEvent.h"

View File

@ -113,7 +113,6 @@
#include "nsIObserverService.h"
#include "nsIDocShell.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMMouseScrollEvent.h"
#include "nsIDOMDragEvent.h"
#include "nsIDOMEventTarget.h"

View File

@ -39,7 +39,6 @@
#include "nsIDOMEvent.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsContentUtils.h"
#include "nsEventDispatcher.h"

View File

@ -64,7 +64,6 @@
#include "nsITimer.h"
#include "nsEventDispatcher.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMProgressEvent.h"
using namespace mozilla::dom;

View File

@ -52,7 +52,6 @@
#include "nsIDocument.h"
#include "nsIDOMEvent.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsParserUtils.h"
#include "nsContentUtils.h"

View File

@ -68,7 +68,6 @@
#include "nsITimer.h"
#include "nsEventDispatcher.h"
#include "nsIDOMDocumentEvent.h"
#include "nsMediaError.h"
#include "nsICategoryManager.h"
#include "nsCharSeparatedTokenizer.h"
@ -2250,13 +2249,13 @@ nsresult nsHTMLMediaElement::DispatchAudioAvailableEvent(float* aFrameBuffer,
// which frees the memory when it's destroyed.
nsAutoArrayPtr<float> frameBuffer(aFrameBuffer);
nsCOMPtr<nsIDOMDocumentEvent> docEvent(do_QueryInterface(GetOwnerDoc()));
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(GetOwnerDoc());
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(static_cast<nsIContent*>(this)));
NS_ENSURE_TRUE(docEvent && target, NS_ERROR_INVALID_ARG);
NS_ENSURE_TRUE(domDoc && target, NS_ERROR_INVALID_ARG);
nsCOMPtr<nsIDOMEvent> event;
nsresult rv = docEvent->CreateEvent(NS_LITERAL_STRING("MozAudioAvailableEvent"),
getter_AddRefs(event));
nsresult rv = domDoc->CreateEvent(NS_LITERAL_STRING("MozAudioAvailableEvent"),
getter_AddRefs(event));
nsCOMPtr<nsIDOMNotifyAudioAvailableEvent> audioavailableEvent(do_QueryInterface(event));
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -57,7 +57,6 @@
#include "nsIPrivateDOMEvent.h"
#include "nsIBoxObject.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMDocumentEvent.h"
// Notify/query select frame for selectedIndex
#include "nsIDocument.h"

View File

@ -61,7 +61,6 @@
#include "nsITimer.h"
#include "nsEventDispatcher.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMProgressEvent.h"
#include "nsMediaError.h"

View File

@ -64,9 +64,8 @@ nsSVGDocument::~nsSVGDocument()
DOMCI_NODE_DATA(SVGDocument, nsSVGDocument)
NS_INTERFACE_TABLE_HEAD(nsSVGDocument)
NS_INTERFACE_TABLE_INHERITED2(nsSVGDocument,
nsIDOMSVGDocument,
nsIDOMDocumentEvent)
NS_INTERFACE_TABLE_INHERITED1(nsSVGDocument,
nsIDOMSVGDocument)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGDocument)
NS_INTERFACE_MAP_END_INHERITING(nsXMLDocument)

View File

@ -54,7 +54,6 @@ public:
NS_DECL_NSIDOMSVGDOCUMENT
NS_FORWARD_NSIDOMDOCUMENT(nsXMLDocument::)
NS_FORWARD_NSIDOMNODE(nsXMLDocument::)
NS_FORWARD_NSIDOMDOCUMENTEVENT(nsXMLDocument::)
NS_DECL_ISUPPORTS_INHERITED
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsXPCClassInfo* GetClassInfo();

View File

@ -222,7 +222,6 @@
#include "nsIDOMDocumentType.h"
#include "nsIDOMDOMImplementation.h"
#include "nsIDOMDocumentFragment.h"
#include "nsIDOMDocumentEvent.h"
#include "nsDOMAttribute.h"
#include "nsIDOMText.h"
#include "nsIDOM3Text.h"
@ -2328,7 +2327,6 @@ nsDOMClassInfo::RegisterExternalClasses()
#define DOM_CLASSINFO_DOCUMENT_MAP_ENTRIES \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocument) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentEvent) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentStyle) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSDocumentStyle) \
DOM_CLASSINFO_MAP_ENTRY(nsIDOMDocumentXBL) \

View File

@ -115,7 +115,6 @@
#include "nsIDOMDocument.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMEvent.h"
#include "nsIDOMHTMLAnchorElement.h"
#include "nsIDOMKeyEvent.h"
@ -5513,10 +5512,9 @@ nsGlobalWindow::FirePopupBlockedEvent(nsIDOMDocument* aDoc,
if (aDoc) {
// Fire a "DOMPopupBlocked" event so that the UI can hear about
// blocked popups.
nsCOMPtr<nsIDOMDocumentEvent> docEvent(do_QueryInterface(aDoc));
nsCOMPtr<nsIDOMEvent> event;
docEvent->CreateEvent(NS_LITERAL_STRING("PopupBlockedEvents"),
getter_AddRefs(event));
aDoc->CreateEvent(NS_LITERAL_STRING("PopupBlockedEvents"),
getter_AddRefs(event));
if (event) {
nsCOMPtr<nsIDOMPopupBlockedEvent> pbev(do_QueryInterface(event));
pbev->InitPopupBlockedEvent(NS_LITERAL_STRING("DOMPopupBlocked"),
@ -5928,13 +5926,12 @@ PostMessageEvent::Run()
// Create the event
nsCOMPtr<nsIDOMDocumentEvent> docEvent =
do_QueryInterface(targetWindow->mDocument);
if (!docEvent)
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(targetWindow->mDocument);
if (!domDoc)
return NS_OK;
nsCOMPtr<nsIDOMEvent> event;
docEvent->CreateEvent(NS_LITERAL_STRING("MessageEvent"),
getter_AddRefs(event));
domDoc->CreateEvent(NS_LITERAL_STRING("MessageEvent"),
getter_AddRefs(event));
if (!event)
return NS_OK;

View File

@ -24,6 +24,7 @@
* Johnny Stenback <jst@netscape.com>
* Jonas Sicking <sicking@bigfoot.com>
* Ms2ger <ms2ger@gmail.com>
* Tom Pixley <joki@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@ -58,7 +59,7 @@ interface nsIDOMTreeWalker;
* http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
*/
[scriptable, uuid(e286fcde-873d-4902-874b-49255737ee7d)]
[scriptable, uuid(238bdcb3-8645-4b3e-bf67-e82437acded4)]
interface nsIDOMDocument : nsIDOMNode
{
readonly attribute nsIDOMDocumentType doctype;
@ -139,4 +140,7 @@ interface nsIDOMDocument : nsIDOMNode
in nsIDOMNodeFilter filter,
in boolean entityReferenceExpansion)
raises(DOMException);
nsIDOMEvent createEvent(in DOMString eventType)
raises(DOMException);
};

View File

@ -38,7 +38,7 @@
#include "nsIDOMDocument.idl"
[scriptable, uuid(305a78cc-da33-402c-bcd5-44eb993ab391)]
[scriptable, uuid(044dc1e7-3fe7-4052-ad68-e4ee150a3329)]
interface nsIDOMXMLDocument : nsIDOMDocument
{
// DOM Level 3 Load & Save, DocumentLS

View File

@ -47,7 +47,6 @@ XPIDL_MODULE = dom_events
GRE_MODULE = 1
SDK_XPIDLSRCS = \
nsIDOMDocumentEvent.idl \
nsIDOMEvent.idl \
nsIDOMEventTarget.idl \
nsIDOMEventListener.idl \

View File

@ -1,55 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Tom Pixley <joki@netscape.com> (original author)
* Johnny Stenback <jst@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "domstubs.idl"
/**
* The nsIDOMDocumentEvent interface is the interface to the event
* factory method on a DOM document object.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Events/
*/
[scriptable, uuid(46b91d66-28e2-11d4-ab1e-0010830123b4)]
interface nsIDOMDocumentEvent : nsISupports
{
nsIDOMEvent createEvent(in DOMString eventType)
raises(DOMException);
};

View File

@ -50,7 +50,7 @@
* http://www.whatwg.org/specs/web-apps/current-work/
*/
[scriptable, uuid(4b21c9f8-68bc-4bce-b452-0f844c532dfc)]
[scriptable, uuid(b2c88331-2c2d-432a-8d0c-f0fbfdaf3f5f)]
interface nsIDOMHTMLDocument : nsIDOMDocument
{
attribute DOMString title;

View File

@ -39,9 +39,8 @@
interface nsIDOMSVGSVGElement;
[scriptable, uuid(32f1cd80-9328-4f55-938a-0734217a7944)]
[scriptable, uuid(e760915a-61cd-4787-8617-cd417ebb69b4)]
interface nsIDOMSVGDocument : nsIDOMDocument
/* , nsIDOMDocumentEvent */
{
readonly attribute DOMString title;
readonly attribute DOMString referrer;

View File

@ -74,8 +74,6 @@ interface nsIDOMSVGSVGElement
nsIDOMSVGFitToViewBox,
nsIDOMSVGZoomAndPan,
events::nsIDOMEventTarget,
events::nsIDOMDocumentEvent,
css::nsIDOMViewCSS,
css::nsIDOMDocumentCSS
*/
{
@ -125,8 +123,3 @@ interface nsIDOMSVGSVGElement
nsIDOMSVGTransform createSVGTransformFromMatrix(in nsIDOMSVGMatrix matrix);
nsIDOMElement getElementById(in DOMString elementId);
};

View File

@ -43,7 +43,6 @@
#include "nsIDOMEventTarget.h"
#include "nsIServiceManager.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMDeviceOrientationEvent.h"
#include "nsIServiceManager.h"
#include "nsIPrefService.h"
@ -257,13 +256,12 @@ nsAccelerometer::AccelerationChanged(double alpha, double beta, double gamma)
nsCOMPtr<nsIDOMDocument> domdoc;
mWindowListeners[i]->GetDocument(getter_AddRefs(domdoc));
nsCOMPtr<nsIDOMDocumentEvent> docevent(do_QueryInterface(domdoc));
nsCOMPtr<nsIDOMEvent> event;
PRBool defaultActionEnabled = PR_TRUE;
if (docevent) {
docevent->CreateEvent(NS_LITERAL_STRING("DeviceOrientationEvent"), getter_AddRefs(event));
if (domdoc) {
domdoc->CreateEvent(NS_LITERAL_STRING("DeviceOrientationEvent"), getter_AddRefs(event));
nsCOMPtr<nsIDOMDeviceOrientationEvent> oe = do_QueryInterface(event);

View File

@ -42,7 +42,6 @@
#include "nsIDOMEventTarget.h"
#include "nsIDOMEvent.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMDocumentEvent.h"
#include "nsString.h"
/****************************************************************
@ -89,13 +88,12 @@ nsAutoWindowStateHelper::DispatchCustomEvent(const char *aEventName)
nsCOMPtr<nsIDOMDocument> domdoc;
mWindow->GetDocument(getter_AddRefs(domdoc));
nsCOMPtr<nsIDOMDocumentEvent> docevent(do_QueryInterface(domdoc));
nsCOMPtr<nsIDOMEvent> event;
PRBool defaultActionEnabled = PR_TRUE;
if (docevent) {
docevent->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
if (domdoc) {
domdoc->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));
if (privateEvent) {

View File

@ -111,6 +111,7 @@ members = [
'nsIDOMDocument.adoptNode',
'nsIDOMDocument.defaultView',
'nsIDOMDocument.createNodeIterator',
'nsIDOMDocument.createEvent',
'nsIDOMElement.removeAttributeNS',
'nsIDOMElement.removeAttribute',
'nsIDOMElement.getAttribute',
@ -182,7 +183,6 @@ members = [
'nsIDOMEventTarget.dispatchEvent',
'nsIDOMEventTarget.removeEventListener',
'nsIDOMNSEventTarget.addEventListener',
'nsIDOMDocumentEvent.*',
'nsIDOMEvent.*',
'nsIDOMMouseEvent.*',

View File

@ -52,7 +52,6 @@
#include "nsIDocumentViewer.h"
#include "mozilla/FunctionTimer.h"
#include "nsIDocumentViewerPrint.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMBeforeUnloadEvent.h"
#include "nsIDocument.h"
@ -1142,10 +1141,10 @@ DocumentViewerImpl::PermitUnload(PRBool aCallerClosesWindow, PRBool *aPermitUnlo
// Now, fire an BeforeUnload event to the document and see if it's ok
// to unload...
nsCOMPtr<nsIDOMDocumentEvent> docEvent = do_QueryInterface(mDocument);
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(mDocument);
nsCOMPtr<nsIDOMEvent> event;
docEvent->CreateEvent(NS_LITERAL_STRING("beforeunloadevent"),
getter_AddRefs(event));
domDoc->CreateEvent(NS_LITERAL_STRING("beforeunloadevent"),
getter_AddRefs(event));
nsCOMPtr<nsIDOMBeforeUnloadEvent> beforeUnload = do_QueryInterface(event);
nsCOMPtr<nsIPrivateDOMEvent> pEvent = do_QueryInterface(beforeUnload);
NS_ENSURE_STATE(pEvent);

View File

@ -103,7 +103,6 @@ enum { XKeyPress = KeyPress };
#include "nsIDOMHTMLEmbedElement.h"
#include "nsIDOMHTMLAppletElement.h"
#include "nsIDOMWindow.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMMouseListener.h"
#include "nsIDOMMouseMotionListener.h"
#include "nsIDOMFocusListener.h"

View File

@ -70,7 +70,6 @@
#include "nsIDOMNodeList.h"
#include "nsIDOMDocument.h"
#include "nsIDOMNSDocument.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMXULElement.h"
#include "nsIDocument.h"
#include "nsIContent.h"
@ -4459,14 +4458,13 @@ nsTreeBodyFrame::FireRowCountChangedEvent(PRInt32 aIndex, PRInt32 aCount)
if (!content)
return;
nsCOMPtr<nsIDOMDocumentEvent> domEventDoc =
do_QueryInterface(content->GetOwnerDoc());
if (!domEventDoc)
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(content->GetOwnerDoc());
if (!domDoc)
return;
nsCOMPtr<nsIDOMEvent> event;
domEventDoc->CreateEvent(NS_LITERAL_STRING("datacontainerevents"),
getter_AddRefs(event));
domDoc->CreateEvent(NS_LITERAL_STRING("datacontainerevents"),
getter_AddRefs(event));
nsCOMPtr<nsIDOMDataContainerEvent> treeEvent(do_QueryInterface(event));
if (!treeEvent)
@ -4515,14 +4513,13 @@ nsTreeBodyFrame::FireInvalidateEvent(PRInt32 aStartRowIdx, PRInt32 aEndRowIdx,
if (!content)
return;
nsCOMPtr<nsIDOMDocumentEvent> domEventDoc =
do_QueryInterface(content->GetOwnerDoc());
if (!domEventDoc)
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(content->GetOwnerDoc());
if (!domDoc)
return;
nsCOMPtr<nsIDOMEvent> event;
domEventDoc->CreateEvent(NS_LITERAL_STRING("datacontainerevents"),
getter_AddRefs(event));
domDoc->CreateEvent(NS_LITERAL_STRING("datacontainerevents"),
getter_AddRefs(event));
nsCOMPtr<nsIDOMDataContainerEvent> treeEvent(do_QueryInterface(event));
if (!treeEvent)

View File

@ -74,7 +74,6 @@
#include "nsDateTimeFormatCID.h"
#include "nsIDOMEvent.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMWindow.h"
#include "nsIDOMWindowCollection.h"
#include "nsIDOMWindowInternal.h"
@ -550,14 +549,9 @@ nsNSSComponent::DispatchEventToWindow(nsIDOMWindow *domWin,
}
// create the event
nsCOMPtr<nsIDOMDocumentEvent> docEvent = do_QueryInterface(doc, &rv);
if (NS_FAILED(rv)) {
return rv;
}
nsCOMPtr<nsIDOMEvent> event;
rv = docEvent->CreateEvent(NS_LITERAL_STRING("Events"),
getter_AddRefs(event));
rv = doc->CreateEvent(NS_LITERAL_STRING("Events"),
getter_AddRefs(event));
if (NS_FAILED(rv)) {
return rv;
}

View File

@ -63,7 +63,6 @@
#include "nsIPresShell.h"
#include "nsIFrame.h"
#include "nsRect.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsILoginManager.h"
#include "nsIDOMMouseEvent.h"
@ -528,12 +527,10 @@ nsFormFillController::OnTextEntered(PRBool* aPrevent)
// Fire off a DOMAutoComplete event
nsCOMPtr<nsIDOMDocument> domDoc;
mFocusedInput->GetOwnerDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDOMDocumentEvent> doc = do_QueryInterface(domDoc);
NS_ENSURE_STATE(doc);
NS_ENSURE_STATE(domDoc);
nsCOMPtr<nsIDOMEvent> event;
doc->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
domDoc->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));
NS_ENSURE_STATE(privateEvent);

View File

@ -54,7 +54,6 @@
#include "nsIDOMDocument.h"
#include "nsIPrivateDOMEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMElement.h"
nsMenuItemX::nsMenuItemX()
@ -211,15 +210,15 @@ nsresult nsMenuItemX::DispatchDOMEvent(const nsString &eventName, PRBool *preven
}
// get interface for creating DOM events from content owner document
nsCOMPtr<nsIDOMDocumentEvent> DOMEventFactory = do_QueryInterface(parentDoc);
if (!DOMEventFactory) {
NS_WARNING("Failed to QI parent nsIDocument to nsIDOMDocumentEvent");
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(parentDoc);
if (!domDoc) {
NS_WARNING("Failed to QI parent nsIDocument to nsIDOMDocument");
return NS_ERROR_FAILURE;
}
// create DOM event
nsCOMPtr<nsIDOMEvent> event;
nsresult rv = DOMEventFactory->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
nsresult rv = domDoc->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
if (NS_FAILED(rv)) {
NS_WARNING("Failed to create nsIDOMEvent");
return rv;

View File

@ -46,7 +46,7 @@
#include "nsCocoaWindow.h"
#include "nsWidgetAtoms.h"
#include "nsIDocument.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMDocument.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMXULCommandEvent.h"
#include "nsIPrivateDOMEvent.h"
@ -57,12 +57,12 @@ void nsMenuUtilsX::DispatchCommandTo(nsIContent* aTargetContent)
NS_PRECONDITION(aTargetContent, "null ptr");
nsIDocument* doc = aTargetContent->GetOwnerDoc();
nsCOMPtr<nsIDOMDocumentEvent> docEvent = do_QueryInterface(doc);
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(doc);
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(aTargetContent);
if (docEvent && target) {
if (domDoc && target) {
nsCOMPtr<nsIDOMEvent> event;
docEvent->CreateEvent(NS_LITERAL_STRING("xulcommandevent"),
getter_AddRefs(event));
domDoc->CreateEvent(NS_LITERAL_STRING("xulcommandevent"),
getter_AddRefs(event));
nsCOMPtr<nsIDOMXULCommandEvent> command = do_QueryInterface(event);
nsCOMPtr<nsIPrivateDOMEvent> pEvent = do_QueryInterface(command);

View File

@ -58,7 +58,6 @@
#include "nsIDocument.h"
#include "nsIDOMBarProp.h"
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMXULDocument.h"
#include "nsIDOMElement.h"
#include "nsIPrivateDOMEvent.h"
@ -272,18 +271,17 @@ NS_IMETHODIMP nsXULWindow::SetZLevel(PRUint32 aLevel)
nsCOMPtr<nsIContentViewer> cv;
mDocShell->GetContentViewer(getter_AddRefs(cv));
if (cv) {
nsCOMPtr<nsIDOMDocumentEvent> docEvent(
do_QueryInterface(cv->GetDocument()));
if (docEvent) {
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(cv->GetDocument());
if (domDoc) {
nsCOMPtr<nsIDOMEvent> event;
docEvent->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
domDoc->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
if (event) {
event->InitEvent(NS_LITERAL_STRING("windowZLevel"), PR_TRUE, PR_FALSE);
nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));
privateEvent->SetTrusted(PR_TRUE);
nsCOMPtr<nsIDOMEventTarget> targ(do_QueryInterface(docEvent));
nsCOMPtr<nsIDOMEventTarget> targ = do_QueryInterface(domDoc);
if (targ) {
PRBool defaultActionEnabled;
targ->DispatchEvent(event, &defaultActionEnabled);