зеркало из https://github.com/mozilla/pjs.git
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
This commit is contained in:
Родитель
e365bb5bdf
Коммит
adf1d8320a
|
@ -148,7 +148,7 @@ NS_IMETHODIMP nsRootAccessible::RemoveAccessibleEventListener(nsIAccessibleEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nsresult nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
||||||
{
|
{
|
||||||
if (mListener) {
|
if (mListener) {
|
||||||
nsCOMPtr<nsIDOMEventTarget> t;
|
nsCOMPtr<nsIDOMEventTarget> t;
|
||||||
|
@ -185,12 +185,12 @@ nsresult nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsRootAccessible::Focus(nsIDOMEvent* aEvent)
|
NS_IMETHODIMP nsRootAccessible::Focus(nsIDOMEvent* aEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsRootAccessible::Blur(nsIDOMEvent* aEvent)
|
NS_IMETHODIMP nsRootAccessible::Blur(nsIDOMEvent* aEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,9 +51,9 @@ class nsRootAccessible : public nsAccessible,
|
||||||
NS_IMETHOD RemoveAccessibleEventListener(nsIAccessibleEventListener *aListener);
|
NS_IMETHOD RemoveAccessibleEventListener(nsIAccessibleEventListener *aListener);
|
||||||
|
|
||||||
// ----- nsIDOMEventListener --------
|
// ----- nsIDOMEventListener --------
|
||||||
virtual nsresult HandleEvent(nsIDOMEvent* anEvent);
|
NS_IMETHOD HandleEvent(nsIDOMEvent* anEvent);
|
||||||
virtual nsresult Focus(nsIDOMEvent* aEvent);
|
NS_IMETHOD Focus(nsIDOMEvent* aEvent);
|
||||||
virtual nsresult Blur(nsIDOMEvent* aEvent);
|
NS_IMETHOD Blur(nsIDOMEvent* aEvent);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual nsIFrame* GetFrame();
|
virtual nsIFrame* GetFrame();
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
NS_IMETHOD Action(nsIDOMEvent* aEvent) { return NS_OK; }
|
NS_IMETHOD Action(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||||
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
|
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||||
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
|
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||||
nsresult HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> mPopupAtom;
|
nsCOMPtr<nsIAtom> mPopupAtom;
|
||||||
nsCOMPtr<nsIContent> mSelectContent;
|
nsCOMPtr<nsIContent> mSelectContent;
|
||||||
|
@ -90,7 +90,7 @@ public:
|
||||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||||
NS_IMETHOD GetAccExtState(PRUint32 *_retval);
|
NS_IMETHOD GetAccExtState(PRUint32 *_retval);
|
||||||
|
|
||||||
// popup listener
|
// popup listener
|
||||||
NS_IMETHOD Create(nsIDOMEvent* aEvent);
|
NS_IMETHOD Create(nsIDOMEvent* aEvent);
|
||||||
NS_IMETHOD Close(nsIDOMEvent* aEvent);
|
NS_IMETHOD Close(nsIDOMEvent* aEvent);
|
||||||
|
@ -98,7 +98,7 @@ public:
|
||||||
NS_IMETHOD Action(nsIDOMEvent* aEvent) { return NS_OK; }
|
NS_IMETHOD Action(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||||
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
|
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||||
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
|
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||||
nsresult HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||||
|
|
||||||
// helpers
|
// helpers
|
||||||
virtual nsIFrame* GetBoundsFrame();
|
virtual nsIFrame* GetBoundsFrame();
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Netscape 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/NPL/
|
|
||||||
*
|
|
||||||
* 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 Netscape are
|
|
||||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
||||||
* Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _nsMutableAccessible_H_
|
|
||||||
#define _nsMutableAccessible_H_
|
|
||||||
|
|
||||||
#include "nsAccessible.h"
|
|
||||||
#include "nsString.h"
|
|
||||||
|
|
||||||
#include "nsIMutableAccessible.h"
|
|
||||||
|
|
||||||
class nsMutableAccessible : public nsIMutableAccessible
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
NS_DECL_NSIACCESSIBLE
|
|
||||||
NS_DECL_NSIMUTABLEACCESSIBLE
|
|
||||||
|
|
||||||
nsMutableAccessible(nsISupports* aNode);
|
|
||||||
virtual ~nsMutableAccessible();
|
|
||||||
|
|
||||||
private:
|
|
||||||
nsCOMPtr<nsISupports> mNode;
|
|
||||||
nsAutoString mName;
|
|
||||||
nsAutoString mRole;
|
|
||||||
nsCOMPtr<nsIAtom> mNameAttribute;
|
|
||||||
PRPackedBool mNameNodeValue;
|
|
||||||
PRPackedBool mNameStringSet;
|
|
||||||
PRPackedBool mIsLeaf;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ NS_IMETHODIMP nsRootAccessible::RemoveAccessibleEventListener(nsIAccessibleEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nsresult nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
||||||
{
|
{
|
||||||
if (mListener) {
|
if (mListener) {
|
||||||
nsCOMPtr<nsIDOMEventTarget> t;
|
nsCOMPtr<nsIDOMEventTarget> t;
|
||||||
|
@ -185,12 +185,12 @@ nsresult nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsRootAccessible::Focus(nsIDOMEvent* aEvent)
|
NS_IMETHODIMP nsRootAccessible::Focus(nsIDOMEvent* aEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsRootAccessible::Blur(nsIDOMEvent* aEvent)
|
NS_IMETHODIMP nsRootAccessible::Blur(nsIDOMEvent* aEvent)
|
||||||
{
|
{
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,9 +51,9 @@ class nsRootAccessible : public nsAccessible,
|
||||||
NS_IMETHOD RemoveAccessibleEventListener(nsIAccessibleEventListener *aListener);
|
NS_IMETHOD RemoveAccessibleEventListener(nsIAccessibleEventListener *aListener);
|
||||||
|
|
||||||
// ----- nsIDOMEventListener --------
|
// ----- nsIDOMEventListener --------
|
||||||
virtual nsresult HandleEvent(nsIDOMEvent* anEvent);
|
NS_IMETHOD HandleEvent(nsIDOMEvent* anEvent);
|
||||||
virtual nsresult Focus(nsIDOMEvent* aEvent);
|
NS_IMETHOD Focus(nsIDOMEvent* aEvent);
|
||||||
virtual nsresult Blur(nsIDOMEvent* aEvent);
|
NS_IMETHOD Blur(nsIDOMEvent* aEvent);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual nsIFrame* GetFrame();
|
virtual nsIFrame* GetFrame();
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
NS_IMETHOD Action(nsIDOMEvent* aEvent) { return NS_OK; }
|
NS_IMETHOD Action(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||||
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
|
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||||
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
|
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||||
nsresult HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> mPopupAtom;
|
nsCOMPtr<nsIAtom> mPopupAtom;
|
||||||
nsCOMPtr<nsIContent> mSelectContent;
|
nsCOMPtr<nsIContent> mSelectContent;
|
||||||
|
@ -90,7 +90,7 @@ public:
|
||||||
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
NS_IMETHOD GetAccRole(PRUnichar **_retval);
|
||||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||||
NS_IMETHOD GetAccExtState(PRUint32 *_retval);
|
NS_IMETHOD GetAccExtState(PRUint32 *_retval);
|
||||||
|
|
||||||
// popup listener
|
// popup listener
|
||||||
NS_IMETHOD Create(nsIDOMEvent* aEvent);
|
NS_IMETHOD Create(nsIDOMEvent* aEvent);
|
||||||
NS_IMETHOD Close(nsIDOMEvent* aEvent);
|
NS_IMETHOD Close(nsIDOMEvent* aEvent);
|
||||||
|
@ -98,7 +98,7 @@ public:
|
||||||
NS_IMETHOD Action(nsIDOMEvent* aEvent) { return NS_OK; }
|
NS_IMETHOD Action(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||||
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
|
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||||
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
|
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||||
nsresult HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
|
||||||
|
|
||||||
// helpers
|
// helpers
|
||||||
virtual nsIFrame* GetBoundsFrame();
|
virtual nsIFrame* GetBoundsFrame();
|
||||||
|
|
|
@ -75,32 +75,23 @@ MAKEFILES_dom="
|
||||||
dom/Makefile
|
dom/Makefile
|
||||||
dom/public/Makefile
|
dom/public/Makefile
|
||||||
dom/public/base/Makefile
|
dom/public/base/Makefile
|
||||||
dom/public/coreDom/Makefile
|
|
||||||
dom/public/coreEvents/Makefile
|
dom/public/coreEvents/Makefile
|
||||||
dom/public/css/Makefile
|
|
||||||
dom/public/events/Makefile
|
|
||||||
dom/public/range/Makefile
|
|
||||||
dom/public/html/Makefile
|
|
||||||
dom/public/xul/Makefile
|
|
||||||
dom/public/idl/Makefile
|
dom/public/idl/Makefile
|
||||||
dom/public/idl/base/Makefile
|
dom/public/idl/base/Makefile
|
||||||
dom/public/idl/coreDom/Makefile
|
dom/public/idl/core/Makefile
|
||||||
dom/public/idl/css/Makefile
|
dom/public/idl/css/Makefile
|
||||||
dom/public/idl/events/Makefile
|
dom/public/idl/events/Makefile
|
||||||
dom/public/idl/html/Makefile
|
dom/public/idl/html/Makefile
|
||||||
dom/public/idl/range/Makefile
|
dom/public/idl/range/Makefile
|
||||||
|
dom/public/idl/stylesheets/Makefile
|
||||||
|
dom/public/idl/views/Makefile
|
||||||
|
dom/public/idl/xbl/Makefile
|
||||||
dom/public/idl/xul/Makefile
|
dom/public/idl/xul/Makefile
|
||||||
dom/src/Makefile
|
dom/src/Makefile
|
||||||
dom/src/base/Makefile
|
dom/src/base/Makefile
|
||||||
dom/src/build/Makefile
|
dom/src/build/Makefile
|
||||||
dom/src/coreDOM/Makefile
|
|
||||||
dom/src/css/Makefile
|
|
||||||
dom/src/events/Makefile
|
dom/src/events/Makefile
|
||||||
dom/src/range/Makefile
|
|
||||||
dom/src/html/Makefile
|
|
||||||
dom/src/xul/Makefile
|
|
||||||
dom/src/jsurl/Makefile
|
dom/src/jsurl/Makefile
|
||||||
dom/tools/Makefile
|
|
||||||
"
|
"
|
||||||
|
|
||||||
MAKEFILES_editor="
|
MAKEFILES_editor="
|
||||||
|
|
|
@ -702,16 +702,20 @@ sub BuildClientDist()
|
||||||
InstallFromManifest(":mozilla:view:public:MANIFEST", "$distdirectory:view:");
|
InstallFromManifest(":mozilla:view:public:MANIFEST", "$distdirectory:view:");
|
||||||
|
|
||||||
#DOM
|
#DOM
|
||||||
InstallFromManifest(":mozilla:dom:public:MANIFEST", "$distdirectory:dom:");
|
|
||||||
InstallFromManifest(":mozilla:dom:public:MANIFEST_IDL", "$distdirectory:idl:");
|
InstallFromManifest(":mozilla:dom:public:MANIFEST_IDL", "$distdirectory:idl:");
|
||||||
|
InstallFromManifest(":mozilla:dom:public:idl:base:MANIFEST_IDL", "$distdirectory:idl:");
|
||||||
|
InstallFromManifest(":mozilla:dom:public:idl:core:MANIFEST_IDL", "$distdirectory:idl:");
|
||||||
|
InstallFromManifest(":mozilla:dom:public:idl:css:MANIFEST_IDL", "$distdirectory:idl:");
|
||||||
|
InstallFromManifest(":mozilla:dom:public:idl:events:MANIFEST_IDL", "$distdirectory:idl:");
|
||||||
|
InstallFromManifest(":mozilla:dom:public:idl:html:MANIFEST_IDL", "$distdirectory:idl:");
|
||||||
|
InstallFromManifest(":mozilla:dom:public:idl:range:MANIFEST_IDL", "$distdirectory:idl:");
|
||||||
|
InstallFromManifest(":mozilla:dom:public:idl:stylesheets:MANIFEST_IDL", "$distdirectory:idl:");
|
||||||
|
InstallFromManifest(":mozilla:dom:public:idl:views:MANIFEST_IDL", "$distdirectory:idl:");
|
||||||
|
InstallFromManifest(":mozilla:dom:public:idl:xbl:MANIFEST_IDL", "$distdirectory:idl:");
|
||||||
|
InstallFromManifest(":mozilla:dom:public:idl:xul:MANIFEST_IDL", "$distdirectory:idl:");
|
||||||
|
InstallFromManifest(":mozilla:dom:public:MANIFEST", "$distdirectory:dom:");
|
||||||
InstallFromManifest(":mozilla:dom:public:base:MANIFEST", "$distdirectory:dom:");
|
InstallFromManifest(":mozilla:dom:public:base:MANIFEST", "$distdirectory:dom:");
|
||||||
InstallFromManifest(":mozilla:dom:public:coreDom:MANIFEST", "$distdirectory:dom:");
|
|
||||||
InstallFromManifest(":mozilla:dom:public:coreEvents:MANIFEST", "$distdirectory:dom:");
|
InstallFromManifest(":mozilla:dom:public:coreEvents:MANIFEST", "$distdirectory:dom:");
|
||||||
InstallFromManifest(":mozilla:dom:public:events:MANIFEST", "$distdirectory:dom:");
|
|
||||||
InstallFromManifest(":mozilla:dom:public:range:MANIFEST", "$distdirectory:dom:");
|
|
||||||
InstallFromManifest(":mozilla:dom:public:html:MANIFEST", "$distdirectory:dom:");
|
|
||||||
InstallFromManifest(":mozilla:dom:public:css:MANIFEST", "$distdirectory:dom:");
|
|
||||||
InstallFromManifest(":mozilla:dom:public:xul:MANIFEST", "$distdirectory:dom:");
|
|
||||||
InstallFromManifest(":mozilla:dom:src:jsurl:MANIFEST", "$distdirectory:dom:");
|
InstallFromManifest(":mozilla:dom:src:jsurl:MANIFEST", "$distdirectory:dom:");
|
||||||
InstallFromManifest(":mozilla:dom:src:base:MANIFEST", "$distdirectory:dom:");
|
InstallFromManifest(":mozilla:dom:src:base:MANIFEST", "$distdirectory:dom:");
|
||||||
|
|
||||||
|
@ -1051,6 +1055,16 @@ sub BuildIDLProjects()
|
||||||
BuildIDLProject(":mozilla:modules:oji:macbuild:ojiIDL.mcp", "oji");
|
BuildIDLProject(":mozilla:modules:oji:macbuild:ojiIDL.mcp", "oji");
|
||||||
BuildIDLProject(":mozilla:js:macbuild:XPConnectIDL.mcp", "xpconnect");
|
BuildIDLProject(":mozilla:js:macbuild:XPConnectIDL.mcp", "xpconnect");
|
||||||
BuildIDLProject(":mozilla:dom:macbuild:domIDL.mcp", "dom");
|
BuildIDLProject(":mozilla:dom:macbuild:domIDL.mcp", "dom");
|
||||||
|
BuildIDLProject(":mozilla:dom:macbuild:dom_baseIDL.mcp", "dom_base");
|
||||||
|
BuildIDLProject(":mozilla:dom:macbuild:dom_coreIDL.mcp", "dom_core");
|
||||||
|
BuildIDLProject(":mozilla:dom:macbuild:dom_cssIDL.mcp", "dom_css");
|
||||||
|
BuildIDLProject(":mozilla:dom:macbuild:dom_eventsIDL.mcp", "dom_events");
|
||||||
|
BuildIDLProject(":mozilla:dom:macbuild:dom_htmlIDL.mcp", "dom_html");
|
||||||
|
BuildIDLProject(":mozilla:dom:macbuild:dom_rangeIDL.mcp", "dom_range");
|
||||||
|
BuildIDLProject(":mozilla:dom:macbuild:dom_stylesheetsIDL.mcp", "dom_stylesheets");
|
||||||
|
BuildIDLProject(":mozilla:dom:macbuild:dom_viewsIDL.mcp", "dom_views");
|
||||||
|
BuildIDLProject(":mozilla:dom:macbuild:dom_xblIDL.mcp", "dom_xbl");
|
||||||
|
BuildIDLProject(":mozilla:dom:macbuild:dom_xulIDL.mcp", "dom_xul");
|
||||||
|
|
||||||
BuildIDLProject(":mozilla:dom:src:jsurl:macbuild:JSUrlDL.mcp", "jsurl");
|
BuildIDLProject(":mozilla:dom:src:jsurl:macbuild:JSUrlDL.mcp", "jsurl");
|
||||||
|
|
||||||
|
@ -1538,7 +1552,7 @@ sub BuildLayoutProjects()
|
||||||
BuildOneProject(":mozilla:htmlparser:macbuild:htmlparser.mcp", "htmlparser$D.shlb", 1, $main::ALIAS_SYM_FILES, 1);
|
BuildOneProject(":mozilla:htmlparser:macbuild:htmlparser.mcp", "htmlparser$D.shlb", 1, $main::ALIAS_SYM_FILES, 1);
|
||||||
# BuildOneProject(":mozilla:gfx:macbuild:gfx.mcp", "gfx$D.shlb", 1, $main::ALIAS_SYM_FILES, 0);
|
# BuildOneProject(":mozilla:gfx:macbuild:gfx.mcp", "gfx$D.shlb", 1, $main::ALIAS_SYM_FILES, 0);
|
||||||
BuildOneProjectWithOutput(":mozilla:gfx:macbuild:gfx.mcp", "gfx$C$D.shlb", "gfx$D.shlb", 1, $main::ALIAS_SYM_FILES, 0);
|
BuildOneProjectWithOutput(":mozilla:gfx:macbuild:gfx.mcp", "gfx$C$D.shlb", "gfx$D.shlb", 1, $main::ALIAS_SYM_FILES, 0);
|
||||||
BuildOneProject(":mozilla:dom:macbuild:dom.mcp", "dom$D.shlb", 1, $main::ALIAS_SYM_FILES, 0);
|
BuildOneProject(":mozilla:dom:macbuild:dom.mcp", "dom$D.shlb", 1, $main::ALIAS_SYM_FILES, 1);
|
||||||
BuildOneProject(":mozilla:modules:plugin:macbuild:plugin.mcp", "plugin$D.shlb", 1, $main::ALIAS_SYM_FILES, 1);
|
BuildOneProject(":mozilla:modules:plugin:macbuild:plugin.mcp", "plugin$D.shlb", 1, $main::ALIAS_SYM_FILES, 1);
|
||||||
|
|
||||||
# Static library shared between different content- and layout-related libraries
|
# Static library shared between different content- and layout-related libraries
|
||||||
|
|
|
@ -17,106 +17,74 @@
|
||||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||||
* Rights Reserved.
|
* Rights Reserved.
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
|
* Norris Boyd
|
||||||
|
* Mitch Stoltz
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
#include "nsIPrincipal.idl"
|
#include "nsIPrincipal.idl"
|
||||||
|
#include "nsIXPCSecurityManager.idl"
|
||||||
%{C++
|
|
||||||
#include "jspubtd.h"
|
|
||||||
%}
|
|
||||||
[ptr] native JSContextPtr(JSContext);
|
|
||||||
|
|
||||||
interface nsIURI;
|
interface nsIURI;
|
||||||
|
|
||||||
[scriptable, uuid(58df5780-8006-11d2-bd91-00805f8ae3f4)]
|
[scriptable, uuid(58df5780-8006-11d2-bd91-00805f8ae3f4)]
|
||||||
interface nsIScriptSecurityManager : nsISupports
|
interface nsIScriptSecurityManager : nsIXPCSecurityManager
|
||||||
{
|
{
|
||||||
///////////////// Principals ///////////////////////
|
///////////////// Security Checks //////////////////
|
||||||
|
/**
|
||||||
/**
|
* Checks whether the running script is allowed to access aProperty.
|
||||||
* Return the principal of the innermost frame of the currently
|
*/
|
||||||
* executing script. Will return null if there is no script
|
[noscript] void checkPropertyAccess(in PRUint32 aAction,
|
||||||
* currently executing.
|
in JSContextPtr aJSContext,
|
||||||
*/
|
in JSObjectPtr aJSObject,
|
||||||
nsIPrincipal getSubjectPrincipal();
|
in nsISupports aObj,
|
||||||
|
in nsIClassInfo aClassInfo,
|
||||||
/**
|
in string aClassName,
|
||||||
* Return the all-powerful system principal.
|
in string aProperty,
|
||||||
*/
|
in boolean skipFrame);
|
||||||
nsIPrincipal getSystemPrincipal();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a principal that can be QI'd to nsICodebasePrincipal and
|
|
||||||
* has the same origin as aURI.
|
|
||||||
*/
|
|
||||||
nsIPrincipal getCodebasePrincipal(in nsIURI aURI);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a principal that can be QI'd to nsICertificatePrincipal.
|
|
||||||
*/
|
|
||||||
nsIPrincipal getCertificatePrincipal(in string CertID);
|
|
||||||
|
|
||||||
///////////////// Security Checks //////////////////
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the currently executing script can access the given
|
* Check that the script currently running in context "cx" can load "uri".
|
||||||
* property.
|
|
||||||
*
|
*
|
||||||
* @param cx The current active JavaScript context
|
* Will return error code NS_ERROR_DOM_BAD_URI if the load request
|
||||||
* @param obj The object that is being accessed
|
* should be denied.
|
||||||
* @param prop The ordinal of the property being accessed (see nsDOMPropEnums.h)
|
*
|
||||||
* @param isWrite True if write access is being attempted
|
* @param cx the JSContext of the script causing the load
|
||||||
|
* @param uri the URI that is being loaded
|
||||||
*/
|
*/
|
||||||
[noscript] void checkScriptAccess(in JSContextPtr cx, in voidPtr obj,
|
|
||||||
in long prop, in boolean isWrite);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check that the script with context "cx" can load "uri".
|
|
||||||
*
|
|
||||||
* Will return error code NS_ERROR_DOM_BAD_URI if the load request
|
|
||||||
* should be denied.
|
|
||||||
*
|
|
||||||
* @param cx the JSContext of the script causing the load
|
|
||||||
* @param uri the URI that is being loaded
|
|
||||||
*/
|
|
||||||
[noscript] void checkLoadURIFromScript(in JSContextPtr cx, in nsIURI uri);
|
[noscript] void checkLoadURIFromScript(in JSContextPtr cx, in nsIURI uri);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default CheckLoadURI permissions
|
* Default CheckLoadURI permissions
|
||||||
*/
|
*/
|
||||||
|
// Default permissions
|
||||||
const unsigned long STANDARD = 0;
|
const unsigned long STANDARD = 0;
|
||||||
|
|
||||||
/**
|
// If the source is mail, disallow the load
|
||||||
* If the source is mail, disallow the load
|
|
||||||
*/
|
|
||||||
const unsigned long DISALLOW_FROM_MAIL = 1 << 0;
|
const unsigned long DISALLOW_FROM_MAIL = 1 << 0;
|
||||||
|
|
||||||
/**
|
// Allow the loading of chrome URLs by non-chrome URLs
|
||||||
* Allow the loading of chrome URLs by non-chrome URLs
|
|
||||||
*/
|
|
||||||
const unsigned long ALLOW_CHROME = 1 << 1;
|
const unsigned long ALLOW_CHROME = 1 << 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that content from "from" can load "uri".
|
* Check that content from "from" can load "uri".
|
||||||
*
|
*
|
||||||
* Will return error code NS_ERROR_DOM_BAD_URI if the load request
|
* Will return error code NS_ERROR_DOM_BAD_URI if the load request
|
||||||
* should be denied.
|
* should be denied.
|
||||||
*
|
*
|
||||||
* @param from the URI causing the load
|
* @param from the URI causing the load
|
||||||
* @param uri the URI that is being loaded
|
* @param uri the URI that is being loaded
|
||||||
* @param disallowFromMail if true, return NS_ERROR_DOM_BAD_URI if 'from'
|
* @param flags the permission set, see above
|
||||||
* is a URI associated with mail or news
|
*/
|
||||||
*/
|
|
||||||
void checkLoadURI(in nsIURI from, in nsIURI uri,
|
void checkLoadURI(in nsIURI from, in nsIURI uri,
|
||||||
in unsigned long flags);
|
in unsigned long flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as CheckLoadURI but takes string arguments for ease of use by scripts
|
* Same as CheckLoadURI but takes string arguments for ease of use
|
||||||
*/
|
* by scripts
|
||||||
|
*/
|
||||||
void checkLoadURIStr(in string from, in string uri,
|
void checkLoadURIStr(in string from, in string uri,
|
||||||
in unsigned long flags);
|
in unsigned long flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check that the function 'funObj' is allowed to run on 'targetObj'
|
* Check that the function 'funObj' is allowed to run on 'targetObj'
|
||||||
|
@ -131,68 +99,78 @@ interface nsIScriptSecurityManager : nsISupports
|
||||||
[noscript] void checkFunctionAccess(in JSContextPtr cx, in voidPtr funObj,
|
[noscript] void checkFunctionAccess(in JSContextPtr cx, in voidPtr funObj,
|
||||||
in voidPtr targetObj);
|
in voidPtr targetObj);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if content from the given principal is allowed to
|
* Return true if content from the given principal is allowed to
|
||||||
* execute scripts.
|
* execute scripts.
|
||||||
*/
|
*/
|
||||||
[noscript] boolean canExecuteScripts(in JSContextPtr cx, in nsIPrincipal principal);
|
[noscript] boolean canExecuteScripts(in JSContextPtr cx,
|
||||||
|
in nsIPrincipal principal);
|
||||||
|
|
||||||
|
///////////////// Principals ///////////////////////
|
||||||
///////////////// Capabilities /////////////////////
|
/**
|
||||||
|
* Return the principal of the innermost frame of the currently
|
||||||
|
* executing script. Will return null if there is no script
|
||||||
|
* currently executing.
|
||||||
|
*/
|
||||||
|
nsIPrincipal getSubjectPrincipal();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request that 'capability' can be enabled by scripts or applets running
|
* Return the all-powerful system principal.
|
||||||
* with 'principal'. Will prompt user if necessary. Returns
|
|
||||||
* nsIPrincipal::ENABLE_GRANTED or nsIPrincipal::ENABLE_DENIED based on user's choice.
|
|
||||||
*/
|
*/
|
||||||
void requestCapability(in nsIPrincipal principal, in string capability, out short result);
|
nsIPrincipal getSystemPrincipal();
|
||||||
|
|
||||||
/**
|
|
||||||
* Return true if the currently executing script has 'capability' enabled.
|
|
||||||
*/
|
|
||||||
boolean IsCapabilityEnabled(in string capability);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enable 'capability' in the innermost frame of the currently executing
|
|
||||||
* script.
|
|
||||||
*/
|
|
||||||
void enableCapability(in string capability);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove 'capability' from the innermost frame of the currently executing
|
* Return a principal that can be QI'd to nsICertificatePrincipal.
|
||||||
* script. Any setting of 'capability' from enclosing frames thus comes into
|
*/
|
||||||
* effect.
|
nsIPrincipal getCertificatePrincipal(in string CertID);
|
||||||
*/
|
|
||||||
|
/**
|
||||||
|
* Return a principal that can be QI'd to nsICodebasePrincipal and
|
||||||
|
* has the same origin as aURI.
|
||||||
|
*/
|
||||||
|
nsIPrincipal getCodebasePrincipal(in nsIURI aURI);
|
||||||
|
|
||||||
|
///////////////// Capabilities API /////////////////////
|
||||||
|
/**
|
||||||
|
* Request that 'capability' can be enabled by scripts or applets
|
||||||
|
* running with 'principal'. Will prompt user if
|
||||||
|
* necessary. Returns nsIPrincipal::ENABLE_GRANTED or
|
||||||
|
* nsIPrincipal::ENABLE_DENIED based on user's choice.
|
||||||
|
*/
|
||||||
|
void requestCapability(in nsIPrincipal principal, in string capability,
|
||||||
|
out short result);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the currently executing script has 'capability' enabled.
|
||||||
|
*/
|
||||||
|
boolean IsCapabilityEnabled(in string capability);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable 'capability' in the innermost frame of the currently executing
|
||||||
|
* script.
|
||||||
|
*/
|
||||||
|
void enableCapability(in string capability);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove 'capability' from the innermost frame of the currently
|
||||||
|
* executing script. Any setting of 'capability' from enclosing
|
||||||
|
* frames thus comes into effect.
|
||||||
|
*/
|
||||||
void revertCapability(in string capability);
|
void revertCapability(in string capability);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disable 'capability' in the innermost frame of the currently executing
|
* Disable 'capability' in the innermost frame of the currently executing
|
||||||
* script.
|
* script.
|
||||||
*/
|
*/
|
||||||
void disableCapability(in string capability);
|
void disableCapability(in string capability);
|
||||||
|
|
||||||
//////////////// Master Certificate Functions ////////////////////
|
//////////////// Master Certificate Functions ////////////////////
|
||||||
|
|
||||||
/**
|
|
||||||
* Allow 'certificateID' to enable 'capability.' Can only be performed
|
|
||||||
* by code signed by the system certificate.
|
|
||||||
*/
|
|
||||||
void setCanEnableCapability(in string certificateID, in string capability,
|
|
||||||
in short canEnable);
|
|
||||||
|
|
||||||
|
|
||||||
//////////////// Temporary ///////////////////////////////////////
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the currently executing script can load the given URL
|
* Allow 'certificateID' to enable 'capability.' Can only be performed
|
||||||
* (special case for XMLHttpRequest)
|
* by code signed by the system certificate.
|
||||||
*
|
|
||||||
* @param cx The current active JavaScript context
|
|
||||||
* @param url The url that is being accessed
|
|
||||||
* @param prop The ordinal of the property being accessed (see nsDOMPropEnums.h)
|
|
||||||
* @param isWrite True if write access is being attempted
|
|
||||||
*/
|
*/
|
||||||
[noscript] void checkScriptAccessToURL(in JSContextPtr cx, in string url,
|
void setCanEnableCapability(in string certificateID, in string capability,
|
||||||
in long prop, in boolean isWrite);
|
in short canEnable);
|
||||||
};
|
};
|
||||||
|
|
||||||
%{C++
|
%{C++
|
||||||
|
|
|
@ -32,14 +32,15 @@
|
||||||
#include "jsdbgapi.h"
|
#include "jsdbgapi.h"
|
||||||
#include "nsIXPCSecurityManager.h"
|
#include "nsIXPCSecurityManager.h"
|
||||||
#include "nsHashtable.h"
|
#include "nsHashtable.h"
|
||||||
#include "nsDOMPropEnums.h"
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIPref.h"
|
#include "nsIPrefService.h"
|
||||||
#include "nsISecurityPref.h"
|
#include "nsISecurityPref.h"
|
||||||
#include "nsIJSContextStack.h"
|
#include "nsIJSContextStack.h"
|
||||||
|
#include "nsIObserver.h"
|
||||||
|
|
||||||
class nsIDocShell;
|
class nsIDocShell;
|
||||||
class nsString;
|
class nsString;
|
||||||
|
class nsIClassInfo;
|
||||||
|
|
||||||
/////////////////////
|
/////////////////////
|
||||||
// nsIPrincipalKey //
|
// nsIPrincipalKey //
|
||||||
|
@ -62,9 +63,9 @@ public:
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool Equals(const nsHashKey *aKey) const {
|
PRBool Equals(const nsHashKey* aKey) const {
|
||||||
PRBool eq;
|
PRBool eq;
|
||||||
mKey->Equals(((nsIPrincipalKey *) aKey)->mKey, &eq);
|
mKey->Equals(((nsIPrincipalKey*) aKey)->mKey, &eq);
|
||||||
return eq;
|
return eq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,8 +81,7 @@ protected:
|
||||||
{ 0x7ee2a4c0, 0x4b93, 0x17d3, \
|
{ 0x7ee2a4c0, 0x4b93, 0x17d3, \
|
||||||
{ 0xba, 0x18, 0x00, 0x60, 0xb0, 0xf1, 0x99, 0xa2 }}
|
{ 0xba, 0x18, 0x00, 0x60, 0xb0, 0xf1, 0x99, 0xa2 }}
|
||||||
|
|
||||||
class nsScriptSecurityManager : public nsIScriptSecurityManager,
|
class nsScriptSecurityManager : public nsIScriptSecurityManager, public nsIObserver
|
||||||
public nsIXPCSecurityManager
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsScriptSecurityManager();
|
nsScriptSecurityManager();
|
||||||
|
@ -92,100 +92,116 @@ public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
NS_DECL_NSISCRIPTSECURITYMANAGER
|
NS_DECL_NSISCRIPTSECURITYMANAGER
|
||||||
NS_DECL_NSIXPCSECURITYMANAGER
|
NS_DECL_NSIXPCSECURITYMANAGER
|
||||||
|
NS_DECL_NSIOBSERVER
|
||||||
|
|
||||||
static nsScriptSecurityManager *
|
static nsScriptSecurityManager*
|
||||||
GetScriptSecurityManager();
|
GetScriptSecurityManager();
|
||||||
|
|
||||||
JSContext * GetCurrentContextQuick();
|
JSContext* GetCurrentContextQuick();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
static PRBool IsDOMClass(nsIClassInfo* aClassInfo);
|
||||||
|
|
||||||
static nsresult
|
static nsresult
|
||||||
ReportErrorToConsole(nsIURI* aTarget);
|
ReportErrorToConsole(nsIURI* aTarget);
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
GetRootDocShell(JSContext *cx, nsIDocShell **result);
|
GetRootDocShell(JSContext* cx, nsIDocShell **result);
|
||||||
|
|
||||||
NS_IMETHOD
|
nsresult
|
||||||
CheckScriptAccessInternal(JSContext *cx,
|
CheckPropertyAccessImpl(PRUint32 aAction, nsIXPCNativeCallContext* aCallContext,
|
||||||
void* obj, const char* aObjUrlStr, PRInt32 domPropInt,
|
JSContext* aJSContext, JSObject* aJSObject,
|
||||||
PRBool isWrite);
|
nsISupports* aObj, nsIClassInfo* aClassInfo,
|
||||||
|
jsval aName, const char* aClassName,
|
||||||
|
const char* aProperty, PRBool skipFrame, void** aPolicy);
|
||||||
|
|
||||||
NS_IMETHOD
|
nsresult
|
||||||
CreateCodebasePrincipal(nsIURI* aURI, nsIPrincipal** result);
|
CheckSameOrigin(JSContext* aCx, nsIPrincipal* aSubject,
|
||||||
|
nsIPrincipal* aObject, PRUint32 aAction, PRBool aSkipFrame);
|
||||||
NS_IMETHOD
|
|
||||||
GetSubjectPrincipal(JSContext *aCx, nsIPrincipal **result);
|
|
||||||
|
|
||||||
NS_IMETHOD
|
|
||||||
GetObjectPrincipal(JSContext *aCx, JSObject *aObj, nsIPrincipal **result);
|
|
||||||
|
|
||||||
NS_IMETHOD
|
|
||||||
CheckPermissions(JSContext *aCx, nsIPrincipal* aObjectPrincipal, const char *aCapability);
|
|
||||||
|
|
||||||
PRInt32
|
PRInt32
|
||||||
GetSecurityLevel(nsIPrincipal *principal, nsDOMProp domProp,
|
GetSecurityLevel(JSContext* aCx, nsIPrincipal *principal,
|
||||||
PRBool isWrite, nsCString &capability);
|
nsIClassInfo* aClassInfo,
|
||||||
|
const char* aClassName, const char* aProperty,
|
||||||
|
PRUint32 aAction, nsCString &capability, void** aPolicy);
|
||||||
|
|
||||||
NS_IMETHOD
|
nsresult
|
||||||
GetPrefName(nsIPrincipal *principal, nsDOMProp domProp,
|
GetPrefName(nsIPrincipal* principal,
|
||||||
nsCString &result);
|
const char* aClassName, const char* aPropertyName,
|
||||||
|
void* aClassPolicy, nsCString &result);
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
CheckXPCCapability(JSContext *aJSContext, const char *aCapability);
|
CreateCodebasePrincipal(nsIURI* aURI, nsIPrincipal** result);
|
||||||
|
|
||||||
NS_IMETHOD
|
|
||||||
CheckXPCPermissions(JSContext *cx, nsISupports* aObj);
|
|
||||||
|
|
||||||
NS_IMETHOD
|
nsresult
|
||||||
GetFramePrincipal(JSContext *cx, JSStackFrame *fp, nsIPrincipal **result);
|
GetSubjectPrincipal(JSContext* aCx, nsIPrincipal** result);
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
GetObjectPrincipal(JSContext* aCx, JSObject* aObj, nsIPrincipal** result);
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
GetFramePrincipal(JSContext* cx, JSStackFrame* fp, nsIPrincipal** result);
|
||||||
|
|
||||||
NS_IMETHOD
|
nsresult
|
||||||
GetScriptPrincipal(JSContext *cx, JSScript *script, nsIPrincipal **result);
|
GetScriptPrincipal(JSContext* cx, JSScript* script, nsIPrincipal** result);
|
||||||
|
|
||||||
NS_IMETHOD
|
nsresult
|
||||||
GetFunctionObjectPrincipal(JSContext *cx, JSObject *obj,
|
GetCallingPrincipal(JSContext* cx, nsIPrincipal** result);
|
||||||
nsIPrincipal **result);
|
|
||||||
|
|
||||||
NS_IMETHOD
|
nsresult
|
||||||
GetPrincipalAndFrame(JSContext *cx, nsIPrincipal **result,
|
GetFunctionObjectPrincipal(JSContext* cx, JSObject* obj,
|
||||||
JSStackFrame **frameResult);
|
nsIPrincipal** result);
|
||||||
|
|
||||||
NS_IMETHOD
|
nsresult
|
||||||
|
GetPrincipalAndFrame(JSContext *cx, PRBool skipInnerFrame,
|
||||||
|
nsIPrincipal** result,
|
||||||
|
JSStackFrame** frameResult);
|
||||||
|
|
||||||
|
nsresult
|
||||||
SavePrincipal(nsIPrincipal* aToSave);
|
SavePrincipal(nsIPrincipal* aToSave);
|
||||||
|
|
||||||
NS_IMETHOD
|
nsresult IsCapabilityEnabledImpl(const char *capability,
|
||||||
InitPrefs();
|
PRBool skipFrame,
|
||||||
|
PRBool *result);
|
||||||
|
|
||||||
PRBool
|
nsresult
|
||||||
EnsureNameSetRegistered();
|
CheckXPCPermissions(JSContext* cx, nsISupports* aObj,
|
||||||
|
const char* aObjectSecurityLevel, PRBool skipFrame, const char* aErrorMsg);
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
InitPrefs();
|
||||||
|
|
||||||
static nsresult
|
static nsresult
|
||||||
PrincipalPrefNames(const char* pref, char** grantedPref, char** deniedPref);
|
PrincipalPrefNames(const char* pref, char** grantedPref, char** deniedPref);
|
||||||
|
|
||||||
static void
|
nsresult
|
||||||
EnumeratePolicyCallback(const char *prefName, void *data);
|
InitPolicies(PRUint32 prefCount, const char** prefNames);
|
||||||
|
|
||||||
static void
|
nsresult
|
||||||
EnumeratePrincipalsCallback(const char *prefName, void *data);
|
InitPrincipals(PRUint32 prefCount, const char** prefNames);
|
||||||
|
|
||||||
static int PR_CALLBACK
|
inline void
|
||||||
JSEnabledPrefChanged(const char *pref, void *data);
|
JSEnabledPrefChanged();
|
||||||
|
|
||||||
static int PR_CALLBACK
|
static const char* sJSEnabledPrefName;
|
||||||
PrincipalPrefChanged(const char *pref, void *data);
|
static const char* sJSMailEnabledPrefName;
|
||||||
|
static const char* sPrincipalPrefix;
|
||||||
|
|
||||||
nsObjectHashtable *mOriginToPolicyMap;
|
nsObjectHashtable* mOriginToPolicyMap;
|
||||||
nsCOMPtr<nsIPref> mPrefs;
|
nsHashtable* mClassPolicies;
|
||||||
|
nsCOMPtr<nsIPrefService> mPrefService;
|
||||||
|
nsCOMPtr<nsIPrefBranch> mPrefs;
|
||||||
nsCOMPtr<nsISecurityPref> mSecurityPrefs;
|
nsCOMPtr<nsISecurityPref> mSecurityPrefs;
|
||||||
nsIPrincipal *mSystemPrincipal;
|
nsIPrincipal* mSystemPrincipal;
|
||||||
nsCOMPtr<nsIPrincipal> mSystemCertificate;
|
nsCOMPtr<nsIPrincipal> mSystemCertificate;
|
||||||
nsSupportsHashtable *mPrincipals;
|
nsSupportsHashtable* mPrincipals;
|
||||||
PRBool mIsJavaScriptEnabled;
|
PRBool mIsJavaScriptEnabled;
|
||||||
PRBool mIsMailJavaScriptEnabled;
|
PRBool mIsMailJavaScriptEnabled;
|
||||||
PRBool mIsWritingPrefs;
|
PRBool mIsWritingPrefs;
|
||||||
unsigned char hasDomainPolicyVector[(NS_DOM_PROP_MAX >> 3) + 1];
|
|
||||||
nsCOMPtr<nsIJSContextStack> mThreadJSContextStack;
|
nsCOMPtr<nsIJSContextStack> mThreadJSContextStack;
|
||||||
PRBool mNameSetRegistered;
|
PRBool mNameSetRegistered;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /*_NS_SCRIPT_SECURITY_MANAGER_H_*/
|
#endif /*_NS_SCRIPT_SECURITY_MANAGER_H_*/
|
||||||
|
|
||||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -28,8 +28,295 @@
|
||||||
#include "nsScriptSecurityManager.h"
|
#include "nsScriptSecurityManager.h"
|
||||||
#include "nsIPrincipal.h"
|
#include "nsIPrincipal.h"
|
||||||
#include "nsCodebasePrincipal.h"
|
#include "nsCodebasePrincipal.h"
|
||||||
|
#include "nsIScriptNameSpaceManager.h"
|
||||||
|
#include "nsIScriptExternalNameSet.h"
|
||||||
|
#include "nsIScriptContext.h"
|
||||||
|
#include "nsICategoryManager.h"
|
||||||
|
#include "nsXPIDLString.h"
|
||||||
|
#include "nsCOMPtr.h"
|
||||||
|
|
||||||
|
///////////////////////
|
||||||
|
// nsSecurityNameSet //
|
||||||
|
///////////////////////
|
||||||
|
|
||||||
|
#define NS_SECURITYNAMESET_CID \
|
||||||
|
{ 0x7c02eadc, 0x76, 0x4d03, \
|
||||||
|
{ 0x99, 0x8d, 0x80, 0xd7, 0x79, 0xc4, 0x85, 0x89 } }
|
||||||
|
#define NS_SECURITYNAMESET_CONTRACTID "@mozilla.org/security/script/nameset;1"
|
||||||
|
|
||||||
|
class nsSecurityNameSet : public nsIScriptExternalNameSet
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
nsSecurityNameSet();
|
||||||
|
virtual ~nsSecurityNameSet();
|
||||||
|
|
||||||
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
|
NS_IMETHOD InitializeNameSet(nsIScriptContext* aScriptContext);
|
||||||
|
};
|
||||||
|
|
||||||
|
nsSecurityNameSet::nsSecurityNameSet()
|
||||||
|
{
|
||||||
|
NS_INIT_REFCNT();
|
||||||
|
}
|
||||||
|
|
||||||
|
nsSecurityNameSet::~nsSecurityNameSet()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMPL_ISUPPORTS(nsSecurityNameSet, NS_GET_IID(nsIScriptExternalNameSet));
|
||||||
|
|
||||||
|
static char *
|
||||||
|
getStringArgument(JSContext *cx, JSObject *obj, PRUint16 argNum, uintN argc, jsval *argv)
|
||||||
|
{
|
||||||
|
if (argc <= argNum || !JSVAL_IS_STRING(argv[argNum])) {
|
||||||
|
JS_ReportError(cx, "String argument expected");
|
||||||
|
return nsnull;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* We don't want to use JS_ValueToString because we want to be able
|
||||||
|
* to have an object to represent a target in subsequent versions.
|
||||||
|
*/
|
||||||
|
JSString *str = JSVAL_TO_STRING(argv[argNum]);
|
||||||
|
if (!str)
|
||||||
|
return nsnull;
|
||||||
|
|
||||||
|
return JS_GetStringBytes(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
PR_STATIC_CALLBACK(JSBool)
|
||||||
|
netscape_security_isPrivilegeEnabled(JSContext *cx, JSObject *obj, uintN argc,
|
||||||
|
jsval *argv, jsval *rval)
|
||||||
|
{
|
||||||
|
JSBool result = JS_FALSE;
|
||||||
|
char *cap = getStringArgument(cx, obj, 0, argc, argv);
|
||||||
|
if (cap) {
|
||||||
|
nsresult rv;
|
||||||
|
NS_WITH_SERVICE(nsIScriptSecurityManager, securityManager,
|
||||||
|
NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
|
||||||
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// NS_ASSERTION(cx == GetCurrentContext(), "unexpected context");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
rv = securityManager->IsCapabilityEnabled(cap, &result);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
result = JS_FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*rval = BOOLEAN_TO_JSVAL(result);
|
||||||
|
return JS_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PR_STATIC_CALLBACK(JSBool)
|
||||||
|
netscape_security_enablePrivilege(JSContext *cx, JSObject *obj, uintN argc,
|
||||||
|
jsval *argv, jsval *rval)
|
||||||
|
{
|
||||||
|
char *cap = getStringArgument(cx, obj, 0, argc, argv);
|
||||||
|
if (!cap)
|
||||||
|
return JS_FALSE;
|
||||||
|
nsresult rv;
|
||||||
|
NS_WITH_SERVICE(nsIScriptSecurityManager, securityManager,
|
||||||
|
NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return JS_FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// NS_ASSERTION(cx == GetCurrentContext(), "unexpected context");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (NS_FAILED(securityManager->EnableCapability(cap)))
|
||||||
|
return JS_FALSE;
|
||||||
|
return JS_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
PR_STATIC_CALLBACK(JSBool)
|
||||||
|
netscape_security_disablePrivilege(JSContext *cx, JSObject *obj, uintN argc,
|
||||||
|
jsval *argv, jsval *rval)
|
||||||
|
{
|
||||||
|
char *cap = getStringArgument(cx, obj, 0, argc, argv);
|
||||||
|
if (!cap)
|
||||||
|
return JS_FALSE;
|
||||||
|
nsresult rv;
|
||||||
|
NS_WITH_SERVICE(nsIScriptSecurityManager, securityManager,
|
||||||
|
NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return JS_FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// NS_ASSERTION(cx == GetCurrentContext(), "unexpected context");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (NS_FAILED(securityManager->DisableCapability(cap)))
|
||||||
|
return JS_FALSE;
|
||||||
|
return JS_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
PR_STATIC_CALLBACK(JSBool)
|
||||||
|
netscape_security_revertPrivilege(JSContext *cx, JSObject *obj, uintN argc,
|
||||||
|
jsval *argv, jsval *rval)
|
||||||
|
{
|
||||||
|
char *cap = getStringArgument(cx, obj, 0, argc, argv);
|
||||||
|
if (!cap)
|
||||||
|
return JS_FALSE;
|
||||||
|
nsresult rv;
|
||||||
|
NS_WITH_SERVICE(nsIScriptSecurityManager, securityManager,
|
||||||
|
NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return JS_FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// NS_ASSERTION(cx == GetCurrentContext(), "unexpected context");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (NS_FAILED(securityManager->RevertCapability(cap)))
|
||||||
|
return JS_FALSE;
|
||||||
|
return JS_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
PR_STATIC_CALLBACK(JSBool)
|
||||||
|
netscape_security_setCanEnablePrivilege(JSContext *cx, JSObject *obj, uintN argc,
|
||||||
|
jsval *argv, jsval *rval)
|
||||||
|
{
|
||||||
|
if (argc < 2) return JS_FALSE;
|
||||||
|
char *principalID = getStringArgument(cx, obj, 0, argc, argv);
|
||||||
|
char *cap = getStringArgument(cx, obj, 1, argc, argv);
|
||||||
|
if (!principalID || !cap)
|
||||||
|
return JS_FALSE;
|
||||||
|
nsresult rv;
|
||||||
|
NS_WITH_SERVICE(nsIScriptSecurityManager, securityManager,
|
||||||
|
NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return JS_FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// NS_ASSERTION(cx == GetCurrentContext(), "unexpected context");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (NS_FAILED(securityManager->SetCanEnableCapability(principalID, cap,
|
||||||
|
nsIPrincipal::ENABLE_GRANTED)))
|
||||||
|
return JS_FALSE;
|
||||||
|
return JS_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
PR_STATIC_CALLBACK(JSBool)
|
||||||
|
netscape_security_invalidate(JSContext *cx, JSObject *obj, uintN argc,
|
||||||
|
jsval *argv, jsval *rval)
|
||||||
|
{
|
||||||
|
char *principalID = getStringArgument(cx, obj, 0, argc, argv);
|
||||||
|
if (!principalID)
|
||||||
|
return JS_FALSE;
|
||||||
|
nsresult rv;
|
||||||
|
NS_WITH_SERVICE(nsIScriptSecurityManager, securityManager,
|
||||||
|
NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return JS_FALSE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// NS_ASSERTION(cx == GetCurrentContext(), "unexpected context");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (NS_FAILED(securityManager->SetCanEnableCapability(principalID,
|
||||||
|
nsBasePrincipal::Invalid,
|
||||||
|
nsIPrincipal::ENABLE_GRANTED)))
|
||||||
|
return JS_FALSE;
|
||||||
|
return JS_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static JSFunctionSpec PrivilegeManager_static_methods[] = {
|
||||||
|
{ "isPrivilegeEnabled", netscape_security_isPrivilegeEnabled, 1},
|
||||||
|
{ "enablePrivilege", netscape_security_enablePrivilege, 1},
|
||||||
|
{ "disablePrivilege", netscape_security_disablePrivilege, 1},
|
||||||
|
{ "revertPrivilege", netscape_security_revertPrivilege, 1},
|
||||||
|
//-- System Cert Functions
|
||||||
|
{ "setCanEnablePrivilege", netscape_security_setCanEnablePrivilege, 2},
|
||||||
|
{ "invalidate", netscape_security_invalidate, 1},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* "Steal" calls to netscape.security.PrivilegeManager.enablePrivilege,
|
||||||
|
* et. al. so that code that worked with 4.0 can still work.
|
||||||
|
*/
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsSecurityNameSet::InitializeNameSet(nsIScriptContext* aScriptContext)
|
||||||
|
{
|
||||||
|
JSContext *cx = (JSContext *) aScriptContext->GetNativeContext();
|
||||||
|
JSObject *global = JS_GetGlobalObject(cx);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Find Object.prototype's class by walking up the global object's
|
||||||
|
* prototype chain.
|
||||||
|
*/
|
||||||
|
JSObject *obj = global;
|
||||||
|
JSObject *proto;
|
||||||
|
while ((proto = JS_GetPrototype(cx, obj)) != nsnull)
|
||||||
|
obj = proto;
|
||||||
|
JSClass *objectClass = JS_GetClass(cx, obj);
|
||||||
|
|
||||||
|
jsval v;
|
||||||
|
if (!JS_GetProperty(cx, global, "netscape", &v))
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
JSObject *securityObj;
|
||||||
|
if (JSVAL_IS_OBJECT(v)) {
|
||||||
|
/*
|
||||||
|
* "netscape" property of window object exists; must be LiveConnect
|
||||||
|
* package. Get the "security" property.
|
||||||
|
*/
|
||||||
|
obj = JSVAL_TO_OBJECT(v);
|
||||||
|
if (!JS_GetProperty(cx, obj, "security", &v) || !JSVAL_IS_OBJECT(v))
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
securityObj = JSVAL_TO_OBJECT(v);
|
||||||
|
} else {
|
||||||
|
/* define netscape.security object */
|
||||||
|
obj = JS_DefineObject(cx, global, "netscape", objectClass, nsnull, 0);
|
||||||
|
if (obj == nsnull)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
securityObj = JS_DefineObject(cx, obj, "security", objectClass,
|
||||||
|
nsnull, 0);
|
||||||
|
if (securityObj == nsnull)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Define PrivilegeManager object with the necessary "static" methods. */
|
||||||
|
obj = JS_DefineObject(cx, securityObj, "PrivilegeManager", objectClass,
|
||||||
|
nsnull, 0);
|
||||||
|
if (obj == nsnull)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
return JS_DefineFunctions(cx, obj, PrivilegeManager_static_methods)
|
||||||
|
? NS_OK
|
||||||
|
: NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCodebasePrincipal)
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsCodebasePrincipal)
|
||||||
|
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSecurityNameSet)
|
||||||
|
|
||||||
static NS_IMETHODIMP
|
static NS_IMETHODIMP
|
||||||
Construct_nsIScriptSecurityManager(nsISupports *aOuter, REFNSIID aIID,
|
Construct_nsIScriptSecurityManager(nsISupports *aOuter, REFNSIID aIID,
|
||||||
|
@ -48,18 +335,50 @@ Construct_nsIScriptSecurityManager(nsISupports *aOuter, REFNSIID aIID,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NS_METHOD
|
||||||
|
RegisterSecurityNameSet(nsIComponentManager *aCompMgr,
|
||||||
|
nsIFile *aPath,
|
||||||
|
const char *registryLocation,
|
||||||
|
const char *componentType,
|
||||||
|
const nsModuleComponentInfo *info)
|
||||||
|
{
|
||||||
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
|
nsCOMPtr<nsICategoryManager> catman =
|
||||||
|
do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
|
||||||
|
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
|
||||||
|
nsXPIDLCString previous;
|
||||||
|
rv = catman->AddCategoryEntry(JAVASCRIPT_GLOBAL_STATIC_NAMESET_CATEGORY,
|
||||||
|
"PrivilegeManager",
|
||||||
|
NS_SECURITYNAMESET_CONTRACTID,
|
||||||
|
PR_TRUE, PR_TRUE, getter_Copies(previous));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
static nsModuleComponentInfo components[] =
|
static nsModuleComponentInfo components[] =
|
||||||
{
|
{
|
||||||
{ NS_SCRIPTSECURITYMANAGER_CLASSNAME,
|
{ NS_SCRIPTSECURITYMANAGER_CLASSNAME,
|
||||||
NS_SCRIPTSECURITYMANAGER_CID,
|
NS_SCRIPTSECURITYMANAGER_CID,
|
||||||
NS_SCRIPTSECURITYMANAGER_CONTRACTID,
|
NS_SCRIPTSECURITYMANAGER_CONTRACTID,
|
||||||
Construct_nsIScriptSecurityManager
|
Construct_nsIScriptSecurityManager,
|
||||||
|
RegisterSecurityNameSet
|
||||||
},
|
},
|
||||||
|
|
||||||
{ NS_CODEBASEPRINCIPAL_CLASSNAME,
|
{ NS_CODEBASEPRINCIPAL_CLASSNAME,
|
||||||
NS_CODEBASEPRINCIPAL_CID,
|
NS_CODEBASEPRINCIPAL_CID,
|
||||||
NS_CODEBASEPRINCIPAL_CONTRACTID,
|
NS_CODEBASEPRINCIPAL_CONTRACTID,
|
||||||
nsCodebasePrincipalConstructor
|
nsCodebasePrincipalConstructor
|
||||||
|
},
|
||||||
|
|
||||||
|
{ "Security Script Name Set",
|
||||||
|
NS_SECURITYNAMESET_CID,
|
||||||
|
NS_SECURITYNAMESET_CONTRACTID,
|
||||||
|
nsSecurityNameSetConstructor
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# This is a list of local files which get copied to the mozilla:dist:content directory
|
# This is a list of local files which get copied to the mozilla:dist:content directory
|
||||||
#
|
#
|
||||||
nsContentPolicyUtils.h
|
nsContentPolicyUtils.h
|
||||||
|
nsContentUtils.h
|
||||||
nsIAnonymousContent.h
|
nsIAnonymousContent.h
|
||||||
nsIContent.h
|
nsIContent.h
|
||||||
nsIContentIterator.h
|
nsIContentIterator.h
|
||||||
|
@ -25,4 +26,3 @@ nsIStyleRuleSupplier.h
|
||||||
nsIStyleSheet.h
|
nsIStyleSheet.h
|
||||||
nsIStyleSheetLinkingElement.h
|
nsIStyleSheetLinkingElement.h
|
||||||
nsITextContent.h
|
nsITextContent.h
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
* file under either the NPL or the GPL.
|
* file under either the NPL or the GPL.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* A namespace class for static layout utilities. */
|
/* A namespace class for static content utilities. */
|
||||||
|
|
||||||
#ifndef nsContentUtils_h___
|
#ifndef nsContentUtils_h___
|
||||||
#define nsContentUtils_h___
|
#define nsContentUtils_h___
|
||||||
|
@ -40,13 +40,24 @@
|
||||||
#include "nslayout.h"
|
#include "nslayout.h"
|
||||||
#include "jspubtd.h"
|
#include "jspubtd.h"
|
||||||
#include "nsAReadableString.h"
|
#include "nsAReadableString.h"
|
||||||
|
#include "nsIDOMScriptObjectFactory.h"
|
||||||
|
|
||||||
class nsIScriptContext;
|
class nsIScriptContext;
|
||||||
class nsIScriptGlobalObject;
|
class nsIScriptGlobalObject;
|
||||||
|
class nsIXPConnect;
|
||||||
|
class nsIContent;
|
||||||
|
class nsIDocument;
|
||||||
|
|
||||||
|
|
||||||
class nsContentUtils
|
class nsContentUtils
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static nsresult Init();
|
||||||
|
|
||||||
|
static nsresult ReparentContentWrapper(nsIContent *aContent,
|
||||||
|
nsIContent *aNewParent,
|
||||||
|
nsIDocument *aNewDocument,
|
||||||
|
nsIDocument *aOldDocument);
|
||||||
|
|
||||||
// These are copied from nsJSUtils.h
|
// These are copied from nsJSUtils.h
|
||||||
|
|
||||||
|
@ -70,6 +81,51 @@ public:
|
||||||
PRUint32 aLength);
|
PRUint32 aLength);
|
||||||
|
|
||||||
static PRUint32 CopyNewlineNormalizedUnicodeTo(nsReadingIterator<PRUnichar>& aSrcStart, const nsReadingIterator<PRUnichar>& aSrcEnd, nsAWritableString& aDest);
|
static PRUint32 CopyNewlineNormalizedUnicodeTo(nsReadingIterator<PRUnichar>& aSrcStart, const nsReadingIterator<PRUnichar>& aSrcEnd, nsAWritableString& aDest);
|
||||||
|
|
||||||
|
static nsISupports *
|
||||||
|
GetClassInfoInstance(nsDOMClassInfoID aID, GetDOMClassIIDsFnc aGetIIDsFptr,
|
||||||
|
const char *aName);
|
||||||
|
|
||||||
|
static void Shutdown();
|
||||||
|
|
||||||
|
private:
|
||||||
|
static nsresult doReparentContentWrapper(nsIContent *aChild,
|
||||||
|
nsIDocument *aNewDocument,
|
||||||
|
nsIDocument *aOldDocument,
|
||||||
|
JSContext *cx,
|
||||||
|
JSObject *parent_obj);
|
||||||
|
|
||||||
|
|
||||||
|
static nsIDOMScriptObjectFactory *sDOMScriptObjectFactory;
|
||||||
|
|
||||||
|
static nsIXPConnect *sXPConnect;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(_class) \
|
||||||
|
if (aIID.Equals(NS_GET_IID(nsIClassInfo))) { \
|
||||||
|
foundInterface = \
|
||||||
|
nsContentUtils::GetClassInfoInstance(eDOMClassInfo_##_class##_id, \
|
||||||
|
Get##_class##IIDs, \
|
||||||
|
#_class); \
|
||||||
|
NS_ENSURE_TRUE(foundInterface, NS_ERROR_OUT_OF_MEMORY); \
|
||||||
|
\
|
||||||
|
*aInstancePtr = foundInterface; \
|
||||||
|
\
|
||||||
|
return NS_OK; \
|
||||||
|
} else
|
||||||
|
|
||||||
|
#define NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_WITH_NAME(_class, _name) \
|
||||||
|
if (aIID.Equals(NS_GET_IID(nsIClassInfo))) { \
|
||||||
|
foundInterface = \
|
||||||
|
nsContentUtils::GetClassInfoInstance(eDOMClassInfo_##_class##_id, \
|
||||||
|
Get##_class##IIDs, \
|
||||||
|
#_name); \
|
||||||
|
NS_ENSURE_TRUE(foundInterface, NS_ERROR_OUT_OF_MEMORY); \
|
||||||
|
\
|
||||||
|
*aInstancePtr = foundInterface; \
|
||||||
|
\
|
||||||
|
return NS_OK; \
|
||||||
|
} else
|
||||||
|
|
||||||
|
|
||||||
#endif /* nsContentUtils_h___ */
|
#endif /* nsContentUtils_h___ */
|
||||||
|
|
|
@ -49,7 +49,7 @@ class nsINodeInfo;
|
||||||
// is supported by all content objects.
|
// is supported by all content objects.
|
||||||
class nsIContent : public nsISupports {
|
class nsIContent : public nsISupports {
|
||||||
public:
|
public:
|
||||||
static const nsIID& GetIID() { static nsIID iid = NS_ICONTENT_IID; return iid; }
|
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICONTENT_IID)
|
||||||
|
|
||||||
NS_IMETHOD GetDocument(nsIDocument*& aResult) const = 0;
|
NS_IMETHOD GetDocument(nsIDocument*& aResult) const = 0;
|
||||||
|
|
||||||
|
@ -295,6 +295,22 @@ public:
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD SetBindingParent(nsIContent* aContent) = 0;
|
NS_IMETHOD SetBindingParent(nsIContent* aContent) = 0;
|
||||||
NS_IMETHOD GetBindingParent(nsIContent** aContent) = 0;
|
NS_IMETHOD GetBindingParent(nsIContent** aContent) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bit-flags to pass (or'ed together) to IsContentOfType()
|
||||||
|
*/
|
||||||
|
enum {
|
||||||
|
eTEXT = 0x00000001,
|
||||||
|
eELEMENT = 0x00000002,
|
||||||
|
eHTML = 0x00000004,
|
||||||
|
eHTML_FORM_CONTROL = 0x00000008
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API for doing a quick check if a content object is of a given
|
||||||
|
* type, such as HTML, XUL, Text, ...
|
||||||
|
*/
|
||||||
|
NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
// nsresult codes for GetAttribute
|
// nsresult codes for GetAttribute
|
||||||
|
|
|
@ -21,7 +21,9 @@
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
#include "nsIURL.idl"
|
#include "nsIURL.idl"
|
||||||
#include "domstubs.idl"
|
|
||||||
|
interface nsIDOMElement;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for content policy mechanism. Implementations of this
|
* Interface for content policy mechanism. Implementations of this
|
||||||
|
|
|
@ -61,6 +61,7 @@ class nsIDOMDocumentType;
|
||||||
class nsIBindingManager;
|
class nsIBindingManager;
|
||||||
class nsIObserver;
|
class nsIObserver;
|
||||||
class nsISupportsArray;
|
class nsISupportsArray;
|
||||||
|
class nsString;
|
||||||
|
|
||||||
// IID for the nsIDocument interface
|
// IID for the nsIDocument interface
|
||||||
#define NS_IDOCUMENT_IID \
|
#define NS_IDOCUMENT_IID \
|
||||||
|
@ -78,7 +79,7 @@ class nsISupportsArray;
|
||||||
// Document interface
|
// Document interface
|
||||||
class nsIDocument : public nsISupports {
|
class nsIDocument : public nsISupports {
|
||||||
public:
|
public:
|
||||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOCUMENT_IID; return iid; }
|
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOCUMENT_IID)
|
||||||
|
|
||||||
// All documents have a memory arena associated with them which is
|
// All documents have a memory arena associated with them which is
|
||||||
// used for memory allocation during document creation. This call
|
// used for memory allocation during document creation. This call
|
||||||
|
@ -312,12 +313,6 @@ public:
|
||||||
NS_IMETHOD StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
|
NS_IMETHOD StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
|
||||||
nsIStyleRule* aStyleRule) = 0;
|
nsIStyleRule* aStyleRule) = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds text in content
|
|
||||||
*/
|
|
||||||
NS_IMETHOD FindNext(const nsAReadableString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound) = 0;
|
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
|
NS_IMETHOD HandleDOMEvent(nsIPresContext* aPresContext,
|
||||||
nsEvent* aEvent,
|
nsEvent* aEvent,
|
||||||
nsIDOMEvent** aDOMEvent,
|
nsIDOMEvent** aDOMEvent,
|
||||||
|
@ -335,6 +330,9 @@ public:
|
||||||
NS_IMETHOD GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager) = 0;
|
NS_IMETHOD GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager) = 0;
|
||||||
|
|
||||||
NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) = 0;
|
NS_IMETHOD Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) = 0;
|
||||||
|
|
||||||
|
NS_IMETHOD AddReference(void *aKey, nsISupports *aReference) = 0;
|
||||||
|
NS_IMETHOD RemoveReference(void *aKey, nsISupports **aOldReference) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
class nsIAtom;
|
class nsIAtom;
|
||||||
class nsINodeInfoManager;
|
class nsINodeInfoManager;
|
||||||
class nsINameSpaceManager;
|
class nsINameSpaceManager;
|
||||||
class nsString;
|
class nsIDocument;
|
||||||
|
|
||||||
|
|
||||||
// IID for the nsINodeInfo interface
|
// IID for the nsINodeInfo interface
|
||||||
|
@ -191,6 +191,11 @@ public:
|
||||||
* only by prefix from the one this is called on.
|
* only by prefix from the one this is called on.
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD PrefixChanged(nsIAtom *aPrefix, nsINodeInfo*& aResult) = 0;
|
NS_IMETHOD PrefixChanged(nsIAtom *aPrefix, nsINodeInfo*& aResult) = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Retrieve a pointer to the document that owns this node info.
|
||||||
|
*/
|
||||||
|
NS_IMETHOD GetDocument(nsIDocument*& aDocument) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -203,7 +208,14 @@ public:
|
||||||
* Initialize the nodeinfo manager with a namespace manager, this should
|
* Initialize the nodeinfo manager with a namespace manager, this should
|
||||||
* allways be done.
|
* allways be done.
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD Init(nsINameSpaceManager *aNameSpaceManager) = 0;
|
NS_IMETHOD Init(nsIDocument *aDocument,
|
||||||
|
nsINameSpaceManager *aNameSpaceManager) = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Release the reference to the document, this will be called when
|
||||||
|
* the document is going away.
|
||||||
|
*/
|
||||||
|
NS_IMETHOD DropDocumentReference() = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Methods for creating nodeinfo's from atoms and/or strings.
|
* Methods for creating nodeinfo's from atoms and/or strings.
|
||||||
|
@ -227,6 +239,12 @@ public:
|
||||||
* Getter for the namespace manager used by this nodeinfo manager.
|
* Getter for the namespace manager used by this nodeinfo manager.
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD GetNamespaceManager(nsINameSpaceManager*& aNameSpaceManager) = 0;
|
NS_IMETHOD GetNamespaceManager(nsINameSpaceManager*& aNameSpaceManager) = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Retrieve a pointer to the document that owns this node info
|
||||||
|
* manager.
|
||||||
|
*/
|
||||||
|
NS_IMETHOD GetDocument(nsIDocument*& aDocument) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern nsresult NS_NewNodeInfoManager(nsINodeInfoManager** aResult);
|
extern nsresult NS_NewNodeInfoManager(nsINodeInfoManager** aResult);
|
||||||
|
|
|
@ -21,14 +21,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
#include "domstubs.idl"
|
|
||||||
|
|
||||||
/* THIS IS A PUBLIC INTERFACE */
|
/* THIS IS A PUBLIC INTERFACE */
|
||||||
|
|
||||||
%{C++
|
interface nsIDOMNode;
|
||||||
class nsIDOMNode;
|
interface nsIDOMRange;
|
||||||
class nsIDOMRange;
|
|
||||||
%}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface for manipulating and querying the current selected range
|
* Interface for manipulating and querying the current selected range
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
|
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
#include "domstubs.idl"
|
|
||||||
#include "nsISelection.idl"
|
#include "nsISelection.idl"
|
||||||
|
|
||||||
%{C++
|
%{C++
|
||||||
|
@ -31,9 +30,10 @@
|
||||||
class nsISelection;
|
class nsISelection;
|
||||||
typedef short SelectionType;
|
typedef short SelectionType;
|
||||||
typedef short SelectionRegion;
|
typedef short SelectionRegion;
|
||||||
class nsIDOMNode;
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
interface nsIDOMNode;
|
||||||
|
|
||||||
|
|
||||||
[scriptable, uuid(D2D1D179-85A7-11d3-9932-00108301233C)]
|
[scriptable, uuid(D2D1D179-85A7-11d3-9932-00108301233C)]
|
||||||
interface nsISelectionController : nsISupports
|
interface nsISelectionController : nsISupports
|
||||||
|
|
|
@ -21,11 +21,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
#include "domstubs.idl"
|
|
||||||
|
|
||||||
%{C++
|
interface nsIDOMDocument;
|
||||||
class nsIDOMDocument;
|
|
||||||
%}
|
|
||||||
interface nsISelection;
|
interface nsISelection;
|
||||||
|
|
||||||
[scriptable, uuid(A6CF90E2-15B3-11d2-932E-00805F8ADD32)]
|
[scriptable, uuid(A6CF90E2-15B3-11d2-932E-00805F8ADD32)]
|
||||||
|
|
|
@ -21,15 +21,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
#include "domstubs.idl"
|
|
||||||
#include "nsISelectionListener.idl"
|
#include "nsISelectionListener.idl"
|
||||||
#include "nsIEnumerator.idl"
|
#include "nsIEnumerator.idl"
|
||||||
|
|
||||||
%{C++
|
interface nsIDOMRange;
|
||||||
class nsIDOMNode;
|
interface nsISelectionListener;
|
||||||
class nsIDOMRange;
|
|
||||||
class nsISelectionListener;
|
|
||||||
%}
|
|
||||||
|
|
||||||
[scriptable, uuid(2d5535e2-1dd2-11b2-8e38-d53ec833adf6)]
|
[scriptable, uuid(2d5535e2-1dd2-11b2-8e38-d53ec833adf6)]
|
||||||
interface nsISelectionPrivate : nsISupports
|
interface nsISelectionPrivate : nsISupports
|
||||||
|
|
|
@ -28,15 +28,15 @@ DEFINES = $(DEFINES) -DXP_NEW_SELECTION
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
CPPSRCS = \
|
CPPSRCS = \
|
||||||
nsStyleContext.cpp \
|
nsStyleContext.cpp \
|
||||||
nsStyleSet.cpp \
|
nsStyleSet.cpp \
|
||||||
nsCommentNode.cpp \
|
nsCommentNode.cpp \
|
||||||
nsGenericElement.cpp \
|
nsGenericElement.cpp \
|
||||||
nsGenericDOMDataNode.cpp \
|
nsGenericDOMDataNode.cpp \
|
||||||
nsGenericDOMNodeList.cpp \
|
nsGenericDOMNodeList.cpp \
|
||||||
nsContentList.cpp \
|
nsContentList.cpp \
|
||||||
nsContentIterator.cpp \
|
nsContentIterator.cpp \
|
||||||
nsContentPolicy.cpp \
|
nsContentPolicy.cpp \
|
||||||
nsDocument.cpp \
|
nsDocument.cpp \
|
||||||
nsDocumentEncoder.cpp \
|
nsDocumentEncoder.cpp \
|
||||||
nsDocumentFragment.cpp \
|
nsDocumentFragment.cpp \
|
||||||
|
@ -57,14 +57,14 @@ CPPSRCS = \
|
||||||
nsHTMLContentSerializer.cpp \
|
nsHTMLContentSerializer.cpp \
|
||||||
nsParserUtils.cpp \
|
nsParserUtils.cpp \
|
||||||
nsPlainTextSerializer.cpp \
|
nsPlainTextSerializer.cpp \
|
||||||
nsContentUtils.cpp \
|
nsContentUtils.cpp \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
MODULE=raptor
|
MODULE=raptor
|
||||||
|
|
||||||
CPP_OBJS= \
|
CPP_OBJS= \
|
||||||
.\$(OBJDIR)\nsStyleContext.obj \
|
.\$(OBJDIR)\nsStyleContext.obj \
|
||||||
.\$(OBJDIR)\nsStyleSet.obj \
|
.\$(OBJDIR)\nsStyleSet.obj \
|
||||||
.\$(OBJDIR)\nsCommentNode.obj \
|
.\$(OBJDIR)\nsCommentNode.obj \
|
||||||
.\$(OBJDIR)\nsGenericDOMDataNode.obj \
|
.\$(OBJDIR)\nsGenericDOMDataNode.obj \
|
||||||
.\$(OBJDIR)\nsGenericDOMNodeList.obj \
|
.\$(OBJDIR)\nsGenericDOMNodeList.obj \
|
||||||
|
@ -89,9 +89,9 @@ CPP_OBJS= \
|
||||||
.\$(OBJDIR)\nsTextNode.obj \
|
.\$(OBJDIR)\nsTextNode.obj \
|
||||||
.\$(OBJDIR)\nsXMLContentSerializer.obj \
|
.\$(OBJDIR)\nsXMLContentSerializer.obj \
|
||||||
.\$(OBJDIR)\nsHTMLContentSerializer.obj \
|
.\$(OBJDIR)\nsHTMLContentSerializer.obj \
|
||||||
.\$(OBJDIR)\nsParserUtils.obj \
|
.\$(OBJDIR)\nsParserUtils.obj \
|
||||||
.\$(OBJDIR)\nsPlainTextSerializer.obj \
|
.\$(OBJDIR)\nsPlainTextSerializer.obj \
|
||||||
.\$(OBJDIR)\nsContentUtils.obj \
|
.\$(OBJDIR)\nsContentUtils.obj \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor \
|
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor \
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMComment.h"
|
#include "nsIDOMComment.h"
|
||||||
#include "nsGenericDOMDataNode.h"
|
#include "nsGenericDOMDataNode.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsLayoutAtoms.h"
|
#include "nsLayoutAtoms.h"
|
||||||
|
@ -31,9 +30,12 @@
|
||||||
#include "nsIEnumerator.h"
|
#include "nsIEnumerator.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIDOMRange.h"
|
#include "nsIDOMRange.h"
|
||||||
|
#include "nsString.h"
|
||||||
|
|
||||||
|
#include "nsContentUtils.h"
|
||||||
|
|
||||||
|
|
||||||
class nsCommentNode : public nsIDOMComment,
|
class nsCommentNode : public nsIDOMComment,
|
||||||
public nsIScriptObjectOwner,
|
|
||||||
public nsITextContent
|
public nsITextContent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -44,16 +46,13 @@ public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_IMPL_IDOMNODE_USING_GENERIC_DOM_DATA(mInner)
|
NS_IMPL_NSIDOMNODE_USING_GENERIC_DOM_DATA(mInner)
|
||||||
|
|
||||||
// nsIDOMCharacterData
|
// nsIDOMCharacterData
|
||||||
NS_IMPL_IDOMCHARACTERDATA_USING_GENERIC_DOM_DATA(mInner)
|
NS_IMPL_NSIDOMCHARACTERDATA_USING_GENERIC_DOM_DATA(mInner)
|
||||||
|
|
||||||
// nsIDOMComment
|
// nsIDOMComment
|
||||||
|
|
||||||
// nsIScriptObjectOwner
|
|
||||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC_DOM_DATA(mInner)
|
|
||||||
|
|
||||||
// nsIContent
|
// nsIContent
|
||||||
//NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner)
|
//NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner)
|
||||||
|
|
||||||
|
@ -180,6 +179,10 @@ public:
|
||||||
return mInner.SetBindingParent(aParent);
|
return mInner.SetBindingParent(aParent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags) {
|
||||||
|
return PR_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const {
|
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const {
|
||||||
if (!aResult) {
|
if (!aResult) {
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
@ -241,28 +244,28 @@ nsCommentNode::~nsCommentNode()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsCommentNode)
|
|
||||||
|
|
||||||
|
// XPConnect interface list for nsCommentNode
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(Comment)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMComment)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOM3Node)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsCommentNode
|
||||||
|
NS_INTERFACE_MAP_BEGIN(nsCommentNode)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_DOM_DATA()
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsITextContent)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMComment)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMCharacterData)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(Comment)
|
||||||
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
NS_IMPL_ADDREF(nsCommentNode)
|
||||||
NS_IMPL_RELEASE(nsCommentNode)
|
NS_IMPL_RELEASE(nsCommentNode)
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsCommentNode::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|
||||||
{
|
|
||||||
NS_IMPL_DOM_DATA_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
|
||||||
if (aIID.Equals(NS_GET_IID(nsIDOMComment))) {
|
|
||||||
nsIDOMComment* tmp = this;
|
|
||||||
*aInstancePtr = (void*) tmp;
|
|
||||||
NS_ADDREF_THIS();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
if (aIID.Equals(NS_GET_IID(nsITextContent))) {
|
|
||||||
nsITextContent* tmp = this;
|
|
||||||
*aInstancePtr = (void*) tmp;
|
|
||||||
NS_ADDREF_THIS();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
return NS_NOINTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsCommentNode::GetTag(nsIAtom*& aResult) const
|
nsCommentNode::GetTag(nsIAtom*& aResult) const
|
||||||
|
|
|
@ -23,12 +23,12 @@
|
||||||
#include "nsContentList.h"
|
#include "nsContentList.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIDOMNode.h"
|
#include "nsIDOMNode.h"
|
||||||
#include "nsIScriptGlobalObject.h"
|
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsINameSpaceManager.h"
|
#include "nsINameSpaceManager.h"
|
||||||
#include "nsIDOMScriptObjectFactory.h"
|
|
||||||
#include "nsGenericElement.h"
|
#include "nsGenericElement.h"
|
||||||
|
|
||||||
|
#include "nsContentUtils.h"
|
||||||
|
|
||||||
#include "nsLayoutAtoms.h"
|
#include "nsLayoutAtoms.h"
|
||||||
#include "nsHTMLAtoms.h" // XXX until atoms get factored into nsLayoutAtoms
|
#include "nsHTMLAtoms.h" // XXX until atoms get factored into nsLayoutAtoms
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@
|
||||||
#include "nsIDOMHTMLFormElement.h"
|
#include "nsIDOMHTMLFormElement.h"
|
||||||
|
|
||||||
nsBaseContentList::nsBaseContentList()
|
nsBaseContentList::nsBaseContentList()
|
||||||
: mScriptObject(nsnull)
|
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
}
|
}
|
||||||
|
@ -48,14 +47,23 @@ nsBaseContentList::~nsBaseContentList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// XPConnect interface list for nsBaseContentList
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(NodeList)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMNodeList)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsBaseContentList
|
||||||
|
NS_INTERFACE_MAP_BEGIN(nsBaseContentList)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNodeList)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMNodeList)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(NodeList)
|
||||||
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsBaseContentList)
|
NS_IMPL_ADDREF(nsBaseContentList)
|
||||||
NS_IMPL_RELEASE(nsBaseContentList)
|
NS_IMPL_RELEASE(nsBaseContentList)
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN(nsBaseContentList)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNodeList)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner)
|
|
||||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMNodeList)
|
|
||||||
NS_INTERFACE_MAP_END
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsBaseContentList::GetLength(PRUint32* aLength)
|
nsBaseContentList::GetLength(PRUint32* aLength)
|
||||||
|
@ -80,41 +88,6 @@ nsBaseContentList::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||||
return CallQueryInterface(tmp, aReturn);
|
return CallQueryInterface(tmp, aReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsBaseContentList::GetScriptObject(nsIScriptContext *aContext,
|
|
||||||
void** aScriptObject)
|
|
||||||
{
|
|
||||||
nsresult res = NS_OK;
|
|
||||||
nsIScriptGlobalObject *global = aContext->GetGlobalObject();
|
|
||||||
|
|
||||||
if (!mScriptObject) {
|
|
||||||
nsIDOMScriptObjectFactory *factory;
|
|
||||||
|
|
||||||
res = nsGenericElement::GetScriptObjectFactory(&factory);
|
|
||||||
if (NS_FAILED(res)) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = factory->NewScriptNodeList(aContext,
|
|
||||||
NS_STATIC_CAST(nsIDOMNodeList *, this),
|
|
||||||
global, &mScriptObject);
|
|
||||||
NS_RELEASE(factory);
|
|
||||||
}
|
|
||||||
|
|
||||||
*aScriptObject = mScriptObject;
|
|
||||||
|
|
||||||
NS_RELEASE(global);
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsBaseContentList::SetScriptObject(void *aScriptObject)
|
|
||||||
{
|
|
||||||
mScriptObject = aScriptObject;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsBaseContentList::AppendElement(nsIContent *aContent)
|
nsBaseContentList::AppendElement(nsIContent *aContent)
|
||||||
{
|
{
|
||||||
|
@ -387,13 +360,25 @@ nsContentList::~nsContentList()
|
||||||
delete mData;
|
delete mData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// XPConnect interface list for nsContentList
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLCollection)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMNodeList)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLCollection)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsContentList
|
||||||
NS_INTERFACE_MAP_BEGIN(nsContentList)
|
NS_INTERFACE_MAP_BEGIN(nsContentList)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLCollection)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLCollection)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLCollection)
|
||||||
NS_INTERFACE_MAP_END_INHERITING(nsBaseContentList)
|
NS_INTERFACE_MAP_END_INHERITING(nsBaseContentList)
|
||||||
|
|
||||||
|
|
||||||
NS_IMPL_ADDREF_INHERITED(nsContentList, nsBaseContentList)
|
NS_IMPL_ADDREF_INHERITED(nsContentList, nsBaseContentList)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsContentList, nsBaseContentList)
|
NS_IMPL_RELEASE_INHERITED(nsContentList, nsBaseContentList)
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsContentList::GetLength(PRUint32* aLength)
|
nsContentList::GetLength(PRUint32* aLength)
|
||||||
{
|
{
|
||||||
|
@ -418,10 +403,10 @@ nsContentList::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||||
// Flush pending content changes Bug 4891
|
// Flush pending content changes Bug 4891
|
||||||
mDocument->FlushPendingNotifications(PR_FALSE);
|
mDocument->FlushPendingNotifications(PR_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsISupports *element = NS_STATIC_CAST(nsISupports *,
|
nsISupports *element = NS_STATIC_CAST(nsISupports *,
|
||||||
mElements.ElementAt(aIndex));
|
mElements.ElementAt(aIndex));
|
||||||
|
|
||||||
if (element) {
|
if (element) {
|
||||||
result = CallQueryInterface(element, aReturn);
|
result = CallQueryInterface(element, aReturn);
|
||||||
}
|
}
|
||||||
|
@ -429,15 +414,15 @@ nsContentList::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||||
*aReturn = nsnull;
|
*aReturn = nsnull;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsContentList::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)
|
nsContentList::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)
|
||||||
{
|
{
|
||||||
nsresult result = CheckDocumentExistence();
|
nsresult result = CheckDocumentExistence();
|
||||||
|
|
||||||
if (NS_SUCCEEDED(result)) {
|
if (NS_SUCCEEDED(result)) {
|
||||||
if (mDocument) {
|
if (mDocument) {
|
||||||
mDocument->FlushPendingNotifications(PR_FALSE); // Flush pending content changes Bug 4891
|
mDocument->FlushPendingNotifications(PR_FALSE); // Flush pending content changes Bug 4891
|
||||||
|
@ -466,35 +451,6 @@ nsContentList::NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsContentList::GetScriptObject(nsIScriptContext *aContext,
|
|
||||||
void** aScriptObject)
|
|
||||||
{
|
|
||||||
nsresult res = NS_OK;
|
|
||||||
nsIScriptGlobalObject *global = aContext->GetGlobalObject();
|
|
||||||
|
|
||||||
if (!mScriptObject) {
|
|
||||||
nsIDOMScriptObjectFactory *factory;
|
|
||||||
|
|
||||||
res = nsGenericElement::GetScriptObjectFactory(&factory);
|
|
||||||
if (NS_FAILED(res)) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = factory->NewScriptHTMLCollection(aContext,
|
|
||||||
NS_STATIC_CAST(nsIDOMNodeList *,
|
|
||||||
this),
|
|
||||||
global, &mScriptObject);
|
|
||||||
NS_RELEASE(factory);
|
|
||||||
}
|
|
||||||
|
|
||||||
*aScriptObject = mScriptObject;
|
|
||||||
|
|
||||||
NS_RELEASE(global);
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsContentList::ContentAppended(nsIDocument *aDocument, nsIContent* aContainer,
|
nsContentList::ContentAppended(nsIDocument *aDocument, nsIContent* aContainer,
|
||||||
PRInt32 aNewIndexInContainer)
|
PRInt32 aNewIndexInContainer)
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include "nsIDOMHTMLCollection.h"
|
#include "nsIDOMHTMLCollection.h"
|
||||||
#include "nsIDOMNodeList.h"
|
#include "nsIDOMNodeList.h"
|
||||||
#include "nsIDocumentObserver.h"
|
#include "nsIDocumentObserver.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
|
|
||||||
typedef PRBool (*nsContentListMatchFunc)(nsIContent* aContent,
|
typedef PRBool (*nsContentListMatchFunc)(nsIContent* aContent,
|
||||||
nsString* aData);
|
nsString* aData);
|
||||||
|
@ -37,8 +36,7 @@ class nsIDocument;
|
||||||
class nsIDOMHTMLFormElement;
|
class nsIDOMHTMLFormElement;
|
||||||
|
|
||||||
|
|
||||||
class nsBaseContentList : public nsIDOMNodeList,
|
class nsBaseContentList : public nsIDOMNodeList
|
||||||
public nsIScriptObjectOwner
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsBaseContentList();
|
nsBaseContentList();
|
||||||
|
@ -47,12 +45,8 @@ public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
// nsIDOMNodeList
|
// nsIDOMNodeList
|
||||||
NS_DECL_IDOMNODELIST
|
NS_DECL_NSIDOMNODELIST
|
||||||
|
|
||||||
// nsIScriptObjectOwner
|
|
||||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
|
||||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
|
||||||
|
|
||||||
NS_IMETHOD AppendElement(nsIContent *aContent);
|
NS_IMETHOD AppendElement(nsIContent *aContent);
|
||||||
NS_IMETHOD RemoveElement(nsIContent *aContent);
|
NS_IMETHOD RemoveElement(nsIContent *aContent);
|
||||||
NS_IMETHOD IndexOf(nsIContent *aContent, PRInt32& aIndex);
|
NS_IMETHOD IndexOf(nsIContent *aContent, PRInt32& aIndex);
|
||||||
|
@ -60,7 +54,6 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsVoidArray mElements;
|
nsVoidArray mElements;
|
||||||
void *mScriptObject;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,9 +97,6 @@ public:
|
||||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
|
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
|
||||||
NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn);
|
NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn);
|
||||||
|
|
||||||
// nsIScriptObjectOwner
|
|
||||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
|
||||||
|
|
||||||
// nsIDocumentObserver
|
// nsIDocumentObserver
|
||||||
NS_IMETHOD BeginUpdate(nsIDocument *aDocument) { return NS_OK; }
|
NS_IMETHOD BeginUpdate(nsIDocument *aDocument) { return NS_OK; }
|
||||||
NS_IMETHOD EndUpdate(nsIDocument *aDocument) { return NS_OK; }
|
NS_IMETHOD EndUpdate(nsIDocument *aDocument) { return NS_OK; }
|
||||||
|
|
|
@ -36,12 +36,37 @@
|
||||||
|
|
||||||
#include "jsapi.h"
|
#include "jsapi.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
#include "nsIServiceManager.h"
|
||||||
#include "nsIScriptGlobalObject.h"
|
#include "nsIScriptGlobalObject.h"
|
||||||
#include "nsIScriptContext.h"
|
#include "nsIScriptContext.h"
|
||||||
|
#include "nsIDOMScriptObjectFactory.h"
|
||||||
|
#include "nsDOMCID.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
|
#include "nsIXPConnect.h"
|
||||||
|
#include "nsIContent.h"
|
||||||
|
#include "nsIDocument.h"
|
||||||
|
#include "nsINodeInfo.h"
|
||||||
|
|
||||||
|
|
||||||
|
nsIDOMScriptObjectFactory *nsContentUtils::sDOMScriptObjectFactory = nsnull;
|
||||||
|
nsIXPConnect *nsContentUtils::sXPConnect = nsnull;
|
||||||
|
|
||||||
|
// static
|
||||||
|
nsresult
|
||||||
|
nsContentUtils::Init()
|
||||||
|
{
|
||||||
|
NS_ENSURE_TRUE(!sXPConnect, NS_ERROR_ALREADY_INITIALIZED);
|
||||||
|
|
||||||
|
nsresult rv = nsServiceManager::GetService(nsIXPConnect::GetCID(),
|
||||||
|
nsIXPConnect::GetIID(),
|
||||||
|
(nsISupports **)&sXPConnect);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
nsresult
|
nsresult
|
||||||
nsContentUtils::GetStaticScriptGlobal(JSContext* aContext,
|
nsContentUtils::GetStaticScriptGlobal(JSContext* aContext,
|
||||||
JSObject* aObj,
|
JSObject* aObj,
|
||||||
nsIScriptGlobalObject** aNativeGlobal)
|
nsIScriptGlobalObject** aNativeGlobal)
|
||||||
|
@ -70,12 +95,17 @@ nsContentUtils::GetStaticScriptGlobal(JSContext* aContext,
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return supports->QueryInterface(NS_GET_IID(nsIScriptGlobalObject),
|
nsCOMPtr<nsIXPConnectWrappedNative> wrapper(do_QueryInterface(supports));
|
||||||
(void**) aNativeGlobal);
|
NS_ENSURE_TRUE(wrapper, NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
|
nsCOMPtr<nsISupports> native;
|
||||||
|
wrapper->GetNative(getter_AddRefs(native));
|
||||||
|
|
||||||
|
return CallQueryInterface(native, aNativeGlobal);
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
//static
|
||||||
nsresult
|
nsresult
|
||||||
nsContentUtils::GetStaticScriptContext(JSContext* aContext,
|
nsContentUtils::GetStaticScriptContext(JSContext* aContext,
|
||||||
JSObject* aObj,
|
JSObject* aObj,
|
||||||
nsIScriptContext** aScriptContext)
|
nsIScriptContext** aScriptContext)
|
||||||
|
@ -271,3 +301,208 @@ nsContentUtils::CopyNewlineNormalizedUnicodeTo(nsReadingIterator<PRUnichar>& aSr
|
||||||
copy_string(aSrcStart, aSrcEnd, normalizer);
|
copy_string(aSrcStart, aSrcEnd, normalizer);
|
||||||
return normalizer.GetCharsWritten();
|
return normalizer.GetCharsWritten();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
void
|
||||||
|
nsContentUtils::Shutdown()
|
||||||
|
{
|
||||||
|
NS_IF_RELEASE(sDOMScriptObjectFactory);
|
||||||
|
NS_IF_RELEASE(sXPConnect);
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
nsISupports *
|
||||||
|
nsContentUtils::GetClassInfoInstance(nsDOMClassInfoID aID,
|
||||||
|
GetDOMClassIIDsFnc aGetIIDsFptr,
|
||||||
|
const char *aName)
|
||||||
|
{
|
||||||
|
if (!sDOMScriptObjectFactory) {
|
||||||
|
static NS_DEFINE_CID(kDOMScriptObjectFactoryCID,
|
||||||
|
NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
|
||||||
|
|
||||||
|
nsServiceManager::GetService(kDOMScriptObjectFactoryCID,
|
||||||
|
NS_GET_IID(nsIDOMScriptObjectFactory),
|
||||||
|
(nsISupports **)&sDOMScriptObjectFactory);
|
||||||
|
|
||||||
|
if (!sDOMScriptObjectFactory) {
|
||||||
|
return nsnull;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sDOMScriptObjectFactory->GetClassInfoInstance(aID, aGetIIDsFptr,
|
||||||
|
aName);
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
nsresult
|
||||||
|
nsContentUtils::doReparentContentWrapper(nsIContent *aChild,
|
||||||
|
nsIDocument *aNewDocument,
|
||||||
|
nsIDocument *aOldDocument,
|
||||||
|
JSContext *cx,
|
||||||
|
JSObject *parent_obj)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIXPConnectJSObjectHolder> old_wrapper;
|
||||||
|
|
||||||
|
nsresult rv;
|
||||||
|
|
||||||
|
rv = sXPConnect->ReparentWrappedNativeIfFound(cx, ::JS_GetGlobalObject(cx),
|
||||||
|
parent_obj, aChild,
|
||||||
|
getter_AddRefs(old_wrapper));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
if (!old_wrapper) {
|
||||||
|
// If aChild isn't wrapped none of it's children are wrapped so
|
||||||
|
// there's no need to walk into aChild's children.
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aOldDocument) {
|
||||||
|
nsCOMPtr<nsISupports> old_ref;
|
||||||
|
|
||||||
|
aOldDocument->RemoveReference(aChild, getter_AddRefs(old_ref));
|
||||||
|
|
||||||
|
if (old_ref) {
|
||||||
|
// Transfer the reference from aOldDocument to aNewDocument
|
||||||
|
|
||||||
|
aNewDocument->AddReference(aChild, old_ref);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JSObject *old;
|
||||||
|
|
||||||
|
rv = old_wrapper->GetJSObject(&old);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIContent> child;
|
||||||
|
PRInt32 count = 0, i;
|
||||||
|
|
||||||
|
aChild->ChildCount(count);
|
||||||
|
|
||||||
|
for (i = 0; i < count; i++) {
|
||||||
|
aChild->ChildAt(i, *getter_AddRefs(child));
|
||||||
|
NS_ENSURE_TRUE(child, NS_ERROR_UNEXPECTED);
|
||||||
|
|
||||||
|
rv = doReparentContentWrapper(child, aNewDocument, aOldDocument, cx, old);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
nsresult GetContextFromDocument(nsIDocument *aDocument, JSContext **cx)
|
||||||
|
{
|
||||||
|
*cx = nsnull;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIScriptGlobalObject> sgo;
|
||||||
|
aDocument->GetScriptGlobalObject(getter_AddRefs(sgo));
|
||||||
|
|
||||||
|
if (!sgo) {
|
||||||
|
// No script global, no context.
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIScriptContext> scx;
|
||||||
|
sgo->GetContext(getter_AddRefs(scx));
|
||||||
|
|
||||||
|
if (!scx) {
|
||||||
|
// No context left in the old scope...
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
*cx = (JSContext *)scx->GetNativeContext();
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
nsresult
|
||||||
|
nsContentUtils::ReparentContentWrapper(nsIContent *aContent,
|
||||||
|
nsIContent *aNewParent,
|
||||||
|
nsIDocument *aNewDocument,
|
||||||
|
nsIDocument *aOldDocument)
|
||||||
|
{
|
||||||
|
if (!aNewDocument || aNewDocument == aOldDocument) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDocument> old_doc(aOldDocument);
|
||||||
|
|
||||||
|
if (!old_doc) {
|
||||||
|
nsCOMPtr<nsINodeInfo> ni;
|
||||||
|
|
||||||
|
aContent->GetNodeInfo(*getter_AddRefs(ni));
|
||||||
|
|
||||||
|
if (ni) {
|
||||||
|
ni->GetDocument(*getter_AddRefs(old_doc));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!aOldDocument) {
|
||||||
|
// If we can't find our old document we don't know what our old
|
||||||
|
// scope was so there's no way to find the old wrapper
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_ENSURE_TRUE(sXPConnect, NS_ERROR_NOT_INITIALIZED);
|
||||||
|
|
||||||
|
nsCOMPtr<nsISupports> new_parent;
|
||||||
|
|
||||||
|
if (!aNewParent) {
|
||||||
|
nsCOMPtr<nsIContent> root(dont_AddRef(old_doc->GetRootContent()));
|
||||||
|
|
||||||
|
if (root.get() == aContent) {
|
||||||
|
new_parent = old_doc;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
new_parent = aNewParent;
|
||||||
|
}
|
||||||
|
|
||||||
|
JSContext *cx = nsnull;
|
||||||
|
|
||||||
|
GetContextFromDocument(old_doc, &cx);
|
||||||
|
|
||||||
|
if (!cx) {
|
||||||
|
// No JSContext left in the old scope, can't find the old wrapper
|
||||||
|
// w/o the old context.
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIXPConnectWrappedNative> wrapper;
|
||||||
|
|
||||||
|
nsresult rv;
|
||||||
|
|
||||||
|
rv = sXPConnect->GetWrappedNativeOfNativeObject(cx, ::JS_GetGlobalObject(cx),
|
||||||
|
aContent,
|
||||||
|
NS_GET_IID(nsISupports),
|
||||||
|
getter_AddRefs(wrapper));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
if (!wrapper) {
|
||||||
|
// aContent is not wrapped (and thus none of it's children are
|
||||||
|
// wrapped) so there's no need to reparent anything.
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrap the new parent and reparent aContent
|
||||||
|
|
||||||
|
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||||
|
rv = sXPConnect->WrapNative(cx, ::JS_GetGlobalObject(cx), new_parent,
|
||||||
|
NS_GET_IID(nsISupports),
|
||||||
|
getter_AddRefs(holder));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
JSObject *obj;
|
||||||
|
rv = holder->GetJSObject(&obj);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
return doReparentContentWrapper(aContent, aNewDocument, aOldDocument, cx,
|
||||||
|
obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,27 +23,25 @@
|
||||||
#include "nsDOMAttribute.h"
|
#include "nsDOMAttribute.h"
|
||||||
#include "nsGenericElement.h"
|
#include "nsGenericElement.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIDOMScriptObjectFactory.h"
|
|
||||||
#include "nsITextContent.h"
|
#include "nsITextContent.h"
|
||||||
#include "nsINameSpaceManager.h"
|
#include "nsINameSpaceManager.h"
|
||||||
#include "nsDOMError.h"
|
#include "nsDOMError.h"
|
||||||
|
#include "nsContentUtils.h"
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
nsDOMAttribute::nsDOMAttribute(nsIContent* aContent,
|
nsDOMAttribute::nsDOMAttribute(nsIContent* aContent, nsINodeInfo *aNodeInfo,
|
||||||
nsINodeInfo *aNodeInfo,
|
|
||||||
const nsAReadableString& aValue)
|
const nsAReadableString& aValue)
|
||||||
: mNodeInfo(aNodeInfo), mValue(aValue)
|
: mNodeInfo(aNodeInfo), mValue(aValue), mContent(aContent), mChild(nsnull),
|
||||||
|
mChildList(nsnull)
|
||||||
{
|
{
|
||||||
NS_ABORT_IF_FALSE(mNodeInfo, "We must get a nodeinfo here!");
|
NS_ABORT_IF_FALSE(mNodeInfo, "We must get a nodeinfo here!");
|
||||||
|
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
|
|
||||||
// We don't add a reference to our content. It will tell us
|
// We don't add a reference to our content. It will tell us
|
||||||
// to drop our reference when it goes away.
|
// to drop our reference when it goes away.
|
||||||
mContent = aContent;
|
|
||||||
mScriptObject = nsnull;
|
|
||||||
mChild = nsnull;
|
|
||||||
mChildList = nsnull;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDOMAttribute::~nsDOMAttribute()
|
nsDOMAttribute::~nsDOMAttribute()
|
||||||
|
@ -52,49 +50,28 @@ nsDOMAttribute::~nsDOMAttribute()
|
||||||
NS_IF_RELEASE(mChildList);
|
NS_IF_RELEASE(mChildList);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsDOMAttribute::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
// XPConnect interface list for nsDOMAttribute
|
||||||
{
|
NS_CLASSINFO_MAP_BEGIN(Attr)
|
||||||
if (NULL == aInstancePtr) {
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMAttr)
|
||||||
return NS_ERROR_NULL_POINTER;
|
NS_CLASSINFO_MAP_END
|
||||||
}
|
|
||||||
if (aIID.Equals(NS_GET_IID(nsIDOMAttr))) {
|
|
||||||
nsIDOMAttr* tmp = this;
|
// QueryInterface implementation for nsDOMAttribute
|
||||||
*aInstancePtr = (void*)tmp;
|
NS_INTERFACE_MAP_BEGIN(nsDOMAttribute)
|
||||||
NS_ADDREF_THIS();
|
NS_INTERFACE_MAP_ENTRY(nsIDOMAttr)
|
||||||
return NS_OK;
|
NS_INTERFACE_MAP_ENTRY(nsIDOMAttributePrivate)
|
||||||
}
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNode)
|
||||||
if (aIID.Equals(NS_GET_IID(nsIScriptObjectOwner))) {
|
NS_INTERFACE_MAP_ENTRY(nsIDOM3Node)
|
||||||
nsIScriptObjectOwner* tmp = this;
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMAttr)
|
||||||
*aInstancePtr = (void*)tmp;
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(Attr)
|
||||||
NS_ADDREF_THIS();
|
NS_INTERFACE_MAP_END
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
if (aIID.Equals(NS_GET_IID(nsIDOMAttributePrivate))) {
|
|
||||||
nsIDOMAttributePrivate* tmp = this;
|
|
||||||
*aInstancePtr = (void*)tmp;
|
|
||||||
NS_ADDREF_THIS();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
if (aIID.Equals(NS_GET_IID(nsIDOMNode))) {
|
|
||||||
nsIDOMNode* tmp = this;
|
|
||||||
*aInstancePtr = (void*)tmp;
|
|
||||||
NS_ADDREF_THIS();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
if (aIID.Equals(NS_GET_IID(nsISupports))) {
|
|
||||||
nsIDOMAttr* tmp1 = this;
|
|
||||||
nsISupports* tmp2 = tmp1;
|
|
||||||
*aInstancePtr = (void*)tmp2;
|
|
||||||
NS_ADDREF_THIS();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
return NS_NOINTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsDOMAttribute)
|
NS_IMPL_ADDREF(nsDOMAttribute)
|
||||||
NS_IMPL_RELEASE(nsDOMAttribute)
|
NS_IMPL_RELEASE(nsDOMAttribute)
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMAttribute::DropReference()
|
nsDOMAttribute::DropReference()
|
||||||
{
|
{
|
||||||
|
@ -120,36 +97,6 @@ nsDOMAttribute::GetContent(nsIContent** aContent)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsDOMAttribute::GetScriptObject(nsIScriptContext *aContext,
|
|
||||||
void** aScriptObject)
|
|
||||||
{
|
|
||||||
nsresult res = NS_OK;
|
|
||||||
if (nsnull == mScriptObject) {
|
|
||||||
nsIDOMScriptObjectFactory *factory;
|
|
||||||
|
|
||||||
res = nsGenericElement::GetScriptObjectFactory(&factory);
|
|
||||||
if (NS_OK != res) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = factory->NewScriptAttr(aContext,
|
|
||||||
(nsISupports *)(nsIDOMAttr *)this,
|
|
||||||
(nsISupports *)mContent,
|
|
||||||
(void **)&mScriptObject);
|
|
||||||
NS_RELEASE(factory);
|
|
||||||
}
|
|
||||||
*aScriptObject = mScriptObject;
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsDOMAttribute::SetScriptObject(void *aScriptObject)
|
|
||||||
{
|
|
||||||
mScriptObject = aScriptObject;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsDOMAttribute::GetName(nsAWritableString& aName)
|
nsDOMAttribute::GetName(nsAWritableString& aName)
|
||||||
{
|
{
|
||||||
|
@ -164,7 +111,7 @@ nsDOMAttribute::GetValue(nsAWritableString& aValue)
|
||||||
NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsresult result = NS_OK;
|
nsresult result = NS_OK;
|
||||||
if (nsnull != mContent) {
|
if (mContent) {
|
||||||
nsresult attrResult;
|
nsresult attrResult;
|
||||||
PRInt32 nameSpaceID;
|
PRInt32 nameSpaceID;
|
||||||
nsCOMPtr<nsIAtom> name;
|
nsCOMPtr<nsIAtom> name;
|
||||||
|
@ -188,7 +135,7 @@ nsDOMAttribute::SetValue(const nsAReadableString& aValue)
|
||||||
NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(mNodeInfo, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsresult result = NS_OK;
|
nsresult result = NS_OK;
|
||||||
if (nsnull != mContent) {
|
if (mContent) {
|
||||||
result = mContent->SetAttribute(mNodeInfo, aValue, PR_TRUE);
|
result = mContent->SetAttribute(mNodeInfo, aValue, PR_TRUE);
|
||||||
}
|
}
|
||||||
mValue=aValue;
|
mValue=aValue;
|
||||||
|
@ -280,27 +227,26 @@ nsDOMAttribute::GetParentNode(nsIDOMNode** aParentNode)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMAttribute::GetChildNodes(nsIDOMNodeList** aChildNodes)
|
nsDOMAttribute::GetChildNodes(nsIDOMNodeList** aChildNodes)
|
||||||
{
|
{
|
||||||
if (nsnull == mChildList) {
|
if (!mChildList) {
|
||||||
mChildList = new nsAttributeChildList(this);
|
mChildList = new nsAttributeChildList(this);
|
||||||
if (nsnull == mChildList) {
|
NS_ENSURE_TRUE(mChildList, NS_ERROR_OUT_OF_MEMORY);
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
NS_ADDREF(mChildList);
|
NS_ADDREF(mChildList);
|
||||||
}
|
}
|
||||||
|
|
||||||
return mChildList->QueryInterface(NS_GET_IID(nsIDOMNodeList), (void**)aChildNodes);
|
return CallQueryInterface(mChildList, aChildNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMAttribute::HasChildNodes(PRBool* aHasChildNodes)
|
nsDOMAttribute::HasChildNodes(PRBool* aHasChildNodes)
|
||||||
{
|
{
|
||||||
*aHasChildNodes = PR_FALSE;
|
*aHasChildNodes = PR_FALSE;
|
||||||
if (nsnull != mChild) {
|
if (mChild) {
|
||||||
*aHasChildNodes = PR_TRUE;
|
*aHasChildNodes = PR_TRUE;
|
||||||
}
|
}
|
||||||
else if (nsnull != mContent) {
|
else if (mContent) {
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
|
|
||||||
GetValue(value);
|
GetValue(value);
|
||||||
if (0 < value.Length()) {
|
if (0 < value.Length()) {
|
||||||
*aHasChildNodes = PR_TRUE;
|
*aHasChildNodes = PR_TRUE;
|
||||||
|
@ -331,7 +277,7 @@ nsDOMAttribute::GetFirstChild(nsIDOMNode** aFirstChild)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (0 < value.Length()) {
|
if (0 < value.Length()) {
|
||||||
if (nsnull == mChild) {
|
if (!mChild) {
|
||||||
nsIContent* content;
|
nsIContent* content;
|
||||||
|
|
||||||
result = NS_NewTextNode(&content);
|
result = NS_NewTextNode(&content);
|
||||||
|
@ -412,7 +358,7 @@ nsDOMAttribute::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||||
{
|
{
|
||||||
nsDOMAttribute* newAttr;
|
nsDOMAttribute* newAttr;
|
||||||
|
|
||||||
if (nsnull != mContent) {
|
if (mContent) {
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
PRInt32 nameSpaceID;
|
PRInt32 nameSpaceID;
|
||||||
nsCOMPtr<nsIAtom> name;
|
nsCOMPtr<nsIAtom> name;
|
||||||
|
@ -427,7 +373,7 @@ nsDOMAttribute::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||||
newAttr = new nsDOMAttribute(nsnull, mNodeInfo, mValue);
|
newAttr = new nsDOMAttribute(nsnull, mNodeInfo, mValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsnull == newAttr) {
|
if (!newAttr) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,7 +384,7 @@ NS_IMETHODIMP
|
||||||
nsDOMAttribute::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
|
nsDOMAttribute::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
|
||||||
{
|
{
|
||||||
nsresult result = NS_OK;
|
nsresult result = NS_OK;
|
||||||
if (nsnull != mContent) {
|
if (mContent) {
|
||||||
nsIDOMNode* node;
|
nsIDOMNode* node;
|
||||||
result = mContent->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)&node);
|
result = mContent->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)&node);
|
||||||
if (NS_SUCCEEDED(result)) {
|
if (NS_SUCCEEDED(result)) {
|
||||||
|
@ -477,7 +423,7 @@ nsDOMAttribute::SetPrefix(const nsAReadableString& aPrefix)
|
||||||
nsCOMPtr<nsIAtom> prefix;
|
nsCOMPtr<nsIAtom> prefix;
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
if (aPrefix.Length())
|
if (aPrefix.Length() && !DOMStringIsNull(aPrefix))
|
||||||
prefix = dont_AddRef(NS_NewAtom(aPrefix));
|
prefix = dont_AddRef(NS_NewAtom(aPrefix));
|
||||||
|
|
||||||
rv = mNodeInfo->PrefixChanged(prefix, *getter_AddRefs(newNodeInfo));
|
rv = mNodeInfo->PrefixChanged(prefix, *getter_AddRefs(newNodeInfo));
|
||||||
|
@ -527,18 +473,16 @@ nsDOMAttribute::IsSupported(const nsAReadableString& aFeature,
|
||||||
return nsGenericElement::InternalIsSupported(aFeature, aVersion, aReturn);
|
return nsGenericElement::InternalIsSupported(aFeature, aVersion, aReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMAttribute::GetBaseURI(nsAWritableString &aURI)
|
nsDOMAttribute::GetBaseURI(nsAWritableString &aURI)
|
||||||
{
|
{
|
||||||
aURI.Truncate();
|
aURI.Truncate();
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(mContent));
|
nsCOMPtr<nsIDOM3Node> node(do_QueryInterface(mContent));
|
||||||
if (node)
|
if (node)
|
||||||
rv = node->GetBaseURI(aURI);
|
rv = node->GetBaseURI(aURI);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -559,7 +503,7 @@ nsAttributeChildList::GetLength(PRUint32* aLength)
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
|
|
||||||
*aLength = 0;
|
*aLength = 0;
|
||||||
if (nsnull != mAttribute) {
|
if (mAttribute) {
|
||||||
mAttribute->GetValue(value);
|
mAttribute->GetValue(value);
|
||||||
if (0 < value.Length()) {
|
if (0 < value.Length()) {
|
||||||
*aLength = 1;
|
*aLength = 1;
|
||||||
|
@ -573,7 +517,7 @@ NS_IMETHODIMP
|
||||||
nsAttributeChildList::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
nsAttributeChildList::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||||
{
|
{
|
||||||
*aReturn = nsnull;
|
*aReturn = nsnull;
|
||||||
if ((nsnull != mAttribute) && (0 == aIndex)) {
|
if (mAttribute && 0 == aIndex) {
|
||||||
mAttribute->GetFirstChild(aReturn);
|
mAttribute->GetFirstChild(aReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include "nsIDOMAttr.h"
|
#include "nsIDOMAttr.h"
|
||||||
#include "nsIDOMText.h"
|
#include "nsIDOMText.h"
|
||||||
#include "nsIDOMNodeList.h"
|
#include "nsIDOMNodeList.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsGenericDOMNodeList.h"
|
#include "nsGenericDOMNodeList.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
@ -65,10 +64,9 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
// Attribute helper class used to wrap up an attribute with a dom
|
// Attribute helper class used to wrap up an attribute with a dom
|
||||||
// object that implements nsIDOMAttr and nsIDOMNode and
|
// object that implements nsIDOMAttr and nsIDOMNode
|
||||||
// nsIScriptObjectOwner
|
class nsDOMAttribute : public nsIDOMAttr,
|
||||||
class nsDOMAttribute : public nsIDOMAttr,
|
public nsIDOM3Node,
|
||||||
public nsIScriptObjectOwner,
|
|
||||||
public nsIDOMAttributePrivate
|
public nsIDOMAttributePrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -78,15 +76,15 @@ public:
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject);
|
// nsIDOMNode interface
|
||||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
NS_DECL_NSIDOMNODE
|
||||||
|
|
||||||
|
// nsIDOM3Node interface
|
||||||
|
NS_DECL_NSIDOM3NODE
|
||||||
|
|
||||||
// nsIDOMAttr interface
|
// nsIDOMAttr interface
|
||||||
NS_DECL_IDOMATTR
|
NS_DECL_NSIDOMATTR
|
||||||
|
|
||||||
// nsIDOMNode interface
|
|
||||||
NS_DECL_IDOMNODE
|
|
||||||
|
|
||||||
// nsIDOMAttributePrivate interface
|
// nsIDOMAttributePrivate interface
|
||||||
NS_IMETHOD DropReference();
|
NS_IMETHOD DropReference();
|
||||||
NS_IMETHOD SetContent(nsIContent* aContent);
|
NS_IMETHOD SetContent(nsIContent* aContent);
|
||||||
|
@ -100,7 +98,6 @@ private:
|
||||||
// element representing the value
|
// element representing the value
|
||||||
nsIDOMText* mChild;
|
nsIDOMText* mChild;
|
||||||
nsAttributeChildList* mChildList;
|
nsAttributeChildList* mChildList;
|
||||||
void* mScriptObject;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,9 @@
|
||||||
#include "nsDOMAttribute.h"
|
#include "nsDOMAttribute.h"
|
||||||
#include "nsGenericElement.h"
|
#include "nsGenericElement.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIDOMScriptObjectFactory.h"
|
|
||||||
#include "nsINameSpaceManager.h"
|
#include "nsINameSpaceManager.h"
|
||||||
#include "nsDOMError.h"
|
#include "nsDOMError.h"
|
||||||
|
#include "nsContentUtils.h"
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -35,7 +34,6 @@ nsDOMAttributeMap::nsDOMAttributeMap(nsIContent* aContent)
|
||||||
: mContent(aContent)
|
: mContent(aContent)
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
mScriptObject = nsnull;
|
|
||||||
// We don't add a reference to our content. If it goes away,
|
// We don't add a reference to our content. If it goes away,
|
||||||
// we'll be told to drop our reference
|
// we'll be told to drop our reference
|
||||||
}
|
}
|
||||||
|
@ -50,45 +48,23 @@ nsDOMAttributeMap::DropReference()
|
||||||
mContent = nsnull;
|
mContent = nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// XPConnect interface list for nsDOMAttributeMap
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(NamedNodeMap)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMNamedNodeMap)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsDOMAttributeMap
|
||||||
NS_INTERFACE_MAP_BEGIN(nsDOMAttributeMap)
|
NS_INTERFACE_MAP_BEGIN(nsDOMAttributeMap)
|
||||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMNamedNodeMap)
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNamedNodeMap)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNamedNodeMap)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner)
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(NamedNodeMap)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsDOMAttributeMap)
|
NS_IMPL_ADDREF(nsDOMAttributeMap)
|
||||||
NS_IMPL_RELEASE(nsDOMAttributeMap)
|
NS_IMPL_RELEASE(nsDOMAttributeMap)
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsDOMAttributeMap::GetScriptObject(nsIScriptContext *aContext,
|
|
||||||
void** aScriptObject)
|
|
||||||
{
|
|
||||||
nsresult res = NS_OK;
|
|
||||||
if (nsnull == mScriptObject) {
|
|
||||||
nsIDOMScriptObjectFactory *factory;
|
|
||||||
|
|
||||||
res = nsGenericElement::GetScriptObjectFactory(&factory);
|
|
||||||
if (NS_OK != res) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = factory->NewScriptNamedNodeMap(aContext,
|
|
||||||
(nsISupports *)(nsIDOMNamedNodeMap *)this,
|
|
||||||
(nsISupports *)mContent,
|
|
||||||
(void**)&mScriptObject);
|
|
||||||
NS_RELEASE(factory);
|
|
||||||
}
|
|
||||||
*aScriptObject = mScriptObject;
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsDOMAttributeMap::SetScriptObject(void *aScriptObject)
|
|
||||||
{
|
|
||||||
mScriptObject = aScriptObject;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsDOMAttributeMap::GetNamedItem(const nsAReadableString& aAttrName,
|
nsDOMAttributeMap::GetNamedItem(const nsAReadableString& aAttrName,
|
||||||
nsIDOMNode** aAttribute)
|
nsIDOMNode** aAttribute)
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#define nsDOMAttributeMap_h___
|
#define nsDOMAttributeMap_h___
|
||||||
|
|
||||||
#include "nsIDOMNamedNodeMap.h"
|
#include "nsIDOMNamedNodeMap.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsVoidArray.h"
|
#include "nsVoidArray.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "plhash.h"
|
#include "plhash.h"
|
||||||
|
@ -31,8 +30,7 @@
|
||||||
class nsIContent;
|
class nsIContent;
|
||||||
|
|
||||||
// Helper class that implements the nsIDOMNamedNodeMap interface.
|
// Helper class that implements the nsIDOMNamedNodeMap interface.
|
||||||
class nsDOMAttributeMap : public nsIDOMNamedNodeMap,
|
class nsDOMAttributeMap : public nsIDOMNamedNodeMap
|
||||||
public nsIScriptObjectOwner
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsDOMAttributeMap(nsIContent* aContent);
|
nsDOMAttributeMap(nsIContent* aContent);
|
||||||
|
@ -40,21 +38,8 @@ public:
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject);
|
|
||||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
|
||||||
|
|
||||||
// nsIDOMNamedNodeMap interface
|
// nsIDOMNamedNodeMap interface
|
||||||
NS_IMETHOD GetLength(PRUint32* aSize);
|
NS_DECL_NSIDOMNAMEDNODEMAP
|
||||||
NS_IMETHOD GetNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn);
|
|
||||||
NS_IMETHOD SetNamedItem(nsIDOMNode* aNode, nsIDOMNode** aReturn);
|
|
||||||
NS_IMETHOD RemoveNamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn);
|
|
||||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn);
|
|
||||||
NS_IMETHOD GetNamedItemNS(const nsAReadableString& aNamespaceURI,
|
|
||||||
const nsAReadableString& aLocalName, nsIDOMNode** aReturn);
|
|
||||||
NS_IMETHOD SetNamedItemNS(nsIDOMNode* aArg, nsIDOMNode** aReturn);
|
|
||||||
NS_IMETHOD RemoveNamedItemNS(const nsAReadableString& aNamespaceURI,
|
|
||||||
const nsAReadableString& aLocalName,
|
|
||||||
nsIDOMNode** aReturn);
|
|
||||||
|
|
||||||
void DropReference();
|
void DropReference();
|
||||||
|
|
||||||
|
@ -65,8 +50,7 @@ public:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsIContent* mContent;
|
nsIContent* mContent; // Weak reference
|
||||||
void* mScriptObject;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,10 @@
|
||||||
#include "nsDOMDocumentType.h"
|
#include "nsDOMDocumentType.h"
|
||||||
#include "nsDOMAttributeMap.h"
|
#include "nsDOMAttributeMap.h"
|
||||||
#include "nsIDOMNamedNodeMap.h"
|
#include "nsIDOMNamedNodeMap.h"
|
||||||
#include "nsIDOMScriptObjectFactory.h"
|
|
||||||
#include "nsLayoutAtoms.h"
|
#include "nsLayoutAtoms.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
#include "nsContentUtils.h"
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
|
NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
|
||||||
|
@ -38,8 +39,8 @@ NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aDocType);
|
NS_ENSURE_ARG_POINTER(aDocType);
|
||||||
|
|
||||||
*aDocType = new nsDOMDocumentType(aName, aEntities, aNotations,
|
*aDocType = new nsDOMDocumentType(aName, aEntities, aNotations, aPublicId,
|
||||||
aPublicId, aSystemId, aInternalSubset);
|
aSystemId, aInternalSubset);
|
||||||
if (!*aDocType) {
|
if (!*aDocType) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -75,16 +76,27 @@ nsDOMDocumentType::~nsDOMDocumentType()
|
||||||
NS_IF_RELEASE(mNotations);
|
NS_IF_RELEASE(mNotations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// XPConnect interface list for nsDOMDocumentType
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(DocumentType)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMDocumentType)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOM3Node)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsDOMDocumentType
|
||||||
|
NS_INTERFACE_MAP_BEGIN(nsDOMDocumentType)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIContent)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNode)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentType)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3Node, nsNode3Tearoff(this))
|
||||||
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsDOMDocumentType)
|
NS_IMPL_ADDREF(nsDOMDocumentType)
|
||||||
NS_IMPL_RELEASE(nsDOMDocumentType)
|
NS_IMPL_RELEASE(nsDOMDocumentType)
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN(nsDOMDocumentType)
|
|
||||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMDocumentType)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentType)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNode)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIContent)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner)
|
|
||||||
NS_INTERFACE_MAP_END_THREADSAFE
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMDocumentType::GetName(nsAWritableString& aName)
|
nsDOMDocumentType::GetName(nsAWritableString& aName)
|
||||||
|
@ -137,6 +149,7 @@ nsDOMDocumentType::GetSystemId(nsAWritableString& aSystemId)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMDocumentType::GetInternalSubset(nsAWritableString& aInternalSubset)
|
nsDOMDocumentType::GetInternalSubset(nsAWritableString& aInternalSubset)
|
||||||
{
|
{
|
||||||
|
// XXX: null string
|
||||||
aInternalSubset = mInternalSubset;
|
aInternalSubset = mInternalSubset;
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -266,3 +279,9 @@ nsDOMDocumentType::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
|
||||||
#endif
|
#endif
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP_(PRBool)
|
||||||
|
nsDOMDocumentType::IsContentOfType(PRUint32 aFlags)
|
||||||
|
{
|
||||||
|
return !(aFlags & ~eTEXT);
|
||||||
|
}
|
||||||
|
|
|
@ -24,17 +24,13 @@
|
||||||
#define nsDOMDocumentType_h___
|
#define nsDOMDocumentType_h___
|
||||||
|
|
||||||
#include "nsIDOMDocumentType.h"
|
#include "nsIDOMDocumentType.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsGenericDOMDataNode.h"
|
#include "nsGenericDOMDataNode.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsISizeOfHandler.h"
|
#include "nsISizeOfHandler.h"
|
||||||
|
|
||||||
class nsIDOMNamedNodeMap;
|
class nsDOMDocumentType : public nsIContent,
|
||||||
|
public nsIDOMDocumentType
|
||||||
class nsDOMDocumentType : public nsIDOMDocumentType,
|
|
||||||
public nsIScriptObjectOwner,
|
|
||||||
public nsIContent
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsDOMDocumentType(const nsAReadableString& aName,
|
nsDOMDocumentType(const nsAReadableString& aName,
|
||||||
|
@ -50,13 +46,10 @@ public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_IMPL_IDOMNODE_USING_GENERIC_DOM_DATA(mInner)
|
NS_IMPL_NSIDOMNODE_USING_GENERIC_DOM_DATA(mInner)
|
||||||
|
|
||||||
// nsIDOMDocumentType
|
// nsIDOMDocumentType
|
||||||
NS_DECL_IDOMDOCUMENTTYPE
|
NS_DECL_NSIDOMDOCUMENTTYPE
|
||||||
|
|
||||||
// nsIScriptObjectOwner interface
|
|
||||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC_DOM_DATA(mInner);
|
|
||||||
|
|
||||||
// nsIContent
|
// nsIContent
|
||||||
NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner)
|
NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner)
|
||||||
|
@ -77,12 +70,13 @@ protected:
|
||||||
nsString mInternalSubset;
|
nsString mInternalSubset;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern nsresult NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
|
extern nsresult
|
||||||
const nsAReadableString& aName,
|
NS_NewDOMDocumentType(nsIDOMDocumentType** aDocType,
|
||||||
nsIDOMNamedNodeMap *aEntities,
|
const nsAReadableString& aName,
|
||||||
nsIDOMNamedNodeMap *aNotations,
|
nsIDOMNamedNodeMap *aEntities,
|
||||||
const nsAReadableString& aPublicId,
|
nsIDOMNamedNodeMap *aNotations,
|
||||||
const nsAReadableString& aSystemId,
|
const nsAReadableString& aPublicId,
|
||||||
const nsAReadableString& aInternalSubset);
|
const nsAReadableString& aSystemId,
|
||||||
|
const nsAReadableString& aInternalSubset);
|
||||||
|
|
||||||
#endif // nsDOMDocument_h___
|
#endif // nsDOMDocument_h___
|
||||||
|
|
|
@ -46,13 +46,13 @@
|
||||||
#include "nsIEventStateManager.h"
|
#include "nsIEventStateManager.h"
|
||||||
#include "nsContentList.h"
|
#include "nsContentList.h"
|
||||||
#include "nsIObserver.h"
|
#include "nsIObserver.h"
|
||||||
|
#include "nsIBaseWindow.h"
|
||||||
|
|
||||||
#include "nsIDOMEventListener.h"
|
#include "nsIDOMEventListener.h"
|
||||||
|
|
||||||
#include "nsIDOMStyleSheet.h"
|
#include "nsIDOMStyleSheet.h"
|
||||||
#include "nsDOMAttribute.h"
|
#include "nsDOMAttribute.h"
|
||||||
#include "nsDOMCID.h"
|
#include "nsDOMCID.h"
|
||||||
#include "nsIDOMScriptObjectFactory.h"
|
|
||||||
#include "nsIDOMDOMImplementation.h"
|
#include "nsIDOMDOMImplementation.h"
|
||||||
#include "nsIDOMDocumentView.h"
|
#include "nsIDOMDocumentView.h"
|
||||||
#include "nsIDOMAbstractView.h"
|
#include "nsIDOMAbstractView.h"
|
||||||
|
@ -127,7 +127,6 @@ nsDOMStyleSheetList::nsDOMStyleSheetList(nsIDocument *aDocument)
|
||||||
// The document will tell us when its going away.
|
// The document will tell us when its going away.
|
||||||
mDocument = aDocument;
|
mDocument = aDocument;
|
||||||
mDocument->AddObserver(this);
|
mDocument->AddObserver(this);
|
||||||
mScriptObject = nsnull;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDOMStyleSheetList::~nsDOMStyleSheetList()
|
nsDOMStyleSheetList::~nsDOMStyleSheetList()
|
||||||
|
@ -138,15 +137,27 @@ nsDOMStyleSheetList::~nsDOMStyleSheetList()
|
||||||
mDocument = nsnull;
|
mDocument = nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// XXX couldn't we use the GetIIDs method from CSSStyleSheetList here?
|
||||||
|
// XPConnect interface list for nsDOMStyleSheetList
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(DocumentStyleSheetList)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMStyleSheetList)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsDOMStyleSheetList
|
||||||
|
NS_INTERFACE_MAP_BEGIN(nsDOMStyleSheetList)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMStyleSheetList)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDocumentObserver)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMStyleSheetList)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_WITH_NAME(DocumentStyleSheetList,
|
||||||
|
StyleSheetList)
|
||||||
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsDOMStyleSheetList)
|
NS_IMPL_ADDREF(nsDOMStyleSheetList)
|
||||||
NS_IMPL_RELEASE(nsDOMStyleSheetList)
|
NS_IMPL_RELEASE(nsDOMStyleSheetList)
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN(nsDOMStyleSheetList)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMStyleSheetList)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDocumentObserver)
|
|
||||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMStyleSheetList)
|
|
||||||
NS_INTERFACE_MAP_END
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMStyleSheetList::GetLength(PRUint32* aLength)
|
nsDOMStyleSheetList::GetLength(PRUint32* aLength)
|
||||||
|
@ -207,33 +218,6 @@ nsDOMStyleSheetList::Item(PRUint32 aIndex, nsIDOMStyleSheet** aReturn)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDOMStyleSheetList::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
|
|
||||||
{
|
|
||||||
nsresult res = NS_OK;
|
|
||||||
|
|
||||||
if (nsnull == mScriptObject) {
|
|
||||||
nsISupports *supports = (nsISupports *)(nsIDOMStyleSheetList *)this;
|
|
||||||
nsISupports *parent = (nsISupports *)mDocument;
|
|
||||||
|
|
||||||
// XXX Should be done through factory
|
|
||||||
res = NS_NewScriptStyleSheetList(aContext,
|
|
||||||
supports,
|
|
||||||
parent,
|
|
||||||
(void**)&mScriptObject);
|
|
||||||
}
|
|
||||||
*aScriptObject = mScriptObject;
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDOMStyleSheetList::SetScriptObject(void* aScriptObject)
|
|
||||||
{
|
|
||||||
mScriptObject = aScriptObject;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMStyleSheetList::StyleSheetAdded(nsIDocument *aDocument,
|
nsDOMStyleSheetList::StyleSheetAdded(nsIDocument *aDocument,
|
||||||
nsIStyleSheet* aStyleSheet)
|
nsIStyleSheet* aStyleSheet)
|
||||||
|
@ -277,7 +261,6 @@ nsDOMStyleSheetList::DocumentWillBeDestroyed(nsIDocument *aDocument)
|
||||||
// ==================================================================
|
// ==================================================================
|
||||||
|
|
||||||
class nsDOMImplementation : public nsIDOMDOMImplementation,
|
class nsDOMImplementation : public nsIDOMDOMImplementation,
|
||||||
public nsIScriptObjectOwner,
|
|
||||||
public nsIPrivateDOMImplementation
|
public nsIPrivateDOMImplementation
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -300,15 +283,10 @@ public:
|
||||||
nsIDOMDocumentType* aDoctype,
|
nsIDOMDocumentType* aDoctype,
|
||||||
nsIDOMDocument** aReturn);
|
nsIDOMDocument** aReturn);
|
||||||
|
|
||||||
// nsIScriptObjectOwner
|
|
||||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
|
||||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
|
||||||
|
|
||||||
//nsIPrivateDOMImplementation
|
//nsIPrivateDOMImplementation
|
||||||
NS_IMETHOD Init(nsIURI* aBaseURI);
|
NS_IMETHOD Init(nsIURI* aBaseURI);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void *mScriptObject;
|
|
||||||
nsCOMPtr<nsIURI> mBaseURI;
|
nsCOMPtr<nsIURI> mBaseURI;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -325,7 +303,6 @@ NS_NewDOMImplementation(nsIDOMDOMImplementation** aInstancePtrResult)
|
||||||
nsDOMImplementation::nsDOMImplementation(nsIURI* aBaseURI)
|
nsDOMImplementation::nsDOMImplementation(nsIURI* aBaseURI)
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
mScriptObject = nsnull;
|
|
||||||
mBaseURI = aBaseURI;
|
mBaseURI = aBaseURI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,7 +310,24 @@ nsDOMImplementation::~nsDOMImplementation()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS4(nsDOMImplementation, nsIDOMDOMImplementation, nsIPrivateDOMImplementation, nsIScriptObjectOwner, nsIDOMDOMImplementation)
|
|
||||||
|
// XPConnect interface list for nsDOMImplementation
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(DOMImplementation)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMDOMImplementation)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsDOMImplementation
|
||||||
|
NS_INTERFACE_MAP_BEGIN(nsDOMImplementation)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMDOMImplementation)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIPrivateDOMImplementation)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMDOMImplementation)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(DOMImplementation)
|
||||||
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
NS_IMPL_ADDREF(nsDOMImplementation);
|
||||||
|
NS_IMPL_RELEASE(nsDOMImplementation);
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -362,7 +356,7 @@ nsDOMImplementation::CreateDocument(const nsAReadableString& aNamespaceURI,
|
||||||
nsIDOMDocumentType* aDoctype,
|
nsIDOMDocumentType* aDoctype,
|
||||||
nsIDOMDocument** aReturn)
|
nsIDOMDocument** aReturn)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aReturn);
|
NS_ENSURE_ARG_POINTER(aReturn);
|
||||||
|
|
||||||
*aReturn = nsnull;
|
*aReturn = nsnull;
|
||||||
|
|
||||||
|
@ -370,34 +364,6 @@ nsDOMImplementation::CreateDocument(const nsAReadableString& aNamespaceURI,
|
||||||
mBaseURI);
|
mBaseURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDOMImplementation::GetScriptObject(nsIScriptContext *aContext,
|
|
||||||
void** aScriptObject)
|
|
||||||
{
|
|
||||||
nsresult result = NS_OK;
|
|
||||||
|
|
||||||
if (!mScriptObject) {
|
|
||||||
nsCOMPtr<nsIDOMScriptObjectFactory> factory(do_GetService(kDOMScriptObjectFactoryCID, &result));
|
|
||||||
|
|
||||||
if (NS_OK == result) {
|
|
||||||
nsCOMPtr<nsIScriptGlobalObject> global(dont_AddRef(aContext->GetGlobalObject()));
|
|
||||||
|
|
||||||
result = factory->NewScriptDOMImplementation(aContext, (nsISupports*)(nsIDOMDOMImplementation*)this,
|
|
||||||
global, &mScriptObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*aScriptObject = mScriptObject;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDOMImplementation::SetScriptObject(void *aScriptObject)
|
|
||||||
{
|
|
||||||
mScriptObject = nsnull;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMImplementation::Init(nsIURI* aBaseURI)
|
nsDOMImplementation::Init(nsIURI* aBaseURI)
|
||||||
{
|
{
|
||||||
|
@ -409,8 +375,6 @@ nsDOMImplementation::Init(nsIURI* aBaseURI)
|
||||||
// =
|
// =
|
||||||
// ==================================================================
|
// ==================================================================
|
||||||
|
|
||||||
MOZ_DECL_CTOR_COUNTER(nsDocumentChildNodes)
|
|
||||||
|
|
||||||
nsDocumentChildNodes::nsDocumentChildNodes(nsIDocument* aDocument)
|
nsDocumentChildNodes::nsDocumentChildNodes(nsIDocument* aDocument)
|
||||||
{
|
{
|
||||||
MOZ_COUNT_CTOR(nsDocumentChildNodes);
|
MOZ_COUNT_CTOR(nsDocumentChildNodes);
|
||||||
|
@ -419,7 +383,7 @@ nsDocumentChildNodes::nsDocumentChildNodes(nsIDocument* aDocument)
|
||||||
// references). We'll be told when the document goes away.
|
// references). We'll be told when the document goes away.
|
||||||
mDocument = aDocument;
|
mDocument = aDocument;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDocumentChildNodes::~nsDocumentChildNodes()
|
nsDocumentChildNodes::~nsDocumentChildNodes()
|
||||||
{
|
{
|
||||||
MOZ_COUNT_DTOR(nsDocumentChildNodes);
|
MOZ_COUNT_DTOR(nsDocumentChildNodes);
|
||||||
|
@ -472,12 +436,10 @@ nsDocument::nsDocument()
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
|
|
||||||
mArena = nsnull;
|
mArena = nsnull;
|
||||||
mDocumentTitle = nsnull;
|
|
||||||
mDocumentURL = nsnull;
|
mDocumentURL = nsnull;
|
||||||
mCharacterSet.AssignWithConversion("ISO-8859-1");
|
mCharacterSet.AssignWithConversion("ISO-8859-1");
|
||||||
mParentDocument = nsnull;
|
mParentDocument = nsnull;
|
||||||
mRootContent = nsnull;
|
mRootContent = nsnull;
|
||||||
mScriptObject = nsnull;
|
|
||||||
mListenerManager = nsnull;
|
mListenerManager = nsnull;
|
||||||
mInDestructor = PR_FALSE;
|
mInDestructor = PR_FALSE;
|
||||||
mNameSpaceManager = nsnull;
|
mNameSpaceManager = nsnull;
|
||||||
|
@ -519,10 +481,6 @@ nsDocument::~nsDocument()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsnull != mDocumentTitle) {
|
|
||||||
delete mDocumentTitle;
|
|
||||||
mDocumentTitle = nsnull;
|
|
||||||
}
|
|
||||||
NS_IF_RELEASE(mDocumentURL);
|
NS_IF_RELEASE(mDocumentURL);
|
||||||
NS_IF_RELEASE(mPrincipal);
|
NS_IF_RELEASE(mPrincipal);
|
||||||
mDocumentLoadGroup = null_nsCOMPtr();
|
mDocumentLoadGroup = null_nsCOMPtr();
|
||||||
|
@ -571,6 +529,10 @@ nsDocument::~nsDocument()
|
||||||
NS_IF_RELEASE(mDTD);
|
NS_IF_RELEASE(mDTD);
|
||||||
|
|
||||||
delete mBoxObjectTable;
|
delete mBoxObjectTable;
|
||||||
|
|
||||||
|
if (mNodeInfoManager) {
|
||||||
|
mNodeInfoManager->DropDocumentReference();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN(nsDocument)
|
NS_INTERFACE_MAP_BEGIN(nsDocument)
|
||||||
|
@ -580,13 +542,13 @@ NS_INTERFACE_MAP_BEGIN(nsDocument)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentEvent)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentEvent)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentStyle)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentStyle)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentView)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentView)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentRange)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentXBL)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentXBL)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIJSScriptObject)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
|
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMEventReceiver)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNode)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNode)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOM3Node)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDiskDocument)
|
NS_INTERFACE_MAP_ENTRY(nsIDiskDocument)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDocument)
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDocument)
|
||||||
|
@ -615,7 +577,7 @@ nsresult nsDocument::Init()
|
||||||
mNodeInfoManager = new nsNodeInfoManager();
|
mNodeInfoManager = new nsNodeInfoManager();
|
||||||
NS_ENSURE_TRUE(mNodeInfoManager, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(mNodeInfoManager, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
mNodeInfoManager->Init(mNameSpaceManager);
|
mNodeInfoManager->Init(this, mNameSpaceManager);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -633,10 +595,8 @@ nsDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
if (nsnull != mDocumentTitle) {
|
mDocumentTitle.Truncate();
|
||||||
delete mDocumentTitle;
|
|
||||||
mDocumentTitle = nsnull;
|
|
||||||
}
|
|
||||||
NS_IF_RELEASE(mDocumentURL);
|
NS_IF_RELEASE(mDocumentURL);
|
||||||
NS_IF_RELEASE(mPrincipal);
|
NS_IF_RELEASE(mPrincipal);
|
||||||
mDocumentLoadGroup = null_nsCOMPtr();
|
mDocumentLoadGroup = null_nsCOMPtr();
|
||||||
|
@ -757,7 +717,7 @@ nsDocument::StopDocumentLoad()
|
||||||
|
|
||||||
const nsString* nsDocument::GetDocumentTitle() const
|
const nsString* nsDocument::GetDocumentTitle() const
|
||||||
{
|
{
|
||||||
return mDocumentTitle;
|
return &mDocumentTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIURI* nsDocument::GetDocumentURL() const
|
nsIURI* nsDocument::GetDocumentURL() const
|
||||||
|
@ -1403,6 +1363,13 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
|
||||||
|
|
||||||
shell->ReleaseAnonymousContent();
|
shell->ReleaseAnonymousContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_jst
|
||||||
|
printf ("Content wrapper hash had %d entries.\n",
|
||||||
|
mContentWrapperHash.Count());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
mContentWrapperHash.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
mScriptGlobalObject = aScriptGlobalObject;
|
mScriptGlobalObject = aScriptGlobalObject;
|
||||||
|
@ -1734,55 +1701,6 @@ nsDocument::StyleRuleRemoved(nsIStyleSheet* aStyleSheet, nsIStyleRule* aStyleRul
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nsresult nsDocument::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
|
|
||||||
{
|
|
||||||
nsresult res = NS_OK;
|
|
||||||
nsCOMPtr<nsIScriptGlobalObject> global;
|
|
||||||
|
|
||||||
if (nsnull == mScriptObject) {
|
|
||||||
// XXX We make the (possibly erroneous) assumption that the first
|
|
||||||
// presentation shell represents the "primary view" of the document
|
|
||||||
// and that the JS parent chain should incorporate just that view.
|
|
||||||
// This is done for lack of a better model when we have multiple
|
|
||||||
// views.
|
|
||||||
nsIPresShell* shell = (nsIPresShell*) mPresShells.ElementAt(0);
|
|
||||||
if (shell) {
|
|
||||||
nsCOMPtr<nsIPresContext> cx;
|
|
||||||
shell->GetPresContext(getter_AddRefs(cx));
|
|
||||||
nsCOMPtr<nsISupports> container;
|
|
||||||
|
|
||||||
res = cx->GetContainer(getter_AddRefs(container));
|
|
||||||
if (NS_SUCCEEDED(res) && container) {
|
|
||||||
global = do_GetInterface(container);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// XXX If we can't find a view, parent to the calling context's
|
|
||||||
// global object. This may not be right either, but we need
|
|
||||||
// something.
|
|
||||||
else {
|
|
||||||
global = getter_AddRefs(aContext->GetGlobalObject());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NS_SUCCEEDED(res)) {
|
|
||||||
res = NS_NewScriptDocument(aContext,
|
|
||||||
(nsISupports *)(nsIDOMDocument *)this,
|
|
||||||
(nsISupports *)global,
|
|
||||||
(void**)&mScriptObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*aScriptObject = mScriptObject;
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult nsDocument::SetScriptObject(void *aScriptObject)
|
|
||||||
{
|
|
||||||
mScriptObject = aScriptObject;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// nsIDOMDocument interface
|
// nsIDOMDocument interface
|
||||||
//
|
//
|
||||||
|
@ -1863,6 +1781,15 @@ nsDocument::CreateElement(const nsAReadableString& aTagName,
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsDocument::CreateElementNS(const nsAReadableString & namespaceURI,
|
||||||
|
const nsAReadableString & qualifiedName,
|
||||||
|
nsIDOMElement **_retval)
|
||||||
|
{
|
||||||
|
// Should be implemented by subclass
|
||||||
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocument::CreateTextNode(const nsAReadableString& aData, nsIDOMText** aReturn)
|
nsDocument::CreateTextNode(const nsAReadableString& aData, nsIDOMText** aReturn)
|
||||||
{
|
{
|
||||||
|
@ -1934,6 +1861,15 @@ nsDocument::CreateAttribute(const nsAReadableString& aName,
|
||||||
return attribute->QueryInterface(NS_GET_IID(nsIDOMAttr), (void**)aReturn);
|
return attribute->QueryInterface(NS_GET_IID(nsIDOMAttr), (void**)aReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsDocument::CreateAttributeNS(const nsAReadableString & namespaceURI,
|
||||||
|
const nsAReadableString & qualifiedName,
|
||||||
|
nsIDOMAttr **_retval)
|
||||||
|
{
|
||||||
|
// Should be implemented by subclass
|
||||||
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocument::CreateEntityReference(const nsAReadableString& aName,
|
nsDocument::CreateEntityReference(const nsAReadableString& aName,
|
||||||
nsIDOMEntityReference** aReturn)
|
nsIDOMEntityReference** aReturn)
|
||||||
|
@ -1983,6 +1919,14 @@ nsDocument::GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI,
|
||||||
return list->QueryInterface(NS_GET_IID(nsIDOMNodeList), (void **)aReturn);
|
return list->QueryInterface(NS_GET_IID(nsIDOMNodeList), (void **)aReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsDocument::GetElementById(const nsAReadableString & elementId,
|
||||||
|
nsIDOMElement **_retval)
|
||||||
|
{
|
||||||
|
// Should be implemented by subclass
|
||||||
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocument::GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets)
|
nsDocument::GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets)
|
||||||
{
|
{
|
||||||
|
@ -2146,30 +2090,6 @@ nsDocument::GetAnonymousNodes(nsIDOMElement* aElement,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDocument::GetLocation(jsval* aLocation)
|
|
||||||
{
|
|
||||||
if (mScriptGlobalObject) {
|
|
||||||
nsCOMPtr<nsIDOMWindowInternal> window(do_QueryInterface(mScriptGlobalObject));
|
|
||||||
if(window) {
|
|
||||||
return window->GetLocation(aLocation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDocument::SetLocation(jsval aLocation)
|
|
||||||
{
|
|
||||||
if (mScriptGlobalObject) {
|
|
||||||
nsCOMPtr<nsIDOMWindowInternal> window(do_QueryInterface(mScriptGlobalObject));
|
|
||||||
if(window) {
|
|
||||||
return window->SetLocation(aLocation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocument::CreateRange(nsIDOMRange** aReturn)
|
nsDocument::CreateRange(nsIDOMRange** aReturn)
|
||||||
{
|
{
|
||||||
|
@ -2249,6 +2169,59 @@ nsDocument::GetPlugins(nsIDOMPluginArray** aPlugins)
|
||||||
return navigator->GetPlugins(aPlugins);
|
return navigator->GetPlugins(aPlugins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsDocument::GetLocation(nsIDOMLocation **_retval)
|
||||||
|
{
|
||||||
|
NS_ENSURE_ARG_POINTER(_retval);
|
||||||
|
*_retval = nsnull;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDOMWindowInternal> w(do_QueryInterface(mScriptGlobalObject));
|
||||||
|
|
||||||
|
if(w) {
|
||||||
|
return w->GetLocation(_retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsDocument::GetTitle(nsAWritableString& aTitle)
|
||||||
|
{
|
||||||
|
aTitle.Assign(mDocumentTitle);
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsDocument::SetTitle(const nsAReadableString& aTitle)
|
||||||
|
{
|
||||||
|
for (PRInt32 i = mPresShells.Count() - 1; i >= 0; --i) {
|
||||||
|
nsIPresShell* shell = NS_STATIC_CAST(nsIPresShell*, mPresShells[i]);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIPresContext> context;
|
||||||
|
nsresult rv = shell->GetPresContext(getter_AddRefs(context));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
nsCOMPtr<nsISupports> container;
|
||||||
|
rv = context->GetContainer(getter_AddRefs(container));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
if (!container)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIBaseWindow> docShellWin = do_QueryInterface(container);
|
||||||
|
if(!docShellWin)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
rv = docShellWin->SetTitle(PromiseFlatString(aTitle).get());
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
}
|
||||||
|
|
||||||
|
mDocumentTitle.Assign(aTitle);
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocument::GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult)
|
nsDocument::GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult)
|
||||||
{
|
{
|
||||||
|
@ -2377,7 +2350,7 @@ nsDocument::GetDir(nsAWritableString& aDirection)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
aDirection.Assign(NS_LITERAL_STRING("ltr") );
|
aDirection.Assign(NS_LITERAL_STRING("ltr"));
|
||||||
#endif // IBMBIDI
|
#endif // IBMBIDI
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -2413,6 +2386,7 @@ nsDocument::SetDir(const nsAReadableString& aDirection)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// nsIDOMNode methods
|
// nsIDOMNode methods
|
||||||
//
|
//
|
||||||
|
@ -2426,7 +2400,8 @@ nsDocument::GetNodeName(nsAWritableString& aNodeName)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocument::GetNodeValue(nsAWritableString& aNodeValue)
|
nsDocument::GetNodeValue(nsAWritableString& aNodeValue)
|
||||||
{
|
{
|
||||||
aNodeValue.Truncate();
|
SetDOMStringToNull(aNodeValue);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2544,14 +2519,16 @@ nsDocument::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocument::GetNamespaceURI(nsAWritableString& aNamespaceURI)
|
nsDocument::GetNamespaceURI(nsAWritableString& aNamespaceURI)
|
||||||
{
|
{
|
||||||
aNamespaceURI.Truncate();
|
SetDOMStringToNull(aNamespaceURI);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocument::GetPrefix(nsAWritableString& aPrefix)
|
nsDocument::GetPrefix(nsAWritableString& aPrefix)
|
||||||
{
|
{
|
||||||
aPrefix.Truncate();
|
SetDOMStringToNull(aPrefix);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2564,7 +2541,8 @@ nsDocument::SetPrefix(const nsAReadableString& aPrefix)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocument::GetLocalName(nsAWritableString& aLocalName)
|
nsDocument::GetLocalName(nsAWritableString& aLocalName)
|
||||||
{
|
{
|
||||||
aLocalName.Truncate();
|
SetDOMStringToNull(aLocalName);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2767,7 +2745,6 @@ nsDocument::IsSupported(const nsAReadableString& aFeature,
|
||||||
return nsGenericElement::InternalIsSupported(aFeature, aVersion, aReturn);
|
return nsGenericElement::InternalIsSupported(aFeature, aVersion, aReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocument::GetBaseURI(nsAWritableString &aURI)
|
nsDocument::GetBaseURI(nsAWritableString &aURI)
|
||||||
{
|
{
|
||||||
|
@ -2781,7 +2758,6 @@ nsDocument::GetBaseURI(nsAWritableString &aURI)
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocument::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
|
nsDocument::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
|
||||||
|
@ -2980,6 +2956,7 @@ nsDocument::CreateEvent(const nsAReadableString& aEventType, nsIDOMEvent** aRetu
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
PRBool nsDocument::AddProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp)
|
PRBool nsDocument::AddProperty(JSContext *aContext, JSObject *aObj, jsval aID, jsval *aVp)
|
||||||
{
|
{
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
|
@ -3073,16 +3050,7 @@ PRBool nsDocument::InternalRegisterCompileEventHandler(JSContext* aContext, jsv
|
||||||
}
|
}
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
/**
|
|
||||||
* Finds text in content
|
|
||||||
*/
|
|
||||||
NS_IMETHODIMP nsDocument::FindNext(const nsAReadableString& aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound)
|
|
||||||
{
|
|
||||||
aIsFound = PR_FALSE;
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocument::InitDiskDocument(nsIFile *aFile)
|
nsDocument::InitDiskDocument(nsIFile *aFile)
|
||||||
|
@ -3268,39 +3236,27 @@ nsDocument::GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
//
|
nsDocument::AddReference(void *aKey, nsISupports *aReference)
|
||||||
// FindContent does a depth-first search from aStartNode
|
|
||||||
// and returns the first of aTest1 or aTest2 which it finds.
|
|
||||||
// I think.
|
|
||||||
//
|
|
||||||
nsIContent* nsDocument::FindContent(const nsIContent* aStartNode,
|
|
||||||
const nsIContent* aTest1,
|
|
||||||
const nsIContent* aTest2) const
|
|
||||||
{
|
{
|
||||||
PRInt32 count;
|
nsVoidKey key(aKey);
|
||||||
aStartNode->ChildCount(count);
|
|
||||||
PRInt32 indx;
|
|
||||||
|
|
||||||
for(indx = 0; indx < count;indx++)
|
if (mScriptGlobalObject) {
|
||||||
{
|
mContentWrapperHash.Put(&key, aReference);
|
||||||
nsIContent* child;
|
|
||||||
aStartNode->ChildAt(indx, child);
|
|
||||||
nsIContent* content = FindContent(child,aTest1,aTest2);
|
|
||||||
if (content != nsnull) {
|
|
||||||
NS_IF_RELEASE(child);
|
|
||||||
return content;
|
|
||||||
}
|
|
||||||
if (child == aTest1 || child == aTest2) {
|
|
||||||
NS_IF_RELEASE(content);
|
|
||||||
return child;
|
|
||||||
}
|
|
||||||
NS_IF_RELEASE(child);
|
|
||||||
NS_IF_RELEASE(content);
|
|
||||||
}
|
}
|
||||||
return nsnull;
|
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsDocument::RemoveReference(void *aKey, nsISupports **aOldReference)
|
||||||
|
{
|
||||||
|
nsVoidKey key(aKey);
|
||||||
|
|
||||||
|
mContentWrapperHash.Remove(&key, aOldReference);
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocument::GetDTD(nsIDTD** aDTD) const
|
nsDocument::GetDTD(nsIDTD** aDTD) const
|
||||||
|
|
|
@ -31,14 +31,13 @@
|
||||||
#include "nsIDOMDocumentXBL.h"
|
#include "nsIDOMDocumentXBL.h"
|
||||||
#include "nsIDOMNSDocument.h"
|
#include "nsIDOMNSDocument.h"
|
||||||
#include "nsIDOMDocumentStyle.h"
|
#include "nsIDOMDocumentStyle.h"
|
||||||
|
#include "nsIDOMDocumentRange.h"
|
||||||
#include "nsIDocumentObserver.h"
|
#include "nsIDocumentObserver.h"
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIDiskDocument.h"
|
#include "nsIDiskDocument.h"
|
||||||
#include "nsIDOMStyleSheetList.h"
|
#include "nsIDOMStyleSheetList.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIScriptGlobalObject.h"
|
#include "nsIScriptGlobalObject.h"
|
||||||
#include "nsIDOMEventTarget.h"
|
#include "nsIDOMEventTarget.h"
|
||||||
#include "nsIJSScriptObject.h"
|
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsGenericDOMNodeList.h"
|
#include "nsGenericDOMNodeList.h"
|
||||||
#include "nsIPrincipal.h"
|
#include "nsIPrincipal.h"
|
||||||
|
@ -49,6 +48,7 @@
|
||||||
#include "nsHashtable.h"
|
#include "nsHashtable.h"
|
||||||
#include "nsIWordBreakerFactory.h"
|
#include "nsIWordBreakerFactory.h"
|
||||||
#include "nsILineBreakerFactory.h"
|
#include "nsILineBreakerFactory.h"
|
||||||
|
#include "nsIScriptObjectPrincipal.h"
|
||||||
#include "nsIURI.h"
|
#include "nsIURI.h"
|
||||||
|
|
||||||
class nsIEventListenerManager;
|
class nsIEventListenerManager;
|
||||||
|
@ -57,6 +57,7 @@ class nsIOutputStream;
|
||||||
class nsDocument;
|
class nsDocument;
|
||||||
class nsIDTD;
|
class nsIDTD;
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
class nsPostData : public nsIPostData {
|
class nsPostData : public nsIPostData {
|
||||||
public:
|
public:
|
||||||
|
@ -120,7 +121,6 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
class nsDOMStyleSheetList : public nsIDOMStyleSheetList,
|
class nsDOMStyleSheetList : public nsIDOMStyleSheetList,
|
||||||
public nsIScriptObjectOwner,
|
|
||||||
public nsIDocumentObserver
|
public nsIDocumentObserver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -128,7 +128,8 @@ public:
|
||||||
virtual ~nsDOMStyleSheetList();
|
virtual ~nsDOMStyleSheetList();
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
NS_DECL_IDOMSTYLESHEETLIST
|
|
||||||
|
NS_DECL_NSIDOMSTYLESHEETLIST
|
||||||
|
|
||||||
NS_IMETHOD BeginUpdate(nsIDocument *aDocument) { return NS_OK; }
|
NS_IMETHOD BeginUpdate(nsIDocument *aDocument) { return NS_OK; }
|
||||||
NS_IMETHOD EndUpdate(nsIDocument *aDocument) { return NS_OK; }
|
NS_IMETHOD EndUpdate(nsIDocument *aDocument) { return NS_OK; }
|
||||||
|
@ -185,10 +186,6 @@ public:
|
||||||
nsIStyleRule* aStyleRule) { return NS_OK; }
|
nsIStyleRule* aStyleRule) { return NS_OK; }
|
||||||
NS_IMETHOD DocumentWillBeDestroyed(nsIDocument *aDocument);
|
NS_IMETHOD DocumentWillBeDestroyed(nsIDocument *aDocument);
|
||||||
|
|
||||||
// nsIScriptObjectOwner interface
|
|
||||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
|
||||||
NS_IMETHOD SetScriptObject(void* aScriptObject);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PRInt32 mLength;
|
PRInt32 mLength;
|
||||||
nsIDocument* mDocument;
|
nsIDocument* mDocument;
|
||||||
|
@ -202,9 +199,10 @@ class nsDocument : public nsIDocument,
|
||||||
public nsIDOMDocumentEvent,
|
public nsIDOMDocumentEvent,
|
||||||
public nsIDOMDocumentStyle,
|
public nsIDOMDocumentStyle,
|
||||||
public nsIDOMDocumentView,
|
public nsIDOMDocumentView,
|
||||||
|
public nsIDOMDocumentRange,
|
||||||
public nsIDOMDocumentXBL,
|
public nsIDOMDocumentXBL,
|
||||||
|
public nsIDOM3Node,
|
||||||
public nsIDiskDocument,
|
public nsIDiskDocument,
|
||||||
public nsIJSScriptObject,
|
|
||||||
public nsSupportsWeakReference,
|
public nsSupportsWeakReference,
|
||||||
public nsIDOMEventReceiver,
|
public nsIDOMEventReceiver,
|
||||||
public nsIScriptObjectPrincipal
|
public nsIScriptObjectPrincipal
|
||||||
|
@ -309,8 +307,10 @@ public:
|
||||||
* Access HTTP header data (this may also get set from other sources, like
|
* Access HTTP header data (this may also get set from other sources, like
|
||||||
* HTML META tags).
|
* HTML META tags).
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField, nsAWritableString& aData) const;
|
NS_IMETHOD GetHeaderData(nsIAtom* aHeaderField,
|
||||||
NS_IMETHOD SetHeaderData(nsIAtom* aheaderField, const nsAReadableString& aData);
|
nsAWritableString& aData) const;
|
||||||
|
NS_IMETHOD SetHeaderData(nsIAtom* aheaderField,
|
||||||
|
const nsAReadableString& aData);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new presentation shell that will use aContext for
|
* Create a new presentation shell that will use aContext for
|
||||||
|
@ -362,11 +362,13 @@ public:
|
||||||
virtual void AddStyleSheet(nsIStyleSheet* aSheet);
|
virtual void AddStyleSheet(nsIStyleSheet* aSheet);
|
||||||
virtual void RemoveStyleSheet(nsIStyleSheet* aSheet);
|
virtual void RemoveStyleSheet(nsIStyleSheet* aSheet);
|
||||||
|
|
||||||
NS_IMETHOD UpdateStyleSheets(nsISupportsArray* aOldSheets, nsISupportsArray* aNewSheets);
|
NS_IMETHOD UpdateStyleSheets(nsISupportsArray* aOldSheets,
|
||||||
|
nsISupportsArray* aNewSheets);
|
||||||
virtual void AddStyleSheetToStyleSets(nsIStyleSheet* aSheet);
|
virtual void AddStyleSheetToStyleSets(nsIStyleSheet* aSheet);
|
||||||
virtual void RemoveStyleSheetFromStyleSets(nsIStyleSheet* aSheet);
|
virtual void RemoveStyleSheetFromStyleSets(nsIStyleSheet* aSheet);
|
||||||
|
|
||||||
NS_IMETHOD InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex, PRBool aNotify);
|
NS_IMETHOD InsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex,
|
||||||
|
PRBool aNotify);
|
||||||
virtual void SetStyleSheetDisabledState(nsIStyleSheet* aSheet,
|
virtual void SetStyleSheetDisabledState(nsIStyleSheet* aSheet,
|
||||||
PRBool mDisabled);
|
PRBool mDisabled);
|
||||||
|
|
||||||
|
@ -435,74 +437,47 @@ public:
|
||||||
NS_IMETHOD StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
|
NS_IMETHOD StyleRuleRemoved(nsIStyleSheet* aStyleSheet,
|
||||||
nsIStyleRule* aStyleRule);
|
nsIStyleRule* aStyleRule);
|
||||||
|
|
||||||
/**
|
|
||||||
* Finds text in content
|
|
||||||
*/
|
|
||||||
NS_IMETHOD FindNext(const nsAReadableString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound);
|
|
||||||
|
|
||||||
NS_IMETHOD FlushPendingNotifications(PRBool aFlushReflows = PR_TRUE);
|
NS_IMETHOD FlushPendingNotifications(PRBool aFlushReflows = PR_TRUE);
|
||||||
NS_IMETHOD GetAndIncrementContentID(PRInt32* aID);
|
NS_IMETHOD GetAndIncrementContentID(PRInt32* aID);
|
||||||
NS_IMETHOD GetBindingManager(nsIBindingManager** aResult);
|
NS_IMETHOD GetBindingManager(nsIBindingManager** aResult);
|
||||||
NS_IMETHOD GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager);
|
NS_IMETHOD GetNodeInfoManager(nsINodeInfoManager*& aNodeInfoManager);
|
||||||
|
NS_IMETHOD AddReference(void *aKey, nsISupports *aReference);
|
||||||
|
NS_IMETHOD RemoveReference(void *aKey, nsISupports **aOldReference);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
// nsIDOMNode
|
||||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
NS_DECL_NSIDOMNODE
|
||||||
|
|
||||||
// nsIDOMDocument interface
|
// nsIDOM3Node
|
||||||
NS_IMETHOD GetDoctype(nsIDOMDocumentType** aDoctype);
|
NS_DECL_NSIDOM3NODE
|
||||||
NS_IMETHOD GetImplementation(nsIDOMDOMImplementation** aImplementation);
|
|
||||||
NS_IMETHOD GetDocumentElement(nsIDOMElement** aDocumentElement);
|
|
||||||
|
|
||||||
NS_IMETHOD CreateElement(const nsAReadableString& aTagName, nsIDOMElement** aReturn);
|
// nsIDOMDocument
|
||||||
NS_IMETHOD CreateDocumentFragment(nsIDOMDocumentFragment** aReturn);
|
NS_DECL_NSIDOMDOCUMENT
|
||||||
NS_IMETHOD CreateTextNode(const nsAReadableString& aData, nsIDOMText** aReturn);
|
|
||||||
NS_IMETHOD CreateComment(const nsAReadableString& aData, nsIDOMComment** aReturn);
|
|
||||||
NS_IMETHOD CreateCDATASection(const nsAReadableString& aData, nsIDOMCDATASection** aReturn);
|
|
||||||
NS_IMETHOD CreateProcessingInstruction(const nsAReadableString& aTarget, const nsAReadableString& aData, nsIDOMProcessingInstruction** aReturn);
|
|
||||||
NS_IMETHOD CreateAttribute(const nsAReadableString& aName, nsIDOMAttr** aReturn);
|
|
||||||
NS_IMETHOD CreateEntityReference(const nsAReadableString& aName, nsIDOMEntityReference** aReturn);
|
|
||||||
NS_IMETHOD GetElementsByTagName(const nsAReadableString& aTagname, nsIDOMNodeList** aReturn);
|
|
||||||
NS_IMETHOD GetElementsByTagNameNS(const nsAReadableString& aNamespaceURI, const nsAReadableString& aLocalName, nsIDOMNodeList** aReturn);
|
|
||||||
NS_IMETHOD GetStyleSheets(nsIDOMStyleSheetList** aStyleSheets);
|
|
||||||
NS_IMETHOD GetCharacterSet(nsAWritableString& aCharacterSet);
|
|
||||||
NS_IMETHOD ImportNode(nsIDOMNode* aImportedNode,
|
|
||||||
PRBool aDeep,
|
|
||||||
nsIDOMNode** aReturn);
|
|
||||||
NS_IMETHOD GetLocation(jsval* aLocation);
|
|
||||||
NS_IMETHOD SetLocation(jsval aLocation);
|
|
||||||
NS_IMETHOD CreateRange(nsIDOMRange** aReturn);
|
|
||||||
NS_IMETHOD Load (const nsAReadableString& aUrl);
|
|
||||||
NS_IMETHOD GetPlugins(nsIDOMPluginArray** aPlugins);
|
|
||||||
NS_IMETHOD GetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject** aResult);
|
|
||||||
NS_IMETHOD SetBoxObjectFor(nsIDOMElement* aElement, nsIBoxObject* aBoxObject);
|
|
||||||
|
|
||||||
/**
|
// nsIDOMNSDocument
|
||||||
* Retrieve the "direction" property of the document.
|
NS_DECL_NSIDOMNSDOCUMENT
|
||||||
*/
|
|
||||||
NS_IMETHOD GetDir(nsAWritableString& aDirection);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the "direction" property of the document.
|
|
||||||
*/
|
|
||||||
NS_IMETHOD SetDir(const nsAReadableString& aDirection);
|
|
||||||
|
|
||||||
// nsIDOMNode interface
|
|
||||||
NS_DECL_IDOMNODE
|
|
||||||
|
|
||||||
// nsIDOMDocumentView
|
|
||||||
NS_DECL_IDOMDOCUMENTVIEW
|
|
||||||
|
|
||||||
// nsIDOMDocumentXBL
|
|
||||||
NS_DECL_IDOMDOCUMENTXBL
|
|
||||||
|
|
||||||
// nsIDOMDocumentEvent
|
// nsIDOMDocumentEvent
|
||||||
NS_DECL_IDOMDOCUMENTEVENT
|
NS_DECL_NSIDOMDOCUMENTEVENT
|
||||||
|
|
||||||
|
// nsIDOMDocumentStyle
|
||||||
|
NS_DECL_NSIDOMDOCUMENTSTYLE
|
||||||
|
|
||||||
|
// nsIDOMDocumentView
|
||||||
|
NS_DECL_NSIDOMDOCUMENTVIEW
|
||||||
|
|
||||||
|
// nsIDOMDocumentRange
|
||||||
|
NS_DECL_NSIDOMDOCUMENTRANGE
|
||||||
|
|
||||||
|
// nsIDOMDocumentXBL
|
||||||
|
NS_DECL_NSIDOMDOCUMENTXBL
|
||||||
|
|
||||||
// nsIDOMEventReceiver interface
|
// nsIDOMEventReceiver interface
|
||||||
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
|
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,
|
||||||
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
|
const nsIID& aIID);
|
||||||
|
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener,
|
||||||
|
const nsIID& aIID);
|
||||||
NS_IMETHOD GetListenerManager(nsIEventListenerManager** aInstancePtrResult);
|
NS_IMETHOD GetListenerManager(nsIEventListenerManager** aInstancePtrResult);
|
||||||
NS_IMETHOD GetNewListenerManager(nsIEventListenerManager **aInstancePtrResult);
|
NS_IMETHOD GetNewListenerManager(nsIEventListenerManager **aInstancePtrResult);
|
||||||
NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent);
|
NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent);
|
||||||
|
@ -511,9 +486,11 @@ public:
|
||||||
NS_DECL_NSIDISKDOCUMENT
|
NS_DECL_NSIDISKDOCUMENT
|
||||||
|
|
||||||
// nsIDOMEventTarget interface
|
// nsIDOMEventTarget interface
|
||||||
NS_IMETHOD AddEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener,
|
NS_IMETHOD AddEventListener(const nsAReadableString& aType,
|
||||||
|
nsIDOMEventListener* aListener,
|
||||||
PRBool aUseCapture);
|
PRBool aUseCapture);
|
||||||
NS_IMETHOD RemoveEventListener(const nsAReadableString& aType, nsIDOMEventListener* aListener,
|
NS_IMETHOD RemoveEventListener(const nsAReadableString& aType,
|
||||||
|
nsIDOMEventListener* aListener,
|
||||||
PRBool aUseCapture);
|
PRBool aUseCapture);
|
||||||
NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent);
|
NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent);
|
||||||
|
|
||||||
|
@ -527,43 +504,23 @@ public:
|
||||||
NS_IMETHOD_(PRBool) EventCaptureRegistration(PRInt32 aCapturerIncrement);
|
NS_IMETHOD_(PRBool) EventCaptureRegistration(PRInt32 aCapturerIncrement);
|
||||||
|
|
||||||
|
|
||||||
// nsIJSScriptObject interface
|
|
||||||
virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj,
|
|
||||||
jsval aID, jsval *aVp);
|
|
||||||
virtual PRBool DeleteProperty(JSContext *aContext,
|
|
||||||
JSObject *aObj, jsval aID, jsval *aVp);
|
|
||||||
virtual PRBool GetProperty(JSContext *aContext, JSObject *aObj,
|
|
||||||
jsval aID, jsval *aVp);
|
|
||||||
virtual PRBool SetProperty(JSContext *aContext, JSObject *aObj,
|
|
||||||
jsval aID, jsval *aVp);
|
|
||||||
virtual PRBool EnumerateProperty(JSContext *aContext, JSObject *aObj);
|
|
||||||
virtual PRBool Resolve(JSContext *aContext, JSObject *aObj, jsval aID,
|
|
||||||
PRBool *aDidDefineProperty);
|
|
||||||
virtual PRBool Convert(JSContext *aContext, JSObject *aObj, jsval aID);
|
|
||||||
virtual void Finalize(JSContext *aContext, JSObject *aObj);
|
|
||||||
|
|
||||||
virtual nsresult SetDocumentURL(nsIURI* aURI);
|
virtual nsresult SetDocumentURL(nsIURI* aURI);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsIContent* FindContent(const nsIContent* aStartNode,
|
|
||||||
const nsIContent* aTest1,
|
|
||||||
const nsIContent* aTest2) const;
|
|
||||||
NS_IMETHOD GetDTD(nsIDTD** aDTD) const;
|
NS_IMETHOD GetDTD(nsIDTD** aDTD) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual void InternalAddStyleSheet(nsIStyleSheet* aSheet); // subclass hooks for sheet ordering
|
virtual void InternalAddStyleSheet(nsIStyleSheet* aSheet); // subclass hooks for sheet ordering
|
||||||
virtual void InternalInsertStyleSheetAt(nsIStyleSheet* aSheet, PRInt32 aIndex);
|
virtual void InternalInsertStyleSheetAt(nsIStyleSheet* aSheet,
|
||||||
|
PRInt32 aIndex);
|
||||||
virtual PRBool InternalRegisterCompileEventHandler(JSContext* aContext, jsval aPropName,
|
|
||||||
jsval *aVp, PRBool aCompile);
|
|
||||||
|
|
||||||
nsDocument();
|
nsDocument();
|
||||||
virtual ~nsDocument();
|
virtual ~nsDocument();
|
||||||
nsresult Init();
|
nsresult Init();
|
||||||
|
|
||||||
nsIArena* mArena;
|
nsIArena* mArena;
|
||||||
nsString* mDocumentTitle;
|
nsString mDocumentTitle;
|
||||||
nsIURI* mDocumentURL;
|
nsIURI* mDocumentURL;
|
||||||
nsCOMPtr<nsIURI> mDocumentBaseURL;
|
nsCOMPtr<nsIURI> mDocumentBaseURL;
|
||||||
nsIPrincipal* mPrincipal;
|
nsIPrincipal* mPrincipal;
|
||||||
|
@ -578,7 +535,6 @@ protected:
|
||||||
// mChildren, or null if no such element exists.
|
// mChildren, or null if no such element exists.
|
||||||
nsVoidArray mStyleSheets;
|
nsVoidArray mStyleSheets;
|
||||||
nsVoidArray mObservers;
|
nsVoidArray mObservers;
|
||||||
void* mScriptObject;
|
|
||||||
nsCOMPtr<nsIScriptGlobalObject> mScriptGlobalObject;
|
nsCOMPtr<nsIScriptGlobalObject> mScriptGlobalObject;
|
||||||
nsIEventListenerManager* mListenerManager;
|
nsIEventListenerManager* mListenerManager;
|
||||||
PRBool mInDestructor;
|
PRBool mInDestructor;
|
||||||
|
@ -607,6 +563,8 @@ protected:
|
||||||
nsSupportsHashtable* mBoxObjectTable;
|
nsSupportsHashtable* mBoxObjectTable;
|
||||||
PRInt32 mNumCapturers; //Number of capturing event handlers in doc. Used to optimize event delivery.
|
PRInt32 mNumCapturers; //Number of capturing event handlers in doc. Used to optimize event delivery.
|
||||||
|
|
||||||
|
nsSupportsHashtable mContentWrapperHash;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// These are not implemented and not supported.
|
// These are not implemented and not supported.
|
||||||
nsDocument(const nsDocument& aOther);
|
nsDocument(const nsDocument& aOther);
|
||||||
|
|
|
@ -23,19 +23,18 @@
|
||||||
#include "nsISupports.h"
|
#include "nsISupports.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIDOMDocumentFragment.h"
|
#include "nsIDOMDocumentFragment.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsGenericElement.h"
|
#include "nsGenericElement.h"
|
||||||
#include "nsINameSpaceManager.h"
|
#include "nsINameSpaceManager.h"
|
||||||
#include "nsINodeInfo.h"
|
#include "nsINodeInfo.h"
|
||||||
#include "nsNodeInfoManager.h"
|
#include "nsNodeInfoManager.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsIDOMDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
#include "nsIDOMScriptObjectFactory.h"
|
|
||||||
#include "nsDOMError.h"
|
#include "nsDOMError.h"
|
||||||
|
|
||||||
|
|
||||||
class nsDocumentFragment : public nsGenericContainerElement,
|
class nsDocumentFragment : public nsGenericContainerElement,
|
||||||
public nsIDOMDocumentFragment
|
public nsIDOMDocumentFragment,
|
||||||
|
public nsIDOM3Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsDocumentFragment(nsIDocument* aOwnerDocument);
|
nsDocumentFragment(nsIDocument* aOwnerDocument);
|
||||||
|
@ -101,12 +100,12 @@ public:
|
||||||
PRBool* aReturn)
|
PRBool* aReturn)
|
||||||
{ return nsGenericContainerElement::IsSupported(aFeature, aVersion,
|
{ return nsGenericContainerElement::IsSupported(aFeature, aVersion,
|
||||||
aReturn); }
|
aReturn); }
|
||||||
|
|
||||||
|
// nsIDOM3Node
|
||||||
NS_IMETHOD GetBaseURI(nsAWritableString& aURI)
|
NS_IMETHOD GetBaseURI(nsAWritableString& aURI)
|
||||||
{ return nsGenericContainerElement::GetBaseURI(aURI); }
|
{ aURI.Truncate(); return NS_OK; }
|
||||||
|
|
||||||
// interface nsIScriptObjectOwner
|
|
||||||
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject);
|
|
||||||
|
|
||||||
|
// nsIContent
|
||||||
NS_IMETHOD SetParent(nsIContent* aParent)
|
NS_IMETHOD SetParent(nsIContent* aParent)
|
||||||
{ return NS_OK; }
|
{ return NS_OK; }
|
||||||
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
|
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||||
|
@ -213,20 +212,30 @@ nsDocumentFragment::nsDocumentFragment(nsIDocument* aOwnerDocument)
|
||||||
nsDocumentFragment::~nsDocumentFragment()
|
nsDocumentFragment::~nsDocumentFragment()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsDocumentFragment)
|
|
||||||
NS_IMPL_RELEASE(nsDocumentFragment)
|
|
||||||
|
|
||||||
|
|
||||||
|
// XPConnect interface list for nsDocumentFragment
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(DocumentFragment)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMDocumentFragment)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOM3Node)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsDocumentFragment
|
||||||
NS_INTERFACE_MAP_BEGIN(nsDocumentFragment)
|
NS_INTERFACE_MAP_BEGIN(nsDocumentFragment)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentFragment)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMDocumentFragment)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNode)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNode)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOM3Node)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIContent)
|
NS_INTERFACE_MAP_ENTRY(nsIContent)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner)
|
|
||||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent)
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(DocumentFragment)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
NS_IMPL_ADDREF(nsDocumentFragment)
|
||||||
|
NS_IMPL_RELEASE(nsDocumentFragment)
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocumentFragment::GetNodeType(PRUint16* aNodeType)
|
nsDocumentFragment::GetNodeType(PRUint16* aNodeType)
|
||||||
{
|
{
|
||||||
|
@ -281,34 +290,3 @@ nsDocumentFragment::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDocumentFragment::GetScriptObject(nsIScriptContext* aContext,
|
|
||||||
void** aScriptObject)
|
|
||||||
{
|
|
||||||
nsresult res = NS_OK;
|
|
||||||
|
|
||||||
*aScriptObject = nsnull;
|
|
||||||
|
|
||||||
nsDOMSlots *slots = GetDOMSlots();
|
|
||||||
|
|
||||||
if (slots && !mDOMSlots->mScriptObject) {
|
|
||||||
nsCOMPtr<nsIDOMScriptObjectFactory> factory;
|
|
||||||
|
|
||||||
res = GetScriptObjectFactory(getter_AddRefs(factory));
|
|
||||||
if (NS_OK != res) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = factory->NewScriptDocumentFragment(aContext,
|
|
||||||
NS_STATIC_CAST(nsIDOMDocumentFragment *, this),
|
|
||||||
mOwnerDocument,
|
|
||||||
(void**)&slots->mScriptObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (slots) {
|
|
||||||
*aScriptObject = slots->mScriptObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
|
@ -242,9 +242,9 @@ public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
/*BEGIN implementations of focus event handler interface*/
|
/*BEGIN implementations of focus event handler interface*/
|
||||||
virtual nsresult HandleEvent(nsIDOMEvent* aEvent);
|
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
|
||||||
virtual nsresult Focus(nsIDOMEvent* aEvent);
|
NS_IMETHOD Focus(nsIDOMEvent* aEvent);
|
||||||
virtual nsresult Blur(nsIDOMEvent* aEvent);
|
NS_IMETHOD Blur(nsIDOMEvent* aEvent);
|
||||||
/*END implementations of focus event handler interface*/
|
/*END implementations of focus event handler interface*/
|
||||||
nsresult Init(DocumentViewerImpl *aDocViewer);
|
nsresult Init(DocumentViewerImpl *aDocViewer);
|
||||||
|
|
||||||
|
@ -5231,7 +5231,7 @@ nsDocViewerFocusListener::HandleEvent(nsIDOMEvent* aEvent)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
NS_IMETHODIMP
|
||||||
nsDocViewerFocusListener::Focus(nsIDOMEvent* aEvent)
|
nsDocViewerFocusListener::Focus(nsIDOMEvent* aEvent)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIPresShell> shell;
|
nsCOMPtr<nsIPresShell> shell;
|
||||||
|
@ -5256,8 +5256,8 @@ nsDocViewerFocusListener::Focus(nsIDOMEvent* aEvent)
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
NS_IMETHODIMP
|
||||||
nsDocViewerFocusListener::Blur(nsIDOMEvent* aEvent)
|
nsDocViewerFocusListener::Blur(nsIDOMEvent* aEvent)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIPresShell> shell;
|
nsCOMPtr<nsIPresShell> shell;
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
#include "nsISizeOfHandler.h"
|
#include "nsISizeOfHandler.h"
|
||||||
#include "nsIDOMEvent.h"
|
#include "nsIDOMEvent.h"
|
||||||
#include "nsIDOMText.h"
|
#include "nsIDOMText.h"
|
||||||
#include "nsIDOMScriptObjectFactory.h"
|
|
||||||
#include "nsIScriptGlobalObject.h"
|
#include "nsIScriptGlobalObject.h"
|
||||||
#include "prprf.h"
|
#include "prprf.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
@ -54,7 +53,6 @@ nsGenericDOMDataNode::nsGenericDOMDataNode()
|
||||||
{
|
{
|
||||||
mDocument = nsnull;
|
mDocument = nsnull;
|
||||||
mParent = nsnull;
|
mParent = nsnull;
|
||||||
mScriptObject = nsnull;
|
|
||||||
mListenerManager = nsnull;
|
mListenerManager = nsnull;
|
||||||
mRangeList = nsnull;
|
mRangeList = nsnull;
|
||||||
}
|
}
|
||||||
|
@ -207,14 +205,16 @@ nsGenericDOMDataNode::GetOwnerDocument(nsIDOMDocument** aOwnerDocument)
|
||||||
nsresult
|
nsresult
|
||||||
nsGenericDOMDataNode::GetNamespaceURI(nsAWritableString& aNamespaceURI)
|
nsGenericDOMDataNode::GetNamespaceURI(nsAWritableString& aNamespaceURI)
|
||||||
{
|
{
|
||||||
aNamespaceURI.Truncate();
|
SetDOMStringToNull(aNamespaceURI);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsGenericDOMDataNode::GetPrefix(nsAWritableString& aPrefix)
|
nsGenericDOMDataNode::GetPrefix(nsAWritableString& aPrefix)
|
||||||
{
|
{
|
||||||
aPrefix.Truncate();
|
SetDOMStringToNull(aPrefix);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,6 +224,14 @@ nsGenericDOMDataNode::SetPrefix(const nsAReadableString& aPrefix)
|
||||||
return NS_ERROR_DOM_NAMESPACE_ERR;
|
return NS_ERROR_DOM_NAMESPACE_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsGenericDOMDataNode::GetLocalName(nsAWritableString& aLocalName)
|
||||||
|
{
|
||||||
|
SetDOMStringToNull(aLocalName);
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsGenericDOMDataNode::Normalize()
|
nsGenericDOMDataNode::Normalize()
|
||||||
{
|
{
|
||||||
|
@ -244,7 +252,7 @@ nsGenericDOMDataNode::GetBaseURI(nsAWritableString& aURI)
|
||||||
aURI.Truncate();
|
aURI.Truncate();
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
// DOM Data Node inherits the base from its parent element/document
|
// DOM Data Node inherits the base from its parent element/document
|
||||||
nsCOMPtr<nsIDOMNode> node;
|
nsCOMPtr<nsIDOM3Node> node;
|
||||||
if (mParent) {
|
if (mParent) {
|
||||||
node = do_QueryInterface(mParent);
|
node = do_QueryInterface(mParent);
|
||||||
} else if (mDocument) {
|
} else if (mDocument) {
|
||||||
|
@ -314,14 +322,14 @@ nsGenericDOMDataNode::SetData(nsIContent *aOuterContent, const nsAReadableString
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsGenericDOMDataNode::GetLength(PRUint32* aLength)
|
nsGenericDOMDataNode::GetLength(PRUint32* aLength)
|
||||||
{
|
{
|
||||||
*aLength = mText.GetLength();
|
*aLength = mText.GetLength();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsGenericDOMDataNode::SubstringData(PRUint32 aStart,
|
nsGenericDOMDataNode::SubstringData(PRUint32 aStart,
|
||||||
PRUint32 aCount,
|
PRUint32 aCount,
|
||||||
nsAWritableString& aReturn)
|
nsAWritableString& aReturn)
|
||||||
|
@ -486,55 +494,6 @@ nsGenericDOMDataNode::ReplaceData(nsIContent *aOuterContent, PRUint32 aOffset,
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
// nsIScriptObjectOwner implementation
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsGenericDOMDataNode::GetScriptObject(nsIContent *aOuterContent,
|
|
||||||
nsIScriptContext* aContext,
|
|
||||||
void** aScriptObject)
|
|
||||||
{
|
|
||||||
nsresult res = NS_OK;
|
|
||||||
if (nsnull == mScriptObject) {
|
|
||||||
nsIDOMScriptObjectFactory *factory;
|
|
||||||
|
|
||||||
res = nsGenericElement::GetScriptObjectFactory(&factory);
|
|
||||||
if (NS_OK != res) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIDOMNode* node;
|
|
||||||
PRUint16 nodeType;
|
|
||||||
|
|
||||||
res = aOuterContent->QueryInterface(NS_GET_IID(nsIDOMNode), (void**)&node);
|
|
||||||
if (NS_OK != res) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
node->GetNodeType(&nodeType);
|
|
||||||
res = factory->NewScriptCharacterData(nodeType,
|
|
||||||
aContext, aOuterContent,
|
|
||||||
mParent, (void**)&mScriptObject);
|
|
||||||
if (nsnull != mDocument) {
|
|
||||||
aContext->AddNamedReference((void *)&mScriptObject,
|
|
||||||
mScriptObject,
|
|
||||||
"nsGenericDOMDataNode::mScriptObject");
|
|
||||||
}
|
|
||||||
NS_RELEASE(node);
|
|
||||||
NS_RELEASE(factory);
|
|
||||||
}
|
|
||||||
*aScriptObject = mScriptObject;
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsGenericDOMDataNode::SetScriptObject(void *aScriptObject)
|
|
||||||
{
|
|
||||||
mScriptObject = aScriptObject;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsGenericDOMDataNode::GetListenerManager(nsIContent* aOuterContent, nsIEventListenerManager** aResult)
|
nsGenericDOMDataNode::GetListenerManager(nsIContent* aOuterContent, nsIEventListenerManager** aResult)
|
||||||
{
|
{
|
||||||
|
@ -618,14 +577,16 @@ nsGenericDOMDataNode::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool a
|
||||||
// If we were part of a document, make sure we get rid of the
|
// If we were part of a document, make sure we get rid of the
|
||||||
// script context reference to our script object so that our
|
// script context reference to our script object so that our
|
||||||
// script object can be freed (or collected).
|
// script object can be freed (or collected).
|
||||||
if ((nsnull != mDocument) && (nsnull != mScriptObject)) {
|
if (mDocument) {
|
||||||
nsCOMPtr<nsIScriptGlobalObject> globalObject;
|
nsCOMPtr<nsIScriptGlobalObject> globalObject;
|
||||||
mDocument->GetScriptGlobalObject(getter_AddRefs(globalObject));
|
mDocument->GetScriptGlobalObject(getter_AddRefs(globalObject));
|
||||||
if (globalObject) {
|
if (globalObject) {
|
||||||
nsCOMPtr<nsIScriptContext> context;
|
nsCOMPtr<nsIScriptContext> context;
|
||||||
if (NS_OK == globalObject->GetContext(getter_AddRefs(context)) && context) {
|
if (NS_OK == globalObject->GetContext(getter_AddRefs(context)) && context) {
|
||||||
context->RemoveReference((void *)&mScriptObject,
|
// context->RemoveReference((void *)&mScriptObject,
|
||||||
mScriptObject);
|
// mScriptObject);
|
||||||
|
|
||||||
|
// XXX: UnRoot!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -636,15 +597,17 @@ nsGenericDOMDataNode::SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool a
|
||||||
// to a document, make sure that the script context adds a
|
// to a document, make sure that the script context adds a
|
||||||
// reference to our script object. This will ensure that it
|
// reference to our script object. This will ensure that it
|
||||||
// won't be freed (or collected) out from under us.
|
// won't be freed (or collected) out from under us.
|
||||||
if ((nsnull != mDocument) && (nsnull != mScriptObject)) {
|
if (mDocument) {
|
||||||
nsCOMPtr<nsIScriptGlobalObject> globalObject;
|
nsCOMPtr<nsIScriptGlobalObject> globalObject;
|
||||||
mDocument->GetScriptGlobalObject(getter_AddRefs(globalObject));
|
mDocument->GetScriptGlobalObject(getter_AddRefs(globalObject));
|
||||||
if (globalObject) {
|
if (globalObject) {
|
||||||
nsCOMPtr<nsIScriptContext> context;
|
nsCOMPtr<nsIScriptContext> context;
|
||||||
if (NS_OK == globalObject->GetContext(getter_AddRefs(context)) && context) {
|
if (NS_OK == globalObject->GetContext(getter_AddRefs(context)) && context) {
|
||||||
context->AddNamedReference((void *)&mScriptObject,
|
// context->AddNamedReference((void *)&mScriptObject,
|
||||||
mScriptObject,
|
// mScriptObject,
|
||||||
"Text");
|
// "Text");
|
||||||
|
|
||||||
|
// XXX: Root!
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIDOMCharacterData.h"
|
#include "nsIDOMCharacterData.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsTextFragment.h"
|
#include "nsTextFragment.h"
|
||||||
|
@ -33,6 +32,7 @@
|
||||||
#include "nsITextContent.h"
|
#include "nsITextContent.h"
|
||||||
#include "nsDOMError.h"
|
#include "nsDOMError.h"
|
||||||
#include "nsIEventListenerManager.h"
|
#include "nsIEventListenerManager.h"
|
||||||
|
#include "nsGenericElement.h"
|
||||||
|
|
||||||
|
|
||||||
class nsIDOMAttr;
|
class nsIDOMAttr;
|
||||||
|
@ -118,6 +118,7 @@ struct nsGenericDOMDataNode {
|
||||||
}
|
}
|
||||||
nsresult GetOwnerDocument(nsIDOMDocument** aOwnerDocument);
|
nsresult GetOwnerDocument(nsIDOMDocument** aOwnerDocument);
|
||||||
nsresult GetNamespaceURI(nsAWritableString& aNamespaceURI);
|
nsresult GetNamespaceURI(nsAWritableString& aNamespaceURI);
|
||||||
|
nsresult GetLocalName(nsAWritableString& aLocalName);
|
||||||
nsresult GetPrefix(nsAWritableString& aPrefix);
|
nsresult GetPrefix(nsAWritableString& aPrefix);
|
||||||
nsresult SetPrefix(const nsAReadableString& aPrefix);
|
nsresult SetPrefix(const nsAReadableString& aPrefix);
|
||||||
nsresult Normalize();
|
nsresult Normalize();
|
||||||
|
@ -140,11 +141,6 @@ struct nsGenericDOMDataNode {
|
||||||
PRUint32 aCount, const nsAReadableString& aArg);
|
PRUint32 aCount, const nsAReadableString& aArg);
|
||||||
|
|
||||||
|
|
||||||
// nsIScriptObjectOwner interface
|
|
||||||
nsresult GetScriptObject(nsIContent *aOuterContent,
|
|
||||||
nsIScriptContext* aContext, void** aScriptObject);
|
|
||||||
nsresult SetScriptObject(void *aScriptObject);
|
|
||||||
|
|
||||||
// Implementation for nsIContent
|
// Implementation for nsIContent
|
||||||
nsresult GetDocument(nsIDocument*& aResult) const;
|
nsresult GetDocument(nsIDocument*& aResult) const;
|
||||||
nsresult SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers);
|
nsresult SetDocument(nsIDocument* aDocument, PRBool aDeep, PRBool aCompileEventHandlers);
|
||||||
|
@ -266,7 +262,6 @@ struct nsGenericDOMDataNode {
|
||||||
|
|
||||||
nsIDocument* mDocument;
|
nsIDocument* mDocument;
|
||||||
nsIContent* mParent;
|
nsIContent* mParent;
|
||||||
void* mScriptObject;
|
|
||||||
nsIEventListenerManager* mListenerManager;
|
nsIEventListenerManager* mListenerManager;
|
||||||
|
|
||||||
nsTextFragment mText;
|
nsTextFragment mText;
|
||||||
|
@ -284,10 +279,10 @@ struct nsGenericDOMDataNode {
|
||||||
* NS_IMETHOD GetNodeType(PRUint16* aNodeType);
|
* NS_IMETHOD GetNodeType(PRUint16* aNodeType);
|
||||||
* NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
|
* NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
|
||||||
*/
|
*/
|
||||||
#define NS_IMPL_IDOMNODE_USING_GENERIC_DOM_DATA(_g) \
|
#define NS_IMPL_NSIDOMNODE_USING_GENERIC_DOM_DATA(_g) \
|
||||||
NS_IMETHOD GetNodeName(nsAWritableString& aNodeName); \
|
NS_IMETHOD GetNodeName(nsAWritableString& aNodeName); \
|
||||||
NS_IMETHOD GetLocalName(nsAWritableString& aLocalName) { \
|
NS_IMETHOD GetLocalName(nsAWritableString& aLocalName) { \
|
||||||
return GetNodeName(aLocalName); \
|
return _g.GetLocalName(aLocalName); \
|
||||||
} \
|
} \
|
||||||
NS_IMETHOD GetNodeValue(nsAWritableString& aNodeValue) { \
|
NS_IMETHOD GetNodeValue(nsAWritableString& aNodeValue) { \
|
||||||
return _g.GetNodeValue(aNodeValue); \
|
return _g.GetNodeValue(aNodeValue); \
|
||||||
|
@ -362,7 +357,7 @@ struct nsGenericDOMDataNode {
|
||||||
} \
|
} \
|
||||||
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
|
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn);
|
||||||
|
|
||||||
#define NS_IMPL_IDOMCHARACTERDATA_USING_GENERIC_DOM_DATA(_g) \
|
#define NS_IMPL_NSIDOMCHARACTERDATA_USING_GENERIC_DOM_DATA(_g) \
|
||||||
NS_IMETHOD GetData(nsAWritableString& aData) { \
|
NS_IMETHOD GetData(nsAWritableString& aData) { \
|
||||||
return _g.GetData(aData); \
|
return _g.GetData(aData); \
|
||||||
} \
|
} \
|
||||||
|
@ -395,7 +390,7 @@ struct nsGenericDOMDataNode {
|
||||||
* generic content object (either nsGenericHTMLLeafElement or
|
* generic content object (either nsGenericHTMLLeafElement or
|
||||||
* nsGenericHTMLContainerContent)
|
* nsGenericHTMLContainerContent)
|
||||||
*/
|
*/
|
||||||
#define NS_IMPL_IDOMEVENTRECEIVER_USING_GENERIC_DOM_DATA(_g) \
|
#define NS_IMPL_NSIDOMEVENTRECEIVER_USING_GENERIC_DOM_DATA(_g) \
|
||||||
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, \
|
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, \
|
||||||
const nsIID& aIID) { \
|
const nsIID& aIID) { \
|
||||||
return _g.AddEventListenerByIID(aListener, aIID); \
|
return _g.AddEventListenerByIID(aListener, aIID); \
|
||||||
|
@ -424,20 +419,6 @@ struct nsGenericDOMDataNode {
|
||||||
return _g.RemoveEventListener(aType, aListener, aUseCapture); \
|
return _g.RemoveEventListener(aType, aListener, aUseCapture); \
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Implement the nsIScriptObjectOwner API by forwarding the methods to a
|
|
||||||
* generic content object (either nsGenericHTMLLeafElement or
|
|
||||||
* nsGenericHTMLContainerContent)
|
|
||||||
*/
|
|
||||||
#define NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC_DOM_DATA(_g) \
|
|
||||||
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, \
|
|
||||||
void** aScriptObject) { \
|
|
||||||
return _g.GetScriptObject(this, aContext, aScriptObject); \
|
|
||||||
} \
|
|
||||||
NS_IMETHOD SetScriptObject(void *aScriptObject) { \
|
|
||||||
return _g.SetScriptObject(aScriptObject); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(_g) \
|
#define NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(_g) \
|
||||||
NS_IMETHOD GetDocument(nsIDocument*& aResult) const { \
|
NS_IMETHOD GetDocument(nsIDocument*& aResult) const { \
|
||||||
return _g.GetDocument(aResult); \
|
return _g.GetDocument(aResult); \
|
||||||
|
@ -543,17 +524,18 @@ struct nsGenericDOMDataNode {
|
||||||
return _g.RemoveFocus(aPresContext); \
|
return _g.RemoveFocus(aPresContext); \
|
||||||
} \
|
} \
|
||||||
NS_IMETHOD GetBindingParent(nsIContent** aContent) { \
|
NS_IMETHOD GetBindingParent(nsIContent** aContent) { \
|
||||||
return _g.GetBindingParent(aContent); \
|
return _g.GetBindingParent(aContent); \
|
||||||
} \
|
} \
|
||||||
NS_IMETHOD SetBindingParent(nsIContent* aParent) { \
|
NS_IMETHOD SetBindingParent(nsIContent* aParent) { \
|
||||||
return _g.SetBindingParent(aParent); \
|
return _g.SetBindingParent(aParent); \
|
||||||
}
|
} \
|
||||||
|
NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implement the nsIDOMText API by forwarding the methods to a
|
* Implement the nsIDOMText API by forwarding the methods to a
|
||||||
* generic character data content object.
|
* generic character data content object.
|
||||||
*/
|
*/
|
||||||
#define NS_IMPL_IDOMTEXT_USING_GENERIC_DOM_DATA(_g) \
|
#define NS_IMPL_NSIDOMTEXT_USING_GENERIC_DOM_DATA(_g) \
|
||||||
NS_IMETHOD SplitText(PRUint32 aOffset, nsIDOMText** aReturn){ \
|
NS_IMETHOD SplitText(PRUint32 aOffset, nsIDOMText** aReturn){ \
|
||||||
return _g.SplitText(this, aOffset, aReturn); \
|
return _g.SplitText(this, aOffset, aReturn); \
|
||||||
}
|
}
|
||||||
|
@ -595,51 +577,27 @@ struct nsGenericDOMDataNode {
|
||||||
* This macro implements the portion of query interface that is
|
* This macro implements the portion of query interface that is
|
||||||
* generic to all html content objects.
|
* generic to all html content objects.
|
||||||
*/
|
*/
|
||||||
#define NS_IMPL_DOM_DATA_QUERY_INTERFACE(_id, _iptr, _this) \
|
|
||||||
if (_id.Equals(NS_GET_IID(nsISupports))) { \
|
#define NS_INTERFACE_MAP_ENTRY_DOM_DATA() \
|
||||||
nsIContent* tmp = _this; \
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContent) \
|
||||||
nsISupports* tmp2 = tmp; \
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNode) \
|
||||||
*_iptr = (void*) tmp2; \
|
if (aIID.Equals(NS_GET_IID(nsIDOMEventReceiver))) { \
|
||||||
NS_ADDREF_THIS(); \
|
nsCOMPtr<nsIEventListenerManager> man; \
|
||||||
return NS_OK; \
|
if (NS_SUCCEEDED(mInner.GetListenerManager(this, getter_AddRefs(man)))) { \
|
||||||
} \
|
return man->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), \
|
||||||
if (_id.Equals(NS_GET_IID(nsIDOMNode))) { \
|
(void**)aInstancePtr); \
|
||||||
nsIDOMNode* tmp = _this; \
|
} \
|
||||||
*_iptr = (void*) tmp; \
|
return NS_NOINTERFACE; \
|
||||||
NS_ADDREF_THIS(); \
|
} else \
|
||||||
return NS_OK; \
|
if (aIID.Equals(NS_GET_IID(nsIDOMEventTarget))) { \
|
||||||
} \
|
nsCOMPtr<nsIEventListenerManager> man; \
|
||||||
if (_id.Equals(NS_GET_IID(nsIDOMCharacterData))) { \
|
if (NS_SUCCEEDED(mInner.GetListenerManager(this, getter_AddRefs(man)))){ \
|
||||||
nsIDOMCharacterData* tmp = _this; \
|
return man->QueryInterface(NS_GET_IID(nsIDOMEventTarget), \
|
||||||
*_iptr = (void*) tmp; \
|
(void**)aInstancePtr); \
|
||||||
NS_ADDREF_THIS(); \
|
} \
|
||||||
return NS_OK; \
|
return NS_NOINTERFACE; \
|
||||||
} \
|
} else \
|
||||||
if (_id.Equals(NS_GET_IID(nsIDOMEventReceiver))) { \
|
NS_INTERFACE_MAP_ENTRY(nsIContent) \
|
||||||
nsCOMPtr<nsIEventListenerManager> man; \
|
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOM3Node, nsNode3Tearoff(this))
|
||||||
if (NS_SUCCEEDED(mInner.GetListenerManager(this, getter_AddRefs(man)))){ \
|
|
||||||
return man->QueryInterface(NS_GET_IID(nsIDOMEventReceiver), (void**)_iptr); \
|
|
||||||
} \
|
|
||||||
return NS_NOINTERFACE; \
|
|
||||||
} \
|
|
||||||
if (_id.Equals(NS_GET_IID(nsIDOMEventTarget))) { \
|
|
||||||
nsCOMPtr<nsIEventListenerManager> man; \
|
|
||||||
if (NS_SUCCEEDED(mInner.GetListenerManager(this, getter_AddRefs(man)))){ \
|
|
||||||
return man->QueryInterface(NS_GET_IID(nsIDOMEventTarget), (void**)_iptr); \
|
|
||||||
} \
|
|
||||||
return NS_NOINTERFACE; \
|
|
||||||
} \
|
|
||||||
if (_id.Equals(NS_GET_IID(nsIScriptObjectOwner))) { \
|
|
||||||
nsIScriptObjectOwner* tmp = _this; \
|
|
||||||
*_iptr = (void*) tmp; \
|
|
||||||
NS_ADDREF_THIS(); \
|
|
||||||
return NS_OK; \
|
|
||||||
} \
|
|
||||||
if (_id.Equals(NS_GET_IID(nsIContent))) { \
|
|
||||||
nsIContent* tmp = _this; \
|
|
||||||
*_iptr = (void*) tmp; \
|
|
||||||
NS_ADDREF_THIS(); \
|
|
||||||
return NS_OK; \
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* nsGenericDOMDataNode_h___ */
|
#endif /* nsGenericDOMDataNode_h___ */
|
||||||
|
|
|
@ -21,68 +21,33 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nsGenericDOMNodeList.h"
|
#include "nsGenericDOMNodeList.h"
|
||||||
#include "nsIDOMScriptObjectFactory.h"
|
|
||||||
#include "nsGenericElement.h"
|
#include "nsGenericElement.h"
|
||||||
|
|
||||||
nsGenericDOMNodeList::nsGenericDOMNodeList()
|
nsGenericDOMNodeList::nsGenericDOMNodeList()
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
mScriptObject = nsnull;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsGenericDOMNodeList::~nsGenericDOMNodeList()
|
nsGenericDOMNodeList::~nsGenericDOMNodeList()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsGenericDOMNodeList::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|
||||||
{
|
|
||||||
if (NULL == aInstancePtr) {
|
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
}
|
|
||||||
if (aIID.Equals(NS_GET_IID(nsIDOMNodeList))) {
|
|
||||||
*aInstancePtr = (void*)(nsIDOMNodeList*)this;
|
|
||||||
AddRef();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
if (aIID.Equals(NS_GET_IID(nsIScriptObjectOwner))) {
|
|
||||||
*aInstancePtr = (void*)(nsIScriptObjectOwner*)this;
|
|
||||||
AddRef();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
if (aIID.Equals(NS_GET_IID(nsISupports))) {
|
|
||||||
*aInstancePtr = (void*)(nsISupports*)(nsIDOMNodeList*)this;
|
|
||||||
AddRef();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
return NS_NOINTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsGenericDOMNodeList)
|
NS_IMPL_ADDREF(nsGenericDOMNodeList)
|
||||||
NS_IMPL_RELEASE(nsGenericDOMNodeList)
|
NS_IMPL_RELEASE(nsGenericDOMNodeList)
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGenericDOMNodeList::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
|
|
||||||
{
|
|
||||||
nsresult res = NS_OK;
|
|
||||||
if (nsnull == mScriptObject) {
|
|
||||||
nsIDOMScriptObjectFactory *factory;
|
|
||||||
|
|
||||||
res = nsGenericElement::GetScriptObjectFactory(&factory);
|
|
||||||
if (NS_OK != res) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
res = factory->NewScriptNodeList(aContext, (nsISupports *)(nsIDOMNodeList *)this, nsnull, (void**)&mScriptObject);
|
// XPConnect interface list for nsGenericDOMNodeList
|
||||||
NS_RELEASE(factory);
|
NS_CLASSINFO_MAP_BEGIN(NodeList)
|
||||||
}
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMNodeList)
|
||||||
*aScriptObject = mScriptObject;
|
NS_CLASSINFO_MAP_END
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
// QueryInterface implementation for nsGenericDOMNodeList
|
||||||
|
NS_INTERFACE_MAP_BEGIN(nsGenericDOMNodeList)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNodeList)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(NodeList)
|
||||||
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGenericDOMNodeList::SetScriptObject(void *aScriptObject)
|
|
||||||
{
|
|
||||||
mScriptObject = aScriptObject;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
|
@ -25,19 +25,16 @@
|
||||||
|
|
||||||
#include "nsISupports.h"
|
#include "nsISupports.h"
|
||||||
#include "nsIDOMNodeList.h"
|
#include "nsIDOMNodeList.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a base class for a generic DOM Node List. The base class
|
* This is a base class for a generic DOM Node List. The base class
|
||||||
* provides implementations for nsISupports and nsIScriptObjectOwner,
|
* provides implementations for nsISupports, it is up to the subclass
|
||||||
* but it is up to the subclass to implement the core node list
|
* to implement the core node list methods:
|
||||||
* methods:
|
*
|
||||||
* GetLength
|
* GetLength
|
||||||
* Item
|
* Item
|
||||||
*
|
* */
|
||||||
*/
|
class nsGenericDOMNodeList : public nsIDOMNodeList
|
||||||
class nsGenericDOMNodeList : public nsIDOMNodeList,
|
|
||||||
public nsIScriptObjectOwner
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsGenericDOMNodeList();
|
nsGenericDOMNodeList();
|
||||||
|
@ -45,16 +42,10 @@ public:
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
|
||||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
|
||||||
|
|
||||||
// The following need to be defined in the subclass
|
// The following need to be defined in the subclass
|
||||||
// nsIDOMNodeList interface
|
// nsIDOMNodeList interface
|
||||||
NS_IMETHOD GetLength(PRUint32* aLength)=0;
|
NS_IMETHOD GetLength(PRUint32* aLength)=0;
|
||||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn)=0;
|
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn)=0;
|
||||||
|
|
||||||
protected:
|
|
||||||
void* mScriptObject;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // nsGenericDOMNodeList_h__
|
#endif // nsGenericDOMNodeList_h__
|
||||||
|
|
|
@ -51,7 +51,6 @@
|
||||||
#include "nsIPrivateDOMEvent.h"
|
#include "nsIPrivateDOMEvent.h"
|
||||||
#include "nsDOMCID.h"
|
#include "nsDOMCID.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "nsIDOMScriptObjectFactory.h"
|
|
||||||
#include "nsIDOMCSSStyleDeclaration.h"
|
#include "nsIDOMCSSStyleDeclaration.h"
|
||||||
#include "nsDOMCSSDeclaration.h"
|
#include "nsDOMCSSDeclaration.h"
|
||||||
#include "nsINameSpaceManager.h"
|
#include "nsINameSpaceManager.h"
|
||||||
|
@ -345,38 +344,89 @@ nsCheapVoidArray::SwitchToVector()
|
||||||
return vector;
|
return vector;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
|
|
||||||
// XXX Currently, the script object factory is global. The way we
|
NS_IMETHODIMP
|
||||||
// obtain it should, at least, be made thread-safe later. Ideally,
|
nsNode3Tearoff::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||||
// we'd find a better way.
|
|
||||||
nsIDOMScriptObjectFactory* nsGenericElement::gScriptObjectFactory = nsnull;
|
|
||||||
|
|
||||||
static NS_DEFINE_IID(kDOMScriptObjectFactoryCID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsGenericElement::GetScriptObjectFactory(nsIDOMScriptObjectFactory **aResult)
|
|
||||||
{
|
{
|
||||||
nsresult result = NS_OK;
|
if (aIID.Equals(NS_GET_IID(nsIDOM3Node))) {
|
||||||
|
nsISupports *inst = this;
|
||||||
|
|
||||||
if (nsnull == gScriptObjectFactory) {
|
NS_ADDREF(inst);
|
||||||
result = nsServiceManager::GetService(kDOMScriptObjectFactoryCID,
|
|
||||||
NS_GET_IID(nsIDOMScriptObjectFactory),
|
*aInstancePtr = inst;
|
||||||
(nsISupports **)&gScriptObjectFactory);
|
|
||||||
if (result != NS_OK) {
|
return NS_OK;
|
||||||
return result;
|
}
|
||||||
|
|
||||||
|
return mContent->QueryInterface(aIID, aInstancePtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NS_IMPL_ADDREF(nsNode3Tearoff)
|
||||||
|
NS_IMPL_RELEASE(nsNode3Tearoff)
|
||||||
|
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsNode3Tearoff::GetBaseURI(nsAWritableString& aURI)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIURI> uri;
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDocument> doc;
|
||||||
|
|
||||||
|
mContent->GetDocument(*getter_AddRefs(doc));
|
||||||
|
|
||||||
|
nsCOMPtr<nsIXMLDocument> xmlDoc(do_QueryInterface(doc));
|
||||||
|
|
||||||
|
aURI.Truncate();
|
||||||
|
|
||||||
|
if (xmlDoc) {
|
||||||
|
// XML documents can use the XML Base (W3C spec) way of setting
|
||||||
|
// the base per element. We look at this node and its ancestors
|
||||||
|
// until we find the first XML content and get it's base.
|
||||||
|
nsCOMPtr<nsIContent> content(mContent);
|
||||||
|
|
||||||
|
while (content) {
|
||||||
|
nsCOMPtr<nsIXMLContent> xmlContent(do_QueryInterface(content));
|
||||||
|
|
||||||
|
if (xmlContent) {
|
||||||
|
xmlContent->GetXMLBaseURI(getter_AddRefs(uri));
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIContent> tmp(content);
|
||||||
|
tmp->GetParent(*getter_AddRefs(content));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*aResult = gScriptObjectFactory;
|
if (!uri && doc) {
|
||||||
NS_ADDREF(gScriptObjectFactory);
|
// HTML document or for some reason there was no XML content in
|
||||||
return result;
|
// XML document
|
||||||
|
|
||||||
|
doc->GetBaseURL(*getter_AddRefs(uri));
|
||||||
|
|
||||||
|
if (!uri) {
|
||||||
|
uri = dont_AddRef(doc->GetDocumentURL());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uri) {
|
||||||
|
nsXPIDLCString spec;
|
||||||
|
|
||||||
|
uri->GetSpec(getter_Copies(spec));
|
||||||
|
|
||||||
|
CopyASCIItoUCS2(nsLiteralCString(spec), aURI);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
/* static */ void
|
/* static */ void
|
||||||
nsGenericElement::Shutdown()
|
nsGenericElement::Shutdown()
|
||||||
{
|
{
|
||||||
NS_IF_RELEASE(gScriptObjectFactory); // assigns null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsGenericElement::nsGenericElement() : mDocument(nsnull), mParent(nsnull),
|
nsGenericElement::nsGenericElement() : mDocument(nsnull), mParent(nsnull),
|
||||||
|
@ -426,7 +476,6 @@ nsGenericElement::GetDOMSlots()
|
||||||
if (!mDOMSlots)
|
if (!mDOMSlots)
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
|
||||||
mDOMSlots->mScriptObject = nsnull;
|
|
||||||
mDOMSlots->mChildNodes = nsnull;
|
mDOMSlots->mChildNodes = nsnull;
|
||||||
mDOMSlots->mStyle = nsnull;
|
mDOMSlots->mStyle = nsnull;
|
||||||
mDOMSlots->mAttributeMap = nsnull;
|
mDOMSlots->mAttributeMap = nsnull;
|
||||||
|
@ -442,7 +491,6 @@ void
|
||||||
nsGenericElement::MaybeClearDOMSlots()
|
nsGenericElement::MaybeClearDOMSlots()
|
||||||
{
|
{
|
||||||
if (mDOMSlots &&
|
if (mDOMSlots &&
|
||||||
!mDOMSlots->mScriptObject &&
|
|
||||||
!mDOMSlots->mChildNodes &&
|
!mDOMSlots->mChildNodes &&
|
||||||
!mDOMSlots->mStyle &&
|
!mDOMSlots->mStyle &&
|
||||||
!mDOMSlots->mAttributeMap &&
|
!mDOMSlots->mAttributeMap &&
|
||||||
|
@ -481,7 +529,10 @@ nsGenericElement::GetLocalName(nsAWritableString& aLocalName)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGenericElement::GetNodeValue(nsAWritableString& aNodeValue)
|
nsGenericElement::GetNodeValue(nsAWritableString& aNodeValue)
|
||||||
{
|
{
|
||||||
|
// XXX: Null string
|
||||||
|
|
||||||
aNodeValue.Truncate();
|
aNodeValue.Truncate();
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,7 +681,7 @@ nsGenericElement::SetPrefix(const nsAReadableString& aPrefix)
|
||||||
nsINodeInfo *newNodeInfo = nsnull;
|
nsINodeInfo *newNodeInfo = nsnull;
|
||||||
nsCOMPtr<nsIAtom> prefix;
|
nsCOMPtr<nsIAtom> prefix;
|
||||||
|
|
||||||
if (aPrefix.Length()) {
|
if (aPrefix.Length() && !DOMStringIsNull(aPrefix)) {
|
||||||
prefix = dont_AddRef(NS_NewAtom(aPrefix));
|
prefix = dont_AddRef(NS_NewAtom(aPrefix));
|
||||||
NS_ENSURE_TRUE(prefix, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(prefix, NS_ERROR_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
|
@ -707,48 +758,6 @@ nsGenericElement::GetXMLBaseURI(nsIURI **aURI)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGenericElement::GetBaseURI(nsAWritableString& aURI)
|
|
||||||
{
|
|
||||||
aURI.Truncate();
|
|
||||||
nsCOMPtr<nsIURI> uri;
|
|
||||||
nsCOMPtr<nsIXMLDocument> xmlDoc(do_QueryInterface(mDocument));
|
|
||||||
if (xmlDoc) {
|
|
||||||
// XML documents can use the XML Base (W3C spec) way of setting the base
|
|
||||||
// per element. We look at this node and its ancestors until we find
|
|
||||||
// the first XML content and get it's base.
|
|
||||||
nsCOMPtr<nsIContent> content(do_QueryInterface(NS_STATIC_CAST(nsIContent*,this)));
|
|
||||||
while (content) {
|
|
||||||
nsCOMPtr<nsIXMLContent> xmlContent(do_QueryInterface(content));
|
|
||||||
if (xmlContent) {
|
|
||||||
xmlContent->GetXMLBaseURI(getter_AddRefs(uri));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
nsCOMPtr<nsIContent> tmp(content);
|
|
||||||
tmp->GetParent(*getter_AddRefs(content));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!uri && mDocument) {
|
|
||||||
// HTML document or for some reason there was no XML content in XML document
|
|
||||||
mDocument->GetBaseURL(*getter_AddRefs(uri));
|
|
||||||
if (!uri) {
|
|
||||||
uri = dont_AddRef(mDocument->GetDocumentURL());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (uri) {
|
|
||||||
nsXPIDLCString spec;
|
|
||||||
uri->GetSpec(getter_Copies(spec));
|
|
||||||
if (spec) {
|
|
||||||
CopyASCIItoUCS2(nsLiteralCString(spec), aURI);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGenericElement::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
|
nsGenericElement::GetAttributes(nsIDOMNamedNodeMap** aAttributes)
|
||||||
{
|
{
|
||||||
|
@ -791,7 +800,12 @@ nsGenericElement::GetAttribute(const nsAReadableString& aName,
|
||||||
ni->GetNamespaceID(nsid);
|
ni->GetNamespaceID(nsid);
|
||||||
ni->GetNameAtom(*getter_AddRefs(nameAtom));
|
ni->GetNameAtom(*getter_AddRefs(nameAtom));
|
||||||
|
|
||||||
NS_STATIC_CAST(nsIContent *, this)->GetAttribute(nsid, nameAtom, aReturn);
|
nsresult rv = NS_STATIC_CAST(nsIContent *,
|
||||||
|
this)->GetAttribute(nsid, nameAtom, aReturn);
|
||||||
|
|
||||||
|
if (rv = NS_CONTENT_ATTR_NOT_THERE) {
|
||||||
|
// XXX: Null aReturn
|
||||||
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -1280,17 +1294,6 @@ nsGenericElement::SetDocument(nsIDocument* aDocument, PRBool aDeep,
|
||||||
// If we were part of a document, make sure we get rid of the
|
// If we were part of a document, make sure we get rid of the
|
||||||
// script context reference to our script object so that our
|
// script context reference to our script object so that our
|
||||||
// script object can be freed (or collected).
|
// script object can be freed (or collected).
|
||||||
if (mDocument && mDOMSlots && mDOMSlots->mScriptObject) {
|
|
||||||
nsCOMPtr<nsIScriptGlobalObject> globalObject;
|
|
||||||
mDocument->GetScriptGlobalObject(getter_AddRefs(globalObject));
|
|
||||||
if (globalObject) {
|
|
||||||
nsCOMPtr<nsIScriptContext> context;
|
|
||||||
if (NS_OK == globalObject->GetContext(getter_AddRefs(context)) && context) {
|
|
||||||
context->RemoveReference((void *)&mDOMSlots->mScriptObject,
|
|
||||||
mDOMSlots->mScriptObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mDocument && aDeep) {
|
if (mDocument && aDeep) {
|
||||||
// Notify XBL- & nsIAnonymousContentCreator-generated
|
// Notify XBL- & nsIAnonymousContentCreator-generated
|
||||||
|
@ -1312,23 +1315,6 @@ nsGenericElement::SetDocument(nsIDocument* aDocument, PRBool aDeep,
|
||||||
}
|
}
|
||||||
|
|
||||||
mDocument = aDocument;
|
mDocument = aDocument;
|
||||||
|
|
||||||
// If we already have a script object and now we're being added
|
|
||||||
// to a document, make sure that the script context adds a
|
|
||||||
// reference to our script object. This will ensure that it
|
|
||||||
// won't be freed (or collected) out from under us.
|
|
||||||
if (mDocument && mDOMSlots && mDOMSlots->mScriptObject) {
|
|
||||||
nsCOMPtr<nsIScriptGlobalObject> globalObject;
|
|
||||||
mDocument->GetScriptGlobalObject(getter_AddRefs(globalObject));
|
|
||||||
if (globalObject) {
|
|
||||||
nsCOMPtr<nsIScriptContext> context;
|
|
||||||
if (NS_OK == globalObject->GetContext(getter_AddRefs(context)) && context) {
|
|
||||||
context->AddNamedReference((void *)&mDOMSlots->mScriptObject,
|
|
||||||
mDOMSlots->mScriptObject,
|
|
||||||
"nsGenericElement::mScriptObject");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PR_TRUE == aDeep) {
|
if (PR_TRUE == aDeep) {
|
||||||
|
@ -1351,6 +1337,7 @@ nsresult
|
||||||
nsGenericElement::SetParent(nsIContent* aParent)
|
nsGenericElement::SetParent(nsIContent* aParent)
|
||||||
{
|
{
|
||||||
mParent = aParent;
|
mParent = aParent;
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1822,6 +1809,11 @@ nsGenericElement::SetBindingParent(nsIContent* aParent)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP_(PRBool)
|
||||||
|
nsGenericElement::IsContentOfType(PRUint32 aFlags)
|
||||||
|
{
|
||||||
|
return !(aFlags & ~eELEMENT);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -1869,125 +1861,6 @@ nsGenericElement::RenderFrame(nsIPresContext* aPresContext)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
// nsIScriptObjectOwner implementation
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsGenericElement::GetScriptObject(nsIScriptContext* aContext,
|
|
||||||
void** aScriptObject)
|
|
||||||
{
|
|
||||||
nsresult res = NS_OK;
|
|
||||||
nsDOMSlots *slots = GetDOMSlots();
|
|
||||||
|
|
||||||
if (!slots->mScriptObject) {
|
|
||||||
nsIDOMScriptObjectFactory *factory;
|
|
||||||
|
|
||||||
res = GetScriptObjectFactory(&factory);
|
|
||||||
if (NS_OK != res) {
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsAutoString tag;
|
|
||||||
mNodeInfo->GetName(tag);
|
|
||||||
|
|
||||||
void* scriptObject;
|
|
||||||
res = factory->NewScriptElement(tag, aContext,
|
|
||||||
NS_STATIC_CAST(nsIHTMLContent *, this),
|
|
||||||
mParent ? (nsISupports*)mParent : (nsISupports*)mDocument,
|
|
||||||
(void**)&scriptObject);
|
|
||||||
NS_RELEASE(factory);
|
|
||||||
|
|
||||||
NS_WARN_IF_FALSE(scriptObject,
|
|
||||||
"Eeek! Cound't create script object!");
|
|
||||||
|
|
||||||
if (slots->mScriptObject) {
|
|
||||||
// We must have re-entered; discard the newly created
|
|
||||||
// script object and use the one created during the
|
|
||||||
// nesting instead.
|
|
||||||
JSContext* cx = (JSContext*) aContext->GetNativeContext();
|
|
||||||
::JS_SetPrivate(cx, (JSObject*) scriptObject, nsnull);
|
|
||||||
|
|
||||||
// Since we've eagerly cleared the transient script
|
|
||||||
// object's native pointer, we now need to ``manually''
|
|
||||||
// balance the reference that it had to us
|
|
||||||
Release();
|
|
||||||
|
|
||||||
*aScriptObject = slots->mScriptObject;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
slots->mScriptObject = scriptObject;
|
|
||||||
|
|
||||||
if (mDocument && slots->mScriptObject) {
|
|
||||||
aContext->AddNamedReference((void *)&slots->mScriptObject,
|
|
||||||
slots->mScriptObject,
|
|
||||||
"nsGenericElement::mScriptObject");
|
|
||||||
|
|
||||||
// See if we have a frame.
|
|
||||||
nsCOMPtr<nsIPresShell> shell = getter_AddRefs(mDocument->GetShellAt(0));
|
|
||||||
if (shell) {
|
|
||||||
nsIFrame* frame;
|
|
||||||
shell->GetPrimaryFrameFor(this, &frame);
|
|
||||||
if (!frame) {
|
|
||||||
// We must ensure that the XBL Binding is installed before we hand
|
|
||||||
// back this object.
|
|
||||||
nsCOMPtr<nsIBindingManager> bindingManager;
|
|
||||||
mDocument->GetBindingManager(getter_AddRefs(bindingManager));
|
|
||||||
nsCOMPtr<nsIXBLBinding> binding;
|
|
||||||
bindingManager->GetBinding(this, getter_AddRefs(binding));
|
|
||||||
if (!binding) {
|
|
||||||
nsCOMPtr<nsIScriptGlobalObject> global;
|
|
||||||
mDocument->GetScriptGlobalObject(getter_AddRefs(global));
|
|
||||||
nsCOMPtr<nsIDOMViewCSS> viewCSS(do_QueryInterface(global));
|
|
||||||
if (viewCSS) {
|
|
||||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl;
|
|
||||||
nsAutoString empty;
|
|
||||||
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(NS_STATIC_CAST(nsIHTMLContent *, this)));
|
|
||||||
viewCSS->GetComputedStyle(elt, empty, getter_AddRefs(cssDecl));
|
|
||||||
if (cssDecl) {
|
|
||||||
nsAutoString behavior; behavior.Assign(NS_LITERAL_STRING("-moz-binding"));
|
|
||||||
nsAutoString value;
|
|
||||||
cssDecl->GetPropertyValue(behavior, value);
|
|
||||||
if (!value.IsEmpty()) {
|
|
||||||
// We have a binding that must be installed.
|
|
||||||
nsresult rv;
|
|
||||||
PRBool dummy;
|
|
||||||
NS_WITH_SERVICE(nsIXBLService, xblService, "@mozilla.org/xbl;1", &rv);
|
|
||||||
xblService->LoadBindings(this, value, PR_FALSE, getter_AddRefs(binding), &dummy);
|
|
||||||
if (binding) {
|
|
||||||
binding->ExecuteAttachedHandler();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
*aScriptObject = slots->mScriptObject;
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsGenericElement::SetScriptObject(void *aScriptObject)
|
|
||||||
{
|
|
||||||
nsDOMSlots *slots = GetDOMSlots();
|
|
||||||
|
|
||||||
slots->mScriptObject = aScriptObject;
|
|
||||||
|
|
||||||
if (!aScriptObject) {
|
|
||||||
if (slots->mListenerManager) {
|
|
||||||
slots->mListenerManager->RemoveAllListeners(PR_TRUE);
|
|
||||||
}
|
|
||||||
MaybeClearDOMSlots();
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsGenericElement::GetListenerManager(nsIEventListenerManager** aResult)
|
nsGenericElement::GetListenerManager(nsIEventListenerManager** aResult)
|
||||||
{
|
{
|
||||||
|
@ -2009,115 +1882,6 @@ nsGenericElement::GetListenerManager(nsIEventListenerManager** aResult)
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
// nsIJSScriptObject implementation
|
|
||||||
|
|
||||||
PRBool
|
|
||||||
nsGenericElement::AddProperty(JSContext *aContext, JSObject *aObj, jsval aID,
|
|
||||||
jsval *aVp)
|
|
||||||
{
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool
|
|
||||||
nsGenericElement::DeleteProperty(JSContext *aContext, JSObject *aObj,
|
|
||||||
jsval aID, jsval *aVp)
|
|
||||||
{
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool
|
|
||||||
nsGenericElement::GetProperty(JSContext *aContext, JSObject *aObj, jsval aID,
|
|
||||||
jsval *aVp)
|
|
||||||
{
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool
|
|
||||||
nsGenericElement::SetProperty(JSContext *aContext, JSObject *aObj, jsval aID,
|
|
||||||
jsval *aVp)
|
|
||||||
{
|
|
||||||
return InternalRegisterCompileEventHandler(aContext, aID, aVp, PR_FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool
|
|
||||||
nsGenericElement::EnumerateProperty(JSContext *aContext, JSObject *aObj)
|
|
||||||
{
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool
|
|
||||||
nsGenericElement::Resolve(JSContext *aContext, JSObject *aObj, jsval aID,
|
|
||||||
PRBool* aDidDefineProperty)
|
|
||||||
{
|
|
||||||
*aDidDefineProperty = PR_FALSE;
|
|
||||||
|
|
||||||
return InternalRegisterCompileEventHandler(aContext, aID, nsnull, PR_TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool
|
|
||||||
nsGenericElement::Convert(JSContext *aContext, JSObject *aObj, jsval aID)
|
|
||||||
{
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsGenericElement::Finalize(JSContext *aContext, JSObject *aObj)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool
|
|
||||||
nsGenericElement::InternalRegisterCompileEventHandler(JSContext* aContext, jsval aPropName,
|
|
||||||
jsval *aVp, PRBool aCompile)
|
|
||||||
{
|
|
||||||
//If called from resolve there is no aVp arg to check against. Else check for function value.
|
|
||||||
//In both cases check for string type starting with 'on' before continuing with handler checking.
|
|
||||||
if ((!aVp || JS_TypeOfValue(aContext, *aVp) == JSTYPE_FUNCTION) && JSVAL_IS_STRING(aPropName)) {
|
|
||||||
const PRUnichar* str = NS_REINTERPRET_CAST(const PRUnichar *, JS_GetStringChars(JS_ValueToString(aContext, aPropName)));
|
|
||||||
|
|
||||||
if (str && str[0] == 'o' && str[1] == 'n' && str[2]) {
|
|
||||||
nsCOMPtr<nsIAtom> atom(dont_AddRef(NS_NewAtom(str)));
|
|
||||||
|
|
||||||
if (atom.get() == nsLayoutAtoms::onmousedown || atom.get() == nsLayoutAtoms::onmouseup ||
|
|
||||||
atom.get() == nsLayoutAtoms::onclick || atom.get() == nsLayoutAtoms::onmouseover ||
|
|
||||||
atom.get() == nsLayoutAtoms::onmouseout ||atom.get() == nsLayoutAtoms::onkeydown ||
|
|
||||||
atom.get() == nsLayoutAtoms::onkeyup || atom.get() == nsLayoutAtoms::onkeypress ||
|
|
||||||
atom.get() == nsLayoutAtoms::onmousemove || atom.get() == nsLayoutAtoms::onfocus ||
|
|
||||||
atom.get() == nsLayoutAtoms::onblur || atom.get() == nsLayoutAtoms::onsubmit ||
|
|
||||||
atom.get() == nsLayoutAtoms::onreset || atom.get() == nsLayoutAtoms::onchange ||
|
|
||||||
atom.get() == nsLayoutAtoms::onselect || atom.get() == nsLayoutAtoms::onload ||
|
|
||||||
atom.get() == nsLayoutAtoms::onunload || atom.get() == nsLayoutAtoms::onabort ||
|
|
||||||
atom.get() == nsLayoutAtoms::onerror || atom.get() == nsLayoutAtoms::onpaint ||
|
|
||||||
atom.get() == nsLayoutAtoms::onresize || atom.get() == nsLayoutAtoms::onscroll ||
|
|
||||||
atom.get() == nsLayoutAtoms::oncontextmenu || atom.get() == nsLayoutAtoms::onDOMAttrModified ||
|
|
||||||
atom.get() == nsLayoutAtoms::onDOMCharacterDataModified || atom.get() == nsLayoutAtoms::onDOMSubtreeModified ||
|
|
||||||
atom.get() == nsLayoutAtoms::onDOMNodeInsertedIntoDocument || atom.get() == nsLayoutAtoms::onDOMNodeRemovedFromDocument ||
|
|
||||||
atom.get() == nsLayoutAtoms::onDOMNodeInserted || atom.get() == nsLayoutAtoms::onDOMNodeRemoved
|
|
||||||
) {
|
|
||||||
|
|
||||||
nsCOMPtr<nsIEventListenerManager> manager;
|
|
||||||
GetListenerManager(getter_AddRefs(manager));
|
|
||||||
|
|
||||||
if (manager) {
|
|
||||||
nsCOMPtr<nsIScriptContext> scriptContext;
|
|
||||||
nsresult rv = nsContentUtils::GetStaticScriptContext(aContext, NS_REINTERPRET_CAST(JSObject*, GetDOMSlots()->mScriptObject),
|
|
||||||
getter_AddRefs(scriptContext));
|
|
||||||
if (NS_SUCCEEDED(rv) && scriptContext) {
|
|
||||||
if (aCompile) {
|
|
||||||
rv = manager->CompileScriptEventListener(scriptContext, this, atom);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
rv = manager->RegisterScriptEventListener(scriptContext, this, atom);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Generic DOMNode implementations
|
// Generic DOMNode implementations
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2285,6 +2049,10 @@ nsGenericElement::doInsertBefore(nsIDOMNode* aNewChild,
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDocument> old_doc;
|
||||||
|
|
||||||
|
newContent->GetDocument(*getter_AddRefs(old_doc));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove the element from the old parent if one exists, since oldParent
|
* Remove the element from the old parent if one exists, since oldParent
|
||||||
* is a nsIDOMNode this will do the right thing even if the parent of
|
* is a nsIDOMNode this will do the right thing even if the parent of
|
||||||
|
@ -2333,6 +2101,9 @@ nsGenericElement::doInsertBefore(nsIDOMNode* aNewChild,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsContentUtils::ReparentContentWrapper(newContent, this, mDocument,
|
||||||
|
old_doc);
|
||||||
|
|
||||||
res = InsertChildAt(newContent, refPos, PR_TRUE, PR_TRUE);
|
res = InsertChildAt(newContent, refPos, PR_TRUE, PR_TRUE);
|
||||||
|
|
||||||
if (NS_FAILED(res)) {
|
if (NS_FAILED(res)) {
|
||||||
|
@ -2478,6 +2249,10 @@ nsGenericElement::doReplaceChild(nsIDOMNode* aNewChild,
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDocument> old_doc;
|
||||||
|
|
||||||
|
newContent->GetDocument(*getter_AddRefs(old_doc));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove the element from the old parent if one exists, since oldParent
|
* Remove the element from the old parent if one exists, since oldParent
|
||||||
* is a nsIDOMNode this will do the right thing even if the parent of
|
* is a nsIDOMNode this will do the right thing even if the parent of
|
||||||
|
@ -2518,6 +2293,9 @@ nsGenericElement::doReplaceChild(nsIDOMNode* aNewChild,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsContentUtils::ReparentContentWrapper(newContent, this, mDocument,
|
||||||
|
old_doc);
|
||||||
|
|
||||||
res = ReplaceChildAt(newContent, oldPos, PR_TRUE, PR_TRUE);
|
res = ReplaceChildAt(newContent, oldPos, PR_TRUE, PR_TRUE);
|
||||||
|
|
||||||
if (NS_FAILED(res)) {
|
if (NS_FAILED(res)) {
|
||||||
|
@ -2596,17 +2374,13 @@ nsGenericElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_NOINTERFACE;
|
return NS_NOINTERFACE;
|
||||||
} else if (aIID.Equals(NS_GET_IID(nsIScriptObjectOwner))) {
|
}
|
||||||
inst = NS_STATIC_CAST(nsIScriptObjectOwner *, this);
|
else if (mDocument) {
|
||||||
} else if (aIID.Equals(NS_GET_IID(nsIJSScriptObject))) {
|
|
||||||
inst = NS_STATIC_CAST(nsIJSScriptObject *, this);
|
|
||||||
}
|
|
||||||
else if (mDOMSlots && mDOMSlots->mScriptObject && mDocument) {
|
|
||||||
nsCOMPtr<nsIBindingManager> manager;
|
nsCOMPtr<nsIBindingManager> manager;
|
||||||
mDocument->GetBindingManager(getter_AddRefs(manager));
|
mDocument->GetBindingManager(getter_AddRefs(manager));
|
||||||
if (manager)
|
if (manager)
|
||||||
return manager->GetBindingImplementation(NS_STATIC_CAST(nsIStyledContent*, this), mDOMSlots->mScriptObject,
|
return manager->GetBindingImplementation(this, aIID, aInstancePtr);
|
||||||
aIID, aInstancePtr);
|
|
||||||
return NS_NOINTERFACE;
|
return NS_NOINTERFACE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -2719,11 +2493,8 @@ nsGenericElement::AddScriptEventListener(nsIAtom* aAttribute,
|
||||||
receiver->GetListenerManager(getter_AddRefs(manager));
|
receiver->GetListenerManager(getter_AddRefs(manager));
|
||||||
|
|
||||||
if (manager) {
|
if (manager) {
|
||||||
nsCOMPtr<nsIScriptObjectOwner> objOwner(do_QueryInterface(global));
|
ret = manager->AddScriptEventListener(context, global, aAttribute,
|
||||||
if (objOwner) {
|
aValue, PR_FALSE);
|
||||||
ret = manager->AddScriptEventListener(context, objOwner, aAttribute,
|
|
||||||
aValue, PR_FALSE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -2884,16 +2655,15 @@ nsGenericContainerElement::GetChildNodes(nsIDOMNodeList** aChildNodes)
|
||||||
{
|
{
|
||||||
nsDOMSlots *slots = GetDOMSlots();
|
nsDOMSlots *slots = GetDOMSlots();
|
||||||
|
|
||||||
if (nsnull == slots->mChildNodes) {
|
if (!slots->mChildNodes) {
|
||||||
slots->mChildNodes = new nsChildContentList(this);
|
slots->mChildNodes = new nsChildContentList(this);
|
||||||
if (nsnull == slots->mChildNodes) {
|
if (!slots->mChildNodes) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
NS_ADDREF(slots->mChildNodes);
|
NS_ADDREF(slots->mChildNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
return slots->mChildNodes->QueryInterface(NS_GET_IID(nsIDOMNodeList),
|
return CallQueryInterface(slots->mChildNodes, aChildNodes);
|
||||||
(void **)aChildNodes);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -3101,8 +2871,10 @@ nsGenericContainerElement::SetAttribute(nsINodeInfo* aNodeInfo,
|
||||||
mutation.mPrevAttrValue = getter_AddRefs(NS_NewAtom(oldValue));
|
mutation.mPrevAttrValue = getter_AddRefs(NS_NewAtom(oldValue));
|
||||||
if (!aValue.IsEmpty())
|
if (!aValue.IsEmpty())
|
||||||
mutation.mNewAttrValue = getter_AddRefs(NS_NewAtom(aValue));
|
mutation.mNewAttrValue = getter_AddRefs(NS_NewAtom(aValue));
|
||||||
mutation.mAttrChange = modification ? nsIDOMMutationEvent::MODIFICATION :
|
if (modification)
|
||||||
nsIDOMMutationEvent::ADDITION;
|
mutation.mAttrChange = nsIDOMMutationEvent::MODIFICATION;
|
||||||
|
else
|
||||||
|
mutation.mAttrChange = nsIDOMMutationEvent::ADDITION;
|
||||||
nsEventStatus status = nsEventStatus_eIgnore;
|
nsEventStatus status = nsEventStatus_eIgnore;
|
||||||
HandleDOMEvent(nsnull, &mutation, nsnull,
|
HandleDOMEvent(nsnull, &mutation, nsnull,
|
||||||
NS_EVENT_FLAG_INIT, &status);
|
NS_EVENT_FLAG_INIT, &status);
|
||||||
|
|
|
@ -33,26 +33,23 @@
|
||||||
#include "nsICSSStyleSheet.h"
|
#include "nsICSSStyleSheet.h"
|
||||||
#include "nsICSSLoaderObserver.h"
|
#include "nsICSSLoaderObserver.h"
|
||||||
#include "nsVoidArray.h"
|
#include "nsVoidArray.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIJSScriptObject.h"
|
|
||||||
#include "nsILinkHandler.h"
|
#include "nsILinkHandler.h"
|
||||||
#include "nsGenericDOMNodeList.h"
|
#include "nsGenericDOMNodeList.h"
|
||||||
#include "nsIEventListenerManager.h"
|
#include "nsIEventListenerManager.h"
|
||||||
#include "nsINodeInfo.h"
|
#include "nsINodeInfo.h"
|
||||||
#include "nsIParser.h"
|
#include "nsIParser.h"
|
||||||
|
#include "nsContentUtils.h"
|
||||||
|
|
||||||
class nsIDOMAttr;
|
class nsIDOMAttr;
|
||||||
class nsIDOMEventListener;
|
class nsIDOMEventListener;
|
||||||
class nsIFrame;
|
class nsIFrame;
|
||||||
class nsISupportsArray;
|
class nsISupportsArray;
|
||||||
class nsIDOMScriptObjectFactory;
|
|
||||||
class nsDOMCSSDeclaration;
|
class nsDOMCSSDeclaration;
|
||||||
class nsIDOMCSSStyleDeclaration;
|
class nsIDOMCSSStyleDeclaration;
|
||||||
class nsDOMAttributeMap;
|
class nsDOMAttributeMap;
|
||||||
class nsIURI;
|
class nsIURI;
|
||||||
class nsINodeInfo;
|
class nsINodeInfo;
|
||||||
|
|
||||||
|
|
||||||
// Class that holds the child list of a content element and also
|
// Class that holds the child list of a content element and also
|
||||||
// implements the nsIDOMNodeList interface.
|
// implements the nsIDOMNodeList interface.
|
||||||
class nsChildContentList : public nsGenericDOMNodeList
|
class nsChildContentList : public nsGenericDOMNodeList
|
||||||
|
@ -62,7 +59,7 @@ public:
|
||||||
virtual ~nsChildContentList();
|
virtual ~nsChildContentList();
|
||||||
|
|
||||||
// nsIDOMNodeList interface
|
// nsIDOMNodeList interface
|
||||||
NS_DECL_IDOMNODELIST
|
NS_DECL_NSIDOMNODELIST
|
||||||
|
|
||||||
void DropReference();
|
void DropReference();
|
||||||
|
|
||||||
|
@ -117,7 +114,6 @@ private:
|
||||||
// in a side structure that's only allocated when the content is
|
// in a side structure that's only allocated when the content is
|
||||||
// accessed through the DOM.
|
// accessed through the DOM.
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void *mScriptObject;
|
|
||||||
nsChildContentList *mChildNodes;
|
nsChildContentList *mChildNodes;
|
||||||
nsDOMCSSDeclaration *mStyle;
|
nsDOMCSSDeclaration *mStyle;
|
||||||
nsDOMAttributeMap* mAttributeMap;
|
nsDOMAttributeMap* mAttributeMap;
|
||||||
|
@ -127,8 +123,25 @@ typedef struct {
|
||||||
// that created us. [Weak]
|
// that created us. [Weak]
|
||||||
} nsDOMSlots;
|
} nsDOMSlots;
|
||||||
|
|
||||||
class nsGenericElement : public nsIHTMLContent,
|
|
||||||
public nsIJSScriptObject
|
class nsNode3Tearoff : public nsIDOM3Node
|
||||||
|
{
|
||||||
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
|
NS_DECL_NSIDOM3NODE
|
||||||
|
|
||||||
|
nsNode3Tearoff(nsIContent *aContent) : mContent(aContent)
|
||||||
|
{
|
||||||
|
NS_INIT_ISUPPORTS();
|
||||||
|
}
|
||||||
|
virtual ~nsNode3Tearoff() {};
|
||||||
|
|
||||||
|
private:
|
||||||
|
nsCOMPtr<nsIContent> mContent;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class nsGenericElement : public nsIHTMLContent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsGenericElement();
|
nsGenericElement();
|
||||||
|
@ -196,6 +209,7 @@ public:
|
||||||
NS_IMETHOD RemoveFocus(nsIPresContext* aContext);
|
NS_IMETHOD RemoveFocus(nsIPresContext* aContext);
|
||||||
NS_IMETHOD GetBindingParent(nsIContent** aContent);
|
NS_IMETHOD GetBindingParent(nsIContent** aContent);
|
||||||
NS_IMETHOD SetBindingParent(nsIContent* aParent);
|
NS_IMETHOD SetBindingParent(nsIContent* aParent);
|
||||||
|
NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags);
|
||||||
|
|
||||||
// nsIStyledContent interface methods
|
// nsIStyledContent interface methods
|
||||||
NS_IMETHOD GetID(nsIAtom*& aResult) const;
|
NS_IMETHOD GetID(nsIAtom*& aResult) const;
|
||||||
|
@ -230,27 +244,6 @@ public:
|
||||||
NS_IMETHOD GetBaseURL(nsIURI*& aBaseURL) const;
|
NS_IMETHOD GetBaseURL(nsIURI*& aBaseURL) const;
|
||||||
NS_IMETHOD GetBaseTarget(nsAWritableString& aBaseTarget) const;
|
NS_IMETHOD GetBaseTarget(nsAWritableString& aBaseTarget) const;
|
||||||
|
|
||||||
|
|
||||||
// nsIScriptObjectOwner interface methods
|
|
||||||
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject);
|
|
||||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
|
||||||
|
|
||||||
// nsIJSScriptObject interface methods
|
|
||||||
virtual PRBool AddProperty(JSContext *aContext, JSObject *aObj,
|
|
||||||
jsval aID, jsval *aVp);
|
|
||||||
virtual PRBool DeleteProperty(JSContext *aContext, JSObject *aObj,
|
|
||||||
jsval aID, jsval *aVp);
|
|
||||||
virtual PRBool GetProperty(JSContext *aContext, JSObject *aObj,
|
|
||||||
jsval aID, jsval *aVp);
|
|
||||||
virtual PRBool SetProperty(JSContext *aContext, JSObject *aObj,
|
|
||||||
jsval aID, jsval *aVp);
|
|
||||||
virtual PRBool EnumerateProperty(JSContext *aContext, JSObject *aObj);
|
|
||||||
virtual PRBool Resolve(JSContext *aContext, JSObject *aObj, jsval aID,
|
|
||||||
PRBool *aDidDefineProperty);
|
|
||||||
virtual PRBool Convert(JSContext *aContext, JSObject *aObj, jsval aID);
|
|
||||||
virtual void Finalize(JSContext *aContext, JSObject *aObj);
|
|
||||||
|
|
||||||
|
|
||||||
// nsIDOMNode method implementation
|
// nsIDOMNode method implementation
|
||||||
NS_IMETHOD GetNodeName(nsAWritableString& aNodeName);
|
NS_IMETHOD GetNodeName(nsAWritableString& aNodeName);
|
||||||
NS_IMETHOD GetLocalName(nsAWritableString& aLocalName);
|
NS_IMETHOD GetLocalName(nsAWritableString& aLocalName);
|
||||||
|
@ -269,7 +262,6 @@ public:
|
||||||
NS_IMETHOD IsSupported(const nsAReadableString& aFeature,
|
NS_IMETHOD IsSupported(const nsAReadableString& aFeature,
|
||||||
const nsAReadableString& aVersion, PRBool* aReturn);
|
const nsAReadableString& aVersion, PRBool* aReturn);
|
||||||
NS_IMETHOD HasAttributes(PRBool* aHasAttributes);
|
NS_IMETHOD HasAttributes(PRBool* aHasAttributes);
|
||||||
NS_IMETHOD GetBaseURI(nsAWritableString& aURI);
|
|
||||||
|
|
||||||
// nsIDOMElement method implementation
|
// nsIDOMElement method implementation
|
||||||
NS_IMETHOD GetTagName(nsAWritableString& aTagName);
|
NS_IMETHOD GetTagName(nsAWritableString& aTagName);
|
||||||
|
@ -333,10 +325,6 @@ public:
|
||||||
static void SetDocumentInChildrenOf(nsIContent* aContent,
|
static void SetDocumentInChildrenOf(nsIContent* aContent,
|
||||||
nsIDocument* aDocument, PRBool aCompileEventHandlers);
|
nsIDocument* aDocument, PRBool aCompileEventHandlers);
|
||||||
|
|
||||||
static nsresult GetScriptObjectFactory(nsIDOMScriptObjectFactory **aFactory);
|
|
||||||
|
|
||||||
static nsIDOMScriptObjectFactory *gScriptObjectFactory;
|
|
||||||
|
|
||||||
static nsresult InternalIsSupported(const nsAReadableString& aFeature,
|
static nsresult InternalIsSupported(const nsAReadableString& aFeature,
|
||||||
const nsAReadableString& aVersion,
|
const nsAReadableString& aVersion,
|
||||||
PRBool* aReturn);
|
PRBool* aReturn);
|
||||||
|
@ -346,8 +334,6 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual PRUint32 BaseSizeOf(nsISizeOfHandler *aSizer) const;
|
virtual PRUint32 BaseSizeOf(nsISizeOfHandler *aSizer) const;
|
||||||
virtual PRBool InternalRegisterCompileEventHandler(JSContext* aContext, jsval aPropName,
|
|
||||||
jsval *aVp, PRBool aCompile);
|
|
||||||
|
|
||||||
nsDOMSlots *GetDOMSlots();
|
nsDOMSlots *GetDOMSlots();
|
||||||
void MaybeClearDOMSlots();
|
void MaybeClearDOMSlots();
|
||||||
|
@ -450,7 +436,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#define NS_FORWARD_IDOMNODE_NO_CLONENODE(_to) \
|
#define NS_FORWARD_NSIDOMNODE_NO_CLONENODE(_to) \
|
||||||
NS_IMETHOD GetNodeName(nsAWritableString& aNodeName) { return _to GetNodeName(aNodeName); } \
|
NS_IMETHOD GetNodeName(nsAWritableString& aNodeName) { return _to GetNodeName(aNodeName); } \
|
||||||
NS_IMETHOD GetNodeValue(nsAWritableString& aNodeValue) { return _to GetNodeValue(aNodeValue); } \
|
NS_IMETHOD GetNodeValue(nsAWritableString& aNodeValue) { return _to GetNodeValue(aNodeValue); } \
|
||||||
NS_IMETHOD SetNodeValue(const nsAReadableString& aNodeValue) { return _to SetNodeValue(aNodeValue); } \
|
NS_IMETHOD SetNodeValue(const nsAReadableString& aNodeValue) { return _to SetNodeValue(aNodeValue); } \
|
||||||
|
@ -475,7 +461,12 @@ protected:
|
||||||
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); \
|
NS_IMETHOD CloneNode(PRBool aDeep, nsIDOMNode** aReturn); \
|
||||||
NS_IMETHOD Normalize() { return _to Normalize(); } \
|
NS_IMETHOD Normalize() { return _to Normalize(); } \
|
||||||
NS_IMETHOD IsSupported(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn) { return _to IsSupported(aFeature, aVersion, aReturn); } \
|
NS_IMETHOD IsSupported(const nsAReadableString& aFeature, const nsAReadableString& aVersion, PRBool* aReturn) { return _to IsSupported(aFeature, aVersion, aReturn); } \
|
||||||
NS_IMETHOD HasAttributes(PRBool* aReturn) { return _to HasAttributes(aReturn); } \
|
NS_IMETHOD HasAttributes(PRBool* aReturn) { return _to HasAttributes(aReturn); }
|
||||||
NS_IMETHOD GetBaseURI(nsAWritableString& aURI) { return _to GetBaseURI(aURI); } \
|
|
||||||
|
#define NS_INTERFACE_MAP_ENTRY_TEAROFF(_iid, _tearoff) \
|
||||||
|
if (aIID.Equals(NS_GET_IID(_iid))) { \
|
||||||
|
foundInterface = new _tearoff; \
|
||||||
|
NS_ENSURE_TRUE(foundInterface, NS_ERROR_OUT_OF_MEMORY); \
|
||||||
|
} else
|
||||||
|
|
||||||
#endif /* nsGenericElement_h___ */
|
#endif /* nsGenericElement_h___ */
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsIAtom.h"
|
#include "nsIAtom.h"
|
||||||
#include "nsINameSpaceManager.h"
|
#include "nsINameSpaceManager.h"
|
||||||
|
#include "domstubs.h" // for SetDOMStringToNull();
|
||||||
|
|
||||||
|
|
||||||
nsNodeInfo::nsNodeInfo()
|
nsNodeInfo::nsNodeInfo()
|
||||||
|
@ -129,7 +130,7 @@ nsNodeInfo::GetLocalName(nsAWritableString& aLocalName)
|
||||||
return mInner.mName->ToString(aLocalName);
|
return mInner.mName->ToString(aLocalName);
|
||||||
}
|
}
|
||||||
|
|
||||||
aLocalName.Truncate();
|
SetDOMStringToNull(aLocalName);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
#else
|
#else
|
||||||
|
@ -144,7 +145,7 @@ nsNodeInfo::GetPrefix(nsAWritableString& aPrefix)
|
||||||
if (mInner.mPrefix) {
|
if (mInner.mPrefix) {
|
||||||
mInner.mPrefix->ToString(aPrefix);
|
mInner.mPrefix->ToString(aPrefix);
|
||||||
} else {
|
} else {
|
||||||
aPrefix.Truncate();
|
SetDOMStringToNull(aPrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -175,7 +176,7 @@ nsNodeInfo::GetNamespaceURI(nsAWritableString& aNameSpaceURI)
|
||||||
|
|
||||||
rv = nsm->GetNameSpaceURI(mInner.mNamespaceID, aNameSpaceURI);
|
rv = nsm->GetNameSpaceURI(mInner.mNamespaceID, aNameSpaceURI);
|
||||||
} else {
|
} else {
|
||||||
aNameSpaceURI.Truncate();
|
SetDOMStringToNull(aNameSpaceURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -394,6 +395,14 @@ nsNodeInfo::PrefixChanged(nsIAtom *aPrefix, nsINodeInfo*& aResult)
|
||||||
aResult);
|
aResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsNodeInfo::GetDocument(nsIDocument*& aDocument)
|
||||||
|
{
|
||||||
|
NS_ENSURE_TRUE(mOwnerManager, NS_ERROR_NOT_INITIALIZED);
|
||||||
|
|
||||||
|
return mOwnerManager->GetDocument(aDocument);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PLHashNumber
|
PLHashNumber
|
||||||
nsNodeInfoInner::GetHashValue(const void *key)
|
nsNodeInfoInner::GetHashValue(const void *key)
|
||||||
|
|
|
@ -98,6 +98,7 @@ public:
|
||||||
|
|
||||||
NS_IMETHOD NameChanged(nsIAtom *aName, nsINodeInfo*& aResult);
|
NS_IMETHOD NameChanged(nsIAtom *aName, nsINodeInfo*& aResult);
|
||||||
NS_IMETHOD PrefixChanged(nsIAtom *aPrefix, nsINodeInfo*& aResult);
|
NS_IMETHOD PrefixChanged(nsIAtom *aPrefix, nsINodeInfo*& aResult);
|
||||||
|
NS_IMETHOD GetDocument(nsIDocument*& aDocument);
|
||||||
|
|
||||||
// nsNodeInfo
|
// nsNodeInfo
|
||||||
nsNodeInfo();
|
nsNodeInfo();
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsIAtom.h"
|
#include "nsIAtom.h"
|
||||||
|
#include "nsIDocument.h"
|
||||||
|
|
||||||
nsNodeInfoManager* nsNodeInfoManager::gAnonymousNodeInfoManager = nsnull;
|
nsNodeInfoManager* nsNodeInfoManager::gAnonymousNodeInfoManager = nsnull;
|
||||||
PRUint32 nsNodeInfoManager::gNodeManagerCount = 0;
|
PRUint32 nsNodeInfoManager::gNodeManagerCount = 0;
|
||||||
|
@ -44,7 +45,7 @@ nsresult NS_NewNodeInfoManager(nsINodeInfoManager** aResult)
|
||||||
|
|
||||||
|
|
||||||
nsNodeInfoManager::nsNodeInfoManager()
|
nsNodeInfoManager::nsNodeInfoManager()
|
||||||
: mNameSpaceManager(nsnull)
|
: mDocument(nsnull)
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
|
|
||||||
|
@ -101,17 +102,28 @@ NS_IMPL_THREADSAFE_ISUPPORTS(nsNodeInfoManager,
|
||||||
// nsINodeInfoManager
|
// nsINodeInfoManager
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsNodeInfoManager::Init(nsINameSpaceManager *aNameSpaceManager)
|
nsNodeInfoManager::Init(nsIDocument *aDocument,
|
||||||
|
nsINameSpaceManager *aNameSpaceManager)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aNameSpaceManager);
|
NS_ENSURE_ARG_POINTER(aNameSpaceManager);
|
||||||
NS_ENSURE_TRUE(mNodeInfoHash, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(mNodeInfoHash, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
|
mDocument = aDocument;
|
||||||
mNameSpaceManager = aNameSpaceManager;
|
mNameSpaceManager = aNameSpaceManager;
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsNodeInfoManager::DropDocumentReference()
|
||||||
|
{
|
||||||
|
mDocument = nsnull;
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsNodeInfoManager::GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix,
|
nsNodeInfoManager::GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix,
|
||||||
PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo)
|
PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo)
|
||||||
|
@ -263,6 +275,17 @@ nsNodeInfoManager::GetNamespaceManager(nsINameSpaceManager*& aNameSpaceManager)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsNodeInfoManager::GetDocument(nsIDocument*& aDocument)
|
||||||
|
{
|
||||||
|
aDocument = mDocument;
|
||||||
|
|
||||||
|
NS_IF_ADDREF(aDocument);
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
nsNodeInfoManager::RemoveNodeInfo(nsNodeInfo *aNodeInfo)
|
nsNodeInfoManager::RemoveNodeInfo(nsNodeInfo *aNodeInfo)
|
||||||
{
|
{
|
||||||
|
|
|
@ -37,7 +37,9 @@ public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
// nsINodeInfoManager
|
// nsINodeInfoManager
|
||||||
NS_IMETHOD Init(nsINameSpaceManager *aNameSpaceManager);
|
NS_IMETHOD Init(nsIDocument *aDocument,
|
||||||
|
nsINameSpaceManager *aNameSpaceManager);
|
||||||
|
NS_IMETHOD DropDocumentReference();
|
||||||
NS_IMETHOD GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix,
|
NS_IMETHOD GetNodeInfo(nsIAtom *aName, nsIAtom *aPrefix,
|
||||||
PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo);
|
PRInt32 aNamespaceID, nsINodeInfo*& aNodeInfo);
|
||||||
NS_IMETHOD GetNodeInfo(const nsAReadableString& aName, nsIAtom *aPrefix,
|
NS_IMETHOD GetNodeInfo(const nsAReadableString& aName, nsIAtom *aPrefix,
|
||||||
|
@ -51,6 +53,7 @@ public:
|
||||||
const nsAReadableString& aNamespaceURI,
|
const nsAReadableString& aNamespaceURI,
|
||||||
nsINodeInfo*& aNodeInfo);
|
nsINodeInfo*& aNodeInfo);
|
||||||
NS_IMETHOD GetNamespaceManager(nsINameSpaceManager*& aNameSpaceManager);
|
NS_IMETHOD GetNamespaceManager(nsINameSpaceManager*& aNameSpaceManager);
|
||||||
|
NS_IMETHOD GetDocument(nsIDocument*& aDocument);
|
||||||
|
|
||||||
// nsNodeInfoManager
|
// nsNodeInfoManager
|
||||||
nsNodeInfoManager();
|
nsNodeInfoManager();
|
||||||
|
@ -63,6 +66,7 @@ public:
|
||||||
private:
|
private:
|
||||||
PLHashTable *mNodeInfoHash;
|
PLHashTable *mNodeInfoHash;
|
||||||
nsCOMPtr<nsINameSpaceManager> mNameSpaceManager;
|
nsCOMPtr<nsINameSpaceManager> mNameSpaceManager;
|
||||||
|
nsIDocument *mDocument; // WEAK
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gAnonymousNodeInfoManager is a global nodeinfo manager used for nodes
|
* gAnonymousNodeInfoManager is a global nodeinfo manager used for nodes
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#include "nsDOMError.h"
|
#include "nsDOMError.h"
|
||||||
#include "nsIContentIterator.h"
|
#include "nsIContentIterator.h"
|
||||||
#include "nsIDOMNodeList.h"
|
#include "nsIDOMNodeList.h"
|
||||||
#include "nsIScriptGlobalObject.h"
|
|
||||||
#include "nsIParser.h"
|
#include "nsIParser.h"
|
||||||
#include "nsIComponentManager.h"
|
#include "nsIComponentManager.h"
|
||||||
#include "nsParserCIID.h"
|
#include "nsParserCIID.h"
|
||||||
|
@ -44,6 +43,8 @@
|
||||||
// XXX Temporary inclusion to deal with fragment parsing
|
// XXX Temporary inclusion to deal with fragment parsing
|
||||||
#include "nsHTMLParts.h"
|
#include "nsHTMLParts.h"
|
||||||
|
|
||||||
|
#include "nsContentUtils.h"
|
||||||
|
|
||||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||||
static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
|
static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
|
||||||
|
|
||||||
|
@ -78,7 +79,6 @@ class nsAutoRangeLock
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Returns -1 if point1 < point2, 1, if point1 > point2,
|
// Returns -1 if point1 < point2, 1, if point1 > point2,
|
||||||
// 0 if error or if point1 == point2.
|
// 0 if error or if point1 == point2.
|
||||||
PRInt32 ComparePoints(nsIDOMNode* aParent1, PRInt32 aOffset1,
|
PRInt32 ComparePoints(nsIDOMNode* aParent1, PRInt32 aOffset1,
|
||||||
|
@ -392,8 +392,7 @@ nsRange::nsRange() :
|
||||||
mStartOffset(0),
|
mStartOffset(0),
|
||||||
mEndOffset(0),
|
mEndOffset(0),
|
||||||
mStartParent(),
|
mStartParent(),
|
||||||
mEndParent(),
|
mEndParent()
|
||||||
mScriptObject(nsnull)
|
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
}
|
}
|
||||||
|
@ -429,44 +428,27 @@ void nsRange::Shutdown()
|
||||||
/******************************************************
|
/******************************************************
|
||||||
* nsISupports
|
* nsISupports
|
||||||
******************************************************/
|
******************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
// XPConnect interface list for nsRange
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(Range)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMRange)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMNSRange)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsRange
|
||||||
|
NS_INTERFACE_MAP_BEGIN(nsRange)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMRange)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNSRange)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMRange)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(Range)
|
||||||
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsRange)
|
NS_IMPL_ADDREF(nsRange)
|
||||||
NS_IMPL_RELEASE(nsRange)
|
NS_IMPL_RELEASE(nsRange)
|
||||||
|
|
||||||
nsresult nsRange::QueryInterface(const nsIID& aIID,
|
|
||||||
void** aInstancePtrResult)
|
|
||||||
{
|
|
||||||
NS_PRECONDITION(aInstancePtrResult, "null pointer");
|
|
||||||
if (!aInstancePtrResult)
|
|
||||||
{
|
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
}
|
|
||||||
if (aIID.Equals(kISupportsIID))
|
|
||||||
{
|
|
||||||
*aInstancePtrResult = (void*)(nsISupports*)(nsIDOMRange *)this;
|
|
||||||
NS_ADDREF_THIS();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
if (aIID.Equals(NS_GET_IID(nsIDOMRange)))
|
|
||||||
{
|
|
||||||
*aInstancePtrResult = (void*)(nsIDOMRange*)this;
|
|
||||||
NS_ADDREF_THIS();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
if (aIID.Equals(NS_GET_IID(nsIDOMNSRange)))
|
|
||||||
{
|
|
||||||
*aInstancePtrResult = (void*)(nsIDOMNSRange*)this;
|
|
||||||
NS_ADDREF_THIS();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
if (aIID.Equals(NS_GET_IID(nsIScriptObjectOwner))) {
|
|
||||||
nsIScriptObjectOwner* tmp = this;
|
|
||||||
*aInstancePtrResult = (void*) tmp;
|
|
||||||
NS_ADDREF_THIS();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
return NS_NOINTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/********************************************************
|
/********************************************************
|
||||||
* Utilities for comparing points: API from nsIDOMNSRange
|
* Utilities for comparing points: API from nsIDOMNSRange
|
||||||
|
@ -2215,31 +2197,6 @@ nsRange::SetBeforeAndAfter(PRBool aBefore, PRBool aAfter)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// BEGIN nsIScriptObjectOwner interface implementations
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsRange::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
|
|
||||||
{
|
|
||||||
nsresult res = NS_OK;
|
|
||||||
nsIScriptGlobalObject *globalObj = aContext->GetGlobalObject();
|
|
||||||
|
|
||||||
if (!mScriptObject) {
|
|
||||||
res = NS_NewScriptRange(aContext, (nsISupports *)(nsIDOMRange *)this, globalObj, (void**)&mScriptObject);
|
|
||||||
}
|
|
||||||
*aScriptObject = mScriptObject;
|
|
||||||
|
|
||||||
NS_RELEASE(globalObj);
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsRange::SetScriptObject(void *aScriptObject)
|
|
||||||
{
|
|
||||||
mScriptObject = aScriptObject;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
// END nsIScriptObjectOwner interface implementations
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsRange::Lock()
|
nsRange::Lock()
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include "nsIDOMDocumentFragment.h"
|
#include "nsIDOMDocumentFragment.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIDOMNode.h"
|
#include "nsIDOMNode.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "prmon.h"
|
#include "prmon.h"
|
||||||
|
|
||||||
class nsVoidArray;
|
class nsVoidArray;
|
||||||
|
@ -63,8 +62,7 @@ public:
|
||||||
// -------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------
|
||||||
|
|
||||||
class nsRange : public nsIDOMRange,
|
class nsRange : public nsIDOMRange,
|
||||||
public nsIDOMNSRange,
|
public nsIDOMNSRange
|
||||||
public nsIScriptObjectOwner
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
@ -138,12 +136,6 @@ public:
|
||||||
NS_IMETHOD SetHasGeneratedAfter(PRBool aBool);
|
NS_IMETHOD SetHasGeneratedAfter(PRBool aBool);
|
||||||
NS_IMETHOD SetBeforeAndAfter(PRBool aBefore, PRBool aAfter);
|
NS_IMETHOD SetBeforeAndAfter(PRBool aBefore, PRBool aAfter);
|
||||||
|
|
||||||
/*BEGIN nsIScriptObjectOwner interface implementations*/
|
|
||||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
|
||||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
|
||||||
/*END nsIScriptObjectOwner interface implementations*/
|
|
||||||
|
|
||||||
|
|
||||||
// nsRange interface extensions
|
// nsRange interface extensions
|
||||||
|
|
||||||
static NS_METHOD OwnerGone(nsIContent* aParentNode);
|
static NS_METHOD OwnerGone(nsIContent* aParentNode);
|
||||||
|
@ -211,7 +203,6 @@ public:
|
||||||
nsresult ContentOwnsUs(nsIDOMNode* domNode);
|
nsresult ContentOwnsUs(nsIDOMNode* domNode);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void* mScriptObject;
|
|
||||||
PRBool mBeforeGenContent;
|
PRBool mBeforeGenContent;
|
||||||
PRBool mAfterGenContent;
|
PRBool mAfterGenContent;
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,8 @@ static NS_DEFINE_CID(kFrameTraversalCID, NS_FRAMETRAVERSAL_CID);
|
||||||
|
|
||||||
#include "nsIDOMText.h"
|
#include "nsIDOMText.h"
|
||||||
|
|
||||||
|
#include "nsContentUtils.h"
|
||||||
|
|
||||||
//included for desired x position;
|
//included for desired x position;
|
||||||
#include "nsIPresContext.h"
|
#include "nsIPresContext.h"
|
||||||
#include "nsIPresShell.h"
|
#include "nsIPresShell.h"
|
||||||
|
@ -84,9 +86,6 @@ static NS_DEFINE_CID(kFrameTraversalCID, NS_FRAMETRAVERSAL_CID);
|
||||||
|
|
||||||
#include "nsISelectionController.h"//for the enums
|
#include "nsISelectionController.h"//for the enums
|
||||||
|
|
||||||
/*included so html can call into nsISelection code with no security issues*/
|
|
||||||
#include "nsISecurityCheckedComponent.h"
|
|
||||||
|
|
||||||
#define STATUS_CHECK_RETURN_MACRO() {if (!mTracker) return NS_ERROR_FAILURE;}
|
#define STATUS_CHECK_RETURN_MACRO() {if (!mTracker) return NS_ERROR_FAILURE;}
|
||||||
//#define DEBUG_TABLE 1
|
//#define DEBUG_TABLE 1
|
||||||
|
|
||||||
|
@ -141,11 +140,10 @@ class nsSelectionIterator;
|
||||||
class nsSelection;
|
class nsSelection;
|
||||||
class nsAutoScrollTimer;
|
class nsAutoScrollTimer;
|
||||||
|
|
||||||
class nsTypedSelection : public nsISelection ,
|
class nsTypedSelection : public nsISelection,
|
||||||
public nsISelectionPrivate,
|
public nsISelectionPrivate,
|
||||||
public nsSupportsWeakReference,
|
public nsSupportsWeakReference,
|
||||||
public nsIIndependentSelection,
|
public nsIIndependentSelection
|
||||||
public nsISecurityCheckedComponent
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsTypedSelection();
|
nsTypedSelection();
|
||||||
|
@ -191,9 +189,6 @@ public:
|
||||||
NS_IMETHOD SelectionLanguageChange(PRBool aLangRTL);
|
NS_IMETHOD SelectionLanguageChange(PRBool aLangRTL);
|
||||||
|
|
||||||
/*END nsISelection interface implementations*/
|
/*END nsISelection interface implementations*/
|
||||||
/* nsISecurityCheckedComponent */
|
|
||||||
NS_DECL_NSISECURITYCHECKEDCOMPONENT
|
|
||||||
/*END nsISecurityCheckedComponent*/
|
|
||||||
|
|
||||||
// utility methods for scrolling the selection into view
|
// utility methods for scrolling the selection into view
|
||||||
nsresult GetPresContext(nsIPresContext **aPresContext);
|
nsresult GetPresContext(nsIPresContext **aPresContext);
|
||||||
|
@ -4443,13 +4438,26 @@ nsTypedSelection::~nsTypedSelection()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// XPConnect interface list for nsTypedSelection
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(Selection)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsISelection)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsRange
|
||||||
|
NS_INTERFACE_MAP_BEGIN(nsTypedSelection)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsISelection)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsISelectionPrivate)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIIndependentSelection)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsISelection)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(Selection)
|
||||||
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsTypedSelection)
|
NS_IMPL_ADDREF(nsTypedSelection)
|
||||||
|
|
||||||
NS_IMPL_RELEASE(nsTypedSelection)
|
NS_IMPL_RELEASE(nsTypedSelection)
|
||||||
|
|
||||||
NS_IMPL_QUERY_INTERFACE5(nsTypedSelection, nsISelection, nsISelectionPrivate, nsISupportsWeakReference, nsIIndependentSelection, nsISecurityCheckedComponent)
|
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsTypedSelection::SetPresShell(nsIPresShell *aPresShell)
|
nsTypedSelection::SetPresShell(nsIPresShell *aPresShell)
|
||||||
|
@ -7552,55 +7560,6 @@ nsTypedSelection::DeleteFromDocument()
|
||||||
return mFrameSelection->DeleteFromDocument();
|
return mFrameSelection->DeleteFromDocument();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const char* kAllAccess = "AllAccess";
|
|
||||||
static const char* kNoAccess = "NoAccess";
|
|
||||||
|
|
||||||
/* string canCreateWrapper (in nsIIDPtr iid); */
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsTypedSelection::CanCreateWrapper(const nsIID * iid, char **_retval)
|
|
||||||
{
|
|
||||||
if (iid->Equals(NS_GET_IID(nsISelection))) {
|
|
||||||
*_retval = nsCRT::strdup(kAllAccess);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*_retval = nsCRT::strdup(kNoAccess);
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* string canCallMethod (in nsIIDPtr iid, in wstring methodName); */
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsTypedSelection::CanCallMethod(const nsIID * iid, const PRUnichar *methodName, char **_retval)
|
|
||||||
{
|
|
||||||
if (iid->Equals(NS_GET_IID(nsISelection))) {
|
|
||||||
*_retval = nsCRT::strdup(kAllAccess);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* string canGetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsTypedSelection::CanGetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
|
||||||
{
|
|
||||||
if (iid->Equals(NS_GET_IID(nsISelection))) {
|
|
||||||
*_retval = nsCRT::strdup(kAllAccess);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* string canSetProperty (in nsIIDPtr iid, in wstring propertyName); */
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsTypedSelection::CanSetProperty(const nsIID * iid, const PRUnichar *propertyName, char **_retval)
|
|
||||||
{
|
|
||||||
if (iid->Equals(NS_GET_IID(nsISelection))) {
|
|
||||||
*_retval = nsCRT::strdup(kAllAccess);
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** SelectionLanguageChange modifies the cursor Bidi level after a change in keyboard direction
|
/** SelectionLanguageChange modifies the cursor Bidi level after a change in keyboard direction
|
||||||
* @param aLangRTL is PR_TRUE if the new language is right-to-left or PR_FALSE if the new language is left-to-right
|
* @param aLangRTL is PR_TRUE if the new language is right-to-left or PR_FALSE if the new language is left-to-right
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nsIDOMText.h"
|
#include "nsIDOMText.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsITextContent.h"
|
#include "nsITextContent.h"
|
||||||
|
@ -29,11 +28,12 @@
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
#include "nsLayoutAtoms.h"
|
#include "nsLayoutAtoms.h"
|
||||||
|
#include "nsString.h"
|
||||||
|
#include "nsContentUtils.h"
|
||||||
|
|
||||||
|
|
||||||
class nsTextNode : public nsIDOMText,
|
class nsTextNode : public nsITextContent,
|
||||||
public nsIScriptObjectOwner,
|
public nsIDOMText
|
||||||
public nsITextContent
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsTextNode();
|
nsTextNode();
|
||||||
|
@ -43,16 +43,13 @@ public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_IMPL_IDOMNODE_USING_GENERIC_DOM_DATA(mInner)
|
NS_IMPL_NSIDOMNODE_USING_GENERIC_DOM_DATA(mInner)
|
||||||
|
|
||||||
// nsIDOMCharacterData
|
// nsIDOMCharacterData
|
||||||
NS_IMPL_IDOMCHARACTERDATA_USING_GENERIC_DOM_DATA(mInner)
|
NS_IMPL_NSIDOMCHARACTERDATA_USING_GENERIC_DOM_DATA(mInner)
|
||||||
|
|
||||||
// nsIDOMText
|
// nsIDOMText
|
||||||
NS_IMPL_IDOMTEXT_USING_GENERIC_DOM_DATA(mInner)
|
NS_IMPL_NSIDOMTEXT_USING_GENERIC_DOM_DATA(mInner)
|
||||||
|
|
||||||
// nsIScriptObjectOwner
|
|
||||||
NS_IMPL_ISCRIPTOBJECTOWNER_USING_GENERIC_DOM_DATA(mInner)
|
|
||||||
|
|
||||||
// nsIContent
|
// nsIContent
|
||||||
NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner)
|
NS_IMPL_ICONTENT_USING_GENERIC_DOM_DATA(mInner)
|
||||||
|
@ -97,24 +94,24 @@ nsTextNode::~nsTextNode()
|
||||||
NS_IMPL_ADDREF(nsTextNode)
|
NS_IMPL_ADDREF(nsTextNode)
|
||||||
NS_IMPL_RELEASE(nsTextNode)
|
NS_IMPL_RELEASE(nsTextNode)
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsTextNode::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
// XPConnect interface list for nsTextNode
|
||||||
{
|
NS_CLASSINFO_MAP_BEGIN(Text)
|
||||||
NS_IMPL_DOM_DATA_QUERY_INTERFACE(aIID, aInstancePtr, this)
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMText)
|
||||||
if (aIID.Equals(NS_GET_IID(nsIDOMText))) {
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||||
nsIDOMText* tmp = this;
|
NS_CLASSINFO_MAP_ENTRY(nsIDOM3Node)
|
||||||
*aInstancePtr = (void*) tmp;
|
NS_CLASSINFO_MAP_END
|
||||||
NS_ADDREF_THIS();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
// QueryInterface implementation for nsTextNode
|
||||||
if (aIID.Equals(NS_GET_IID(nsITextContent))) {
|
NS_INTERFACE_MAP_BEGIN(nsTextNode)
|
||||||
nsITextContent* tmp = this;
|
NS_INTERFACE_MAP_ENTRY_DOM_DATA()
|
||||||
*aInstancePtr = (void*) tmp;
|
NS_INTERFACE_MAP_ENTRY(nsITextContent)
|
||||||
NS_ADDREF_THIS();
|
NS_INTERFACE_MAP_ENTRY(nsIDOMText)
|
||||||
return NS_OK;
|
NS_INTERFACE_MAP_ENTRY(nsIDOMCharacterData)
|
||||||
}
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(Text)
|
||||||
return NS_NOINTERFACE;
|
NS_INTERFACE_MAP_END
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsTextNode::GetTag(nsIAtom*& aResult) const
|
nsTextNode::GetTag(nsIAtom*& aResult) const
|
||||||
|
@ -265,3 +262,8 @@ nsTextNode::SetContentID(PRUint32 aID)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP_(PRBool)
|
||||||
|
nsTextNode::IsContentOfType(PRUint32 aFlags)
|
||||||
|
{
|
||||||
|
return !(aFlags & ~eTEXT);
|
||||||
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ LIBRARY_NAME = gkcontent
|
||||||
EXPORT_LIBRARY = 1
|
EXPORT_LIBRARY = 1
|
||||||
SHORT_LIBNAME = gkcontnt
|
SHORT_LIBNAME = gkcontnt
|
||||||
IS_COMPONENT = 1
|
IS_COMPONENT = 1
|
||||||
EXTRA_DSO_LIBS = jsdom gkgfx
|
EXTRA_DSO_LIBS = gkgfx
|
||||||
REQUIRES = xpcom string widget necko rdf docshell dom htmlparser uriloader webshell locale unicharutil lwbrk js pref caps xul xuldoc xultmpl gfx2 timer
|
REQUIRES = xpcom string widget necko rdf docshell dom htmlparser uriloader webshell locale unicharutil lwbrk js pref caps xul xuldoc xultmpl gfx2 timer
|
||||||
|
|
||||||
CPPSRCS = \
|
CPPSRCS = \
|
||||||
|
|
|
@ -74,7 +74,6 @@ LLIBS= \
|
||||||
$(DIST)\lib\xpcom.lib \
|
$(DIST)\lib\xpcom.lib \
|
||||||
$(DIST)\lib\gkgfxwin.lib \
|
$(DIST)\lib\gkgfxwin.lib \
|
||||||
$(DIST)\lib\timer_s.lib \
|
$(DIST)\lib\timer_s.lib \
|
||||||
$(DIST)\lib\jsdom.lib \
|
|
||||||
$(DIST)\lib\js32$(VERSION_NUMBER).lib \
|
$(DIST)\lib\js32$(VERSION_NUMBER).lib \
|
||||||
!if defined(MOZ_PERF)
|
!if defined(MOZ_PERF)
|
||||||
$(DIST)\lib\util.lib \
|
$(DIST)\lib\util.lib \
|
||||||
|
@ -88,7 +87,7 @@ install:: gbdate.h $(DLL)
|
||||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
|
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
|
||||||
|
|
||||||
clobber::
|
clobber::
|
||||||
rm -f $(DIST)\bin\$(DLLNAME).dll
|
rm -f $(DIST)\bin\components\$(DLLNAME).dll
|
||||||
rm -f $(DIST)\lib\$(DLLNAME).lib
|
rm -f $(DIST)\lib\$(DLLNAME).lib
|
||||||
rm -f gbdate.h
|
rm -f gbdate.h
|
||||||
|
|
||||||
|
|
|
@ -45,9 +45,6 @@
|
||||||
#include "nsIRangeUtils.h"
|
#include "nsIRangeUtils.h"
|
||||||
#include "nsIContentIterator.h"
|
#include "nsIContentIterator.h"
|
||||||
#include "nsINameSpaceManager.h"
|
#include "nsINameSpaceManager.h"
|
||||||
#include "nsIScriptNameSetRegistry.h"
|
|
||||||
#include "nsIScriptNameSpaceManager.h"
|
|
||||||
#include "nsIScriptExternalNameSet.h"
|
|
||||||
#include "nsIEventListenerManager.h"
|
#include "nsIEventListenerManager.h"
|
||||||
#include "nsILayoutDebugger.h"
|
#include "nsILayoutDebugger.h"
|
||||||
#include "nsIElementFactory.h"
|
#include "nsIElementFactory.h"
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsContentModule.h"
|
#include "nsContentModule.h"
|
||||||
#include "nsContentCID.h"
|
#include "nsContentCID.h"
|
||||||
|
#include "nsContentUtils.h"
|
||||||
#include "nsIComponentManager.h"
|
#include "nsIComponentManager.h"
|
||||||
#include "nsNetUtil.h"
|
#include "nsNetUtil.h"
|
||||||
#include "nsICSSStyleSheet.h"
|
#include "nsICSSStyleSheet.h"
|
||||||
|
@ -36,12 +37,10 @@
|
||||||
#include "nsColorNames.h" // to addref/release table
|
#include "nsColorNames.h" // to addref/release table
|
||||||
#include "nsLayoutAtoms.h"
|
#include "nsLayoutAtoms.h"
|
||||||
#include "nsDOMCID.h"
|
#include "nsDOMCID.h"
|
||||||
#include "nsIScriptContext.h"
|
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsINameSpaceManager.h"
|
#include "nsINameSpaceManager.h"
|
||||||
#include "nsIScriptNameSetRegistry.h"
|
#include "nsICategoryManager.h"
|
||||||
#include "nsIScriptNameSpaceManager.h"
|
#include "nsIScriptNameSpaceManager.h"
|
||||||
#include "nsIScriptExternalNameSet.h"
|
#include "nsIObserver.h"
|
||||||
|
|
||||||
#include "nsINodeInfo.h"
|
#include "nsINodeInfo.h"
|
||||||
|
|
||||||
|
@ -60,6 +59,13 @@
|
||||||
#include "nsContentPolicyUtils.h"
|
#include "nsContentPolicyUtils.h"
|
||||||
#define PRODUCT_NAME "Gecko"
|
#define PRODUCT_NAME "Gecko"
|
||||||
|
|
||||||
|
#define NS_HTMLIMGELEMENT_CONTRACTID \
|
||||||
|
"@mozilla.org/content/element/html;1?name=img"
|
||||||
|
|
||||||
|
#define NS_HTMLOPTIONELEMENT_CONTRACTID \
|
||||||
|
"@mozilla.org/content/element/html;1?name=option"
|
||||||
|
|
||||||
|
|
||||||
#ifdef MOZ_XUL
|
#ifdef MOZ_XUL
|
||||||
#include "nsXULAtoms.h"
|
#include "nsXULAtoms.h"
|
||||||
#include "nsXULContentUtils.h"
|
#include "nsXULContentUtils.h"
|
||||||
|
@ -94,81 +100,20 @@ extern "C" NS_EXPORT nsresult NSGetModule(nsIComponentManager *servMgr,
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
static NS_DEFINE_IID(kCScriptNameSetRegistryCID, NS_SCRIPT_NAMESET_REGISTRY_CID);
|
|
||||||
|
|
||||||
class ContentScriptNameSet : public nsIScriptExternalNameSet {
|
|
||||||
public:
|
|
||||||
ContentScriptNameSet();
|
|
||||||
virtual ~ContentScriptNameSet();
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
|
|
||||||
NS_IMETHOD InitializeClasses(nsIScriptContext* aScriptContext);
|
|
||||||
NS_IMETHOD AddNameSet(nsIScriptContext* aScriptContext);
|
|
||||||
};
|
|
||||||
|
|
||||||
ContentScriptNameSet::ContentScriptNameSet()
|
|
||||||
{
|
|
||||||
NS_INIT_REFCNT();
|
|
||||||
}
|
|
||||||
|
|
||||||
ContentScriptNameSet::~ContentScriptNameSet()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(ContentScriptNameSet, NS_GET_IID(nsIScriptExternalNameSet));
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
ContentScriptNameSet::InitializeClasses(nsIScriptContext* aScriptContext)
|
|
||||||
{
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
ContentScriptNameSet::AddNameSet(nsIScriptContext* aScriptContext)
|
|
||||||
{
|
|
||||||
nsresult result = NS_OK;
|
|
||||||
nsIScriptNameSpaceManager* manager;
|
|
||||||
static NS_DEFINE_IID(kHTMLImageElementCID, NS_HTMLIMAGEELEMENT_CID);
|
|
||||||
static NS_DEFINE_IID(kHTMLOptionElementCID, NS_HTMLOPTIONELEMENT_CID);
|
|
||||||
|
|
||||||
result = aScriptContext->GetNameSpaceManager(&manager);
|
|
||||||
if (NS_OK == result) {
|
|
||||||
result = manager->RegisterGlobalName(NS_LITERAL_STRING("HTMLImageElement"),
|
|
||||||
NS_GET_IID(nsIScriptObjectOwner),
|
|
||||||
kHTMLImageElementCID,
|
|
||||||
PR_TRUE);
|
|
||||||
if (NS_FAILED(result)) {
|
|
||||||
NS_RELEASE(manager);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = manager->RegisterGlobalName(NS_LITERAL_STRING("HTMLOptionElement"),
|
|
||||||
NS_GET_IID(nsIScriptObjectOwner),
|
|
||||||
kHTMLOptionElementCID,
|
|
||||||
PR_TRUE);
|
|
||||||
if (NS_FAILED(result)) {
|
|
||||||
NS_RELEASE(manager);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_RELEASE(manager);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
nsIScriptNameSetRegistry* nsContentModule::gRegistry;
|
|
||||||
nsICSSStyleSheet* nsContentModule::gUAStyleSheet = nsnull;
|
nsICSSStyleSheet* nsContentModule::gUAStyleSheet = nsnull;
|
||||||
|
|
||||||
nsContentModule::nsContentModule()
|
nsContentModule::nsContentModule()
|
||||||
: mInitialized(PR_FALSE)
|
: mInitialized(PR_FALSE)
|
||||||
{
|
{
|
||||||
NS_INIT_ISUPPORTS();
|
NS_INIT_ISUPPORTS();
|
||||||
|
|
||||||
|
nsCOMPtr<nsIObserverService> observerService =
|
||||||
|
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
|
||||||
|
|
||||||
|
if (observerService) {
|
||||||
|
nsAutoString topic;
|
||||||
|
topic.AssignWithConversion(NS_XPCOM_SHUTDOWN_OBSERVER_ID);
|
||||||
|
observerService->AddObserver(this, topic.GetUnicode());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsContentModule::~nsContentModule()
|
nsContentModule::~nsContentModule()
|
||||||
|
@ -176,7 +121,7 @@ nsContentModule::~nsContentModule()
|
||||||
Shutdown();
|
Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(nsContentModule, NS_GET_IID(nsIModule))
|
NS_IMPL_ISUPPORTS2(nsContentModule, nsIModule, nsIObserver)
|
||||||
|
|
||||||
// Perform our one-time intialization for this module
|
// Perform our one-time intialization for this module
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -203,16 +148,7 @@ nsContentModule::Initialize()
|
||||||
nsXULContentUtils::Init();
|
nsXULContentUtils::Init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// XXX Initialize the script name set thingy-ma-jigger
|
nsContentUtils::Init();
|
||||||
if (!gRegistry) {
|
|
||||||
rv = nsServiceManager::GetService(kCScriptNameSetRegistryCID,
|
|
||||||
NS_GET_IID(nsIScriptNameSetRegistry),
|
|
||||||
(nsISupports**) &gRegistry);
|
|
||||||
if (NS_SUCCEEDED(rv)) {
|
|
||||||
ContentScriptNameSet* nameSet = new ContentScriptNameSet();
|
|
||||||
gRegistry->AddExternalNameSet(nameSet);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
@ -241,8 +177,22 @@ nsContentModule::Shutdown()
|
||||||
nsXULAtoms::ReleaseAtoms();
|
nsXULAtoms::ReleaseAtoms();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NS_IF_RELEASE(gRegistry);
|
|
||||||
NS_IF_RELEASE(gUAStyleSheet);
|
NS_IF_RELEASE(gUAStyleSheet);
|
||||||
|
|
||||||
|
nsContentUtils::Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsContentModule::Observe(nsISupports *aSubject, const PRUnichar *aTopic,
|
||||||
|
const PRUnichar *someData)
|
||||||
|
{
|
||||||
|
nsAutoString topic;
|
||||||
|
topic.AssignWithConversion(NS_XPCOM_SHUTDOWN_OBSERVER_ID);
|
||||||
|
if (topic.EqualsWithConversion(aTopic)) {
|
||||||
|
nsContentUtils::Shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -322,10 +272,11 @@ static Components gComponents[] = {
|
||||||
{ "Generated Subtree iterator", NS_GENERATEDSUBTREEITERATOR_CID, nsnull, },
|
{ "Generated Subtree iterator", NS_GENERATEDSUBTREEITERATOR_CID, nsnull, },
|
||||||
{ "Subtree iterator", NS_SUBTREEITERATOR_CID, nsnull, },
|
{ "Subtree iterator", NS_SUBTREEITERATOR_CID, nsnull, },
|
||||||
|
|
||||||
// XXX ick
|
// Needed to support "new Option;" and "new Image;" in JavaScript
|
||||||
{ "HTML image element", NS_HTMLIMAGEELEMENT_CID, nsnull, },
|
{ "HTML img element", NS_HTMLIMAGEELEMENT_CID,
|
||||||
{ "HTML option element", NS_HTMLOPTIONELEMENT_CID, nsnull, },
|
NS_HTMLIMGELEMENT_CONTRACTID, },
|
||||||
// XXX end ick
|
{ "HTML option element", NS_HTMLOPTIONELEMENT_CID,
|
||||||
|
NS_HTMLOPTIONELEMENT_CONTRACTID, },
|
||||||
|
|
||||||
{ "XML document encoder", NS_TEXT_ENCODER_CID,
|
{ "XML document encoder", NS_TEXT_ENCODER_CID,
|
||||||
NS_DOC_ENCODER_CONTRACTID_BASE "text/xml", },
|
NS_DOC_ENCODER_CONTRACTID_BASE "text/xml", },
|
||||||
|
@ -420,7 +371,23 @@ nsContentModule::RegisterSelf(nsIComponentManager *aCompMgr,
|
||||||
nsContentHTTPStartup::RegisterHTTPStartup();
|
nsContentHTTPStartup::RegisterHTTPStartup();
|
||||||
|
|
||||||
rv = RegisterDocumentFactories(aCompMgr, aPath);
|
rv = RegisterDocumentFactories(aCompMgr, aPath);
|
||||||
|
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
nsCOMPtr<nsICategoryManager> catman =
|
||||||
|
do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
nsXPIDLCString previous;
|
||||||
|
rv = catman->AddCategoryEntry(JAVASCRIPT_GLOBAL_CONSTRUCTOR_CATEGORY,
|
||||||
|
"Image", NS_HTMLIMGELEMENT_CONTRACTID,
|
||||||
|
PR_TRUE, PR_TRUE, getter_Copies(previous));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
rv = catman->AddCategoryEntry(JAVASCRIPT_GLOBAL_CONSTRUCTOR_CATEGORY,
|
||||||
|
"Option", NS_HTMLOPTIONELEMENT_CONTRACTID,
|
||||||
|
PR_TRUE, PR_TRUE, getter_Copies(previous));
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,78 +0,0 @@
|
||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Netscape 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/NPL/
|
|
||||||
*
|
|
||||||
* 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 Communicator client code.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is Netscape Communications
|
|
||||||
* Corporation. Portions created by Netscape are
|
|
||||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
||||||
* Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
*/
|
|
||||||
#ifndef nsContentModule_h___
|
|
||||||
#define nsContentModule_h___
|
|
||||||
|
|
||||||
#include "nslayout.h"
|
|
||||||
#include "nsIModule.h"
|
|
||||||
|
|
||||||
class nsICSSStyleSheet;
|
|
||||||
class nsIScriptNameSetRegistry;
|
|
||||||
|
|
||||||
// Module implementation for the content library
|
|
||||||
class nsContentModule : public nsIModule
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsContentModule();
|
|
||||||
virtual ~nsContentModule();
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
|
|
||||||
NS_DECL_NSIMODULE
|
|
||||||
|
|
||||||
nsresult Initialize();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void Shutdown();
|
|
||||||
|
|
||||||
nsresult RegisterDocumentFactories(nsIComponentManager* aCompMgr,
|
|
||||||
nsIFile* aPath);
|
|
||||||
|
|
||||||
void UnregisterDocumentFactories(nsIComponentManager* aCompMgr,
|
|
||||||
nsIFile* aPath);
|
|
||||||
|
|
||||||
PRBool mInitialized;
|
|
||||||
// static nsIFactory* gFactory;
|
|
||||||
static nsIScriptNameSetRegistry* gRegistry;
|
|
||||||
|
|
||||||
public:
|
|
||||||
static nsICSSStyleSheet* gUAStyleSheet;
|
|
||||||
};
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
|
|
||||||
class nsContentFactory : public nsIFactory
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsContentFactory(const nsCID &aClass);
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
|
|
||||||
NS_DECL_NSIFACTORY
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual ~nsContentFactory();
|
|
||||||
|
|
||||||
nsCID mClassID;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* nsContentModule_h___ */
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
class nsIPresContext;
|
class nsIPresContext;
|
||||||
class nsIDOMEventListener;
|
class nsIDOMEventListener;
|
||||||
class nsIScriptObjectOwner;
|
class nsIScriptContext;
|
||||||
class nsIDOMEventTarget;
|
class nsIDOMEventTarget;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -43,116 +43,123 @@ class nsIDOMEventTarget;
|
||||||
class nsIEventListenerManager : public nsISupports {
|
class nsIEventListenerManager : public nsISupports {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static const nsIID& GetIID() { static nsIID iid = NS_IEVENTLISTENERMANAGER_IID; return iid; }
|
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IEVENTLISTENERMANAGER_IID)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets events listeners of all types.
|
* Sets events listeners of all types.
|
||||||
* @param an event listener
|
* @param an event listener
|
||||||
*/
|
*/
|
||||||
virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID, PRInt32 flags) = 0;
|
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,
|
||||||
|
const nsIID& aIID, PRInt32 flags) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes events listeners of all types.
|
* Removes events listeners of all types.
|
||||||
* @param an event listener
|
* @param an event listener
|
||||||
*/
|
*/
|
||||||
virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID, PRInt32 flags) = 0;
|
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener,
|
||||||
|
const nsIID& aIID, PRInt32 flags) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets events listeners of all types.
|
* Sets events listeners of all types.
|
||||||
* @param an event listener
|
* @param an event listener
|
||||||
*/
|
*/
|
||||||
virtual nsresult AddEventListenerByType(nsIDOMEventListener *aListener, const nsAReadableString& type, PRInt32 flags) = 0;
|
NS_IMETHOD AddEventListenerByType(nsIDOMEventListener *aListener,
|
||||||
|
const nsAReadableString& type,
|
||||||
|
PRInt32 flags) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes events listeners of all types.
|
* Removes events listeners of all types.
|
||||||
* @param an event listener
|
* @param an event listener
|
||||||
*/
|
*/
|
||||||
virtual nsresult RemoveEventListenerByType(nsIDOMEventListener *aListener, const nsAReadableString& type, PRInt32 flags) = 0;
|
NS_IMETHOD RemoveEventListenerByType(nsIDOMEventListener *aListener,
|
||||||
|
const nsAReadableString& type,
|
||||||
|
PRInt32 flags) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a script event listener for the given script object with name aName and function
|
* Creates a script event listener for the given script object with
|
||||||
* body aFunc.
|
* name aName and function body aFunc.
|
||||||
* @param an event listener
|
* @param an event listener
|
||||||
*/
|
*/
|
||||||
virtual nsresult AddScriptEventListener(nsIScriptContext*aContext,
|
NS_IMETHOD AddScriptEventListener(nsIScriptContext*aContext,
|
||||||
nsIScriptObjectOwner *aScriptObjectOwner,
|
nsISupports *aObject,
|
||||||
nsIAtom *aName,
|
nsIAtom *aName,
|
||||||
const nsAReadableString& aFunc,
|
const nsAReadableString& aFunc,
|
||||||
PRBool aDeferCompilation) = 0;
|
PRBool aDeferCompilation) = 0;
|
||||||
|
|
||||||
|
|
||||||
virtual nsresult RemoveScriptEventListener(nsIAtom *aName) = 0;
|
NS_IMETHOD RemoveScriptEventListener(nsIAtom *aName) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers an event listener that already exists on the given script object with the event
|
* Registers an event listener that already exists on the given
|
||||||
* listener manager.
|
* script object with the event listener manager.
|
||||||
* @param an event listener
|
* @param an event listener
|
||||||
*/
|
*/
|
||||||
virtual nsresult RegisterScriptEventListener(nsIScriptContext *aContext,
|
NS_IMETHOD RegisterScriptEventListener(nsIScriptContext *aContext,
|
||||||
nsIScriptObjectOwner *aScriptObjectOwner,
|
nsISupports *aObject,
|
||||||
nsIAtom* aName) = 0;
|
nsIAtom* aName) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compiles any event listeners that already exists on the given script object for a given
|
* Compiles any event listeners that already exists on the given
|
||||||
* event type.
|
* script object for a given event type.
|
||||||
* @param an event listener
|
* @param an event listener */
|
||||||
*/
|
NS_IMETHOD CompileScriptEventListener(nsIScriptContext *aContext,
|
||||||
virtual nsresult CompileScriptEventListener(nsIScriptContext *aContext,
|
nsISupports *aObject,
|
||||||
nsIScriptObjectOwner *aScriptObjectOwner,
|
nsIAtom* aName,
|
||||||
nsIAtom* aName) = 0;
|
PRBool *aDidCompile) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Causes a check for event listeners and processing by them if they exist.
|
* Causes a check for event listeners and processing by them if they exist.
|
||||||
* Event flags live in nsGUIEvent.h
|
* Event flags live in nsGUIEvent.h
|
||||||
* @param an event listener
|
* @param an event listener
|
||||||
*/
|
*/
|
||||||
virtual nsresult HandleEvent(nsIPresContext* aPresContext,
|
NS_IMETHOD HandleEvent(nsIPresContext* aPresContext,
|
||||||
nsEvent* aEvent,
|
nsEvent* aEvent,
|
||||||
nsIDOMEvent** aDOMEvent,
|
nsIDOMEvent** aDOMEvent,
|
||||||
nsIDOMEventTarget* aCurrentTarget,
|
nsIDOMEventTarget* aCurrentTarget,
|
||||||
PRUint32 aFlags,
|
PRUint32 aFlags,
|
||||||
nsEventStatus* aEventStatus) = 0;
|
nsEventStatus* aEventStatus) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a DOM event that can subsequently be passed into HandleEvent.
|
* Creates a DOM event that can subsequently be passed into HandleEvent.
|
||||||
* (used rarely in the situation where methods on the event need to be
|
* (used rarely in the situation where methods on the event need to be
|
||||||
* invoked prior to the processing of the event).
|
* invoked prior to the processing of the event).
|
||||||
*/
|
*/
|
||||||
virtual nsresult CreateEvent(nsIPresContext* aPresContext,
|
NS_IMETHOD CreateEvent(nsIPresContext* aPresContext,
|
||||||
nsEvent* aEvent,
|
nsEvent* aEvent,
|
||||||
const nsAReadableString& aEventType,
|
const nsAReadableString& aEventType,
|
||||||
nsIDOMEvent** aDOMEvent) = 0;
|
nsIDOMEvent** aDOMEvent) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes script listener of specified event types from bubbling listeners to capturing listeners.
|
* Changes script listener of specified event types from bubbling
|
||||||
* @param event types
|
* listeners to capturing listeners.
|
||||||
*/
|
* @param event types */
|
||||||
virtual nsresult CaptureEvent(PRInt32 aEventTypes) = 0;
|
NS_IMETHOD CaptureEvent(PRInt32 aEventTypes) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes script listener of specified event types from capturing listeners to bubbling listeners.
|
* Changes script listener of specified event types from capturing
|
||||||
* @param event types
|
* listeners to bubbling listeners.
|
||||||
*/
|
* @param event types */
|
||||||
virtual nsresult ReleaseEvent(PRInt32 aEventTypes) = 0;
|
NS_IMETHOD ReleaseEvent(PRInt32 aEventTypes) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all event listeners registered by this instance of the listener
|
* Removes all event listeners registered by this instance of the listener
|
||||||
* manager.
|
* manager.
|
||||||
*/
|
*/
|
||||||
virtual nsresult RemoveAllListeners(PRBool aScriptOnly) = 0;
|
NS_IMETHOD RemoveAllListeners(PRBool aScriptOnly) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all event listeners registered by this instance of the listener
|
* Removes all event listeners registered by this instance of the listener
|
||||||
* manager.
|
* manager.
|
||||||
*/
|
*/
|
||||||
virtual nsresult SetListenerTarget(nsISupports* aTarget) = 0;
|
NS_IMETHOD SetListenerTarget(nsISupports* aTarget) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows us to quickly determine if we have mutation listeners registered.
|
* Allows us to quickly determine if we have mutation listeners registered.
|
||||||
*/
|
*/
|
||||||
virtual nsresult HasMutationListeners(PRBool* aListener) = 0;
|
NS_IMETHOD HasMutationListeners(PRBool* aListener) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern NS_HTML nsresult NS_NewEventListenerManager(nsIEventListenerManager** aInstancePtrResult);
|
extern nsresult
|
||||||
|
NS_NewEventListenerManager(nsIEventListenerManager** aInstancePtrResult);
|
||||||
|
|
||||||
#endif // nsIEventListenerManager_h__
|
#endif // nsIEventListenerManager_h__
|
||||||
|
|
|
@ -32,15 +32,15 @@ DEFINES=-D_IMPL_NS_HTML -DWIN32_LEAN_AND_MEAN
|
||||||
CPPSRCS= nsEventListenerManager.cpp \
|
CPPSRCS= nsEventListenerManager.cpp \
|
||||||
nsEventStateManager.cpp \
|
nsEventStateManager.cpp \
|
||||||
nsDOMEvent.cpp \
|
nsDOMEvent.cpp \
|
||||||
nsDOMMutationEvent.cpp \
|
nsDOMMutationEvent.cpp \
|
||||||
nsDOMEventsIIDs.cpp \
|
nsDOMEventsIIDs.cpp \
|
||||||
nsPrivateTextRange.cpp \
|
nsPrivateTextRange.cpp \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
CPP_OBJS= .\$(OBJDIR)\nsEventListenerManager.obj \
|
CPP_OBJS= .\$(OBJDIR)\nsEventListenerManager.obj \
|
||||||
.\$(OBJDIR)\nsEventStateManager.obj \
|
.\$(OBJDIR)\nsEventStateManager.obj \
|
||||||
.\$(OBJDIR)\nsDOMEvent.obj \
|
.\$(OBJDIR)\nsDOMEvent.obj \
|
||||||
.\$(OBJDIR)\nsDOMMutationEvent.obj \
|
.\$(OBJDIR)\nsDOMMutationEvent.obj \
|
||||||
.\$(OBJDIR)\nsDOMEventsIIDs.obj \
|
.\$(OBJDIR)\nsDOMEventsIIDs.obj \
|
||||||
.\$(OBJDIR)\nsPrivateTextRange.obj \
|
.\$(OBJDIR)\nsPrivateTextRange.obj \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
@ -48,8 +48,7 @@ CPP_OBJS= .\$(OBJDIR)\nsEventListenerManager.obj \
|
||||||
|
|
||||||
EXPORTS= nsDOMEventsIIDs.h
|
EXPORTS= nsDOMEventsIIDs.h
|
||||||
|
|
||||||
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor \
|
LINCS= -I..\..\html\base\src -I..\..\xul\content\src -I..\..\base\src
|
||||||
-I$(PUBLIC)\dom -I$(PUBLIC)\js -I..\..\html\base\src -I$(PUBLIC)\netlib -I..\..\xul\content\src
|
|
||||||
|
|
||||||
LCFLAGS = \
|
LCFLAGS = \
|
||||||
$(LCFLAGS) \
|
$(LCFLAGS) \
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "prmem.h"
|
#include "prmem.h"
|
||||||
#include "nsLayoutAtoms.h"
|
#include "nsLayoutAtoms.h"
|
||||||
#include "nsMutationEvent.h"
|
#include "nsMutationEvent.h"
|
||||||
|
#include "nsContentUtils.h"
|
||||||
#include "nsIDOMKeyEvent.h"
|
#include "nsIDOMKeyEvent.h"
|
||||||
#include "nsIDOMMutationEvent.h"
|
#include "nsIDOMMutationEvent.h"
|
||||||
|
|
||||||
|
@ -125,11 +126,15 @@ nsDOMEvent::operator delete(void* aPtr)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, const nsAReadableString& aEventType)
|
nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent,
|
||||||
|
const nsAReadableString& aEventType)
|
||||||
{
|
{
|
||||||
|
NS_INIT_REFCNT();
|
||||||
|
|
||||||
mPresContext = aPresContext;
|
mPresContext = aPresContext;
|
||||||
if (mPresContext)
|
|
||||||
NS_ADDREF(mPresContext);
|
NS_IF_ADDREF(mPresContext);
|
||||||
|
|
||||||
if (aEvent) {
|
if (aEvent) {
|
||||||
mEventIsInternal = PR_FALSE;
|
mEventIsInternal = PR_FALSE;
|
||||||
mEvent = aEvent;
|
mEvent = aEvent;
|
||||||
|
@ -158,6 +163,7 @@ nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, const nsAR
|
||||||
mEvent->eventStructType = NS_EVENT;
|
mEvent->eventStructType = NS_EVENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mTarget = nsnull;
|
mTarget = nsnull;
|
||||||
mCurrentTarget = nsnull;
|
mCurrentTarget = nsnull;
|
||||||
mOriginalTarget = nsnull;
|
mOriginalTarget = nsnull;
|
||||||
|
@ -170,33 +176,46 @@ nsDOMEvent::nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, const nsAR
|
||||||
//
|
//
|
||||||
// extract the IME composition string
|
// extract the IME composition string
|
||||||
//
|
//
|
||||||
mText = new nsString(((nsTextEvent*)aEvent)->theText);
|
|
||||||
//
|
|
||||||
// build the range list -- ranges need to be DOM-ified since the IME transaction
|
|
||||||
// will hold a ref, the widget representation isn't persistent
|
|
||||||
//
|
|
||||||
nsIPrivateTextRange** tempTextRangeList = new nsIPrivateTextRange*[((nsTextEvent*)aEvent)->rangeCount];
|
|
||||||
if (tempTextRangeList!=nsnull) {
|
|
||||||
for(PRUint16 i=0;i<((nsTextEvent*)aEvent)->rangeCount;i++) {
|
|
||||||
nsPrivateTextRange* tempPrivateTextRange = new nsPrivateTextRange((((nsTextEvent*)aEvent)->rangeArray[i]).mStartOffset,
|
|
||||||
(((nsTextEvent*)aEvent)->rangeArray[i]).mEndOffset,
|
|
||||||
(((nsTextEvent*)aEvent)->rangeArray[i]).mRangeType);
|
|
||||||
if (tempPrivateTextRange!=nsnull) {
|
|
||||||
tempPrivateTextRange->AddRef();
|
|
||||||
tempTextRangeList[i] = (nsIPrivateTextRange*)tempPrivateTextRange;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
// We need to create mTextRange even rangeCount is 0.
|
|
||||||
// if rangeCount is 0, mac carbon will return 0 for new and tempTextRangeList will be null. but we should still
|
|
||||||
// create mTextRange, otherwise, we will crash it later when some code call GetInputRange and AddRef to the result
|
|
||||||
mTextRange = (nsIPrivateTextRangeList*) new nsPrivateTextRangeList(((nsTextEvent*)aEvent)->rangeCount,tempTextRangeList);
|
|
||||||
if (mTextRange!=nsnull)
|
|
||||||
mTextRange->AddRef();
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_INIT_REFCNT();
|
nsTextEvent *te = (nsTextEvent*)aEvent;
|
||||||
|
|
||||||
|
mText = new nsString(te->theText);
|
||||||
|
|
||||||
|
//
|
||||||
|
// build the range list -- ranges need to be DOM-ified since the
|
||||||
|
// IME transaction will hold a ref, the widget representation
|
||||||
|
// isn't persistent
|
||||||
|
//
|
||||||
|
nsIPrivateTextRange** tempTextRangeList =
|
||||||
|
new nsIPrivateTextRange*[te->rangeCount];
|
||||||
|
|
||||||
|
if (tempTextRangeList) {
|
||||||
|
PRUint16 i;
|
||||||
|
|
||||||
|
for(i = 0; i < te->rangeCount; i++) {
|
||||||
|
nsPrivateTextRange* tempPrivateTextRange = new
|
||||||
|
nsPrivateTextRange(te->rangeArray[i].mStartOffset,
|
||||||
|
te->rangeArray[i].mEndOffset,
|
||||||
|
te->rangeArray[i].mRangeType);
|
||||||
|
|
||||||
|
if (tempPrivateTextRange) {
|
||||||
|
NS_ADDREF(tempPrivateTextRange);
|
||||||
|
|
||||||
|
tempTextRangeList[i] = (nsIPrivateTextRange*)tempPrivateTextRange;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// We need to create mTextRange even rangeCount is 0.
|
||||||
|
// If rangeCount is 0, mac carbon will return 0 for new and
|
||||||
|
// tempTextRangeList will be null. but we should still create
|
||||||
|
// mTextRange, otherwise, we will crash it later when some code
|
||||||
|
// call GetInputRange and AddRef to the result
|
||||||
|
|
||||||
|
mTextRange = new nsPrivateTextRangeList(te->rangeCount ,tempTextRangeList);
|
||||||
|
|
||||||
|
NS_IF_ADDREF(mTextRange);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsDOMEvent::~nsDOMEvent()
|
nsDOMEvent::~nsDOMEvent()
|
||||||
|
@ -228,6 +247,13 @@ nsDOMEvent::~nsDOMEvent()
|
||||||
NS_IMPL_ADDREF(nsDOMEvent)
|
NS_IMPL_ADDREF(nsDOMEvent)
|
||||||
NS_IMPL_RELEASE(nsDOMEvent)
|
NS_IMPL_RELEASE(nsDOMEvent)
|
||||||
|
|
||||||
|
// XPConnect interface list for nsDOMEvent
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(Event)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMKeyEvent)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMMouseEvent)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMNSUIEvent)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN(nsDOMEvent)
|
NS_INTERFACE_MAP_BEGIN(nsDOMEvent)
|
||||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEvent, nsIDOMMouseEvent)
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEvent, nsIDOMMouseEvent)
|
||||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMUIEvent, nsIDOMMouseEvent)
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMUIEvent, nsIDOMMouseEvent)
|
||||||
|
@ -237,8 +263,8 @@ NS_INTERFACE_MAP_BEGIN(nsDOMEvent)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIPrivateDOMEvent)
|
NS_INTERFACE_MAP_ENTRY(nsIPrivateDOMEvent)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIPrivateTextEvent)
|
NS_INTERFACE_MAP_ENTRY(nsIPrivateTextEvent)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIPrivateCompositionEvent)
|
NS_INTERFACE_MAP_ENTRY(nsIPrivateCompositionEvent)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner)
|
|
||||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMMouseEvent)
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMMouseEvent)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(Event)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
// nsIDOMEventInterface
|
// nsIDOMEventInterface
|
||||||
|
@ -1387,33 +1413,6 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDOMEvent::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
|
|
||||||
{
|
|
||||||
nsresult res = NS_OK;
|
|
||||||
|
|
||||||
if (nsnull == mScriptObject) {
|
|
||||||
if (mEvent && mEvent->eventStructType == NS_MUTATION_EVENT) {
|
|
||||||
nsISupports *supports = (nsISupports *)(nsIDOMMutationEvent *)this;
|
|
||||||
res = NS_NewScriptMutationEvent(aContext, supports, nsnull, (void**)&mScriptObject);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
nsISupports *supports = (nsISupports *)(nsIDOMMouseEvent *)this;
|
|
||||||
res = NS_NewScriptKeyEvent(aContext, supports, nsnull, (void**)&mScriptObject);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*aScriptObject = mScriptObject;
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsDOMEvent::SetScriptObject(void* aScriptObject)
|
|
||||||
{
|
|
||||||
mScriptObject = aScriptObject;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
|
nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
|
||||||
nsIPresContext* aPresContext,
|
nsIPresContext* aPresContext,
|
||||||
const nsAReadableString& aEventType,
|
const nsAReadableString& aEventType,
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
#include "nsIPrivateTextEvent.h"
|
#include "nsIPrivateTextEvent.h"
|
||||||
#include "nsIPrivateTextRange.h"
|
#include "nsIPrivateTextRange.h"
|
||||||
#include "nsIDOMEvent.h"
|
#include "nsIDOMEvent.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
|
|
||||||
#include "nsIPresContext.h"
|
#include "nsIPresContext.h"
|
||||||
#include "nsPoint.h"
|
#include "nsPoint.h"
|
||||||
|
@ -45,8 +44,8 @@ class nsDOMEvent : public nsIDOMKeyEvent,
|
||||||
public nsIDOMNSUIEvent,
|
public nsIDOMNSUIEvent,
|
||||||
public nsIPrivateDOMEvent,
|
public nsIPrivateDOMEvent,
|
||||||
public nsIPrivateTextEvent,
|
public nsIPrivateTextEvent,
|
||||||
public nsIPrivateCompositionEvent,
|
public nsIPrivateCompositionEvent
|
||||||
public nsIScriptObjectOwner {
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Note: this enum must be kept in sync with mEventNames in nsDOMEvent.cpp
|
// Note: this enum must be kept in sync with mEventNames in nsDOMEvent.cpp
|
||||||
|
@ -100,7 +99,8 @@ public:
|
||||||
eDOMEvents_characterdatamodified
|
eDOMEvents_characterdatamodified
|
||||||
};
|
};
|
||||||
|
|
||||||
nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent, const nsAReadableString& aEventType);
|
nsDOMEvent(nsIPresContext* aPresContext, nsEvent* aEvent,
|
||||||
|
const nsAReadableString& aEventType);
|
||||||
virtual ~nsDOMEvent();
|
virtual ~nsDOMEvent();
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
@ -118,12 +118,15 @@ public:
|
||||||
NS_IMETHOD PreventBubble();
|
NS_IMETHOD PreventBubble();
|
||||||
NS_IMETHOD PreventCapture();
|
NS_IMETHOD PreventCapture();
|
||||||
NS_IMETHOD PreventDefault();
|
NS_IMETHOD PreventDefault();
|
||||||
NS_IMETHOD InitEvent(const nsAReadableString& aEventTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg);
|
NS_IMETHOD InitEvent(const nsAReadableString& aEventTypeArg,
|
||||||
|
PRBool aCanBubbleArg, PRBool aCancelableArg);
|
||||||
|
|
||||||
// nsIDOMUIEvent Interface
|
// nsIDOMUIEvent Interface
|
||||||
NS_IMETHOD GetView(nsIDOMAbstractView** aView);
|
NS_IMETHOD GetView(nsIDOMAbstractView** aView);
|
||||||
NS_IMETHOD GetDetail(PRInt32* aDetail);
|
NS_IMETHOD GetDetail(PRInt32* aDetail);
|
||||||
NS_IMETHOD InitUIEvent(const nsAReadableString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg);
|
NS_IMETHOD InitUIEvent(const nsAReadableString& aTypeArg,
|
||||||
|
PRBool aCanBubbleArg, PRBool aCancelableArg,
|
||||||
|
nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg);
|
||||||
|
|
||||||
// nsIDOMMouseEvent Interface and nsIDOMKeyEvent Interface
|
// nsIDOMMouseEvent Interface and nsIDOMKeyEvent Interface
|
||||||
NS_IMETHOD GetScreenX(PRInt32* aScreenX);
|
NS_IMETHOD GetScreenX(PRInt32* aScreenX);
|
||||||
|
@ -138,9 +141,19 @@ public:
|
||||||
NS_IMETHOD GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget);
|
NS_IMETHOD GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget);
|
||||||
NS_IMETHOD GetCharCode(PRUint32* aCharCode);
|
NS_IMETHOD GetCharCode(PRUint32* aCharCode);
|
||||||
NS_IMETHOD GetKeyCode(PRUint32* aKeyCode);
|
NS_IMETHOD GetKeyCode(PRUint32* aKeyCode);
|
||||||
NS_IMETHOD InitMouseEvent(const nsAReadableString& aTypeArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRInt32 aScreenXArg, PRInt32 aScreenYArg, PRInt32 aClientXArg, PRInt32 aClientYArg, PRUint16 aButtonArg, PRUint16 aDetailArg);
|
NS_IMETHOD InitMouseEvent(const nsAReadableString& aTypeArg,
|
||||||
NS_IMETHOD InitKeyEvent(const nsAReadableString& aTypeArg, PRBool aCanBubbleArg, PRBool aCancelableArg, PRBool aCtrlKeyArg, PRBool aAltKeyArg, PRBool aShiftKeyArg, PRBool aMetaKeyArg, PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg, nsIDOMAbstractView* aViewArg);
|
PRBool aCtrlKeyArg, PRBool aAltKeyArg,
|
||||||
|
PRBool aShiftKeyArg, PRBool aMetaKeyArg,
|
||||||
|
PRInt32 aScreenXArg, PRInt32 aScreenYArg,
|
||||||
|
PRInt32 aClientXArg, PRInt32 aClientYArg,
|
||||||
|
PRUint16 aButtonArg, PRUint16 aDetailArg);
|
||||||
|
NS_IMETHOD InitKeyEvent(const nsAReadableString& aTypeArg,
|
||||||
|
PRBool aCanBubbleArg, PRBool aCancelableArg,
|
||||||
|
PRBool aCtrlKeyArg, PRBool aAltKeyArg,
|
||||||
|
PRBool aShiftKeyArg, PRBool aMetaKeyArg,
|
||||||
|
PRUint32 aKeyCodeArg, PRUint32 aCharCodeArg,
|
||||||
|
nsIDOMAbstractView* aViewArg);
|
||||||
|
|
||||||
// nsIDOMNSUIEvent interface
|
// nsIDOMNSUIEvent interface
|
||||||
NS_IMETHOD GetLayerX(PRInt32* aLayerX);
|
NS_IMETHOD GetLayerX(PRInt32* aLayerX);
|
||||||
NS_IMETHOD GetLayerY(PRInt32* aLayerY);
|
NS_IMETHOD GetLayerY(PRInt32* aLayerY);
|
||||||
|
@ -175,10 +188,6 @@ public:
|
||||||
NS_IMETHOD GetCompositionReply(nsTextEventReply** aReply);
|
NS_IMETHOD GetCompositionReply(nsTextEventReply** aReply);
|
||||||
NS_IMETHOD GetReconversionReply(nsReconversionEventReply** aReply);
|
NS_IMETHOD GetReconversionReply(nsReconversionEventReply** aReply);
|
||||||
|
|
||||||
// nsIScriptObjectOwner interface
|
|
||||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
|
||||||
NS_IMETHOD SetScriptObject(void* aScriptObject);
|
|
||||||
|
|
||||||
/** Overloaded new operator. Initializes the memory to 0.
|
/** Overloaded new operator. Initializes the memory to 0.
|
||||||
* Relies on a recycler to perform the allocation,
|
* Relies on a recycler to perform the allocation,
|
||||||
* optionally from a pool.
|
* optionally from a pool.
|
||||||
|
@ -206,7 +215,8 @@ protected:
|
||||||
static PRBool gEventPoolInUse;
|
static PRBool gEventPoolInUse;
|
||||||
|
|
||||||
//Internal helper funcs
|
//Internal helper funcs
|
||||||
nsresult GetScrollInfo(nsIScrollableView** aScrollableView, float* aP2T, float* aT2P);
|
nsresult GetScrollInfo(nsIScrollableView** aScrollableView, float* aP2T,
|
||||||
|
float* aT2P);
|
||||||
nsresult SetEventType(const nsAReadableString& aEventTypeArg);
|
nsresult SetEventType(const nsAReadableString& aEventTypeArg);
|
||||||
const char* GetEventName(PRUint32 aEventType);
|
const char* GetEventName(PRUint32 aEventType);
|
||||||
|
|
||||||
|
|
|
@ -24,13 +24,14 @@
|
||||||
#include "nsIDOMMutationEvent.h"
|
#include "nsIDOMMutationEvent.h"
|
||||||
#include "nsDOMEvent.h"
|
#include "nsDOMEvent.h"
|
||||||
#include "nsMutationEvent.h"
|
#include "nsMutationEvent.h"
|
||||||
|
#include "nsContentUtils.h"
|
||||||
|
|
||||||
class nsIPresContext;
|
class nsIPresContext;
|
||||||
|
|
||||||
class nsDOMMutationEvent : public nsIDOMMutationEvent, public nsDOMEvent
|
class nsDOMMutationEvent : public nsDOMEvent, public nsIDOMMutationEvent
|
||||||
{
|
{
|
||||||
NS_DECL_IDOMMUTATIONEVENT
|
NS_DECL_NSIDOMMUTATIONEVENT
|
||||||
NS_FORWARD_IDOMEVENT(nsDOMEvent::)
|
NS_FORWARD_NSIDOMEVENT(nsDOMEvent::)
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
|
@ -38,12 +39,11 @@ class nsDOMMutationEvent : public nsIDOMMutationEvent, public nsDOMEvent
|
||||||
nsEvent* aEvent);
|
nsEvent* aEvent);
|
||||||
|
|
||||||
~nsDOMMutationEvent();
|
~nsDOMMutationEvent();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nsDOMMutationEvent::nsDOMMutationEvent(nsIPresContext* aPresContext,
|
nsDOMMutationEvent::nsDOMMutationEvent(nsIPresContext* aPresContext,
|
||||||
nsEvent* aEvent)
|
nsEvent* aEvent)
|
||||||
:nsDOMEvent(aPresContext, aEvent, NS_LITERAL_STRING("MutationEvents"))
|
:nsDOMEvent(aPresContext, aEvent, NS_LITERAL_STRING("MutationEvents"))
|
||||||
{
|
{
|
||||||
nsMutationEvent* mutation = (nsMutationEvent*)mEvent;
|
nsMutationEvent* mutation = (nsMutationEvent*)mEvent;
|
||||||
SetTarget(mutation->mTarget);
|
SetTarget(mutation->mTarget);
|
||||||
|
@ -53,16 +53,23 @@ nsDOMMutationEvent::~nsDOMMutationEvent() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ADDREF_INHERITED(nsDOMMutationEvent, nsDOMEvent)
|
// XPConnect interface list for nsDOMMutationEvent
|
||||||
NS_IMPL_RELEASE_INHERITED(nsDOMMutationEvent, nsDOMEvent)
|
NS_CLASSINFO_MAP_BEGIN(MutationEvent)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMMutationEvent)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN(nsDOMMutationEvent)
|
NS_INTERFACE_MAP_BEGIN(nsDOMMutationEvent)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMMutationEvent)
|
||||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEvent, nsIDOMMutationEvent)
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEvent, nsIDOMMutationEvent)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIPrivateDOMEvent)
|
NS_INTERFACE_MAP_ENTRY(nsIPrivateDOMEvent)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMutationEvent)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMMutationEvent)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner)
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(MutationEvent)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
NS_IMPL_ADDREF_INHERITED(nsDOMMutationEvent, nsDOMEvent)
|
||||||
|
NS_IMPL_RELEASE_INHERITED(nsDOMMutationEvent, nsDOMEvent)
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDOMMutationEvent::GetRelatedNode(nsIDOMNode** aRelatedNode)
|
nsDOMMutationEvent::GetRelatedNode(nsIDOMNode** aRelatedNode)
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
#include "nsIEventStateManager.h"
|
#include "nsIEventStateManager.h"
|
||||||
#include "nsPIDOMWindow.h"
|
#include "nsPIDOMWindow.h"
|
||||||
#include "nsIPrivateDOMEvent.h"
|
#include "nsIPrivateDOMEvent.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIScriptEventListener.h"
|
#include "nsIScriptEventListener.h"
|
||||||
#include "nsIJSEventListener.h"
|
#include "nsIJSEventListener.h"
|
||||||
#include "nsDOMEventsIIDs.h"
|
#include "nsDOMEventsIIDs.h"
|
||||||
|
@ -54,12 +53,18 @@
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "nsIScriptSecurityManager.h"
|
#include "nsIScriptSecurityManager.h"
|
||||||
#include "nsDOMPropEnums.h"
|
|
||||||
#include "nsDOMError.h"
|
#include "nsDOMError.h"
|
||||||
#include "nsIJSContextStack.h"
|
#include "nsIJSContextStack.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsIPresShell.h"
|
#include "nsIPresShell.h"
|
||||||
#include "nsMutationEvent.h"
|
#include "nsMutationEvent.h"
|
||||||
|
#include "nsIXPConnect.h"
|
||||||
|
#include "nsIDOMScriptObjectFactory.h"
|
||||||
|
#include "nsDOMCID.h"
|
||||||
|
#include "nsIScriptObjectOwner.h" // for nsIScriptEventHandlerOwner
|
||||||
|
|
||||||
|
static NS_DEFINE_CID(kDOMScriptObjectFactoryCID,
|
||||||
|
NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
|
||||||
|
|
||||||
|
|
||||||
nsEventListenerManager::nsEventListenerManager()
|
nsEventListenerManager::nsEventListenerManager()
|
||||||
|
@ -352,11 +357,13 @@ void nsEventListenerManager::ReleaseListeners(nsVoidArray** aListeners, PRBool a
|
||||||
* Sets events listeners of all types.
|
* Sets events listeners of all types.
|
||||||
* @param an event listener
|
* @param an event listener
|
||||||
*/
|
*/
|
||||||
nsresult nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener,
|
|
||||||
EventArrayType aType,
|
nsresult
|
||||||
PRInt32 aSubType,
|
nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener,
|
||||||
nsHashKey* aKey,
|
EventArrayType aType,
|
||||||
PRInt32 aFlags)
|
PRInt32 aSubType,
|
||||||
|
nsHashKey* aKey,
|
||||||
|
PRInt32 aFlags)
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(aListener, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(aListener, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
|
@ -445,11 +452,12 @@ nsresult nsEventListenerManager::AddEventListener(nsIDOMEventListener *aListener
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEventListenerManager::RemoveEventListener(nsIDOMEventListener *aListener,
|
nsresult
|
||||||
EventArrayType aType,
|
nsEventListenerManager::RemoveEventListener(nsIDOMEventListener *aListener,
|
||||||
PRInt32 aSubType,
|
EventArrayType aType,
|
||||||
nsHashKey* aKey,
|
PRInt32 aSubType,
|
||||||
PRInt32 aFlags)
|
nsHashKey* aKey,
|
||||||
|
PRInt32 aFlags)
|
||||||
{
|
{
|
||||||
nsVoidArray* listeners = GetListenersByType(aType, aKey, PR_FALSE);
|
nsVoidArray* listeners = GetListenersByType(aType, aKey, PR_FALSE);
|
||||||
|
|
||||||
|
@ -515,8 +523,10 @@ nsresult nsEventListenerManager::AddEventListenerByIID(nsIDOMEventListener *aLis
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEventListenerManager::RemoveEventListenerByIID(nsIDOMEventListener *aListener,
|
NS_IMETHODIMP
|
||||||
const nsIID& aIID, PRInt32 aFlags)
|
nsEventListenerManager::RemoveEventListenerByIID(nsIDOMEventListener *aListener,
|
||||||
|
const nsIID& aIID,
|
||||||
|
PRInt32 aFlags)
|
||||||
{
|
{
|
||||||
RemoveEventListener(aListener, GetTypeForIID(aIID), NS_EVENT_BITS_NONE, nsnull, aFlags);
|
RemoveEventListener(aListener, GetTypeForIID(aIID), NS_EVENT_BITS_NONE, nsnull, aFlags);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -714,8 +724,10 @@ nsresult nsEventListenerManager::GetIdentifiersForType(nsIAtom* aType, EventArra
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEventListenerManager::AddEventListenerByType(nsIDOMEventListener *aListener,
|
NS_IMETHODIMP
|
||||||
const nsAReadableString& aType, PRInt32 aFlags)
|
nsEventListenerManager::AddEventListenerByType(nsIDOMEventListener *aListener,
|
||||||
|
const nsAReadableString& aType,
|
||||||
|
PRInt32 aFlags)
|
||||||
{
|
{
|
||||||
PRInt32 subType;
|
PRInt32 subType;
|
||||||
EventArrayType arrayType;
|
EventArrayType arrayType;
|
||||||
|
@ -739,8 +751,10 @@ nsresult nsEventListenerManager::AddEventListenerByType(nsIDOMEventListener *aLi
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEventListenerManager::RemoveEventListenerByType(nsIDOMEventListener *aListener,
|
NS_IMETHODIMP
|
||||||
const nsAReadableString& aType, PRInt32 aFlags)
|
nsEventListenerManager::RemoveEventListenerByType(nsIDOMEventListener *aListener,
|
||||||
|
const nsAReadableString& aType,
|
||||||
|
PRInt32 aFlags)
|
||||||
{
|
{
|
||||||
PRInt32 subType;
|
PRInt32 subType;
|
||||||
EventArrayType arrayType;
|
EventArrayType arrayType;
|
||||||
|
@ -781,33 +795,42 @@ nsEventListenerManager::FindJSEventListener(EventArrayType aType)
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEventListenerManager::SetJSEventListener(nsIScriptContext *aContext,
|
nsresult
|
||||||
nsIScriptObjectOwner *aOwner,
|
nsEventListenerManager::SetJSEventListener(nsIScriptContext *aContext,
|
||||||
nsIAtom* aName,
|
nsISupports *aObject,
|
||||||
PRBool aIsString)
|
nsIAtom* aName,
|
||||||
|
PRBool aIsString)
|
||||||
{
|
{
|
||||||
nsresult result = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
nsListenerStruct *ls;
|
nsListenerStruct *ls;
|
||||||
PRInt32 flags;
|
PRInt32 flags;
|
||||||
EventArrayType arrayType;
|
EventArrayType arrayType;
|
||||||
|
|
||||||
NS_ENSURE_SUCCESS(GetIdentifiersForType(aName, &arrayType, &flags), NS_ERROR_FAILURE);
|
NS_ENSURE_SUCCESS(GetIdentifiersForType(aName, &arrayType, &flags),
|
||||||
|
NS_ERROR_FAILURE);
|
||||||
|
|
||||||
ls = FindJSEventListener(arrayType);
|
ls = FindJSEventListener(arrayType);
|
||||||
|
|
||||||
if (nsnull == ls) {
|
if (nsnull == ls) {
|
||||||
//If we didn't find a script listener or no listeners existed create and add a new one.
|
//If we didn't find a script listener or no listeners existed
|
||||||
nsIDOMEventListener* scriptListener;
|
//create and add a new one.
|
||||||
result = NS_NewJSEventListener(&scriptListener, aContext, aOwner);
|
nsCOMPtr<nsIDOMScriptObjectFactory> factory =
|
||||||
if (NS_SUCCEEDED(result)) {
|
do_GetService(kDOMScriptObjectFactoryCID);
|
||||||
AddEventListener(scriptListener, arrayType, NS_EVENT_BITS_NONE, nsnull, NS_EVENT_FLAG_BUBBLE | NS_PRIV_EVENT_FLAG_SCRIPT);
|
NS_ENSURE_TRUE(factory, NS_ERROR_FAILURE);
|
||||||
NS_RELEASE(scriptListener);
|
|
||||||
|
nsCOMPtr<nsIDOMEventListener> scriptListener;
|
||||||
|
rv = factory->NewJSEventListener(aContext, aObject,
|
||||||
|
getter_AddRefs(scriptListener));
|
||||||
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
AddEventListener(scriptListener, arrayType, NS_EVENT_BITS_NONE, nsnull,
|
||||||
|
NS_EVENT_FLAG_BUBBLE | NS_PRIV_EVENT_FLAG_SCRIPT);
|
||||||
|
|
||||||
ls = FindJSEventListener(arrayType);
|
ls = FindJSEventListener(arrayType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_SUCCEEDED(result) && ls) {
|
if (NS_SUCCEEDED(rv) && ls) {
|
||||||
//Set flag to indicate possible need for compilation later
|
// Set flag to indicate possible need for compilation later
|
||||||
if (aIsString) {
|
if (aIsString) {
|
||||||
ls->mHandlerIsString |= flags;
|
ls->mHandlerIsString |= flags;
|
||||||
}
|
}
|
||||||
|
@ -819,25 +842,37 @@ nsresult nsEventListenerManager::SetJSEventListener(nsIScriptContext *aContext,
|
||||||
ls->mSubType |= flags;
|
ls->mSubType |= flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
NS_IMETHODIMP
|
||||||
nsEventListenerManager::AddScriptEventListener(nsIScriptContext* aContext,
|
nsEventListenerManager::AddScriptEventListener(nsIScriptContext* aContext,
|
||||||
nsIScriptObjectOwner *aScriptObjectOwner,
|
nsISupports *aObject,
|
||||||
nsIAtom *aName,
|
nsIAtom *aName,
|
||||||
const nsAReadableString& aBody,
|
const nsAReadableString& aBody,
|
||||||
PRBool aDeferCompilation)
|
PRBool aDeferCompilation)
|
||||||
{
|
{
|
||||||
JSObject *scriptObject;
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
if (!aDeferCompilation) {
|
|
||||||
rv = aScriptObjectOwner->GetScriptObject(aContext, (void**)&scriptObject);
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return rv;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIScriptEventHandlerOwner> handlerOwner = do_QueryInterface(aScriptObjectOwner);
|
if (!aDeferCompilation) {
|
||||||
|
nsCOMPtr<nsIXPConnect> xpc(do_GetService(nsIXPConnect::GetCID()));
|
||||||
|
|
||||||
|
JSContext *cx = (JSContext *)aContext->GetNativeContext();
|
||||||
|
|
||||||
|
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||||
|
|
||||||
|
rv = xpc->WrapNative(cx, ::JS_GetGlobalObject(cx), aObject,
|
||||||
|
NS_GET_IID(nsISupports), getter_AddRefs(holder));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
JSObject *scriptObject = nsnull;
|
||||||
|
|
||||||
|
rv = holder->GetJSObject(&scriptObject);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIScriptEventHandlerOwner> handlerOwner =
|
||||||
|
do_QueryInterface(aObject);
|
||||||
|
|
||||||
void *handler = nsnull;
|
void *handler = nsnull;
|
||||||
PRBool done = PR_FALSE;
|
PRBool done = PR_FALSE;
|
||||||
|
|
||||||
|
@ -855,7 +890,8 @@ nsEventListenerManager::AddScriptEventListener(nsIScriptContext* aContext,
|
||||||
if (handlerOwner) {
|
if (handlerOwner) {
|
||||||
// Always let the handler owner compile the event handler, as
|
// Always let the handler owner compile the event handler, as
|
||||||
// it may want to use a special context or scope object.
|
// it may want to use a special context or scope object.
|
||||||
rv = handlerOwner->CompileEventHandler(aContext, scriptObject, aName, aBody, &handler);
|
rv = handlerOwner->CompileEventHandler(aContext, scriptObject, aName,
|
||||||
|
aBody, &handler);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rv = aContext->CompileEventHandler(scriptObject, aName, aBody,
|
rv = aContext->CompileEventHandler(scriptObject, aName, aBody,
|
||||||
|
@ -865,7 +901,8 @@ nsEventListenerManager::AddScriptEventListener(nsIScriptContext* aContext,
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SetJSEventListener(aContext, aScriptObjectOwner, aName, aDeferCompilation);
|
|
||||||
|
return SetJSEventListener(aContext, aObject, aName, aDeferCompilation);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -876,7 +913,8 @@ nsEventListenerManager::RemoveScriptEventListener(nsIAtom *aName)
|
||||||
PRInt32 flags;
|
PRInt32 flags;
|
||||||
EventArrayType arrayType;
|
EventArrayType arrayType;
|
||||||
|
|
||||||
NS_ENSURE_SUCCESS(GetIdentifiersForType(aName, &arrayType, &flags), NS_ERROR_FAILURE);
|
NS_ENSURE_SUCCESS(GetIdentifiersForType(aName, &arrayType, &flags),
|
||||||
|
NS_ERROR_FAILURE);
|
||||||
ls = FindJSEventListener(arrayType);
|
ls = FindJSEventListener(arrayType);
|
||||||
|
|
||||||
if (ls) {
|
if (ls) {
|
||||||
|
@ -896,80 +934,118 @@ nsEventListenerManager::RemoveScriptEventListener(nsIAtom *aName)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
NS_IMETHODIMP
|
||||||
nsEventListenerManager::RegisterScriptEventListener(nsIScriptContext *aContext,
|
nsEventListenerManager::RegisterScriptEventListener(nsIScriptContext *aContext,
|
||||||
nsIScriptObjectOwner *aScriptObjectOwner,
|
nsISupports *aObject,
|
||||||
nsIAtom *aName)
|
nsIAtom *aName)
|
||||||
{
|
{
|
||||||
// Check that we have access to set an event listener. Prevents snooping attacks across
|
// Check that we have access to set an event listener. Prevents
|
||||||
// domains by setting onkeypress handlers, for instance.
|
// snooping attacks across domains by setting onkeypress handlers,
|
||||||
// You'd think it'd work just to get the JSContext from aContext, but that's actually the
|
// for instance.
|
||||||
// JSContext whose private object parents the object in aScriptObjectOwner.
|
// You'd think it'd work just to get the JSContext from aContext,
|
||||||
|
// but that's actually the JSContext whose private object parents
|
||||||
|
// the object in aObject.
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
NS_WITH_SERVICE(nsIJSContextStack, stack, "@mozilla.org/js/xpc/ContextStack;1",
|
nsCOMPtr<nsIJSContextStack> stack =
|
||||||
&rv);
|
do_GetService("@mozilla.org/js/xpc/ContextStack;1", &rv);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
JSContext *cx;
|
JSContext *cx;
|
||||||
if (NS_FAILED(stack->Peek(&cx)))
|
if (NS_FAILED(stack->Peek(&cx)))
|
||||||
return nsnull;
|
return nsnull;
|
||||||
JSObject *jsobj;
|
|
||||||
if (NS_FAILED(rv = aScriptObjectOwner->GetScriptObject(aContext, (void**)&jsobj)))
|
JSContext *current_cx = (JSContext *)aContext->GetNativeContext();
|
||||||
return rv;
|
|
||||||
NS_WITH_SERVICE(nsIScriptSecurityManager, securityManager,
|
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||||
NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
|
|
||||||
|
nsCOMPtr<nsIXPConnect> xpc(do_GetService(nsIXPConnect::GetCID()));
|
||||||
|
rv = xpc->WrapNative(current_cx, ::JS_GetGlobalObject(current_cx), aObject,
|
||||||
|
NS_GET_IID(nsISupports), getter_AddRefs(holder));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
JSObject *jsobj = nsnull;
|
||||||
|
|
||||||
|
rv = holder->GetJSObject(&jsobj);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIScriptSecurityManager> securityManager =
|
||||||
|
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
if (NS_FAILED(rv = securityManager->CheckScriptAccess(cx, jsobj,
|
|
||||||
NS_DOM_PROP_EVENTTARGET_ADDEVENTLISTENER, PR_TRUE)))
|
if (NS_FAILED(rv = securityManager->CheckPropertyAccess(
|
||||||
{
|
nsIXPCSecurityManager::ACCESS_SET_PROPERTY, cx, jsobj, aObject, nsnull,
|
||||||
|
"EventTarget","addEventListener", PR_FALSE))) {
|
||||||
|
// XXX set pending exception on the native call context?
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
return SetJSEventListener(aContext, aScriptObjectOwner, aName, PR_FALSE);
|
|
||||||
|
return SetJSEventListener(aContext, aObject, aName, PR_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsEventListenerManager::CompileScriptEventListener(nsIScriptContext *aContext,
|
nsEventListenerManager::CompileScriptEventListener(nsIScriptContext *aContext,
|
||||||
nsIScriptObjectOwner *aScriptObjectOwner,
|
nsISupports *aObject,
|
||||||
nsIAtom *aName)
|
nsIAtom *aName,
|
||||||
|
PRBool *aDidCompile)
|
||||||
{
|
{
|
||||||
nsresult result = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
nsListenerStruct *ls;
|
nsListenerStruct *ls;
|
||||||
PRInt32 subType;
|
PRInt32 subType;
|
||||||
EventArrayType arrayType;
|
EventArrayType arrayType;
|
||||||
|
|
||||||
result = GetIdentifiersForType(aName, &arrayType, &subType);
|
*aDidCompile = PR_FALSE;
|
||||||
if (NS_SUCCEEDED(result)) {
|
|
||||||
ls = FindJSEventListener(arrayType);
|
|
||||||
if (!ls) {
|
|
||||||
//nothing to compile
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ls->mHandlerIsString & subType) {
|
rv = GetIdentifiersForType(aName, &arrayType, &subType);
|
||||||
result = CompileEventHandlerInternal(aContext, aScriptObjectOwner, aName, ls, subType);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
|
||||||
|
ls = FindJSEventListener(arrayType);
|
||||||
|
|
||||||
|
if (!ls) {
|
||||||
|
//nothing to compile
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
if (ls->mHandlerIsString & subType) {
|
||||||
|
rv = CompileEventHandlerInternal(aContext, aObject, aName, ls, subType);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set *aDidCompile to true even if we didn't really compile
|
||||||
|
// anything right now, if we get here it means that this event
|
||||||
|
// handler has been compiled at some point, that's good enough for
|
||||||
|
// us.
|
||||||
|
|
||||||
|
*aDidCompile = PR_TRUE;
|
||||||
|
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsEventListenerManager::CompileEventHandlerInternal(nsIScriptContext *aContext,
|
nsEventListenerManager::CompileEventHandlerInternal(nsIScriptContext *aContext,
|
||||||
nsIScriptObjectOwner *aScriptObjectOwner,
|
nsISupports *aObject,
|
||||||
nsIAtom *aName,
|
nsIAtom *aName,
|
||||||
nsListenerStruct *aListenerStruct,
|
nsListenerStruct *aListenerStruct,
|
||||||
PRUint32 aSubType)
|
PRUint32 aSubType)
|
||||||
{
|
{
|
||||||
nsresult result = NS_OK;
|
nsresult result = NS_OK;
|
||||||
|
|
||||||
JSObject* jsobj;
|
nsCOMPtr<nsIXPConnect> xpc(do_GetService(nsIXPConnect::GetCID()));
|
||||||
result = aScriptObjectOwner->GetScriptObject(aContext, (void**)&jsobj);
|
|
||||||
if (NS_FAILED(result)) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIScriptEventHandlerOwner> handlerOwner = do_QueryInterface(aScriptObjectOwner);
|
JSContext *cx = (JSContext *)aContext->GetNativeContext();
|
||||||
|
|
||||||
|
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||||
|
|
||||||
|
result = xpc->WrapNative(cx, ::JS_GetGlobalObject(cx), aObject,
|
||||||
|
NS_GET_IID(nsISupports), getter_AddRefs(holder));
|
||||||
|
NS_ENSURE_SUCCESS(result, result);
|
||||||
|
|
||||||
|
JSObject *jsobj = nsnull;
|
||||||
|
|
||||||
|
result = holder->GetJSObject(&jsobj);
|
||||||
|
NS_ENSURE_SUCCESS(result, result);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIScriptEventHandlerOwner> handlerOwner =
|
||||||
|
do_QueryInterface(aObject);
|
||||||
void* handler = nsnull;
|
void* handler = nsnull;
|
||||||
|
|
||||||
if (handlerOwner) {
|
if (handlerOwner) {
|
||||||
|
@ -985,25 +1061,29 @@ nsEventListenerManager::CompileEventHandlerInternal(nsIScriptContext *aContext,
|
||||||
// XXX I don't like that we have to reference content
|
// XXX I don't like that we have to reference content
|
||||||
// from here. The alternative is to store the event handler
|
// from here. The alternative is to store the event handler
|
||||||
// string on the JS object itself.
|
// string on the JS object itself.
|
||||||
nsCOMPtr<nsIContent> content = do_QueryInterface(aScriptObjectOwner);
|
nsCOMPtr<nsIContent> content = do_QueryInterface(aObject);
|
||||||
NS_ASSERTION(content, "only content should have event handler attributes");
|
NS_ASSERTION(content, "only content should have event handler attributes");
|
||||||
if (content) {
|
if (content) {
|
||||||
nsAutoString handlerBody;
|
nsAutoString handlerBody;
|
||||||
result = content->GetAttribute(kNameSpaceID_None, aName, handlerBody);
|
result = content->GetAttribute(kNameSpaceID_None, aName, handlerBody);
|
||||||
|
|
||||||
if (NS_SUCCEEDED(result)) {
|
if (NS_SUCCEEDED(result)) {
|
||||||
if (handlerOwner) {
|
if (handlerOwner) {
|
||||||
// Always let the handler owner compile the event
|
// Always let the handler owner compile the event
|
||||||
// handler, as it may want to use a special
|
// handler, as it may want to use a special
|
||||||
// context or scope object.
|
// context or scope object.
|
||||||
result = handlerOwner->CompileEventHandler(aContext, jsobj, aName, handlerBody, &handler);
|
result = handlerOwner->CompileEventHandler(aContext, jsobj, aName,
|
||||||
|
handlerBody, &handler);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
result = aContext->CompileEventHandler(jsobj, aName, handlerBody,
|
result = aContext->CompileEventHandler(jsobj, aName, handlerBody,
|
||||||
(handlerOwner != nsnull),
|
(handlerOwner != nsnull),
|
||||||
&handler);
|
&handler);
|
||||||
}
|
}
|
||||||
if (NS_SUCCEEDED(result))
|
|
||||||
|
if (NS_SUCCEEDED(result)) {
|
||||||
aListenerStruct->mHandlerIsString &= ~aSubType;
|
aListenerStruct->mHandlerIsString &= ~aSubType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1040,9 +1120,10 @@ nsEventListenerManager::HandleEventSubType(nsListenerStruct* aListenerStruct,
|
||||||
|
|
||||||
nsCOMPtr<nsIJSEventListener> jslistener = do_QueryInterface(aListenerStruct->mListener);
|
nsCOMPtr<nsIJSEventListener> jslistener = do_QueryInterface(aListenerStruct->mListener);
|
||||||
if (jslistener) {
|
if (jslistener) {
|
||||||
nsCOMPtr<nsIScriptObjectOwner> owner;
|
nsCOMPtr<nsISupports> target;
|
||||||
nsCOMPtr<nsIScriptContext> scriptCX;
|
nsCOMPtr<nsIScriptContext> scriptCX;
|
||||||
result = jslistener->GetEventTarget(getter_AddRefs(scriptCX), getter_AddRefs(owner));
|
result = jslistener->GetEventTarget(getter_AddRefs(scriptCX),
|
||||||
|
getter_AddRefs(target));
|
||||||
|
|
||||||
if (NS_SUCCEEDED(result)) {
|
if (NS_SUCCEEDED(result)) {
|
||||||
nsAutoString eventString;
|
nsAutoString eventString;
|
||||||
|
@ -1050,7 +1131,8 @@ nsEventListenerManager::HandleEventSubType(nsListenerStruct* aListenerStruct,
|
||||||
eventString.InsertWithConversion("on", 0, 2);
|
eventString.InsertWithConversion("on", 0, 2);
|
||||||
nsCOMPtr<nsIAtom> atom = getter_AddRefs(NS_NewAtom(eventString));
|
nsCOMPtr<nsIAtom> atom = getter_AddRefs(NS_NewAtom(eventString));
|
||||||
|
|
||||||
result = CompileEventHandlerInternal(scriptCX, owner, atom, aListenerStruct, aSubType);
|
result = CompileEventHandlerInternal(scriptCX, target, atom,
|
||||||
|
aListenerStruct, aSubType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2112,10 +2194,12 @@ nsresult nsEventListenerManager::HandleEvent(nsIPresContext* aPresContext,
|
||||||
/**
|
/**
|
||||||
* Creates a DOM event
|
* Creates a DOM event
|
||||||
*/
|
*/
|
||||||
nsresult nsEventListenerManager::CreateEvent(nsIPresContext* aPresContext,
|
|
||||||
nsEvent* aEvent,
|
NS_IMETHODIMP
|
||||||
const nsAReadableString& aEventType,
|
nsEventListenerManager::CreateEvent(nsIPresContext* aPresContext,
|
||||||
nsIDOMEvent** aDOMEvent)
|
nsEvent* aEvent,
|
||||||
|
const nsAReadableString& aEventType,
|
||||||
|
nsIDOMEvent** aDOMEvent)
|
||||||
{
|
{
|
||||||
nsAutoString str(aEventType);
|
nsAutoString str(aEventType);
|
||||||
if (!aEvent && !str.EqualsIgnoreCase("MouseEvents") && !str.EqualsIgnoreCase("KeyEvents") &&
|
if (!aEvent && !str.EqualsIgnoreCase("MouseEvents") && !str.EqualsIgnoreCase("KeyEvents") &&
|
||||||
|
@ -2135,7 +2219,8 @@ nsresult nsEventListenerManager::CreateEvent(nsIPresContext* aPresContext,
|
||||||
* @param an event listener
|
* @param an event listener
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nsresult nsEventListenerManager::CaptureEvent(PRInt32 aEventTypes)
|
NS_IMETHODIMP
|
||||||
|
nsEventListenerManager::CaptureEvent(PRInt32 aEventTypes)
|
||||||
{
|
{
|
||||||
return FlipCaptureBit(aEventTypes, PR_TRUE);
|
return FlipCaptureBit(aEventTypes, PR_TRUE);
|
||||||
}
|
}
|
||||||
|
@ -2145,7 +2230,8 @@ nsresult nsEventListenerManager::CaptureEvent(PRInt32 aEventTypes)
|
||||||
* @param an event listener
|
* @param an event listener
|
||||||
*/
|
*/
|
||||||
|
|
||||||
nsresult nsEventListenerManager::ReleaseEvent(PRInt32 aEventTypes)
|
NS_IMETHODIMP
|
||||||
|
nsEventListenerManager::ReleaseEvent(PRInt32 aEventTypes)
|
||||||
{
|
{
|
||||||
return FlipCaptureBit(aEventTypes, PR_FALSE);
|
return FlipCaptureBit(aEventTypes, PR_FALSE);
|
||||||
}
|
}
|
||||||
|
@ -2374,7 +2460,8 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsEventListenerManager::SetListenerTarget(nsISupports* aTarget)
|
NS_IMETHODIMP
|
||||||
|
nsEventListenerManager::SetListenerTarget(nsISupports* aTarget)
|
||||||
{
|
{
|
||||||
//WEAK reference, must be set back to nsnull when done
|
//WEAK reference, must be set back to nsnull when done
|
||||||
mTarget = aTarget;
|
mTarget = aTarget;
|
||||||
|
@ -2469,18 +2556,15 @@ nsEventListenerManager::HandleEvent(nsIDOMEvent *aEvent)
|
||||||
return DispatchEvent(aEvent);
|
return DispatchEvent(aEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_HTML nsresult NS_NewEventListenerManager(nsIEventListenerManager** aInstancePtrResult)
|
nsresult
|
||||||
|
NS_NewEventListenerManager(nsIEventListenerManager** aInstancePtrResult)
|
||||||
{
|
{
|
||||||
nsIEventListenerManager* l = new nsEventListenerManager();
|
nsIEventListenerManager* l = new nsEventListenerManager();
|
||||||
|
|
||||||
if (nsnull == l) {
|
if (!l) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_OK == l->QueryInterface(NS_GET_IID(nsIEventListenerManager), (void**) aInstancePtrResult)) {
|
return CallQueryInterface(l, aInstancePtrResult);
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,48 +95,58 @@ public:
|
||||||
* Sets events listeners of all types.
|
* Sets events listeners of all types.
|
||||||
* @param an event listener
|
* @param an event listener
|
||||||
*/
|
*/
|
||||||
|
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,
|
||||||
|
const nsIID& aIID, PRInt32 aFlags);
|
||||||
|
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener,
|
||||||
|
const nsIID& aIID, PRInt32 aFlags);
|
||||||
|
NS_IMETHOD AddEventListenerByType(nsIDOMEventListener *aListener,
|
||||||
|
const nsAReadableString& type,
|
||||||
|
PRInt32 aFlags);
|
||||||
|
NS_IMETHOD RemoveEventListenerByType(nsIDOMEventListener *aListener,
|
||||||
|
const nsAReadableString& type,
|
||||||
|
PRInt32 aFlags) ;
|
||||||
|
NS_IMETHOD AddScriptEventListener(nsIScriptContext*aContext,
|
||||||
|
nsISupports *aObject,
|
||||||
|
nsIAtom *aName,
|
||||||
|
const nsAReadableString& aFunc,
|
||||||
|
PRBool aDeferCompilation);
|
||||||
|
NS_IMETHOD RegisterScriptEventListener(nsIScriptContext *aContext,
|
||||||
|
nsISupports *aObject,
|
||||||
|
nsIAtom* aName);
|
||||||
|
NS_IMETHOD RemoveScriptEventListener(nsIAtom *aName);
|
||||||
|
NS_IMETHOD CompileScriptEventListener(nsIScriptContext *aContext,
|
||||||
|
nsISupports *aObject,
|
||||||
|
nsIAtom* aName, PRBool *aDidCompile);
|
||||||
|
|
||||||
virtual nsresult AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID, PRInt32 aFlags);
|
NS_IMETHOD CaptureEvent(PRInt32 aEventTypes);
|
||||||
virtual nsresult RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID, PRInt32 aFlags);
|
NS_IMETHOD ReleaseEvent(PRInt32 aEventTypes);
|
||||||
virtual nsresult AddEventListenerByType(nsIDOMEventListener *aListener, const nsAReadableString& type, PRInt32 aFlags);
|
|
||||||
virtual nsresult RemoveEventListenerByType(nsIDOMEventListener *aListener, const nsAReadableString& type, PRInt32 aFlags) ;
|
|
||||||
|
|
||||||
virtual nsresult AddScriptEventListener(nsIScriptContext*aContext,
|
NS_IMETHOD HandleEvent(nsIPresContext* aPresContext,
|
||||||
nsIScriptObjectOwner *aScriptObjectOwner,
|
nsEvent* aEvent,
|
||||||
nsIAtom *aName,
|
nsIDOMEvent** aDOMEvent,
|
||||||
const nsAReadableString& aFunc,
|
nsIDOMEventTarget* aCurrentTarget,
|
||||||
PRBool aDeferCompilation);
|
PRUint32 aFlags,
|
||||||
virtual nsresult RemoveScriptEventListener(nsIAtom *aName);
|
nsEventStatus* aEventStatus);
|
||||||
virtual nsresult RegisterScriptEventListener(nsIScriptContext *aContext,
|
|
||||||
nsIScriptObjectOwner *aScriptObjectOwner,
|
|
||||||
nsIAtom* aName);
|
|
||||||
virtual nsresult CompileScriptEventListener(nsIScriptContext *aContext,
|
|
||||||
nsIScriptObjectOwner *aScriptObjectOwner,
|
|
||||||
nsIAtom* aName);
|
|
||||||
|
|
||||||
|
NS_IMETHOD CreateEvent(nsIPresContext* aPresContext,
|
||||||
|
nsEvent* aEvent,
|
||||||
|
const nsAReadableString& aEventType,
|
||||||
|
nsIDOMEvent** aDOMEvent);
|
||||||
|
|
||||||
virtual nsresult CaptureEvent(PRInt32 aEventTypes);
|
NS_IMETHOD RemoveAllListeners(PRBool aScriptOnly);
|
||||||
virtual nsresult ReleaseEvent(PRInt32 aEventTypes);
|
|
||||||
|
|
||||||
virtual nsresult HandleEvent(nsIPresContext* aPresContext,
|
NS_IMETHOD SetListenerTarget(nsISupports* aTarget);
|
||||||
nsEvent* aEvent,
|
|
||||||
nsIDOMEvent** aDOMEvent,
|
|
||||||
nsIDOMEventTarget* aCurrentTarget,
|
|
||||||
PRUint32 aFlags,
|
|
||||||
nsEventStatus* aEventStatus);
|
|
||||||
|
|
||||||
virtual nsresult CreateEvent(nsIPresContext* aPresContext,
|
NS_IMETHOD HasMutationListeners(PRBool* aListener)
|
||||||
nsEvent* aEvent,
|
{
|
||||||
const nsAReadableString& aEventType,
|
*aListener = (GetListenersByType(eEventArrayType_Mutation, nsnull,
|
||||||
nsIDOMEvent** aDOMEvent);
|
PR_FALSE) != nsnull);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
virtual nsresult RemoveAllListeners(PRBool aScriptOnly);
|
static nsresult GetIdentifiersForType(nsIAtom* aType,
|
||||||
|
EventArrayType* aArrayType,
|
||||||
virtual nsresult SetListenerTarget(nsISupports* aTarget);
|
PRInt32* aSubType);
|
||||||
|
|
||||||
virtual nsresult HasMutationListeners(PRBool* aListener) { *aListener = (GetListenersByType(eEventArrayType_Mutation, nsnull, PR_FALSE) != nsnull); return NS_OK; };
|
|
||||||
|
|
||||||
static nsresult GetIdentifiersForType(nsIAtom* aType, EventArrayType* aArrayType, PRInt32* aSubType);
|
|
||||||
|
|
||||||
// nsIDOMEventTarget interface
|
// nsIDOMEventTarget interface
|
||||||
NS_IMETHOD AddEventListener(const nsAReadableString& aType,
|
NS_IMETHOD AddEventListener(const nsAReadableString& aType,
|
||||||
|
@ -148,8 +158,10 @@ public:
|
||||||
NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent);
|
NS_IMETHOD DispatchEvent(nsIDOMEvent* aEvent);
|
||||||
|
|
||||||
// nsIDOMEventReceiver interface
|
// nsIDOMEventReceiver interface
|
||||||
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
|
NS_IMETHOD AddEventListenerByIID(nsIDOMEventListener *aListener,
|
||||||
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener, const nsIID& aIID);
|
const nsIID& aIID);
|
||||||
|
NS_IMETHOD RemoveEventListenerByIID(nsIDOMEventListener *aListener,
|
||||||
|
const nsIID& aIID);
|
||||||
NS_IMETHOD GetListenerManager(nsIEventListenerManager** aInstancePtrResult);
|
NS_IMETHOD GetListenerManager(nsIEventListenerManager** aInstancePtrResult);
|
||||||
NS_IMETHOD GetNewListenerManager(nsIEventListenerManager **aInstancePtrResult);
|
NS_IMETHOD GetNewListenerManager(nsIEventListenerManager **aInstancePtrResult);
|
||||||
NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent);
|
NS_IMETHOD HandleEvent(nsIDOMEvent *aEvent);
|
||||||
|
@ -161,12 +173,14 @@ protected:
|
||||||
PRUint32 aSubType,
|
PRUint32 aSubType,
|
||||||
PRUint32 aPhaseFlags);
|
PRUint32 aPhaseFlags);
|
||||||
nsresult CompileEventHandlerInternal(nsIScriptContext *aContext,
|
nsresult CompileEventHandlerInternal(nsIScriptContext *aContext,
|
||||||
nsIScriptObjectOwner *aScriptObjectOwner,
|
nsISupports *aObject,
|
||||||
nsIAtom *aName,
|
nsIAtom *aName,
|
||||||
nsListenerStruct *aListenerStruct,
|
nsListenerStruct *aListenerStruct,
|
||||||
PRUint32 aSubType);
|
PRUint32 aSubType);
|
||||||
nsListenerStruct* FindJSEventListener(EventArrayType aType);
|
nsListenerStruct* FindJSEventListener(EventArrayType aType);
|
||||||
nsresult SetJSEventListener(nsIScriptContext *aContext, nsIScriptObjectOwner *aOwner, nsIAtom* aName, PRBool aIsString);
|
nsresult SetJSEventListener(nsIScriptContext *aContext,
|
||||||
|
nsISupports *aObject, nsIAtom* aName,
|
||||||
|
PRBool aIsString);
|
||||||
nsresult AddEventListener(nsIDOMEventListener *aListener,
|
nsresult AddEventListener(nsIDOMEventListener *aListener,
|
||||||
EventArrayType aType,
|
EventArrayType aType,
|
||||||
PRInt32 aSubType,
|
PRInt32 aSubType,
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
#include "nsITreeFrame.h"
|
#include "nsITreeFrame.h"
|
||||||
#include "nsIOutlinerBoxObject.h"
|
#include "nsIOutlinerBoxObject.h"
|
||||||
#include "nsIScrollableViewProvider.h"
|
#include "nsIScrollableViewProvider.h"
|
||||||
#include "nsIDOMNSDocument.h"
|
#include "nsIDOMDocumentRange.h"
|
||||||
|
|
||||||
#include "nsIDOMRange.h"
|
#include "nsIDOMRange.h"
|
||||||
#include "nsICaret.h"
|
#include "nsICaret.h"
|
||||||
|
@ -1057,8 +1057,8 @@ nsEventStateManager::ChangeTextSize(PRInt32 change)
|
||||||
ourWindow->GetPrivateRoot(getter_AddRefs(rootWindow));
|
ourWindow->GetPrivateRoot(getter_AddRefs(rootWindow));
|
||||||
if(!rootWindow) return NS_ERROR_FAILURE;
|
if(!rootWindow) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMWindowInternal> windowContent;
|
nsCOMPtr<nsIDOMWindow> windowContent;
|
||||||
rootWindow->Get_content(getter_AddRefs(windowContent));
|
rootWindow->GetContent(getter_AddRefs(windowContent));
|
||||||
if(!windowContent) return NS_ERROR_FAILURE;
|
if(!windowContent) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||||
|
@ -1090,7 +1090,7 @@ nsEventStateManager::ChangeTextSize(PRInt32 change)
|
||||||
|
|
||||||
float textzoom;
|
float textzoom;
|
||||||
mv->GetTextZoom(&textzoom);
|
mv->GetTextZoom(&textzoom);
|
||||||
textzoom += 0.1*change;
|
textzoom += ((float)change) / 10;
|
||||||
if (textzoom > 0 && textzoom <= 20)
|
if (textzoom > 0 && textzoom <= 20)
|
||||||
mv->SetTextZoom(textzoom);
|
mv->SetTextZoom(textzoom);
|
||||||
|
|
||||||
|
@ -3705,7 +3705,7 @@ nsresult nsEventStateManager::MoveCaretToFocus()
|
||||||
mPresContext->GetShell(getter_AddRefs(shell));
|
mPresContext->GetShell(getter_AddRefs(shell));
|
||||||
if (shell) {
|
if (shell) {
|
||||||
// rangeDoc is a document interface we can create a range with
|
// rangeDoc is a document interface we can create a range with
|
||||||
nsCOMPtr<nsIDOMNSDocument> rangeDoc(do_QueryInterface(mDocument));
|
nsCOMPtr<nsIDOMDocumentRange> rangeDoc(do_QueryInterface(mDocument));
|
||||||
nsCOMPtr<nsIDOMNode> currentFocusNode(do_QueryInterface(mCurrentFocus));
|
nsCOMPtr<nsIDOMNode> currentFocusNode(do_QueryInterface(mCurrentFocus));
|
||||||
nsCOMPtr<nsIFrameSelection> frameSelection;
|
nsCOMPtr<nsIFrameSelection> frameSelection;
|
||||||
shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
shell->GetFrameSelection(getter_AddRefs(frameSelection));
|
||||||
|
@ -3717,7 +3717,7 @@ nsresult nsEventStateManager::MoveCaretToFocus()
|
||||||
getter_AddRefs(domSelection));
|
getter_AddRefs(domSelection));
|
||||||
if (domSelection) {
|
if (domSelection) {
|
||||||
// First clear the selection
|
// First clear the selection
|
||||||
domSelection ->RemoveAllRanges();
|
domSelection->RemoveAllRanges();
|
||||||
nsCOMPtr<nsIDOMRange> newRange;
|
nsCOMPtr<nsIDOMRange> newRange;
|
||||||
nsresult rv = rangeDoc->CreateRange(getter_AddRefs(newRange));
|
nsresult rv = rangeDoc->CreateRange(getter_AddRefs(newRange));
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
|
|
@ -54,7 +54,7 @@ class nsPrivateTextRangeList: public nsIPrivateTextRangeList
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
public:
|
public:
|
||||||
|
|
||||||
nsPrivateTextRangeList(PRUint16 aLength,nsIPrivateTextRange** aList);
|
nsPrivateTextRangeList(PRUint16 aLength, nsIPrivateTextRange** aList);
|
||||||
virtual ~nsPrivateTextRangeList(void);
|
virtual ~nsPrivateTextRangeList(void);
|
||||||
|
|
||||||
NS_IMETHOD GetLength(PRUint16* aLength);
|
NS_IMETHOD GetLength(PRUint16* aLength);
|
||||||
|
|
|
@ -23,26 +23,32 @@
|
||||||
#define nsIForm_h___
|
#define nsIForm_h___
|
||||||
|
|
||||||
#include "nsISupports.h"
|
#include "nsISupports.h"
|
||||||
#include "nsString.h"
|
#include "nsAReadableString.h"
|
||||||
|
|
||||||
class nsIFormControl;
|
class nsIFormControl;
|
||||||
class nsISizeOfHandler;
|
class nsISizeOfHandler;
|
||||||
|
|
||||||
|
|
||||||
#define NS_FORM_METHOD_GET 0
|
#define NS_FORM_METHOD_GET 0
|
||||||
#define NS_FORM_METHOD_POST 1
|
#define NS_FORM_METHOD_POST 1
|
||||||
#define NS_FORM_ENCTYPE_URLENCODED 0
|
#define NS_FORM_ENCTYPE_URLENCODED 0
|
||||||
#define NS_FORM_ENCTYPE_MULTIPART 1
|
#define NS_FORM_ENCTYPE_MULTIPART 1
|
||||||
|
|
||||||
|
|
||||||
// IID for the nsIFormManager interface
|
// IID for the nsIFormManager interface
|
||||||
#define NS_IFORM_IID \
|
#define NS_IFORM_IID \
|
||||||
{ 0xb7e94510, 0x4c19, 0x11d2, \
|
{ 0xb7e94510, 0x4c19, 0x11d2, \
|
||||||
{ 0x80, 0x3f, 0x0, 0x60, 0x8, 0x15, 0xa7, 0x91 } }
|
{ 0x80, 0x3f, 0x0, 0x60, 0x8, 0x15, 0xa7, 0x91 } }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This interface provides a complete set of methods dealing with
|
* This interface provides a complete set of methods dealing with
|
||||||
* elements which belong to a form element. When nsIDOMHTMLCollection
|
* elements which belong to a form element. When nsIDOMHTMLCollection
|
||||||
* allows write operations
|
* allows write operations
|
||||||
*/
|
*/
|
||||||
class nsIForm : public nsISupports {
|
|
||||||
|
class nsIForm : public nsISupports
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFORM_IID)
|
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFORM_IID)
|
||||||
|
|
||||||
|
@ -60,7 +66,8 @@ public:
|
||||||
* attributes. The name or id attributes of the form control
|
* attributes. The name or id attributes of the form control
|
||||||
* are used as a key into the table.
|
* are used as a key into the table.
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD AddElementToTable(nsIFormControl* aElement, const nsAReadableString& aName) = 0;
|
NS_IMETHOD AddElementToTable(nsIFormControl* aElement,
|
||||||
|
const nsAReadableString& aName) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the element at a specified index position
|
* Get the element at a specified index position
|
||||||
|
@ -84,7 +91,7 @@ public:
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD RemoveElement(nsIFormControl* aElement) = 0;
|
NS_IMETHOD RemoveElement(nsIFormControl* aElement) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove an element from the lookup table mainted by the form.
|
* Remove an element from the lookup table mainted by the form.
|
||||||
* We can't fold this method into RemoveElement() because when
|
* We can't fold this method into RemoveElement() because when
|
||||||
* RemoveElement() is called it doesn't know if the element is
|
* RemoveElement() is called it doesn't know if the element is
|
||||||
|
@ -95,7 +102,20 @@ public:
|
||||||
* @param aName the name or id of the element to remove
|
* @param aName the name or id of the element to remove
|
||||||
* @return NS_OK if the element was successfully removed.
|
* @return NS_OK if the element was successfully removed.
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD RemoveElementFromTable(nsIFormControl* aElement, const nsAReadableString& aName) = 0;
|
NS_IMETHOD RemoveElementFromTable(nsIFormControl* aElement,
|
||||||
|
const nsAReadableString& aName) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resolve a name in the scope of the form object, this means find
|
||||||
|
* form controls in this form with the correct value in the name
|
||||||
|
* attribute.
|
||||||
|
*
|
||||||
|
* @param aElement the element to remove
|
||||||
|
* @param aName the name or id of the element to remove
|
||||||
|
* @return NS_OK if the element was successfully removed. */
|
||||||
|
NS_IMETHOD ResolveName(const nsAReadableString& aName,
|
||||||
|
nsISupports **aResult) = 0;
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const = 0;
|
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
class nsIContent;
|
class nsIContent;
|
||||||
class nsIAtom;
|
class nsIAtom;
|
||||||
|
class nsISizeOfHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class provides a late-bound collection of elements that are
|
* This class provides a late-bound collection of elements that are
|
||||||
|
|
|
@ -118,6 +118,10 @@ public:
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags) {
|
||||||
|
return !(aFlags & ~eTEXT);
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, const nsAReadableString& aValue,
|
NS_IMETHOD SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aAttribute, const nsAReadableString& aValue,
|
||||||
PRBool aNotify) { return NS_OK; }
|
PRBool aNotify) { return NS_OK; }
|
||||||
NS_IMETHOD SetAttribute(nsINodeInfo *aNodeInfo, const nsAReadableString& aValue,
|
NS_IMETHOD SetAttribute(nsINodeInfo *aNodeInfo, const nsAReadableString& aValue,
|
||||||
|
|
|
@ -26,54 +26,16 @@
|
||||||
nsGenericDOMHTMLCollection::nsGenericDOMHTMLCollection()
|
nsGenericDOMHTMLCollection::nsGenericDOMHTMLCollection()
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
mScriptObject = nsnull;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsGenericDOMHTMLCollection::~nsGenericDOMHTMLCollection()
|
nsGenericDOMHTMLCollection::~nsGenericDOMHTMLCollection()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsGenericDOMHTMLCollection::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|
||||||
{
|
|
||||||
if (NULL == aInstancePtr) {
|
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
}
|
|
||||||
if (aIID.Equals(NS_GET_IID(nsIDOMHTMLCollection))) {
|
|
||||||
*aInstancePtr = (void*)(nsIDOMHTMLCollection*)this;
|
|
||||||
AddRef();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
if (aIID.Equals(NS_GET_IID(nsIScriptObjectOwner))) {
|
|
||||||
*aInstancePtr = (void*)(nsIScriptObjectOwner*)this;
|
|
||||||
AddRef();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
if (aIID.Equals(NS_GET_IID(nsISupports))) {
|
|
||||||
*aInstancePtr = (void*)(nsISupports*)(nsIDOMHTMLCollection*)this;
|
|
||||||
AddRef();
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
return NS_NOINTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsGenericDOMHTMLCollection)
|
NS_IMPL_ADDREF(nsGenericDOMHTMLCollection)
|
||||||
NS_IMPL_RELEASE(nsGenericDOMHTMLCollection)
|
NS_IMPL_RELEASE(nsGenericDOMHTMLCollection)
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_INTERFACE_MAP_BEGIN(nsGenericDOMHTMLCollection)
|
||||||
nsGenericDOMHTMLCollection::GetScriptObject(nsIScriptContext *aContext, void** aScriptObject)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLCollection)
|
||||||
{
|
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||||
nsresult res = NS_OK;
|
NS_INTERFACE_MAP_END
|
||||||
if (nsnull == mScriptObject) {
|
|
||||||
res = NS_NewScriptHTMLCollection(aContext, (nsISupports *)(nsIDOMHTMLCollection *)this, nsnull, (void**)&mScriptObject);
|
|
||||||
}
|
|
||||||
*aScriptObject = mScriptObject;
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGenericDOMHTMLCollection::SetScriptObject(void *aScriptObject)
|
|
||||||
{
|
|
||||||
mScriptObject = aScriptObject;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
|
@ -25,20 +25,18 @@
|
||||||
|
|
||||||
#include "nsISupports.h"
|
#include "nsISupports.h"
|
||||||
#include "nsIDOMHTMLCollection.h"
|
#include "nsIDOMHTMLCollection.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is a base class for a generic HTML collection. The base class
|
* This is a base class for a generic HTML collection. The base class
|
||||||
* provides implementations for nsISupports and nsIScriptObjectOwner,
|
* provides implementations for nsISupports, but it is up to the
|
||||||
* but it is up to the subclass to implement the core HTML collection
|
* subclass to implement the core HTML collection
|
||||||
|
*
|
||||||
* methods:
|
* methods:
|
||||||
* GetLength
|
* GetLength
|
||||||
* Item
|
* Item
|
||||||
* NamedItem
|
* NamedItem
|
||||||
*
|
* */
|
||||||
*/
|
class nsGenericDOMHTMLCollection : public nsIDOMHTMLCollection
|
||||||
class nsGenericDOMHTMLCollection : public nsIDOMHTMLCollection,
|
|
||||||
public nsIScriptObjectOwner
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsGenericDOMHTMLCollection();
|
nsGenericDOMHTMLCollection();
|
||||||
|
@ -46,17 +44,11 @@ public:
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
|
||||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
|
||||||
|
|
||||||
// The following need to be defined in the subclass
|
// The following need to be defined in the subclass
|
||||||
// nsIDOMHTMLCollection interface
|
// nsIDOMHTMLCollection interface
|
||||||
NS_IMETHOD GetLength(PRUint32* aLength)=0;
|
NS_IMETHOD GetLength(PRUint32* aLength)=0;
|
||||||
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn)=0;
|
NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn)=0;
|
||||||
NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)=0;
|
NS_IMETHOD NamedItem(const nsAReadableString& aName, nsIDOMNode** aReturn)=0;
|
||||||
|
|
||||||
protected:
|
|
||||||
void* mScriptObject;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // nsGenericDOMHTMLCollection_h__
|
#endif // nsGenericDOMHTMLCollection_h__
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||||
* Rights Reserved.
|
* Rights Reserved.
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
@ -35,6 +35,8 @@
|
||||||
#include "nsIDOMNamedNodeMap.h"
|
#include "nsIDOMNamedNodeMap.h"
|
||||||
#include "nsIDOMNodeList.h"
|
#include "nsIDOMNodeList.h"
|
||||||
#include "nsIDOMDocumentFragment.h"
|
#include "nsIDOMDocumentFragment.h"
|
||||||
|
#include "nsIDOMNSHTMLElement.h"
|
||||||
|
#include "nsIDOMElementCSSInlineStyle.h"
|
||||||
#include "nsIEventListenerManager.h"
|
#include "nsIEventListenerManager.h"
|
||||||
#include "nsIHTMLAttributes.h"
|
#include "nsIHTMLAttributes.h"
|
||||||
#include "nsIHTMLStyleSheet.h"
|
#include "nsIHTMLStyleSheet.h"
|
||||||
|
@ -43,8 +45,6 @@
|
||||||
#include "nsILink.h"
|
#include "nsILink.h"
|
||||||
#include "nsILinkHandler.h"
|
#include "nsILinkHandler.h"
|
||||||
#include "nsPIDOMWindow.h"
|
#include "nsPIDOMWindow.h"
|
||||||
#include "nsIScriptGlobalObject.h"
|
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsISizeOfHandler.h"
|
#include "nsISizeOfHandler.h"
|
||||||
#include "nsIStyleContext.h"
|
#include "nsIStyleContext.h"
|
||||||
#include "nsIMutableStyleContext.h"
|
#include "nsIMutableStyleContext.h"
|
||||||
|
@ -77,7 +77,6 @@
|
||||||
#include "nsIPrivateDOMEvent.h"
|
#include "nsIPrivateDOMEvent.h"
|
||||||
#include "nsDOMCID.h"
|
#include "nsDOMCID.h"
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
#include "nsIDOMScriptObjectFactory.h"
|
|
||||||
#include "nsIDOMCSSStyleDeclaration.h"
|
#include "nsIDOMCSSStyleDeclaration.h"
|
||||||
#include "nsDOMCSSDeclaration.h"
|
#include "nsDOMCSSDeclaration.h"
|
||||||
#include "prprf.h"
|
#include "prprf.h"
|
||||||
|
@ -108,10 +107,12 @@
|
||||||
#include "nsIHTMLContentSink.h"
|
#include "nsIHTMLContentSink.h"
|
||||||
#include "nsLayoutCID.h"
|
#include "nsLayoutCID.h"
|
||||||
#include "nsContentCID.h"
|
#include "nsContentCID.h"
|
||||||
|
|
||||||
static NS_DEFINE_CID(kPresStateCID, NS_PRESSTATE_CID);
|
static NS_DEFINE_CID(kPresStateCID, NS_PRESSTATE_CID);
|
||||||
// XXX todo: add in missing out-of-memory checks
|
// XXX todo: add in missing out-of-memory checks
|
||||||
|
|
||||||
#include "nsIPref.h" // Used by the temp pref, should be removed!
|
#include "nsIPref.h" // Used by the temp pref, should be removed!
|
||||||
|
|
||||||
#include "nsIPluginHost.h"
|
#include "nsIPluginHost.h"
|
||||||
#include "nsPIPluginHost.h"
|
#include "nsPIPluginHost.h"
|
||||||
static NS_DEFINE_IID(kCPluginManagerCID, NS_PLUGINMANAGER_CID);
|
static NS_DEFINE_IID(kCPluginManagerCID, NS_PLUGINMANAGER_CID);
|
||||||
|
@ -406,6 +407,65 @@ static int gGenericHTMLElementCount = 0;
|
||||||
static nsILanguageAtomService* gLangService = nsnull;
|
static nsILanguageAtomService* gLangService = nsnull;
|
||||||
|
|
||||||
|
|
||||||
|
class nsGenericHTMLElementTearoff : public nsIDOMNSHTMLElement,
|
||||||
|
public nsIDOMElementCSSInlineStyle
|
||||||
|
{
|
||||||
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
|
nsGenericHTMLElementTearoff(nsGenericHTMLElement *aElement)
|
||||||
|
: mElement(aElement)
|
||||||
|
{
|
||||||
|
NS_INIT_REFCNT();
|
||||||
|
NS_ADDREF(mElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
~nsGenericHTMLElementTearoff()
|
||||||
|
{
|
||||||
|
NS_RELEASE(mElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_FORWARD_NSIDOMNSHTMLELEMENT(mElement->)
|
||||||
|
NS_FORWARD_NSIDOMELEMENTCSSINLINESTYLE(mElement->)
|
||||||
|
|
||||||
|
private:
|
||||||
|
nsGenericHTMLElement *mElement;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
NS_IMPL_ADDREF(nsGenericHTMLElementTearoff)
|
||||||
|
NS_IMPL_RELEASE(nsGenericHTMLElementTearoff)
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsGenericHTMLElementTearoff::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||||
|
{
|
||||||
|
NS_ENSURE_ARG_POINTER(aInstancePtr);
|
||||||
|
|
||||||
|
nsISupports *inst = nsnull;
|
||||||
|
|
||||||
|
if (aIID.Equals(NS_GET_IID(nsIDOMNSHTMLElement))) {
|
||||||
|
inst = NS_STATIC_CAST(nsIDOMNSHTMLElement *, this);
|
||||||
|
} else if (aIID.Equals(NS_GET_IID(nsIDOMElementCSSInlineStyle))) {
|
||||||
|
inst = NS_STATIC_CAST(nsIDOMElementCSSInlineStyle *, this);
|
||||||
|
} else {
|
||||||
|
return mElement->QueryInterface(aIID, aInstancePtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_ADDREF(inst);
|
||||||
|
|
||||||
|
*aInstancePtr = inst;
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// XPConnect interface list for nsGenericHTMLElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN_EXPORTED(GenericHTMLElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMElementCSSInlineStyle)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsGenericHTMLElement::nsGenericHTMLElement()
|
nsGenericHTMLElement::nsGenericHTMLElement()
|
||||||
{
|
{
|
||||||
mAttributes = nsnull;
|
mAttributes = nsnull;
|
||||||
|
@ -455,6 +515,17 @@ nsGenericHTMLElement::DOMQueryInterface(nsIDOMHTMLElement *aElement,
|
||||||
inst = NS_STATIC_CAST(nsIDOMElement *, aElement);
|
inst = NS_STATIC_CAST(nsIDOMElement *, aElement);
|
||||||
} else if (aIID.Equals(NS_GET_IID(nsIDOMHTMLElement))) {
|
} else if (aIID.Equals(NS_GET_IID(nsIDOMHTMLElement))) {
|
||||||
inst = NS_STATIC_CAST(nsIDOMHTMLElement *, aElement);
|
inst = NS_STATIC_CAST(nsIDOMHTMLElement *, aElement);
|
||||||
|
} else if (aIID.Equals(NS_GET_IID(nsIDOMNSHTMLElement))) {
|
||||||
|
inst = NS_STATIC_CAST(nsIDOMNSHTMLElement *,
|
||||||
|
new nsGenericHTMLElementTearoff(this));
|
||||||
|
NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
} else if (aIID.Equals(NS_GET_IID(nsIDOMElementCSSInlineStyle))) {
|
||||||
|
inst = NS_STATIC_CAST(nsIDOMElementCSSInlineStyle *,
|
||||||
|
new nsGenericHTMLElementTearoff(this));
|
||||||
|
NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
} else if (aIID.Equals(NS_GET_IID(nsIDOMElementCSSInlineStyle))) {
|
||||||
|
inst = new nsNode3Tearoff(this);
|
||||||
|
NS_ENSURE_TRUE(inst, NS_ERROR_OUT_OF_MEMORY);
|
||||||
} else {
|
} else {
|
||||||
return NS_NOINTERFACE;
|
return NS_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
@ -1396,8 +1467,10 @@ nsGenericHTMLElement::SetAttribute(PRInt32 aNameSpaceID,
|
||||||
mutation.mPrevAttrValue = getter_AddRefs(NS_NewAtom(strValue));
|
mutation.mPrevAttrValue = getter_AddRefs(NS_NewAtom(strValue));
|
||||||
if (!aValue.IsEmpty())
|
if (!aValue.IsEmpty())
|
||||||
mutation.mNewAttrValue = getter_AddRefs(NS_NewAtom(aValue));
|
mutation.mNewAttrValue = getter_AddRefs(NS_NewAtom(aValue));
|
||||||
mutation.mAttrChange = modification ? nsIDOMMutationEvent::MODIFICATION :
|
if (modification)
|
||||||
nsIDOMMutationEvent::ADDITION;
|
mutation.mAttrChange = nsIDOMMutationEvent::MODIFICATION;
|
||||||
|
else
|
||||||
|
mutation.mAttrChange = nsIDOMMutationEvent::ADDITION;
|
||||||
nsEventStatus status = nsEventStatus_eIgnore;
|
nsEventStatus status = nsEventStatus_eIgnore;
|
||||||
HandleDOMEvent(nsnull, &mutation, nsnull,
|
HandleDOMEvent(nsnull, &mutation, nsnull,
|
||||||
NS_EVENT_FLAG_INIT, &status);
|
NS_EVENT_FLAG_INIT, &status);
|
||||||
|
@ -2068,6 +2141,13 @@ nsGenericHTMLElement::DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) co
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
NS_IMETHODIMP_(PRBool)
|
||||||
|
nsGenericHTMLElement::IsContentOfType(PRUint32 aFlags)
|
||||||
|
{
|
||||||
|
return !(aFlags & ~(eELEMENT | eHTML));
|
||||||
|
}
|
||||||
|
|
||||||
PRUint32
|
PRUint32
|
||||||
nsGenericHTMLElement::BaseSizeOf(nsISizeOfHandler* aSizer) const
|
nsGenericHTMLElement::BaseSizeOf(nsISizeOfHandler* aSizer) const
|
||||||
{
|
{
|
||||||
|
@ -3308,15 +3388,15 @@ nsGenericHTMLLeafElement::GetChildNodes(nsIDOMNodeList** aChildNodes)
|
||||||
{
|
{
|
||||||
nsDOMSlots* slots = GetDOMSlots();
|
nsDOMSlots* slots = GetDOMSlots();
|
||||||
|
|
||||||
if (nsnull == slots->mChildNodes) {
|
if (!slots->mChildNodes) {
|
||||||
slots->mChildNodes = new nsChildContentList(nsnull);
|
slots->mChildNodes = new nsChildContentList(nsnull);
|
||||||
if (nsnull == slots->mChildNodes) {
|
if (!slots->mChildNodes) {
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
NS_ADDREF(slots->mChildNodes);
|
NS_ADDREF(slots->mChildNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
return slots->mChildNodes->QueryInterface(NS_GET_IID(nsIDOMNodeList), (void **)aChildNodes);
|
return CallQueryInterface(slots->mChildNodes, aChildNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -3674,6 +3754,12 @@ nsGenericHTMLContainerFormElement::QueryInterface(REFNSIID aIID,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP_(PRBool)
|
||||||
|
nsGenericHTMLContainerFormElement::IsContentOfType(PRUint32 aFlags)
|
||||||
|
{
|
||||||
|
return !(aFlags & ~(eELEMENT | eHTML | eHTML_FORM_CONTROL));
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGenericHTMLContainerFormElement::SetForm(nsIDOMHTMLFormElement* aForm,
|
nsGenericHTMLContainerFormElement::SetForm(nsIDOMHTMLFormElement* aForm,
|
||||||
PRBool aRemoveFromForm)
|
PRBool aRemoveFromForm)
|
||||||
|
@ -3734,40 +3820,6 @@ nsGenericHTMLContainerFormElement::GetForm(nsIDOMHTMLFormElement** aForm)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGenericHTMLContainerFormElement::GetScriptObject(nsIScriptContext* aContext,
|
|
||||||
void** aScriptObject)
|
|
||||||
{
|
|
||||||
NS_ENSURE_ARG_POINTER(aScriptObject);
|
|
||||||
|
|
||||||
if (mDOMSlots && mDOMSlots->mScriptObject) {
|
|
||||||
*aScriptObject = mDOMSlots->mScriptObject;
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult rv = nsGenericElement::GetScriptObject(aContext, aScriptObject);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
NS_ENSURE_TRUE(*aScriptObject, NS_ERROR_FAILURE);
|
|
||||||
|
|
||||||
// If there's a form associated with this control we set the form as parent
|
|
||||||
// object for this controls script object.
|
|
||||||
nsCOMPtr<nsIScriptObjectOwner> owner(do_QueryInterface(mForm));
|
|
||||||
|
|
||||||
if (owner) {
|
|
||||||
JSContext *ctx = (JSContext *)aContext->GetNativeContext();
|
|
||||||
JSObject *parent = nsnull;
|
|
||||||
|
|
||||||
rv = owner->GetScriptObject(aContext, (void **)&parent);
|
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv) && parent) {
|
|
||||||
::JS_SetParent(ctx, (JSObject *)*aScriptObject, parent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGenericHTMLContainerFormElement::SetParent(nsIContent* aParent)
|
nsGenericHTMLContainerFormElement::SetParent(nsIContent* aParent)
|
||||||
{
|
{
|
||||||
|
@ -3927,6 +3979,12 @@ nsGenericHTMLLeafFormElement::QueryInterface(REFNSIID aIID,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP_(PRBool)
|
||||||
|
nsGenericHTMLLeafFormElement::IsContentOfType(PRUint32 aFlags)
|
||||||
|
{
|
||||||
|
return !(aFlags & ~(eELEMENT | eHTML | eHTML_FORM_CONTROL));
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGenericHTMLLeafFormElement::SetForm(nsIDOMHTMLFormElement* aForm,
|
nsGenericHTMLLeafFormElement::SetForm(nsIDOMHTMLFormElement* aForm,
|
||||||
PRBool aRemoveFromForm)
|
PRBool aRemoveFromForm)
|
||||||
|
@ -4031,40 +4089,6 @@ nsGenericHTMLLeafFormElement::SetDocument(nsIDocument* aDocument,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsGenericHTMLLeafFormElement::GetScriptObject(nsIScriptContext* aContext,
|
|
||||||
void** aScriptObject)
|
|
||||||
{
|
|
||||||
NS_ENSURE_ARG_POINTER(aScriptObject);
|
|
||||||
|
|
||||||
if (mDOMSlots && mDOMSlots->mScriptObject) {
|
|
||||||
*aScriptObject = mDOMSlots->mScriptObject;
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult rv = nsGenericElement::GetScriptObject(aContext, aScriptObject);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
NS_ENSURE_TRUE(*aScriptObject, NS_ERROR_FAILURE);
|
|
||||||
|
|
||||||
nsCOMPtr<nsIScriptObjectOwner> owner(do_QueryInterface(mForm));
|
|
||||||
|
|
||||||
// If there's a form associated with this control we set the form as parent
|
|
||||||
// object for this controls script object.
|
|
||||||
if (owner) {
|
|
||||||
JSContext *ctx = (JSContext *)aContext->GetNativeContext();
|
|
||||||
JSObject *parent = nsnull;
|
|
||||||
|
|
||||||
rv = owner->GetScriptObject(aContext, (void **)&parent);
|
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv) && parent) {
|
|
||||||
::JS_SetParent(ctx, (JSObject *)*aScriptObject, parent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsGenericHTMLLeafFormElement::SetAttribute(PRInt32 aNameSpaceID,
|
nsGenericHTMLLeafFormElement::SetAttribute(PRInt32 aNameSpaceID,
|
||||||
nsIAtom* aName,
|
nsIAtom* aName,
|
||||||
|
@ -4091,6 +4115,7 @@ nsGenericHTMLElement::SetElementFocus(PRBool aDoFocus)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0 // XXX
|
||||||
nsresult
|
nsresult
|
||||||
nsGenericHTMLElement::GetPluginInstance(nsIPluginInstance** aPluginInstance)
|
nsGenericHTMLElement::GetPluginInstance(nsIPluginInstance** aPluginInstance)
|
||||||
{
|
{
|
||||||
|
@ -4296,3 +4321,4 @@ nsGenericHTMLElement::GetPluginProperty(JSContext *aContext, JSObject *aObj,
|
||||||
}
|
}
|
||||||
return nsGenericElement::GetProperty(aContext, aObj, aID, aVp);
|
return nsGenericElement::GetProperty(aContext, aObj, aID, aVp);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -28,13 +28,11 @@
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsHTMLValue.h"
|
#include "nsHTMLValue.h"
|
||||||
#include "nsVoidArray.h"
|
#include "nsVoidArray.h"
|
||||||
#include "nsIJSScriptObject.h"
|
|
||||||
#include "nsINameSpaceManager.h" // for kNameSpaceID_HTML
|
#include "nsINameSpaceManager.h" // for kNameSpaceID_HTML
|
||||||
#include "nsIFormControl.h"
|
#include "nsIFormControl.h"
|
||||||
|
|
||||||
#include "nsIStatefulFrame.h"
|
#include "nsIStatefulFrame.h"
|
||||||
|
|
||||||
|
|
||||||
class nsIDOMAttr;
|
class nsIDOMAttr;
|
||||||
class nsIDOMEventListener;
|
class nsIDOMEventListener;
|
||||||
class nsIDOMNodeList;
|
class nsIDOMNodeList;
|
||||||
|
@ -46,7 +44,6 @@ class nsIHTMLContent;
|
||||||
class nsIMutableStyleContext;
|
class nsIMutableStyleContext;
|
||||||
class nsIStyleRule;
|
class nsIStyleRule;
|
||||||
class nsISupportsArray;
|
class nsISupportsArray;
|
||||||
class nsIDOMScriptObjectFactory;
|
|
||||||
class nsChildContentList;
|
class nsChildContentList;
|
||||||
class nsDOMCSSDeclaration;
|
class nsDOMCSSDeclaration;
|
||||||
class nsIDOMCSSStyleDeclaration;
|
class nsIDOMCSSStyleDeclaration;
|
||||||
|
@ -56,6 +53,8 @@ class nsIForm;
|
||||||
class nsIPresState;
|
class nsIPresState;
|
||||||
class nsIPluginInstance;
|
class nsIPluginInstance;
|
||||||
|
|
||||||
|
extern void GetGenericHTMLElementIIDs(nsVoidArray& aArray);
|
||||||
|
|
||||||
class nsGenericHTMLElement : public nsGenericElement {
|
class nsGenericHTMLElement : public nsGenericElement {
|
||||||
public:
|
public:
|
||||||
nsGenericHTMLElement();
|
nsGenericHTMLElement();
|
||||||
|
@ -63,8 +62,8 @@ public:
|
||||||
|
|
||||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||||
|
|
||||||
static nsresult DOMQueryInterface(nsIDOMHTMLElement *aElement,
|
nsresult DOMQueryInterface(nsIDOMHTMLElement *aElement, REFNSIID aIID,
|
||||||
REFNSIID aIID, void **aInstancePtr);
|
void **aInstancePtr);
|
||||||
|
|
||||||
NS_METHOD CopyInnerTo(nsIContent* aSrcContent,
|
NS_METHOD CopyInnerTo(nsIContent* aSrcContent,
|
||||||
nsGenericHTMLElement* aDest,
|
nsGenericHTMLElement* aDest,
|
||||||
|
@ -137,6 +136,7 @@ public:
|
||||||
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const;
|
NS_IMETHOD GetAttributeCount(PRInt32& aResult) const;
|
||||||
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
NS_IMETHOD List(FILE* out, PRInt32 aIndent) const;
|
||||||
NS_IMETHOD DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const;
|
NS_IMETHOD DumpContent(FILE* out, PRInt32 aIndent,PRBool aDumpAll) const;
|
||||||
|
NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags);
|
||||||
|
|
||||||
nsresult HandleDOMEventForAnchors(nsIContent* aOuter,
|
nsresult HandleDOMEventForAnchors(nsIContent* aOuter,
|
||||||
nsIPresContext* aPresContext,
|
nsIPresContext* aPresContext,
|
||||||
|
@ -349,16 +349,10 @@ public:
|
||||||
protected:
|
protected:
|
||||||
nsresult SetElementFocus(PRBool aDoFocus);
|
nsresult SetElementFocus(PRBool aDoFocus);
|
||||||
|
|
||||||
nsresult GetPluginInstance(nsIPluginInstance** aPluginInstance);
|
|
||||||
|
|
||||||
nsresult GetPluginScriptObject(nsIScriptContext* aContext,
|
|
||||||
void** aScriptObject);
|
|
||||||
PRBool GetPluginProperty(JSContext *aContext, JSObject *aObj, jsval aID,
|
|
||||||
jsval *aVp);
|
|
||||||
|
|
||||||
PRBool IsEventName(nsIAtom* aName);
|
PRBool IsEventName(nsIAtom* aName);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
class nsGenericHTMLLeafElement : public nsGenericHTMLElement {
|
class nsGenericHTMLLeafElement : public nsGenericHTMLElement {
|
||||||
|
@ -501,6 +495,8 @@ public:
|
||||||
|
|
||||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||||
|
|
||||||
|
NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags);
|
||||||
|
|
||||||
// nsIFormControl
|
// nsIFormControl
|
||||||
NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm);
|
NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm);
|
||||||
NS_IMETHOD SetForm(nsIDOMHTMLFormElement* aForm,
|
NS_IMETHOD SetForm(nsIDOMHTMLFormElement* aForm,
|
||||||
|
@ -519,8 +515,6 @@ public:
|
||||||
return nsGenericHTMLElement::SetAttribute(aName, aValue);
|
return nsGenericHTMLElement::SetAttribute(aName, aValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsIForm* mForm;
|
nsIForm* mForm;
|
||||||
};
|
};
|
||||||
|
@ -536,6 +530,8 @@ public:
|
||||||
|
|
||||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||||
|
|
||||||
|
NS_IMETHOD_(PRBool) IsContentOfType(PRUint32 aFlags);
|
||||||
|
|
||||||
// nsIFormControl
|
// nsIFormControl
|
||||||
NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm);
|
NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm);
|
||||||
NS_IMETHOD SetForm(nsIDOMHTMLFormElement* aForm,
|
NS_IMETHOD SetForm(nsIDOMHTMLFormElement* aForm,
|
||||||
|
@ -553,7 +549,6 @@ public:
|
||||||
{
|
{
|
||||||
return nsGenericHTMLElement::SetAttribute(aName, aValue);
|
return nsGenericHTMLElement::SetAttribute(aName, aValue);
|
||||||
}
|
}
|
||||||
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext, void** aScriptObject);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsIForm* mForm;
|
nsIForm* mForm;
|
||||||
|
@ -810,4 +805,45 @@ _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
|
||||||
return NS_STATIC_CAST(nsIHTMLContent *, this)->SetHTMLAttribute(nsHTMLAtoms::_atom, value, PR_TRUE); \
|
return NS_STATIC_CAST(nsIHTMLContent *, this)->SetHTMLAttribute(nsHTMLAtoms::_atom, value, PR_TRUE); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* QueryInterface() implementation helper macros
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(_class, _base) \
|
||||||
|
NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
|
||||||
|
{ \
|
||||||
|
NS_ENSURE_ARG_POINTER(aInstancePtr); \
|
||||||
|
\
|
||||||
|
*aInstancePtr = nsnull; \
|
||||||
|
\
|
||||||
|
nsresult rv; \
|
||||||
|
\
|
||||||
|
rv = _base::QueryInterface(aIID, aInstancePtr); \
|
||||||
|
\
|
||||||
|
if (NS_SUCCEEDED(rv)) \
|
||||||
|
return rv; \
|
||||||
|
\
|
||||||
|
rv = DOMQueryInterface(this, aIID, aInstancePtr); \
|
||||||
|
\
|
||||||
|
if (NS_SUCCEEDED(rv)) \
|
||||||
|
return rv; \
|
||||||
|
\
|
||||||
|
nsISupports *foundInterface = nsnull;
|
||||||
|
|
||||||
|
|
||||||
|
#define NS_HTML_CONTENT_INTERFACE_MAP_END \
|
||||||
|
{ \
|
||||||
|
return NS_NOINTERFACE; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
NS_ADDREF(foundInterface); \
|
||||||
|
\
|
||||||
|
*aInstancePtr = foundInterface; \
|
||||||
|
\
|
||||||
|
return NS_OK; \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* nsGenericHTMLElement_h___ */
|
#endif /* nsGenericHTMLElement_h___ */
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include "nsHTMLUtils.h"
|
#include "nsHTMLUtils.h"
|
||||||
#include "nsIDOMHTMLAnchorElement.h"
|
#include "nsIDOMHTMLAnchorElement.h"
|
||||||
#include "nsIDOMNSHTMLAnchorElement.h"
|
#include "nsIDOMNSHTMLAnchorElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsIHTMLDocument.h"
|
#include "nsIHTMLDocument.h"
|
||||||
|
@ -46,7 +45,6 @@
|
||||||
#include "nsIPresShell.h"
|
#include "nsIPresShell.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
#include "nsIHTMLAttributes.h"
|
#include "nsIHTMLAttributes.h"
|
||||||
#include "prprf.h"
|
|
||||||
|
|
||||||
// XXX suppress
|
// XXX suppress
|
||||||
|
|
||||||
|
@ -66,19 +64,19 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLAnchorElement
|
// nsIDOMHTMLAnchorElement
|
||||||
NS_DECL_IDOMHTMLANCHORELEMENT
|
NS_DECL_NSIDOMHTMLANCHORELEMENT
|
||||||
|
|
||||||
// nsIDOMNSHTMLAnchorElement
|
// nsIDOMNSHTMLAnchorElement
|
||||||
NS_DECL_IDOMNSHTMLANCHORELEMENT
|
NS_DECL_NSIDOMNSHTMLANCHORELEMENT
|
||||||
|
|
||||||
// nsILink
|
// nsILink
|
||||||
NS_IMETHOD GetLinkState(nsLinkState &aState);
|
NS_IMETHOD GetLinkState(nsLinkState &aState);
|
||||||
|
@ -102,8 +100,10 @@ protected:
|
||||||
|
|
||||||
// The cached visited state
|
// The cached visited state
|
||||||
nsLinkState mLinkState;
|
nsLinkState mLinkState;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
NS_NewHTMLAnchorElement(nsIHTMLContent** aInstancePtrResult,
|
NS_NewHTMLAnchorElement(nsIHTMLContent** aInstancePtrResult,
|
||||||
nsINodeInfo *aNodeInfo)
|
nsINodeInfo *aNodeInfo)
|
||||||
|
@ -145,9 +145,23 @@ nsHTMLAnchorElement::~nsHTMLAnchorElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLAnchorElement, nsGenericElement)
|
NS_IMPL_ADDREF_INHERITED(nsHTMLAnchorElement, nsGenericElement)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLAnchorElement, nsGenericElement)
|
NS_IMPL_RELEASE_INHERITED(nsHTMLAnchorElement, nsGenericElement)
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI3(nsHTMLAnchorElement, nsGenericHTMLContainerElement,
|
|
||||||
nsIDOMHTMLAnchorElement, nsIDOMNSHTMLAnchorElement,
|
// XPConnect interface list for nsHTMLAnchorElement
|
||||||
nsILink)
|
NS_CLASSINFO_MAP_BEGIN(HTMLAnchorElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLAnchorElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLAnchorElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLAnchorElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLAnchorElement,
|
||||||
|
nsGenericHTMLContainerElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLAnchorElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNSHTMLAnchorElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsILink)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLAnchorElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -647,6 +661,12 @@ nsHTMLAnchorElement::GetText(nsAWritableString& aText)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsHTMLAnchorElement::ToString(nsAWritableString& aSource)
|
||||||
|
{
|
||||||
|
return GetHref(aSource);
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLAnchorElement::GetLinkState(nsLinkState &aState)
|
nsHTMLAnchorElement::GetLinkState(nsLinkState &aState)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMHTMLAppletElement.h"
|
#include "nsIDOMHTMLAppletElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -61,19 +60,16 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLAppletElement
|
// nsIDOMHTMLAppletElement
|
||||||
NS_DECL_IDOMHTMLAPPLETELEMENT
|
NS_DECL_NSIDOMHTMLAPPLETELEMENT
|
||||||
|
|
||||||
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext,
|
|
||||||
void** aScriptObject);
|
|
||||||
|
|
||||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
||||||
const nsAReadableString& aValue,
|
const nsAReadableString& aValue,
|
||||||
|
@ -130,8 +126,20 @@ nsHTMLAppletElement::~nsHTMLAppletElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLAppletElement, nsGenericElement)
|
NS_IMPL_ADDREF_INHERITED(nsHTMLAppletElement, nsGenericElement)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLAppletElement, nsGenericElement)
|
NS_IMPL_RELEASE_INHERITED(nsHTMLAppletElement, nsGenericElement)
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI(nsHTMLAppletElement, nsGenericHTMLContainerElement,
|
|
||||||
nsIDOMHTMLAppletElement)
|
// XPConnect interface list for nsHTMLAppletElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLAppletElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLAppletElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLAppletElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLAppletElement,
|
||||||
|
nsGenericHTMLContainerElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLAppletElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLAppletElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -262,6 +270,7 @@ nsHTMLAppletElement::GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapF
|
||||||
* object. That way, if the Java applet has public fields that shadow
|
* object. That way, if the Java applet has public fields that shadow
|
||||||
* the tag attributes, the applet's fields take precedence.
|
* the tag attributes, the applet's fields take precedence.
|
||||||
*/
|
*/
|
||||||
|
#if 0
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLAppletElement::GetScriptObject(nsIScriptContext* aContext,
|
nsHTMLAppletElement::GetScriptObject(nsIScriptContext* aContext,
|
||||||
void** aScriptObject)
|
void** aScriptObject)
|
||||||
|
@ -364,6 +373,7 @@ nsHTMLAppletElement::GetScriptObject(nsIScriptContext* aContext,
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLAppletElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
|
nsHTMLAppletElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMHTMLAreaElement.h"
|
#include "nsIDOMHTMLAreaElement.h"
|
||||||
#include "nsIDOMNSHTMLAreaElement.h"
|
#include "nsIDOMNSHTMLAreaElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -51,19 +50,19 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLAreaElement
|
// nsIDOMHTMLAreaElement
|
||||||
NS_DECL_IDOMHTMLAREAELEMENT
|
NS_DECL_NSIDOMHTMLAREAELEMENT
|
||||||
|
|
||||||
// nsIDOMNSHTMLAreaElement
|
// nsIDOMNSHTMLAreaElement
|
||||||
NS_DECL_IDOMNSHTMLAREAELEMENT
|
NS_DECL_NSIDOMNSHTMLAREAELEMENT
|
||||||
|
|
||||||
// nsILink
|
// nsILink
|
||||||
NS_IMETHOD GetLinkState(nsLinkState &aState);
|
NS_IMETHOD GetLinkState(nsLinkState &aState);
|
||||||
|
@ -126,9 +125,23 @@ nsHTMLAreaElement::~nsHTMLAreaElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLAreaElement, nsGenericElement)
|
NS_IMPL_ADDREF_INHERITED(nsHTMLAreaElement, nsGenericElement)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLAreaElement, nsGenericElement)
|
NS_IMPL_RELEASE_INHERITED(nsHTMLAreaElement, nsGenericElement)
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI3(nsHTMLAreaElement, nsGenericHTMLLeafElement,
|
|
||||||
nsIDOMHTMLAreaElement, nsIDOMNSHTMLAreaElement,
|
// XPConnect interface list for nsHTMLAreaElement
|
||||||
nsILink)
|
NS_CLASSINFO_MAP_BEGIN(HTMLAreaElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLAreaElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLAreaElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLAreaElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLAreaElement,
|
||||||
|
nsGenericHTMLLeafElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLAreaElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNSHTMLAreaElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsILink)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLAreaElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMHTMLBRElement.h"
|
#include "nsIDOMHTMLBRElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -44,16 +43,16 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLBRElement
|
// nsIDOMHTMLBRElement
|
||||||
NS_DECL_IDOMHTMLBRELEMENT
|
NS_DECL_NSIDOMHTMLBRELEMENT
|
||||||
|
|
||||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
||||||
const nsAReadableString& aValue,
|
const nsAReadableString& aValue,
|
||||||
|
@ -106,8 +105,20 @@ nsHTMLBRElement::~nsHTMLBRElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLBRElement, nsGenericElement)
|
NS_IMPL_ADDREF_INHERITED(nsHTMLBRElement, nsGenericElement)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLBRElement, nsGenericElement)
|
NS_IMPL_RELEASE_INHERITED(nsHTMLBRElement, nsGenericElement)
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI(nsHTMLBRElement, nsGenericHTMLLeafElement,
|
|
||||||
nsIDOMHTMLBRElement)
|
// XPConnect interface list for nsHTMLBRElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLBRElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLBRElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLBRElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLBRElement,
|
||||||
|
nsGenericHTMLLeafElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLBRElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLBRElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMHTMLBaseElement.h"
|
#include "nsIDOMHTMLBaseElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -43,16 +42,16 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLBaseElement
|
// nsIDOMHTMLBaseElement
|
||||||
NS_DECL_IDOMHTMLBASEELEMENT
|
NS_DECL_NSIDOMHTMLBASEELEMENT
|
||||||
|
|
||||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
||||||
};
|
};
|
||||||
|
@ -96,8 +95,20 @@ nsHTMLBaseElement::~nsHTMLBaseElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLBaseElement, nsGenericElement)
|
NS_IMPL_ADDREF_INHERITED(nsHTMLBaseElement, nsGenericElement)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLBaseElement, nsGenericElement)
|
NS_IMPL_RELEASE_INHERITED(nsHTMLBaseElement, nsGenericElement)
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI(nsHTMLBaseElement, nsGenericHTMLLeafElement,
|
|
||||||
nsIDOMHTMLBaseElement)
|
// XPConnect interface list for nsHTMLBaseElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLBaseElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLBaseElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLBaseElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLBaseElement,
|
||||||
|
nsGenericHTMLLeafElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLBaseElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLBaseElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMHTMLBaseFontElement.h"
|
#include "nsIDOMHTMLBaseFontElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -43,16 +42,16 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLBaseElement
|
// nsIDOMHTMLBaseElement
|
||||||
NS_DECL_IDOMHTMLBASEFONTELEMENT
|
NS_DECL_NSIDOMHTMLBASEFONTELEMENT
|
||||||
|
|
||||||
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
NS_IMETHOD GetMappedAttributeImpact(const nsIAtom* aAttribute,
|
||||||
PRInt32& aHint) const;
|
PRInt32& aHint) const;
|
||||||
|
@ -98,8 +97,20 @@ nsHTMLBaseFontElement::~nsHTMLBaseFontElement()
|
||||||
NS_IMPL_ADDREF(nsHTMLBaseFontElement)
|
NS_IMPL_ADDREF(nsHTMLBaseFontElement)
|
||||||
NS_IMPL_RELEASE(nsHTMLBaseFontElement)
|
NS_IMPL_RELEASE(nsHTMLBaseFontElement)
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI(nsHTMLBaseFontElement, nsGenericHTMLLeafElement,
|
|
||||||
nsIDOMHTMLBaseFontElement)
|
// XPConnect interface list for nsHTMLBaseFontElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLBaseFontElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLBaseFontElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLBaseFontElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLBaseFontElement,
|
||||||
|
nsGenericHTMLLeafElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLBaseFontElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLBaseFontElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
*/
|
*/
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIDOMHTMLBodyElement.h"
|
#include "nsIDOMHTMLBodyElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -188,16 +187,16 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLBodyElement
|
// nsIDOMHTMLBodyElement
|
||||||
NS_DECL_IDOMHTMLBODYELEMENT
|
NS_DECL_NSIDOMHTMLBODYELEMENT
|
||||||
|
|
||||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
||||||
const nsAReadableString& aValue,
|
const nsAReadableString& aValue,
|
||||||
|
@ -744,8 +743,20 @@ nsHTMLBodyElement::~nsHTMLBodyElement()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI(nsHTMLBodyElement, nsGenericHTMLContainerElement,
|
|
||||||
nsIDOMHTMLBodyElement)
|
// XPConnect interface list for nsHTMLBodyElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLBodyElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLBodyElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLBodyElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLBodyElement,
|
||||||
|
nsGenericHTMLContainerElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLBodyElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLBodyElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include "nsIDOMHTMLButtonElement.h"
|
#include "nsIDOMHTMLButtonElement.h"
|
||||||
#include "nsIDOMNSHTMLButtonElement.h"
|
#include "nsIDOMNSHTMLButtonElement.h"
|
||||||
#include "nsIDOMHTMLFormElement.h"
|
#include "nsIDOMHTMLFormElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -55,19 +54,19 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerFormElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLContainerFormElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerFormElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLContainerFormElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLButtonElement
|
// nsIDOMHTMLButtonElement
|
||||||
NS_DECL_IDOMHTMLBUTTONELEMENT
|
NS_DECL_NSIDOMHTMLBUTTONELEMENT
|
||||||
|
|
||||||
// nsIDOMNSHTMLButtonElement
|
// nsIDOMNSHTMLButtonElement
|
||||||
NS_DECL_IDOMNSHTMLBUTTONELEMENT
|
NS_DECL_NSIDOMNSHTMLBUTTONELEMENT
|
||||||
|
|
||||||
// overrided nsIFormControl method
|
// overrided nsIFormControl method
|
||||||
NS_IMETHOD GetType(PRInt32* aType);
|
NS_IMETHOD GetType(PRInt32* aType);
|
||||||
|
@ -142,8 +141,22 @@ nsHTMLButtonElement::~nsHTMLButtonElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLButtonElement, nsGenericElement);
|
NS_IMPL_ADDREF_INHERITED(nsHTMLButtonElement, nsGenericElement);
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLButtonElement, nsGenericElement);
|
NS_IMPL_RELEASE_INHERITED(nsHTMLButtonElement, nsGenericElement);
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI2(nsHTMLButtonElement, nsGenericHTMLContainerFormElement,
|
|
||||||
nsIDOMHTMLButtonElement, nsIDOMNSHTMLButtonElement);
|
// XPConnect interface list for nsHTMLButtonElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLButtonElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLButtonElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLButtonElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLButtonElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLButtonElement,
|
||||||
|
nsGenericHTMLContainerFormElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLButtonElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNSHTMLButtonElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLButtonElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMHTMLDListElement.h"
|
#include "nsIDOMHTMLDListElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -44,13 +43,13 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLDListElement
|
// nsIDOMHTMLDListElement
|
||||||
NS_IMETHOD GetCompact(PRBool* aCompact);
|
NS_IMETHOD GetCompact(PRBool* aCompact);
|
||||||
|
@ -105,8 +104,20 @@ nsHTMLDListElement::~nsHTMLDListElement()
|
||||||
NS_IMPL_ADDREF(nsHTMLDListElement);
|
NS_IMPL_ADDREF(nsHTMLDListElement);
|
||||||
NS_IMPL_RELEASE(nsHTMLDListElement);
|
NS_IMPL_RELEASE(nsHTMLDListElement);
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI(nsHTMLDListElement, nsGenericHTMLContainerElement,
|
|
||||||
nsIDOMHTMLDListElement);
|
// XPConnect interface list for nsHTMLDListElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLDListElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLDListElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLDListElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLDListElement,
|
||||||
|
nsGenericHTMLContainerElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLDListElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLDListElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMHTMLModElement.h"
|
#include "nsIDOMHTMLModElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -43,16 +42,16 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLModElement
|
// nsIDOMHTMLModElement
|
||||||
NS_DECL_IDOMHTMLMODELEMENT
|
NS_DECL_NSIDOMHTMLMODELEMENT
|
||||||
|
|
||||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
||||||
};
|
};
|
||||||
|
@ -96,8 +95,20 @@ nsHTMLDelElement::~nsHTMLDelElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLDelElement, nsGenericElement);
|
NS_IMPL_ADDREF_INHERITED(nsHTMLDelElement, nsGenericElement);
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLDelElement, nsGenericElement);
|
NS_IMPL_RELEASE_INHERITED(nsHTMLDelElement, nsGenericElement);
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI(nsHTMLDelElement, nsGenericHTMLContainerElement,
|
|
||||||
nsIDOMHTMLModElement);
|
// XPConnect interface list for nsHTMLDelElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLDelElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLModElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLDelElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLDelElement,
|
||||||
|
nsGenericHTMLContainerElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLModElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLDelElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMHTMLDirectoryElement.h"
|
#include "nsIDOMHTMLDirectoryElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -48,16 +47,16 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLDirectoryElement
|
// nsIDOMHTMLDirectoryElement
|
||||||
NS_DECL_IDOMHTMLDIRECTORYELEMENT
|
NS_DECL_NSIDOMHTMLDIRECTORYELEMENT
|
||||||
|
|
||||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
||||||
const nsAReadableString& aValue,
|
const nsAReadableString& aValue,
|
||||||
|
@ -110,8 +109,20 @@ nsHTMLDirectoryElement::~nsHTMLDirectoryElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLDirectoryElement, nsGenericElement);
|
NS_IMPL_ADDREF_INHERITED(nsHTMLDirectoryElement, nsGenericElement);
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLDirectoryElement, nsGenericElement);
|
NS_IMPL_RELEASE_INHERITED(nsHTMLDirectoryElement, nsGenericElement);
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI(nsHTMLDirectoryElement, nsGenericHTMLContainerElement,
|
|
||||||
nsIDOMHTMLDirectoryElement);
|
// XPConnect interface list for nsHTMLDirectoryElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLDirectoryElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLDirectoryElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLDirectoryElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLDirectoryElement,
|
||||||
|
nsGenericHTMLContainerElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLDirectoryElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLDirectoryElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMHTMLDivElement.h"
|
#include "nsIDOMHTMLDivElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -46,16 +45,16 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLDivElement
|
// nsIDOMHTMLDivElement
|
||||||
NS_DECL_IDOMHTMLDIVELEMENT
|
NS_DECL_NSIDOMHTMLDIVELEMENT
|
||||||
|
|
||||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
||||||
const nsAReadableString& aValue,
|
const nsAReadableString& aValue,
|
||||||
|
@ -110,8 +109,20 @@ NS_IMPL_ADDREF_INHERITED(nsHTMLDivElement, nsGenericElement)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLDivElement, nsGenericElement)
|
NS_IMPL_RELEASE_INHERITED(nsHTMLDivElement, nsGenericElement)
|
||||||
|
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI(nsHTMLDivElement, nsGenericHTMLContainerElement,
|
|
||||||
nsIDOMHTMLDivElement)
|
// XPConnect interface list for nsHTMLDivElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLDivElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLDivElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLDivElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLDivElement,
|
||||||
|
nsGenericHTMLContainerElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLDivElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLDivElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -37,16 +37,16 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLEmbedElement
|
// nsIDOMHTMLEmbedElement
|
||||||
NS_DECL_IDOMHTMLEMBEDELEMENT
|
NS_DECL_NSIDOMHTMLEMBEDELEMENT
|
||||||
|
|
||||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
||||||
const nsAReadableString& aValue,
|
const nsAReadableString& aValue,
|
||||||
|
@ -59,14 +59,6 @@ public:
|
||||||
NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
|
NS_IMETHOD GetAttributeMappingFunctions(nsMapAttributesFunc& aFontMapFunc,
|
||||||
nsMapAttributesFunc& aMapFunc) const;
|
nsMapAttributesFunc& aMapFunc) const;
|
||||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
||||||
|
|
||||||
// nsIScriptObjectOwner
|
|
||||||
NS_IMETHOD GetScriptObject(nsIScriptContext* aContext,
|
|
||||||
void** aScriptObject);
|
|
||||||
|
|
||||||
// nsIJSScriptObject
|
|
||||||
virtual PRBool GetProperty(JSContext *aContext, JSObject *aObj,
|
|
||||||
jsval aID, jsval *aVp);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -107,8 +99,20 @@ nsHTMLEmbedElement::~nsHTMLEmbedElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLEmbedElement, nsGenericElement);
|
NS_IMPL_ADDREF_INHERITED(nsHTMLEmbedElement, nsGenericElement);
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLEmbedElement, nsGenericElement);
|
NS_IMPL_RELEASE_INHERITED(nsHTMLEmbedElement, nsGenericElement);
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI(nsHTMLEmbedElement, nsGenericHTMLLeafElement,
|
|
||||||
nsIDOMHTMLEmbedElement);
|
// XPConnect interface list for nsHTMLEmbedElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLEmbedElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLEmbedElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLEmbedElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLEmbedElement,
|
||||||
|
nsGenericHTMLLeafElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLEmbedElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLEmbedElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -228,6 +232,7 @@ nsHTMLEmbedElement::SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const
|
||||||
|
|
||||||
/***************************************************************************/
|
/***************************************************************************/
|
||||||
|
|
||||||
|
#if 0
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLEmbedElement::GetScriptObject(nsIScriptContext* aContext,
|
nsHTMLEmbedElement::GetScriptObject(nsIScriptContext* aContext,
|
||||||
void** aScriptObject)
|
void** aScriptObject)
|
||||||
|
@ -241,6 +246,7 @@ nsHTMLEmbedElement::GetProperty(JSContext *aContext, JSObject *aObj,
|
||||||
{
|
{
|
||||||
return GetPluginProperty(aContext, aObj, aID, aVp);
|
return GetPluginProperty(aContext, aObj, aID, aVp);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/////////////////////////////////////////////
|
/////////////////////////////////////////////
|
||||||
// Implement nsIDOMHTMLEmbedElement interface
|
// Implement nsIDOMHTMLEmbedElement interface
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMHTMLFieldSetElement.h"
|
#include "nsIDOMHTMLFieldSetElement.h"
|
||||||
#include "nsIDOMHTMLFormElement.h"
|
#include "nsIDOMHTMLFormElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -47,13 +46,13 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerFormElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLContainerFormElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerFormElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLContainerFormElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerFormElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerFormElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLFieldSetElement
|
// nsIDOMHTMLFieldSetElement
|
||||||
NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm);
|
NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm);
|
||||||
|
@ -108,9 +107,20 @@ nsHTMLFieldSetElement::~nsHTMLFieldSetElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLFieldSetElement, nsGenericElement);
|
NS_IMPL_ADDREF_INHERITED(nsHTMLFieldSetElement, nsGenericElement);
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLFieldSetElement, nsGenericElement);
|
NS_IMPL_RELEASE_INHERITED(nsHTMLFieldSetElement, nsGenericElement);
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI(nsHTMLFieldSetElement,
|
|
||||||
nsGenericHTMLContainerFormElement,
|
// XPConnect interface list for nsHTMLFieldSetElement
|
||||||
nsIDOMHTMLFieldSetElement);
|
NS_CLASSINFO_MAP_BEGIN(HTMLFieldSetElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLFieldSetElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLFieldSetElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLFieldSetElement,
|
||||||
|
nsGenericHTMLContainerFormElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLFieldSetElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLFieldSetElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
// nsIDOMHTMLFieldSetElement
|
// nsIDOMHTMLFieldSetElement
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
*/
|
*/
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsIDOMHTMLFontElement.h"
|
#include "nsIDOMHTMLFontElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -51,16 +50,16 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLFontElement
|
// nsIDOMHTMLFontElement
|
||||||
NS_DECL_IDOMHTMLFONTELEMENT
|
NS_DECL_NSIDOMHTMLFONTELEMENT
|
||||||
|
|
||||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
||||||
const nsAReadableString& aValue,
|
const nsAReadableString& aValue,
|
||||||
|
@ -113,8 +112,20 @@ nsHTMLFontElement::~nsHTMLFontElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLFontElement, nsGenericElement);
|
NS_IMPL_ADDREF_INHERITED(nsHTMLFontElement, nsGenericElement);
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLFontElement, nsGenericElement);
|
NS_IMPL_RELEASE_INHERITED(nsHTMLFontElement, nsGenericElement);
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI(nsHTMLFontElement, nsGenericHTMLContainerElement,
|
|
||||||
nsIDOMHTMLFontElement);
|
// XPConnect interface list for nsHTMLFontElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLFontElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLFontElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLFontElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLFontElement,
|
||||||
|
nsGenericHTMLContainerElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLFontElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLFontElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -25,9 +25,8 @@
|
||||||
#include "nsIFormManager.h"
|
#include "nsIFormManager.h"
|
||||||
#include "nsIDOMHTMLFormElement.h"
|
#include "nsIDOMHTMLFormElement.h"
|
||||||
#include "nsIDOMNSHTMLFormElement.h"
|
#include "nsIDOMNSHTMLFormElement.h"
|
||||||
#include "nsIDOMHTMLFormControlList.h"
|
|
||||||
#include "nsIHTMLDocument.h"
|
#include "nsIHTMLDocument.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
#include "nsIDOMNSHTMLFormControlList.h"
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -67,22 +66,19 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLFormElement
|
// nsIDOMHTMLFormElement
|
||||||
NS_DECL_IDOMHTMLFORMELEMENT
|
NS_DECL_NSIDOMHTMLFORMELEMENT
|
||||||
|
|
||||||
// nsIDOMNSHTMLFormElement
|
// nsIDOMNSHTMLFormElement
|
||||||
NS_DECL_IDOMNSHTMLFORMELEMENT
|
NS_DECL_NSIDOMNSHTMLFORMELEMENT
|
||||||
|
|
||||||
virtual PRBool Resolve(JSContext *aContext, JSObject *aObj, jsval aID,
|
|
||||||
PRBool *aDidDefineProperty);
|
|
||||||
|
|
||||||
// nsIForm
|
// nsIForm
|
||||||
NS_IMETHOD AddElement(nsIFormControl* aElement);
|
NS_IMETHOD AddElement(nsIFormControl* aElement);
|
||||||
|
@ -93,8 +89,11 @@ public:
|
||||||
NS_IMETHOD RemoveElement(nsIFormControl* aElement);
|
NS_IMETHOD RemoveElement(nsIFormControl* aElement);
|
||||||
NS_IMETHOD RemoveElementFromTable(nsIFormControl* aElement,
|
NS_IMETHOD RemoveElementFromTable(nsIFormControl* aElement,
|
||||||
const nsAReadableString& aName);
|
const nsAReadableString& aName);
|
||||||
|
NS_IMETHOD ResolveName(const nsAReadableString& aName,
|
||||||
|
nsISupports **aReturn);
|
||||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
||||||
|
|
||||||
|
// nsIContent
|
||||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
||||||
const nsAReadableString& aValue,
|
const nsAReadableString& aValue,
|
||||||
nsHTMLValue& aResult);
|
nsHTMLValue& aResult);
|
||||||
|
@ -116,8 +115,8 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
// nsFormControlList
|
// nsFormControlList
|
||||||
class nsFormControlList : public nsIDOMHTMLFormControlList,
|
class nsFormControlList : public nsIDOMNSHTMLFormControlList,
|
||||||
public nsIScriptObjectOwner
|
public nsIDOMHTMLCollection
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsFormControlList(nsIDOMHTMLFormElement* aForm);
|
nsFormControlList(nsIDOMHTMLFormElement* aForm);
|
||||||
|
@ -128,15 +127,14 @@ public:
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
NS_IMETHOD GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
|
|
||||||
NS_IMETHOD SetScriptObject(void *aScriptObject);
|
|
||||||
NS_IMETHOD ResetScriptObject();
|
|
||||||
|
|
||||||
// nsIDOMHTMLCollection interface
|
// nsIDOMHTMLCollection interface
|
||||||
NS_DECL_IDOMHTMLCOLLECTION
|
NS_DECL_NSIDOMHTMLCOLLECTION
|
||||||
NS_DECL_IDOMHTMLFORMCONTROLLIST
|
|
||||||
|
|
||||||
nsresult GetNamedObject(JSContext* aContext, jsval aID, JSObject** aObj);
|
// nsIDOMNSHTMLFormControlList interface
|
||||||
|
NS_DECL_NSIDOMNSHTMLFORMCONTROLLIST
|
||||||
|
|
||||||
|
nsresult GetNamedObject(const nsAReadableString& aName,
|
||||||
|
nsISupports **aResult);
|
||||||
|
|
||||||
nsresult AddElementToTable(nsIFormControl* aChild,
|
nsresult AddElementToTable(nsIFormControl* aChild,
|
||||||
const nsAReadableString& aName);
|
const nsAReadableString& aName);
|
||||||
|
@ -147,7 +145,6 @@ public:
|
||||||
nsresult SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
nsresult SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void *mScriptObject;
|
|
||||||
nsIDOMHTMLFormElement* mForm; // WEAK - the form owns me
|
nsIDOMHTMLFormElement* mForm; // WEAK - the form owns me
|
||||||
|
|
||||||
nsVoidArray mElements; // Holds WEAK references - bug 36639
|
nsVoidArray mElements; // Holds WEAK references - bug 36639
|
||||||
|
@ -246,6 +243,7 @@ nsHTMLFormElement::nsHTMLFormElement():
|
||||||
mGeneratingReset(PR_FALSE)
|
mGeneratingReset(PR_FALSE)
|
||||||
{
|
{
|
||||||
mControls = new nsFormControlList(this);
|
mControls = new nsFormControlList(this);
|
||||||
|
|
||||||
NS_IF_ADDREF(mControls);
|
NS_IF_ADDREF(mControls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,9 +265,23 @@ nsHTMLFormElement::~nsHTMLFormElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLFormElement, nsGenericElement)
|
NS_IMPL_ADDREF_INHERITED(nsHTMLFormElement, nsGenericElement)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLFormElement, nsGenericElement)
|
NS_IMPL_RELEASE_INHERITED(nsHTMLFormElement, nsGenericElement)
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI3(nsHTMLFormElement, nsGenericHTMLContainerElement,
|
|
||||||
nsIDOMHTMLFormElement, nsIDOMNSHTMLFormElement,
|
// XPConnect interface list for nsHTMLFormElement
|
||||||
nsIForm)
|
NS_CLASSINFO_MAP_BEGIN(HTMLFormElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLFormElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLFormElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLFormElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLFormElement,
|
||||||
|
nsGenericHTMLContainerElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLFormElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNSHTMLFormElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIForm)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLFormElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
// nsIDOMHTMLFormElement
|
// nsIDOMHTMLFormElement
|
||||||
|
@ -582,7 +594,7 @@ nsHTMLFormElement::RemoveElement(nsIFormControl* aChild)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLFormElement::RemoveElementFromTable(nsIFormControl* aElement,
|
nsHTMLFormElement::RemoveElementFromTable(nsIFormControl* aElement,
|
||||||
const nsAReadableString& aName)
|
const nsAReadableString& aName)
|
||||||
{
|
{
|
||||||
|
@ -591,12 +603,24 @@ nsHTMLFormElement::RemoveElementFromTable(nsIFormControl* aElement,
|
||||||
return mControls->RemoveElementFromTable(aElement, aName);
|
return mControls->RemoveElementFromTable(aElement, aName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsHTMLFormElement::ResolveName(const nsAReadableString& aName,
|
||||||
|
nsISupports **aResult)
|
||||||
|
{
|
||||||
|
return mControls->GetNamedObject(aName, aResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLFormElement::GetEncoding(nsAWritableString& aEncoding)
|
nsHTMLFormElement::GetEncoding(nsAWritableString& aEncoding)
|
||||||
{
|
{
|
||||||
return nsGenericHTMLContainerElement::GetAttribute(kNameSpaceID_HTML,
|
return GetEnctype(aEncoding);
|
||||||
nsHTMLAtoms::enctype,
|
}
|
||||||
aEncoding);
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsHTMLFormElement::SetEncoding(const nsAReadableString& aEncoding)
|
||||||
|
{
|
||||||
|
return SetEnctype(aEncoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -607,156 +631,13 @@ nsHTMLFormElement::GetLength(PRInt32* aLength)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsHTMLFormElement::NamedItem(JSContext* cx, jsval* argv, PRUint32 argc,
|
|
||||||
jsval* aReturn)
|
|
||||||
{
|
|
||||||
nsresult result = mControls->NamedItem(cx, argv, argc, aReturn);
|
|
||||||
if (NS_FAILED(result)) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we couldn't find it in our controls list, it may be
|
|
||||||
// a different type of element (IMG, OBJECT, etc.)
|
|
||||||
if (!*aReturn && mDocument && (argc > 0)) {
|
|
||||||
PRUnichar* str = NS_REINTERPRET_CAST(PRUnichar *, JS_GetStringChars(JS_ValueToString(cx, argv[0])));
|
|
||||||
|
|
||||||
nsCOMPtr<nsIScriptContext> scriptContext;
|
|
||||||
nsCOMPtr<nsIScriptGlobalObject> globalObject;
|
|
||||||
|
|
||||||
mDocument->GetScriptGlobalObject(getter_AddRefs(globalObject));
|
|
||||||
|
|
||||||
if (globalObject) {
|
|
||||||
result = globalObject->GetContext(getter_AddRefs(scriptContext));
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIHTMLDocument> html_doc(do_QueryInterface(mDocument));
|
|
||||||
|
|
||||||
if (html_doc) {
|
|
||||||
nsCOMPtr<nsISupports> item;
|
|
||||||
|
|
||||||
result = html_doc->ResolveName(nsLiteralString(str), this,
|
|
||||||
getter_AddRefs(item));
|
|
||||||
if (NS_FAILED(result)) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIScriptObjectOwner> owner(do_QueryInterface(item));
|
|
||||||
|
|
||||||
if (owner) {
|
|
||||||
JSObject* obj;
|
|
||||||
|
|
||||||
result = owner->GetScriptObject(scriptContext, (void**)&obj);
|
|
||||||
if (NS_FAILED(result)) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
*aReturn = OBJECT_TO_JSVAL(obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool
|
|
||||||
nsHTMLFormElement::Resolve(JSContext *aContext, JSObject *aObj, jsval aID,
|
|
||||||
PRBool *aDidDefineProperty)
|
|
||||||
{
|
|
||||||
if (!JSVAL_IS_STRING(aID)) {
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool ret;
|
|
||||||
JSObject* obj;
|
|
||||||
jschar* str = JS_GetStringChars(JS_ValueToString(aContext, aID));
|
|
||||||
size_t str_len = JS_GetStringLength(JS_ValueToString(aContext, aID));
|
|
||||||
nsCOMPtr<nsIScriptContext> scriptContext;
|
|
||||||
nsresult rv = NS_OK;
|
|
||||||
|
|
||||||
rv = nsContentUtils::GetStaticScriptContext(aContext, aObj,
|
|
||||||
getter_AddRefs(scriptContext));
|
|
||||||
|
|
||||||
// If we can't get a script context, there's nothing we can do
|
|
||||||
if (!scriptContext || NS_FAILED(rv)) {
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
rv = mControls->GetNamedObject(aContext, aID, &obj);
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!obj && mDocument) {
|
|
||||||
nsCOMPtr<nsIHTMLDocument> html_doc(do_QueryInterface(mDocument));
|
|
||||||
|
|
||||||
if (html_doc) {
|
|
||||||
nsCOMPtr<nsISupports> item;
|
|
||||||
|
|
||||||
nsLiteralString name(NS_REINTERPRET_CAST(PRUnichar *, str), str_len);
|
|
||||||
|
|
||||||
rv = html_doc->ResolveName(name, this, getter_AddRefs(item));
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIScriptObjectOwner> owner(do_QueryInterface(item));
|
|
||||||
|
|
||||||
if (owner) {
|
|
||||||
rv = owner->GetScriptObject(scriptContext, (void**)&obj);
|
|
||||||
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (obj) {
|
|
||||||
JSObject* myObj;
|
|
||||||
rv = GetScriptObject(scriptContext, (void**)&myObj);
|
|
||||||
ret = ::JS_DefineUCProperty(aContext, myObj,
|
|
||||||
str, str_len, OBJECT_TO_JSVAL(obj),
|
|
||||||
nsnull, nsnull, 0);
|
|
||||||
|
|
||||||
*aDidDefineProperty = PR_TRUE;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ret = nsGenericHTMLContainerElement::Resolve(aContext, aObj, aID,
|
|
||||||
aDidDefineProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsHTMLFormElement::Item(PRUint32 aIndex, nsIDOMElement** aReturn)
|
|
||||||
{
|
|
||||||
if (mControls) {
|
|
||||||
nsCOMPtr<nsIDOMNode> node;
|
|
||||||
nsresult result = mControls->Item(aIndex, getter_AddRefs(node));
|
|
||||||
|
|
||||||
if (node) {
|
|
||||||
result = CallQueryInterface(node, aReturn);
|
|
||||||
} else {
|
|
||||||
*aReturn = nsnull;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
|
||||||
// nsFormControlList implementation, this could go away if there were
|
// nsFormControlList implementation, this could go away if there were
|
||||||
// a lightweight collection implementation somewhere
|
// a lightweight collection implementation somewhere
|
||||||
|
|
||||||
nsFormControlList::nsFormControlList(nsIDOMHTMLFormElement* aForm)
|
nsFormControlList::nsFormControlList(nsIDOMHTMLFormElement* aForm)
|
||||||
: mScriptObject(nsnull), mForm(aForm),
|
: mForm(aForm), mNameLookupTable(NS_FORM_CONTROL_LIST_HASHTABLE_SIZE),
|
||||||
mNameLookupTable(NS_FORM_CONTROL_LIST_HASHTABLE_SIZE),
|
|
||||||
mNoNameLookupTable(nsnull)
|
mNoNameLookupTable(nsnull)
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
|
@ -771,13 +652,6 @@ nsFormControlList::~nsFormControlList()
|
||||||
Clear();
|
Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFormControlList::SetScriptObject(void *aScriptObject)
|
|
||||||
{
|
|
||||||
mScriptObject = aScriptObject;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
nsFormControlList::SetForm(nsIDOMHTMLFormElement* aForm)
|
nsFormControlList::SetForm(nsIDOMHTMLFormElement* aForm)
|
||||||
{
|
{
|
||||||
|
@ -818,36 +692,26 @@ nsFormControlList::Clear()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsFormControlList)
|
|
||||||
NS_IMPL_RELEASE(nsFormControlList)
|
|
||||||
|
|
||||||
|
// XPConnect interface list for nsFormControlList
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLFormControlCollection)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLFormControlList)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLCollection)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// XPConnect interface list for nsFormControlList
|
||||||
NS_INTERFACE_MAP_BEGIN(nsFormControlList)
|
NS_INTERFACE_MAP_BEGIN(nsFormControlList)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNSHTMLFormControlList)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLCollection)
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLCollection)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLFormControlList)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectOwner)
|
|
||||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMHTMLCollection)
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMHTMLCollection)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO_WITH_NAME(HTMLFormControlCollection,
|
||||||
|
HTMLCollection)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult nsFormControlList::GetScriptObject(nsIScriptContext *aContext,
|
NS_IMPL_ADDREF(nsFormControlList)
|
||||||
void** aScriptObject)
|
NS_IMPL_RELEASE(nsFormControlList)
|
||||||
{
|
|
||||||
nsresult res = NS_OK;
|
|
||||||
|
|
||||||
if (!mScriptObject) {
|
|
||||||
res = NS_NewScriptHTMLFormControlList(aContext, (nsISupports *)(nsIDOMHTMLCollection *)this, nsnull, (void**)&mScriptObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
*aScriptObject = mScriptObject;
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult nsFormControlList::ResetScriptObject()
|
|
||||||
{
|
|
||||||
mScriptObject = nsnull;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// nsIDOMHTMLCollection interface
|
// nsIDOMHTMLCollection interface
|
||||||
|
@ -873,79 +737,11 @@ nsFormControlList::Item(PRUint32 aIndex, nsIDOMNode** aReturn)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFormControlList::Item(JSContext* cx, jsval* argv, PRUint32 argc,
|
|
||||||
jsval* aReturn)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIDOMNode> element;
|
|
||||||
nsresult result;
|
|
||||||
nsCOMPtr<nsIScriptContext> scriptContext;
|
|
||||||
nsCOMPtr<nsIScriptObjectOwner> owner;
|
|
||||||
PRInt32 index;
|
|
||||||
nsCOMPtr<nsIDocument> document;
|
|
||||||
|
|
||||||
if (argc < 1) {
|
|
||||||
return NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
*aReturn = nsnull;
|
|
||||||
if (!JS_ValueToInt32(cx, argv[0], (int32*)&index)) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mForm) {
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mForm));
|
|
||||||
if (content) {
|
|
||||||
result = content->GetDocument(*getter_AddRefs(document));
|
|
||||||
if (NS_FAILED(result)) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (document) {
|
|
||||||
nsCOMPtr<nsIScriptGlobalObject> globalObject;
|
|
||||||
document->GetScriptGlobalObject(getter_AddRefs(globalObject));
|
|
||||||
if (globalObject) {
|
|
||||||
result = globalObject->GetContext(getter_AddRefs(scriptContext));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we can't get a script context, there's nothing we can do
|
|
||||||
if (!scriptContext) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = Item((PRUint32)index, getter_AddRefs(element));
|
|
||||||
if (NS_FAILED(result)) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (element) {
|
|
||||||
owner = do_QueryInterface(element);
|
|
||||||
|
|
||||||
if (owner) {
|
|
||||||
JSObject* obj;
|
|
||||||
result = owner->GetScriptObject(scriptContext, (void**)&obj);
|
|
||||||
if (NS_FAILED(result)) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
*aReturn = OBJECT_TO_JSVAL(obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsFormControlList::GetNamedObject(JSContext* aContext, jsval aID,
|
nsFormControlList::GetNamedObject(const nsAReadableString& aName,
|
||||||
JSObject** aObj)
|
nsISupports** aResult)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aObj);
|
*aResult = nsnull;
|
||||||
*aObj = nsnull;
|
|
||||||
|
|
||||||
if (!mForm) {
|
if (!mForm) {
|
||||||
// No form, no named objects
|
// No form, no named objects
|
||||||
|
@ -953,72 +749,13 @@ nsFormControlList::GetNamedObject(JSContext* aContext, jsval aID,
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
nsCOMPtr<nsIScriptContext> scriptContext;
|
|
||||||
nsCOMPtr<nsIScriptObjectOwner> owner;
|
|
||||||
char* str = JS_GetStringBytes(JS_ValueToString(aContext, aID));
|
|
||||||
nsAutoString ustr; ustr.AssignWithConversion(str);
|
|
||||||
|
|
||||||
// Get the hash entry
|
// Get the hash entry
|
||||||
nsStringKey key(ustr);
|
nsStringKey key(aName);
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> item(dont_AddRef(mNameLookupTable.Get(&key)));
|
*aResult = mNameLookupTable.Get(&key);
|
||||||
|
|
||||||
if (item) {
|
return NS_OK;
|
||||||
// Found something, we don't care here if it's a element or a node
|
|
||||||
// list, we just return the script object
|
|
||||||
owner = do_QueryInterface(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!owner) {
|
|
||||||
// No owner means we didn't find anything, at least not something we can
|
|
||||||
// return as a JSObject.
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDocument> document;
|
|
||||||
nsCOMPtr<nsIContent> form = do_QueryInterface(mForm);
|
|
||||||
|
|
||||||
if (form) {
|
|
||||||
rv = form->GetDocument(*getter_AddRefs(document));
|
|
||||||
if (NS_FAILED(rv)) {
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (document) {
|
|
||||||
nsCOMPtr<nsIScriptGlobalObject> globalObject;
|
|
||||||
document->GetScriptGlobalObject(getter_AddRefs(globalObject));
|
|
||||||
if (globalObject) {
|
|
||||||
rv = globalObject->GetContext(getter_AddRefs(scriptContext));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we can't get a script context, there's nothing we can do
|
|
||||||
if (!scriptContext) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return owner->GetScriptObject(scriptContext, (void**)aObj);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsFormControlList::NamedItem(JSContext* cx, jsval* argv, PRUint32 argc,
|
|
||||||
jsval* aReturn)
|
|
||||||
{
|
|
||||||
JSObject *obj;
|
|
||||||
nsresult result = NS_OK;
|
|
||||||
|
|
||||||
if (argc > 0) {
|
|
||||||
result = GetNamedObject(cx, argv[0], &obj);
|
|
||||||
if (NS_SUCCEEDED(result) && (nsnull != obj)) {
|
|
||||||
*aReturn = OBJECT_TO_JSVAL(obj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
result = NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -1026,20 +763,22 @@ nsFormControlList::NamedItem(const nsAReadableString& aName,
|
||||||
nsIDOMNode** aReturn)
|
nsIDOMNode** aReturn)
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aReturn);
|
NS_ENSURE_ARG_POINTER(aReturn);
|
||||||
|
*aReturn = nsnull;
|
||||||
|
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
nsStringKey key(aName);
|
nsStringKey key(aName);
|
||||||
*aReturn = nsnull;
|
|
||||||
|
|
||||||
nsCOMPtr<nsISupports> supports(dont_AddRef(mNameLookupTable.Get(&key)));
|
nsCOMPtr<nsISupports> supports(dont_AddRef(mNameLookupTable.Get(&key)));
|
||||||
|
|
||||||
if (supports) {
|
if (supports) {
|
||||||
// We found something, check if it's a node
|
// We found something, check if it's a node
|
||||||
rv = CallQueryInterface(supports, aReturn);
|
CallQueryInterface(supports, aReturn);
|
||||||
|
|
||||||
if (NS_FAILED(rv)) {
|
if (!*aReturn) {
|
||||||
// If not, we check if it's a node list.
|
// If not, we check if it's a node list.
|
||||||
nsCOMPtr<nsIDOMNodeList> nodeList(do_QueryInterface(supports, &rv));
|
nsCOMPtr<nsIDOMNodeList> nodeList(do_QueryInterface(supports));
|
||||||
|
NS_WARN_IF_FALSE(nodeList, "Huh, what's going one here?");
|
||||||
|
|
||||||
if (nodeList) {
|
if (nodeList) {
|
||||||
// And since we're only asking for one node here, we return the first
|
// And since we're only asking for one node here, we return the first
|
||||||
|
@ -1052,6 +791,19 @@ nsFormControlList::NamedItem(const nsAReadableString& aName,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsFormControlList::NamedItem(const nsAReadableString& aName,
|
||||||
|
nsISupports** aReturn)
|
||||||
|
{
|
||||||
|
NS_ENSURE_ARG_POINTER(aReturn);
|
||||||
|
|
||||||
|
nsStringKey key(aName);
|
||||||
|
|
||||||
|
*aReturn = mNameLookupTable.Get(&key);
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsFormControlList::AddElementToTable(nsIFormControl* aChild,
|
nsFormControlList::AddElementToTable(nsIFormControl* aChild,
|
||||||
const nsAReadableString& aName)
|
const nsAReadableString& aName)
|
||||||
|
@ -1112,10 +864,6 @@ nsFormControlList::AddElementToTable(nsIFormControl* aChild,
|
||||||
list->QueryInterface(NS_GET_IID(nsISupports),
|
list->QueryInterface(NS_GET_IID(nsISupports),
|
||||||
getter_AddRefs(listSupports));
|
getter_AddRefs(listSupports));
|
||||||
|
|
||||||
// Remove the current item from the hash so that we don't create
|
|
||||||
// a leak when we add the new item to the hash.
|
|
||||||
mNameLookupTable.Remove(&key);
|
|
||||||
|
|
||||||
// Replace the element with the list.
|
// Replace the element with the list.
|
||||||
mNameLookupTable.Put(&key, listSupports);
|
mNameLookupTable.Put(&key, listSupports);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMHTMLFrameElement.h"
|
#include "nsIDOMHTMLFrameElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -50,16 +49,16 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLFrameElement
|
// nsIDOMHTMLFrameElement
|
||||||
NS_DECL_IDOMHTMLFRAMEELEMENT
|
NS_DECL_NSIDOMHTMLFRAMEELEMENT
|
||||||
|
|
||||||
// nsIChromeEventHandler
|
// nsIChromeEventHandler
|
||||||
NS_DECL_NSICHROMEEVENTHANDLER
|
NS_DECL_NSICHROMEEVENTHANDLER
|
||||||
|
@ -112,8 +111,21 @@ nsHTMLFrameElement::~nsHTMLFrameElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLFrameElement, nsGenericElement);
|
NS_IMPL_ADDREF_INHERITED(nsHTMLFrameElement, nsGenericElement);
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLFrameElement, nsGenericElement);
|
NS_IMPL_RELEASE_INHERITED(nsHTMLFrameElement, nsGenericElement);
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI2(nsHTMLFrameElement, nsGenericHTMLLeafElement,
|
|
||||||
nsIDOMHTMLFrameElement, nsIChromeEventHandler);
|
// XPConnect interface list for nsHTMLFrameElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLFrameElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLFrameElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLFrameElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLFrameElement,
|
||||||
|
nsGenericHTMLLeafElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLFrameElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIChromeEventHandler)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLFrameElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -188,12 +200,6 @@ nsHTMLFrameElement::GetContentDocument(nsIDOMDocument** aContentDocument)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsHTMLFrameElement::SetContentDocument(nsIDOMDocument* aContentDocument)
|
|
||||||
{
|
|
||||||
return NS_ERROR_DOM_INVALID_MODIFICATION_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLFrameElement::StringToAttribute(nsIAtom* aAttribute,
|
nsHTMLFrameElement::StringToAttribute(nsIAtom* aAttribute,
|
||||||
const nsAReadableString& aValue,
|
const nsAReadableString& aValue,
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMHTMLFrameSetElement.h"
|
#include "nsIDOMHTMLFrameSetElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -43,16 +42,16 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLFrameSetElement
|
// nsIDOMHTMLFrameSetElement
|
||||||
NS_DECL_IDOMHTMLFRAMESETELEMENT
|
NS_DECL_NSIDOMHTMLFRAMESETELEMENT
|
||||||
|
|
||||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
||||||
const nsAReadableString& aValue,
|
const nsAReadableString& aValue,
|
||||||
|
@ -104,8 +103,20 @@ nsHTMLFrameSetElement::~nsHTMLFrameSetElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLFrameSetElement, nsGenericElement)
|
NS_IMPL_ADDREF_INHERITED(nsHTMLFrameSetElement, nsGenericElement)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLFrameSetElement, nsGenericElement)
|
NS_IMPL_RELEASE_INHERITED(nsHTMLFrameSetElement, nsGenericElement)
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI(nsHTMLFrameSetElement, nsGenericHTMLContainerElement,
|
|
||||||
nsIDOMHTMLFrameSetElement);
|
// XPConnect interface list for nsHTMLFrameSetElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLFrameSetElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLFrameSetElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLFrameSetElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLFrameSetElement,
|
||||||
|
nsGenericHTMLContainerElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLFrameSetElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLFrameSetElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMHTMLHRElement.h"
|
#include "nsIDOMHTMLHRElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -44,16 +43,16 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLHRElement
|
// nsIDOMHTMLHRElement
|
||||||
NS_DECL_IDOMHTMLHRELEMENT
|
NS_DECL_NSIDOMHTMLHRELEMENT
|
||||||
|
|
||||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
||||||
const nsAReadableString& aValue,
|
const nsAReadableString& aValue,
|
||||||
|
@ -107,8 +106,20 @@ nsHTMLHRElement::~nsHTMLHRElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLHRElement, nsGenericElement)
|
NS_IMPL_ADDREF_INHERITED(nsHTMLHRElement, nsGenericElement)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLHRElement, nsGenericElement)
|
NS_IMPL_RELEASE_INHERITED(nsHTMLHRElement, nsGenericElement)
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI(nsHTMLHRElement, nsGenericHTMLLeafElement,
|
|
||||||
nsIDOMHTMLHRElement);
|
// XPConnect interface list for nsHTMLHRElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLHRElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLHRElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLHRElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLHRElement,
|
||||||
|
nsGenericHTMLLeafElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLHRElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLHRElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMHTMLHeadElement.h"
|
#include "nsIDOMHTMLHeadElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -43,16 +42,16 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLHeadElement
|
// nsIDOMHTMLHeadElement
|
||||||
NS_DECL_IDOMHTMLHEADELEMENT
|
NS_DECL_NSIDOMHTMLHEADELEMENT
|
||||||
|
|
||||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
||||||
};
|
};
|
||||||
|
@ -96,8 +95,20 @@ nsHTMLHeadElement::~nsHTMLHeadElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLHeadElement, nsGenericElement);
|
NS_IMPL_ADDREF_INHERITED(nsHTMLHeadElement, nsGenericElement);
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLHeadElement, nsGenericElement);
|
NS_IMPL_RELEASE_INHERITED(nsHTMLHeadElement, nsGenericElement);
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI(nsHTMLHeadElement, nsGenericHTMLContainerElement,
|
|
||||||
nsIDOMHTMLHeadElement);
|
// XPConnect interface list for nsHTMLHeadElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLHeadElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLHeadElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLHeadElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLHeadElement,
|
||||||
|
nsGenericHTMLContainerElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLHeadElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLHeadElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMHTMLHeadingElement.h"
|
#include "nsIDOMHTMLHeadingElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -44,16 +43,16 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLHeadingElement
|
// nsIDOMHTMLHeadingElement
|
||||||
NS_DECL_IDOMHTMLHEADINGELEMENT
|
NS_DECL_NSIDOMHTMLHEADINGELEMENT
|
||||||
|
|
||||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
||||||
const nsAReadableString& aValue,
|
const nsAReadableString& aValue,
|
||||||
|
@ -107,8 +106,20 @@ nsHTMLHeadingElement::~nsHTMLHeadingElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLHeadingElement, nsGenericElement)
|
NS_IMPL_ADDREF_INHERITED(nsHTMLHeadingElement, nsGenericElement)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLHeadingElement, nsGenericElement)
|
NS_IMPL_RELEASE_INHERITED(nsHTMLHeadingElement, nsGenericElement)
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI(nsHTMLHeadingElement, nsGenericHTMLContainerElement,
|
|
||||||
nsIDOMHTMLHeadingElement);
|
// XPConnect interface list for nsHTMLHeadingElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLHeadingElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLHeadingElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLHeadingElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLHeadingElement,
|
||||||
|
nsGenericHTMLContainerElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLHeadingElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLHeadingElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMHTMLHtmlElement.h"
|
#include "nsIDOMHTMLHtmlElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -44,16 +43,16 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLHtmlElement
|
// nsIDOMHTMLHtmlElement
|
||||||
NS_DECL_IDOMHTMLHTMLELEMENT
|
NS_DECL_NSIDOMHTMLHTMLELEMENT
|
||||||
|
|
||||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
||||||
};
|
};
|
||||||
|
@ -99,8 +98,20 @@ NS_IMPL_ADDREF_INHERITED(nsHTMLHtmlElement, nsGenericElement)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLHtmlElement, nsGenericElement)
|
NS_IMPL_RELEASE_INHERITED(nsHTMLHtmlElement, nsGenericElement)
|
||||||
|
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI(nsHTMLHtmlElement, nsGenericHTMLContainerElement,
|
|
||||||
nsIDOMHTMLHtmlElement)
|
// XPConnect interface list for nsHTMLHtmlElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLHtmlElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLHtmlElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLHtmlElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLHtmlElement,
|
||||||
|
nsGenericHTMLContainerElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLHtmlElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLHtmlElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMHTMLIFrameElement.h"
|
#include "nsIDOMHTMLIFrameElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -51,16 +50,16 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLIFrameElement
|
// nsIDOMHTMLIFrameElement
|
||||||
NS_DECL_IDOMHTMLIFRAMEELEMENT
|
NS_DECL_NSIDOMHTMLIFRAMEELEMENT
|
||||||
|
|
||||||
// nsIChromeEventHandler
|
// nsIChromeEventHandler
|
||||||
NS_DECL_NSICHROMEEVENTHANDLER
|
NS_DECL_NSICHROMEEVENTHANDLER
|
||||||
|
@ -117,8 +116,21 @@ nsHTMLIFrameElement::~nsHTMLIFrameElement()
|
||||||
NS_IMPL_ADDREF(nsHTMLIFrameElement);
|
NS_IMPL_ADDREF(nsHTMLIFrameElement);
|
||||||
NS_IMPL_RELEASE(nsHTMLIFrameElement);
|
NS_IMPL_RELEASE(nsHTMLIFrameElement);
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI2(nsHTMLIFrameElement, nsGenericHTMLContainerElement,
|
|
||||||
nsIDOMHTMLIFrameElement, nsIChromeEventHandler);
|
// XPConnect interface list for nsHTMLIFrameElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLIFrameElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLIFrameElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLIFrameElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLIFrameElement,
|
||||||
|
nsGenericHTMLContainerElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLIFrameElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIChromeEventHandler)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLIFrameElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -194,13 +206,7 @@ nsHTMLIFrameElement::GetContentDocument(nsIDOMDocument** aContentDocument)
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsHTMLIFrameElement::SetContentDocument(nsIDOMDocument* aContentDocument)
|
|
||||||
{
|
|
||||||
return NS_ERROR_DOM_INVALID_MODIFICATION_ERR;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLIFrameElement::StringToAttribute(nsIAtom* aAttribute,
|
nsHTMLIFrameElement::StringToAttribute(nsIAtom* aAttribute,
|
||||||
const nsAReadableString& aValue,
|
const nsAReadableString& aValue,
|
||||||
|
|
|
@ -20,8 +20,7 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMHTMLImageElement.h"
|
#include "nsIDOMHTMLImageElement.h"
|
||||||
#include "nsIDOMImage.h"
|
#include "nsIDOMNSHTMLImageElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -33,7 +32,6 @@
|
||||||
#include "nsIPresContext.h"
|
#include "nsIPresContext.h"
|
||||||
#include "nsIPresShell.h"
|
#include "nsIPresShell.h"
|
||||||
#include "nsIHTMLAttributes.h"
|
#include "nsIHTMLAttributes.h"
|
||||||
#include "nsIJSScriptObject.h"
|
|
||||||
#include "nsIJSNativeInitializer.h"
|
#include "nsIJSNativeInitializer.h"
|
||||||
#include "nsSize.h"
|
#include "nsSize.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
|
@ -64,11 +62,13 @@
|
||||||
#include "nsIFrameImageLoader.h"
|
#include "nsIFrameImageLoader.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "nsIJSContextStack.h"
|
||||||
|
|
||||||
// XXX nav attrs: suppress
|
// XXX nav attrs: suppress
|
||||||
|
|
||||||
class nsHTMLImageElement : public nsGenericHTMLLeafElement,
|
class nsHTMLImageElement : public nsGenericHTMLLeafElement,
|
||||||
public nsIDOMHTMLImageElement,
|
public nsIDOMHTMLImageElement,
|
||||||
public nsIDOMImage,
|
public nsIDOMNSHTMLImageElement,
|
||||||
public nsIJSNativeInitializer
|
public nsIJSNativeInitializer
|
||||||
#ifdef USE_IMG2
|
#ifdef USE_IMG2
|
||||||
, public imgIDecoderObserver
|
, public imgIDecoderObserver
|
||||||
|
@ -82,37 +82,30 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLImageElement
|
// nsIDOMHTMLImageElement
|
||||||
NS_DECL_IDOMHTMLIMAGEELEMENT
|
NS_DECL_NSIDOMHTMLIMAGEELEMENT
|
||||||
|
|
||||||
|
// nsIDOMNSHTMLImageElement
|
||||||
|
NS_DECL_NSIDOMNSHTMLIMAGEELEMENT
|
||||||
|
|
||||||
// nsIDOMImage
|
|
||||||
NS_DECL_IDOMIMAGE
|
|
||||||
|
|
||||||
#ifdef USE_IMG2
|
#ifdef USE_IMG2
|
||||||
NS_DECL_IMGIDECODEROBSERVER
|
NS_DECL_IMGIDECODEROBSERVER
|
||||||
NS_DECL_IMGICONTAINEROBSERVER
|
NS_DECL_IMGICONTAINEROBSERVER
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// nsIJSScriptObject
|
|
||||||
virtual PRBool GetProperty(JSContext *aContext, JSObject *aObj,
|
|
||||||
jsval aID, jsval *aVp);
|
|
||||||
virtual PRBool SetProperty(JSContext *aContext, JSObject *aObj,
|
|
||||||
jsval aID, jsval *aVp);
|
|
||||||
virtual PRBool Resolve(JSContext *aContext, JSObject *aObj, jsval aID,
|
|
||||||
PRBool *aDidDefineProperty);
|
|
||||||
|
|
||||||
// nsIJSNativeInitializer
|
// nsIJSNativeInitializer
|
||||||
NS_IMETHOD Initialize(JSContext* aContext, JSObject *aObj,
|
NS_IMETHOD Initialize(JSContext* aContext, JSObject *aObj,
|
||||||
PRUint32 argc, jsval *argv);
|
PRUint32 argc, jsval *argv);
|
||||||
|
|
||||||
|
// nsIContent
|
||||||
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep,
|
NS_IMETHOD SetDocument(nsIDocument* aDocument, PRBool aDeep,
|
||||||
PRBool aCompileEventHandlers);
|
PRBool aCompileEventHandlers);
|
||||||
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
NS_IMETHOD StringToAttribute(nsIAtom* aAttribute,
|
||||||
|
@ -132,7 +125,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
nsresult SetSrcInner(nsIURI* aBaseURL, const nsAReadableString& aSrc);
|
nsresult SetSrcInner(nsIURI* aBaseURL, const nsAReadableString& aSrc);
|
||||||
static nsresult GetCallerSourceURL(JSContext* cx, nsIURI** sourceURL);
|
static nsresult GetCallerSourceURL(nsIURI** sourceURL);
|
||||||
|
|
||||||
nsresult GetImageFrame(nsIImageFrame** aImageFrame);
|
nsresult GetImageFrame(nsIImageFrame** aImageFrame);
|
||||||
|
|
||||||
|
@ -217,16 +210,40 @@ nsHTMLImageElement::~nsHTMLImageElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLImageElement, nsGenericElement)
|
NS_IMPL_ADDREF_INHERITED(nsHTMLImageElement, nsGenericElement)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLImageElement, nsGenericElement)
|
NS_IMPL_RELEASE_INHERITED(nsHTMLImageElement, nsGenericElement)
|
||||||
|
|
||||||
|
|
||||||
|
// XPConnect interface list for nsHTMLImageElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLImageElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLImageElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLImageElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLImageElement
|
||||||
#ifdef USE_IMG2
|
#ifdef USE_IMG2
|
||||||
NS_IMPL_HTMLCONTENT_QI4(nsHTMLImageElement, nsGenericHTMLLeafElement,
|
|
||||||
nsIDOMHTMLImageElement, nsIDOMImage,
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLImageElement,
|
||||||
nsIJSNativeInitializer, imgIDecoderObserver);
|
nsGenericHTMLLeafElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLImageElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNSHTMLImageElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(imgIDecoderObserver)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLImageElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
#else
|
#else
|
||||||
NS_IMPL_HTMLCONTENT_QI3(nsHTMLImageElement, nsGenericHTMLLeafElement,
|
|
||||||
nsIDOMHTMLImageElement, nsIDOMImage,
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLImageElement,
|
||||||
nsIJSNativeInitializer);
|
nsGenericHTMLLeafElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLImageElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNSHTMLImageElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLImageElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTMLImageElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
nsHTMLImageElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||||
{
|
{
|
||||||
|
@ -260,15 +277,12 @@ NS_IMPL_STRING_ATTR(nsHTMLImageElement, LowSrc, lowsrc)
|
||||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Name, name)
|
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Name, name)
|
||||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Align, align)
|
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Align, align)
|
||||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Alt, alt)
|
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Alt, alt)
|
||||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Border, border)
|
|
||||||
NS_IMPL_INT_ATTR(nsHTMLImageElement, Border, border)
|
NS_IMPL_INT_ATTR(nsHTMLImageElement, Border, border)
|
||||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Hspace, hspace)
|
|
||||||
NS_IMPL_INT_ATTR(nsHTMLImageElement, Hspace, hspace)
|
NS_IMPL_INT_ATTR(nsHTMLImageElement, Hspace, hspace)
|
||||||
NS_IMPL_BOOL_ATTR(nsHTMLImageElement, IsMap, ismap)
|
NS_IMPL_BOOL_ATTR(nsHTMLImageElement, IsMap, ismap)
|
||||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, LongDesc, longdesc)
|
NS_IMPL_STRING_ATTR(nsHTMLImageElement, LongDesc, longdesc)
|
||||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Lowsrc, lowsrc)
|
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Lowsrc, lowsrc)
|
||||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, UseMap, usemap)
|
NS_IMPL_STRING_ATTR(nsHTMLImageElement, UseMap, usemap)
|
||||||
NS_IMPL_STRING_ATTR(nsHTMLImageElement, Vspace, vspace)
|
|
||||||
NS_IMPL_INT_ATTR(nsHTMLImageElement, Vspace, vspace)
|
NS_IMPL_INT_ATTR(nsHTMLImageElement, Vspace, vspace)
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
@ -353,38 +367,6 @@ nsHTMLImageElement::GetComplete(PRBool* aComplete)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsHTMLImageElement::GetHeight(nsAWritableString& aValue)
|
|
||||||
{
|
|
||||||
nsresult rv = nsGenericHTMLLeafElement::GetAttribute(kNameSpaceID_None,
|
|
||||||
nsHTMLAtoms::height,
|
|
||||||
aValue);
|
|
||||||
|
|
||||||
if (rv == NS_CONTENT_ATTR_NOT_THERE) {
|
|
||||||
PRInt32 height = 0;
|
|
||||||
|
|
||||||
aValue.Truncate();
|
|
||||||
|
|
||||||
// A zero height most likely means that the image is not loaded yet.
|
|
||||||
if (NS_SUCCEEDED(GetHeight(&height)) && height) {
|
|
||||||
nsAutoString heightStr;
|
|
||||||
heightStr.AppendInt(height);
|
|
||||||
aValue.Append(heightStr);
|
|
||||||
aValue.Append(NS_LITERAL_STRING("px"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsHTMLImageElement::SetHeight(const nsAReadableString& aValue)
|
|
||||||
{
|
|
||||||
return nsGenericHTMLLeafElement::SetAttribute(kNameSpaceID_None,
|
|
||||||
nsHTMLAtoms::height,
|
|
||||||
aValue, PR_TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLImageElement::GetHeight(PRInt32* aHeight)
|
nsHTMLImageElement::GetHeight(PRInt32* aHeight)
|
||||||
{
|
{
|
||||||
|
@ -438,38 +420,6 @@ nsHTMLImageElement::SetHeight(PRInt32 aHeight)
|
||||||
val, PR_TRUE);
|
val, PR_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsHTMLImageElement::GetWidth(nsAWritableString& aValue)
|
|
||||||
{
|
|
||||||
nsresult rv = nsGenericHTMLLeafElement::GetAttribute(kNameSpaceID_None,
|
|
||||||
nsHTMLAtoms::width,
|
|
||||||
aValue);
|
|
||||||
|
|
||||||
if (rv == NS_CONTENT_ATTR_NOT_THERE) {
|
|
||||||
PRInt32 width = 0;
|
|
||||||
|
|
||||||
aValue.Truncate();
|
|
||||||
|
|
||||||
// A zero width most likely means that the image is not loaded yet.
|
|
||||||
if (NS_SUCCEEDED(GetWidth(&width)) && width) {
|
|
||||||
nsAutoString widthStr;
|
|
||||||
widthStr.AppendInt(width);
|
|
||||||
aValue.Append(widthStr);
|
|
||||||
aValue.Append(NS_LITERAL_STRING("px"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsHTMLImageElement::SetWidth(const nsAReadableString& aValue)
|
|
||||||
{
|
|
||||||
return nsGenericHTMLLeafElement::SetAttribute(kNameSpaceID_None,
|
|
||||||
nsHTMLAtoms::width, aValue,
|
|
||||||
PR_TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLImageElement::GetWidth(PRInt32* aWidth)
|
nsHTMLImageElement::GetWidth(PRInt32* aWidth)
|
||||||
{
|
{
|
||||||
|
@ -652,41 +602,8 @@ nsHTMLImageElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
||||||
aEventStatus);
|
aEventStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool
|
|
||||||
nsHTMLImageElement::GetProperty(JSContext *aContext, JSObject *aObj,
|
|
||||||
jsval aID, jsval *aVp)
|
|
||||||
{
|
|
||||||
// XXX Security manager needs to be called
|
|
||||||
if (JSVAL_IS_STRING(aID)) {
|
|
||||||
PRUnichar* ustr =
|
|
||||||
NS_REINTERPRET_CAST(PRUnichar *,
|
|
||||||
JS_GetStringChars(JS_ValueToString(aContext, aID)));
|
|
||||||
|
|
||||||
if (NS_LITERAL_STRING("src").Equals(ustr)) {
|
|
||||||
nsAutoString src;
|
|
||||||
if (NS_SUCCEEDED(GetSrc(src))) {
|
|
||||||
const PRUnichar* bytes = src.GetUnicode();
|
|
||||||
JSString* str = JS_NewUCStringCopyZ(aContext, (const jschar*)bytes);
|
|
||||||
if (str) {
|
|
||||||
*aVp = STRING_TO_JSVAL(str);
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nsGenericHTMLLeafElement::GetProperty(aContext, aObj, aID, aVp);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTMLImageElement::GetCallerSourceURL(JSContext* cx,
|
nsHTMLImageElement::GetCallerSourceURL(nsIURI** sourceURL)
|
||||||
nsIURI** sourceURL)
|
|
||||||
{
|
{
|
||||||
// XXX Code duplicated from nsHTMLDocument
|
// XXX Code duplicated from nsHTMLDocument
|
||||||
// XXX Question, why does this return NS_OK on failure?
|
// XXX Question, why does this return NS_OK on failure?
|
||||||
|
@ -697,6 +614,23 @@ nsHTMLImageElement::GetCallerSourceURL(JSContext* cx,
|
||||||
// that we can get the url of the caller.
|
// that we can get the url of the caller.
|
||||||
// XXX This will fail on non-DOM contexts :(
|
// XXX This will fail on non-DOM contexts :(
|
||||||
|
|
||||||
|
// Get JSContext from stack.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// XXX: This service should be cached.
|
||||||
|
nsCOMPtr<nsIJSContextStack>
|
||||||
|
stack(do_GetService("@mozilla.org/js/xpc/ContextStack;1", &result));
|
||||||
|
|
||||||
|
if (NS_FAILED(result))
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
JSContext *cx;
|
||||||
|
|
||||||
|
if (NS_FAILED(stack->Peek(&cx)))
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
nsCOMPtr<nsIScriptGlobalObject> global;
|
nsCOMPtr<nsIScriptGlobalObject> global;
|
||||||
nsContentUtils::GetDynamicScriptGlobal(cx, getter_AddRefs(global));
|
nsContentUtils::GetDynamicScriptGlobal(cx, getter_AddRefs(global));
|
||||||
if (global) {
|
if (global) {
|
||||||
|
@ -722,91 +656,6 @@ nsHTMLImageElement::GetCallerSourceURL(JSContext* cx,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool
|
|
||||||
nsHTMLImageElement::SetProperty(JSContext *aContext, JSObject *aObj,
|
|
||||||
jsval aID, jsval *aVp)
|
|
||||||
{
|
|
||||||
nsresult result = NS_OK;
|
|
||||||
|
|
||||||
// XXX Security manager needs to be called
|
|
||||||
if (JSVAL_IS_STRING(aID)) {
|
|
||||||
PRUnichar* ustr =
|
|
||||||
NS_REINTERPRET_CAST(PRUnichar *,
|
|
||||||
JS_GetStringChars(JS_ValueToString(aContext, aID)));
|
|
||||||
|
|
||||||
if (NS_LITERAL_STRING("src").Equals(ustr)) {
|
|
||||||
nsCOMPtr<nsIURI> base;
|
|
||||||
nsAutoString src, url;
|
|
||||||
|
|
||||||
// Get the parameter passed in
|
|
||||||
JSString *jsstring;
|
|
||||||
if ((jsstring = JS_ValueToString(aContext, *aVp))) {
|
|
||||||
src.Assign(NS_REINTERPRET_CAST(const PRUnichar*,
|
|
||||||
JS_GetStringChars(jsstring)));
|
|
||||||
src.Trim(" \t\n\r");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the source of the caller
|
|
||||||
result = GetCallerSourceURL(aContext, getter_AddRefs(base));
|
|
||||||
|
|
||||||
if (NS_SUCCEEDED(result)) {
|
|
||||||
if (base) {
|
|
||||||
result = NS_MakeAbsoluteURI(url, src, base);
|
|
||||||
} else {
|
|
||||||
url.Assign(src);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NS_SUCCEEDED(result)) {
|
|
||||||
result = SetSrcInner(base, url);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
result = nsGenericHTMLLeafElement::SetProperty(aContext, aObj, aID, aVp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
result = nsGenericHTMLLeafElement::SetProperty(aContext, aObj, aID, aVp);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NS_FAILED(result)) {
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
PRBool
|
|
||||||
nsHTMLImageElement::Resolve(JSContext *aContext, JSObject *aObj, jsval aID,
|
|
||||||
PRBool *aDidDefineProperty)
|
|
||||||
{
|
|
||||||
if (JSVAL_IS_STRING(aID) && mDOMSlots) {
|
|
||||||
JSString *str;
|
|
||||||
|
|
||||||
str = JSVAL_TO_STRING(aID);
|
|
||||||
|
|
||||||
const jschar *chars = ::JS_GetStringChars(str);
|
|
||||||
const PRUnichar *unichars = NS_REINTERPRET_CAST(const PRUnichar*, chars);
|
|
||||||
|
|
||||||
if (!nsCRT::strcmp(unichars, NS_LITERAL_STRING("src").get())) {
|
|
||||||
// Someone is trying to resolve "src" so we deifine it on the
|
|
||||||
// object with a JSVAL_VOID value, the real value will be returned
|
|
||||||
// when the caller calls GetProperty().
|
|
||||||
::JS_DefineUCProperty(aContext,
|
|
||||||
(JSObject *)mDOMSlots->mScriptObject,
|
|
||||||
chars, ::JS_GetStringLength(str),
|
|
||||||
JSVAL_VOID, nsnull, nsnull, 0);
|
|
||||||
|
|
||||||
*aDidDefineProperty = PR_TRUE;
|
|
||||||
|
|
||||||
return PR_TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nsGenericHTMLLeafElement::Resolve(aContext, aObj, aID,
|
|
||||||
aDidDefineProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHTMLImageElement::Initialize(JSContext* aContext,
|
nsHTMLImageElement::Initialize(JSContext* aContext,
|
||||||
JSObject *aObj,
|
JSObject *aObj,
|
||||||
|
@ -1173,7 +1022,13 @@ nsHTMLImageElement::SetSrc(const nsAReadableString& aSrc)
|
||||||
nsCOMPtr<nsIURI> baseURL;
|
nsCOMPtr<nsIURI> baseURL;
|
||||||
nsresult result = NS_OK;
|
nsresult result = NS_OK;
|
||||||
|
|
||||||
if (mOwnerDocument) {
|
GetCallerSourceURL(getter_AddRefs(baseURL));
|
||||||
|
|
||||||
|
if (mDocument && !baseURL) {
|
||||||
|
result = mDocument->GetBaseURL(*getter_AddRefs(baseURL));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mOwnerDocument && !baseURL) {
|
||||||
result = mOwnerDocument->GetBaseURL(*getter_AddRefs(baseURL));
|
result = mOwnerDocument->GetBaseURL(*getter_AddRefs(baseURL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "nsContentCID.h"
|
#include "nsContentCID.h"
|
||||||
#include "nsIComponentManager.h"
|
#include "nsIComponentManager.h"
|
||||||
#include "nsIDOMHTMLFormElement.h"
|
#include "nsIDOMHTMLFormElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -83,7 +82,7 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLLeafFormElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLLeafFormElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
// can't use the macro here because input type=text needs to notify up to
|
// can't use the macro here because input type=text needs to notify up to
|
||||||
|
@ -170,13 +169,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLLeafFormElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLLeafFormElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLInputElement
|
// nsIDOMHTMLInputElement
|
||||||
NS_DECL_IDOMHTMLINPUTELEMENT
|
NS_DECL_NSIDOMHTMLINPUTELEMENT
|
||||||
|
|
||||||
// nsIDOMNSHTMLInputElement
|
// nsIDOMNSHTMLInputElement
|
||||||
NS_DECL_IDOMNSHTMLINPUTELEMENT
|
NS_DECL_NSIDOMNSHTMLINPUTELEMENT
|
||||||
|
|
||||||
// Overriden nsIFormControl methods
|
// Overriden nsIFormControl methods
|
||||||
NS_IMETHOD GetType(PRInt32* aType);
|
NS_IMETHOD GetType(PRInt32* aType);
|
||||||
|
@ -274,8 +273,22 @@ nsHTMLInputElement::~nsHTMLInputElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLInputElement, nsGenericElement)
|
NS_IMPL_ADDREF_INHERITED(nsHTMLInputElement, nsGenericElement)
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLInputElement, nsGenericElement)
|
NS_IMPL_RELEASE_INHERITED(nsHTMLInputElement, nsGenericElement)
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI2(nsHTMLInputElement, nsGenericHTMLLeafFormElement,
|
|
||||||
nsIDOMHTMLInputElement, nsIDOMNSHTMLInputElement)
|
// XPConnect interface list for nsHTMLInputElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLInputElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLInputElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMNSHTMLInputElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLInputElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLInputElement,
|
||||||
|
nsGenericHTMLLeafFormElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLInputElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMNSHTMLInputElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLInputElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMHTMLModElement.h"
|
#include "nsIDOMHTMLModElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -43,16 +42,16 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLContainerElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLModElement
|
// nsIDOMHTMLModElement
|
||||||
NS_DECL_IDOMHTMLMODELEMENT
|
NS_DECL_NSIDOMHTMLMODELEMENT
|
||||||
|
|
||||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
||||||
};
|
};
|
||||||
|
@ -96,8 +95,20 @@ nsHTMLInsElement::~nsHTMLInsElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLInsElement, nsGenericElement);
|
NS_IMPL_ADDREF_INHERITED(nsHTMLInsElement, nsGenericElement);
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLInsElement, nsGenericElement);
|
NS_IMPL_RELEASE_INHERITED(nsHTMLInsElement, nsGenericElement);
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI(nsHTMLInsElement, nsGenericHTMLContainerElement,
|
|
||||||
nsIDOMHTMLModElement);
|
// XPConnect interface list for nsHTMLInsElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLInsElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLModElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLInsElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLInsElement,
|
||||||
|
nsGenericHTMLContainerElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLModElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLInsElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
#include "nsIDOMHTMLIsIndexElement.h"
|
#include "nsIDOMHTMLIsIndexElement.h"
|
||||||
#include "nsIScriptObjectOwner.h"
|
|
||||||
#include "nsIDOMEventReceiver.h"
|
#include "nsIDOMEventReceiver.h"
|
||||||
#include "nsIHTMLContent.h"
|
#include "nsIHTMLContent.h"
|
||||||
#include "nsGenericHTMLElement.h"
|
#include "nsGenericHTMLElement.h"
|
||||||
|
@ -43,16 +42,16 @@ public:
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_FORWARD_IDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMNODE_NO_CLONENODE(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMElement
|
// nsIDOMElement
|
||||||
NS_FORWARD_IDOMELEMENT(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLElement
|
// nsIDOMHTMLElement
|
||||||
NS_FORWARD_IDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
|
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLLeafElement::)
|
||||||
|
|
||||||
// nsIDOMHTMLIsIndexElement
|
// nsIDOMHTMLIsIndexElement
|
||||||
NS_DECL_IDOMHTMLISINDEXELEMENT
|
NS_DECL_NSIDOMHTMLISINDEXELEMENT
|
||||||
|
|
||||||
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
NS_IMETHOD SizeOf(nsISizeOfHandler* aSizer, PRUint32* aResult) const;
|
||||||
};
|
};
|
||||||
|
@ -96,8 +95,20 @@ nsHTMLIsIndexElement::~nsHTMLIsIndexElement()
|
||||||
NS_IMPL_ADDREF_INHERITED(nsHTMLIsIndexElement, nsGenericElement);
|
NS_IMPL_ADDREF_INHERITED(nsHTMLIsIndexElement, nsGenericElement);
|
||||||
NS_IMPL_RELEASE_INHERITED(nsHTMLIsIndexElement, nsGenericElement);
|
NS_IMPL_RELEASE_INHERITED(nsHTMLIsIndexElement, nsGenericElement);
|
||||||
|
|
||||||
NS_IMPL_HTMLCONTENT_QI(nsHTMLIsIndexElement, nsGenericHTMLLeafElement,
|
|
||||||
nsIDOMHTMLIsIndexElement);
|
// XPConnect interface list for nsHTMLIsIndexElement
|
||||||
|
NS_CLASSINFO_MAP_BEGIN(HTMLIsIndexElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY(nsIDOMHTMLIsIndexElement)
|
||||||
|
NS_CLASSINFO_MAP_ENTRY_FUNCTION(GetGenericHTMLElementIIDs)
|
||||||
|
NS_CLASSINFO_MAP_END
|
||||||
|
|
||||||
|
|
||||||
|
// QueryInterface implementation for nsHTMLIsIndexElement
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_BEGIN(nsHTMLIsIndexElement,
|
||||||
|
nsGenericHTMLLeafElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLIsIndexElement)
|
||||||
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(HTMLIsIndexElement)
|
||||||
|
NS_HTML_CONTENT_INTERFACE_MAP_END
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче