зеркало из https://github.com/mozilla/pjs.git
Support for the new interfaces on the browserElement and iframeElement. r=hyatt
This commit is contained in:
Родитель
39b5e2746d
Коммит
64cf297e92
|
@ -88,6 +88,8 @@
|
|||
#include "nsXPIDLString.h"
|
||||
#include "nsXULAttributes.h"
|
||||
#include "nsXULControllers.h"
|
||||
#include "nsXULIFrameElement.h"
|
||||
#include "nsXULBrowserElement.h"
|
||||
#include "nsXULEditorElement.h"
|
||||
#include "nsXULTreeElement.h"
|
||||
#include "nsXULPopupElement.h"
|
||||
|
@ -278,6 +280,8 @@ nsIAtom* nsXULElement::kTreeChildrenAtom;
|
|||
nsIAtom* nsXULElement::kTreeColAtom;
|
||||
nsIAtom* nsXULElement::kTreeItemAtom;
|
||||
nsIAtom* nsXULElement::kTreeRowAtom;
|
||||
nsIAtom* nsXULElement::kIFrameAtom;
|
||||
nsIAtom* nsXULElement::kBrowserAtom;
|
||||
nsIAtom* nsXULElement::kEditorAtom;
|
||||
nsIAtom* nsXULElement::kWindowAtom;
|
||||
nsIAtom* nsXULElement::kNullAtom;
|
||||
|
@ -340,6 +344,8 @@ nsXULElement::Init()
|
|||
kTreeColAtom = NS_NewAtom("treecol");
|
||||
kTreeItemAtom = NS_NewAtom("treeitem");
|
||||
kTreeRowAtom = NS_NewAtom("treerow");
|
||||
kIFrameAtom = NS_NewAtom("iframe");
|
||||
kBrowserAtom = NS_NewAtom("browser");
|
||||
kEditorAtom = NS_NewAtom("editor");
|
||||
kWindowAtom = NS_NewAtom("window");
|
||||
kNullAtom = NS_NewAtom("");
|
||||
|
@ -412,6 +418,8 @@ nsXULElement::~nsXULElement()
|
|||
NS_IF_RELEASE(kTreeColAtom);
|
||||
NS_IF_RELEASE(kTreeItemAtom);
|
||||
NS_IF_RELEASE(kTreeRowAtom);
|
||||
NS_IF_RELEASE(kIFrameAtom);
|
||||
NS_IF_RELEASE(kBrowserAtom);
|
||||
NS_IF_RELEASE(kEditorAtom);
|
||||
NS_IF_RELEASE(kWindowAtom);
|
||||
NS_IF_RELEASE(kNullAtom);
|
||||
|
@ -615,6 +623,34 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result)
|
|||
|
||||
return InnerXULElement()->QueryInterface(iid, result);
|
||||
}
|
||||
else if (iid.Equals(NS_GET_IID(nsIDOMXULIFrameElement)) &&
|
||||
(NameSpaceID() == kNameSpaceID_XUL) &&
|
||||
(Tag() == kIFrameAtom)) {
|
||||
// We delegate XULIFrameElement APIs to an aggregate object
|
||||
if (! InnerXULElement()) {
|
||||
rv = EnsureSlots();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if ((mSlots->mInnerXULElement = new nsXULIFrameElement(this)) == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return InnerXULElement()->QueryInterface(iid, result);
|
||||
}
|
||||
else if (iid.Equals(NS_GET_IID(nsIDOMXULBrowserElement)) &&
|
||||
(NameSpaceID() == kNameSpaceID_XUL) &&
|
||||
(Tag() == kBrowserAtom)) {
|
||||
// We delegate XULBrowserElement APIs to an aggregate object
|
||||
if (! InnerXULElement()) {
|
||||
rv = EnsureSlots();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if ((mSlots->mInnerXULElement = new nsXULBrowserElement(this)) == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return InnerXULElement()->QueryInterface(iid, result);
|
||||
}
|
||||
else if (iid.Equals(NS_GET_IID(nsIDOMXULEditorElement)) &&
|
||||
(NameSpaceID() == kNameSpaceID_XUL) &&
|
||||
(Tag() == kEditorAtom)) {
|
||||
|
@ -1641,6 +1677,14 @@ nsXULElement::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject)
|
|||
fn = NS_NewScriptXULTreeElement;
|
||||
rootname = "nsXULTreeElement::mScriptObject";
|
||||
}
|
||||
else if (Tag() == kIFrameAtom) {
|
||||
fn = NS_NewScriptXULIFrameElement;
|
||||
rootname = "nsXULIFrameElement::mScriptObject";
|
||||
}
|
||||
else if (Tag() == kBrowserAtom) {
|
||||
fn = NS_NewScriptXULBrowserElement;
|
||||
rootname = "nsXULBrowserElement::mScriptObject";
|
||||
}
|
||||
else if (Tag() == kEditorAtom) {
|
||||
fn = NS_NewScriptXULEditorElement;
|
||||
rootname = "nsXULEditorElement::mScriptObject";
|
||||
|
|
|
@ -347,6 +347,8 @@ protected:
|
|||
static nsIAtom* kTreeColAtom;
|
||||
static nsIAtom* kTreeItemAtom;
|
||||
static nsIAtom* kTreeRowAtom;
|
||||
static nsIAtom* kIFrameAtom;
|
||||
static nsIAtom* kBrowserAtom;
|
||||
static nsIAtom* kEditorAtom;
|
||||
static nsIAtom* kWindowAtom;
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@ CPPSRCS = \
|
|||
nsJSXULCommandDispatcher.cpp \
|
||||
nsJSXULPopupElement.cpp \
|
||||
nsJSXULTreeElement.cpp \
|
||||
nsJSXULIFrameElement.cpp \
|
||||
nsJSXULBrowserElement.cpp \
|
||||
nsJSXULEditorElement.cpp \
|
||||
nsRDFDOMNodeList.cpp \
|
||||
nsXULElement.cpp \
|
||||
|
@ -53,6 +55,8 @@ CPPSRCS = \
|
|||
nsXULKeyListener.cpp \
|
||||
nsXULPopupElement.cpp \
|
||||
nsXULTreeElement.cpp \
|
||||
nsXULIFrameElement.cpp \
|
||||
nsXULBrowserElement.cpp \
|
||||
nsXULEditorElement.cpp \
|
||||
nsXULPrototypeDocument.cpp \
|
||||
nsXULPrototypeCache.cpp \
|
||||
|
|
|
@ -44,6 +44,8 @@ CPP_OBJS=\
|
|||
.\$(OBJDIR)\nsJSXULElement.obj \
|
||||
.\$(OBJDIR)\nsJSXULPopupElement.obj \
|
||||
.\$(OBJDIR)\nsJSXULTreeElement.obj \
|
||||
.\$(OBJDIR)\nsJSXULIFrameElement.obj \
|
||||
.\$(OBJDIR)\nsJSXULBrowserElement.obj \
|
||||
.\$(OBJDIR)\nsJSXULEditorElement.obj \
|
||||
.\$(OBJDIR)\nsRDFDOMNodeList.obj \
|
||||
.\$(OBJDIR)\nsXULElement.obj \
|
||||
|
@ -53,6 +55,8 @@ CPP_OBJS=\
|
|||
.\$(OBJDIR)\nsXULKeyListener.obj \
|
||||
.\$(OBJDIR)\nsXULSortService.obj \
|
||||
.\$(OBJDIR)\nsXULTreeElement.obj \
|
||||
.\$(OBJDIR)\nsXULIFrameElement.obj \
|
||||
.\$(OBJDIR)\nsXULBrowserElement.obj \
|
||||
.\$(OBJDIR)\nsXULEditorElement.obj \
|
||||
.\$(OBJDIR)\nsXULPopupElement.obj \
|
||||
$(NULL)
|
||||
|
|
|
@ -0,0 +1,317 @@
|
|||
/* -*- 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nscore.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIJSScriptObject.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMPropEnums.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMXULBrowserElement.h"
|
||||
#include "nsIWebBrowser.h"
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
||||
static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
|
||||
static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
|
||||
static NS_DEFINE_IID(kIXULBrowserElementIID, NS_IDOMXULBROWSERELEMENT_IID);
|
||||
static NS_DEFINE_IID(kIWebBrowserIID, NS_IWEBBROWSER_IID);
|
||||
|
||||
//
|
||||
// XULBrowserElement property ids
|
||||
//
|
||||
enum XULBrowserElement_slots {
|
||||
XULBROWSERELEMENT_WEBBROWSER = -1
|
||||
};
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// XULBrowserElement Properties Getter
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
GetXULBrowserElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMXULBrowserElement *a = (nsIDOMXULBrowserElement*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case XULBROWSERELEMENT_WEBBROWSER:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULBROWSERELEMENT_WEBBROWSER, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIWebBrowser* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetWebBrowser(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object; n.b., this will do a release on 'prop'
|
||||
nsJSUtils::nsConvertXPCObjectToJSVal(prop, NS_GET_IID(nsIWebBrowser), cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// XULBrowserElement Properties Setter
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
SetXULBrowserElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMXULBrowserElement *a = (nsIDOMXULBrowserElement*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// XULBrowserElement finalizer
|
||||
//
|
||||
PR_STATIC_CALLBACK(void)
|
||||
FinalizeXULBrowserElement(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
nsJSUtils::nsGenericFinalize(cx, obj);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// XULBrowserElement enumerate
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
EnumerateXULBrowserElement(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
return nsJSUtils::nsGenericEnumerate(cx, obj);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// XULBrowserElement resolve
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
ResolveXULBrowserElement(JSContext *cx, JSObject *obj, jsval id)
|
||||
{
|
||||
return nsJSUtils::nsGenericResolve(cx, obj, id);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// class for XULBrowserElement
|
||||
//
|
||||
JSClass XULBrowserElementClass = {
|
||||
"XULBrowserElement",
|
||||
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
|
||||
JS_PropertyStub,
|
||||
JS_PropertyStub,
|
||||
GetXULBrowserElementProperty,
|
||||
SetXULBrowserElementProperty,
|
||||
EnumerateXULBrowserElement,
|
||||
ResolveXULBrowserElement,
|
||||
JS_ConvertStub,
|
||||
FinalizeXULBrowserElement,
|
||||
nsnull,
|
||||
nsJSUtils::nsCheckAccess
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// XULBrowserElement class properties
|
||||
//
|
||||
static JSPropertySpec XULBrowserElementProperties[] =
|
||||
{
|
||||
{"webBrowser", XULBROWSERELEMENT_WEBBROWSER, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// XULBrowserElement class methods
|
||||
//
|
||||
static JSFunctionSpec XULBrowserElementMethods[] =
|
||||
{
|
||||
{0}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// XULBrowserElement constructor
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
XULBrowserElement(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// XULBrowserElement class initialization
|
||||
//
|
||||
extern "C" NS_DOM nsresult NS_InitXULBrowserElementClass(nsIScriptContext *aContext, void **aPrototype)
|
||||
{
|
||||
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
|
||||
JSObject *proto = nsnull;
|
||||
JSObject *constructor = nsnull;
|
||||
JSObject *parent_proto = nsnull;
|
||||
JSObject *global = JS_GetGlobalObject(jscontext);
|
||||
jsval vp;
|
||||
|
||||
if ((PR_TRUE != JS_LookupProperty(jscontext, global, "XULBrowserElement", &vp)) ||
|
||||
!JSVAL_IS_OBJECT(vp) ||
|
||||
((constructor = JSVAL_TO_OBJECT(vp)) == nsnull) ||
|
||||
(PR_TRUE != JS_LookupProperty(jscontext, JSVAL_TO_OBJECT(vp), "prototype", &vp)) ||
|
||||
!JSVAL_IS_OBJECT(vp)) {
|
||||
|
||||
if (NS_OK != NS_InitXULElementClass(aContext, (void **)&parent_proto)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
proto = JS_InitClass(jscontext, // context
|
||||
global, // global object
|
||||
parent_proto, // parent proto
|
||||
&XULBrowserElementClass, // JSClass
|
||||
XULBrowserElement, // JSNative ctor
|
||||
0, // ctor args
|
||||
XULBrowserElementProperties, // proto props
|
||||
XULBrowserElementMethods, // proto funcs
|
||||
nsnull, // ctor props (static)
|
||||
nsnull); // ctor funcs (static)
|
||||
if (nsnull == proto) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
}
|
||||
else if ((nsnull != constructor) && JSVAL_IS_OBJECT(vp)) {
|
||||
proto = JSVAL_TO_OBJECT(vp);
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (aPrototype) {
|
||||
*aPrototype = proto;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Method for creating a new XULBrowserElement JavaScript object
|
||||
//
|
||||
extern "C" NS_DOM nsresult NS_NewScriptXULBrowserElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptXULBrowserElement");
|
||||
JSObject *proto;
|
||||
JSObject *parent;
|
||||
nsIScriptObjectOwner *owner;
|
||||
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
|
||||
nsresult result = NS_OK;
|
||||
nsIDOMXULBrowserElement *aXULBrowserElement;
|
||||
|
||||
if (nsnull == aParent) {
|
||||
parent = nsnull;
|
||||
}
|
||||
else if (NS_OK == aParent->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) {
|
||||
if (NS_OK != owner->GetScriptObject(aContext, (void **)&parent)) {
|
||||
NS_RELEASE(owner);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_RELEASE(owner);
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (NS_OK != NS_InitXULBrowserElementClass(aContext, (void **)&proto)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
result = aSupports->QueryInterface(kIXULBrowserElementIID, (void **)&aXULBrowserElement);
|
||||
if (NS_OK != result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// create a js object for this class
|
||||
*aReturn = JS_NewObject(jscontext, &XULBrowserElementClass, proto, parent);
|
||||
if (nsnull != *aReturn) {
|
||||
// connect the native object to the js object
|
||||
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aXULBrowserElement);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(aXULBrowserElement);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,317 @@
|
|||
/* -*- 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):
|
||||
*/
|
||||
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nscore.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIJSScriptObject.h"
|
||||
#include "nsIScriptObjectOwner.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMPropEnums.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDOMXULIFrameElement.h"
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
|
||||
static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
|
||||
static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
|
||||
static NS_DEFINE_IID(kIDocShellIID, NS_IDOCSHELL_IID);
|
||||
static NS_DEFINE_IID(kIXULIFrameElementIID, NS_IDOMXULIFRAMEELEMENT_IID);
|
||||
|
||||
//
|
||||
// XULIFrameElement property ids
|
||||
//
|
||||
enum XULIFrameElement_slots {
|
||||
XULIFRAMEELEMENT_DOCSHELL = -1
|
||||
};
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// XULIFrameElement Properties Getter
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
GetXULIFrameElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMXULIFrameElement *a = (nsIDOMXULIFrameElement*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case XULIFRAMEELEMENT_DOCSHELL:
|
||||
{
|
||||
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULIFRAMEELEMENT_DOCSHELL, PR_FALSE);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, rv);
|
||||
}
|
||||
nsIDocShell* prop;
|
||||
nsresult result = NS_OK;
|
||||
result = a->GetDocShell(&prop);
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
// get the js object; n.b., this will do a release on 'prop'
|
||||
nsJSUtils::nsConvertXPCObjectToJSVal(prop, NS_GET_IID(nsIDocShell), cx, obj, vp);
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsReportError(cx, obj, result);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// XULIFrameElement Properties Setter
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
SetXULIFrameElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
nsIDOMXULIFrameElement *a = (nsIDOMXULIFrameElement*)nsJSUtils::nsGetNativeThis(cx, obj);
|
||||
|
||||
// If there's no private data, this must be the prototype, so ignore
|
||||
if (nsnull == a) {
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
if (JSVAL_IS_INT(id)) {
|
||||
nsresult rv;
|
||||
NS_WITH_SERVICE(nsIScriptSecurityManager, secMan,
|
||||
NS_SCRIPTSECURITYMANAGER_PROGID, &rv);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_SECMAN_ERR);
|
||||
}
|
||||
switch(JSVAL_TO_INT(id)) {
|
||||
case 0:
|
||||
default:
|
||||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// XULIFrameElement finalizer
|
||||
//
|
||||
PR_STATIC_CALLBACK(void)
|
||||
FinalizeXULIFrameElement(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
nsJSUtils::nsGenericFinalize(cx, obj);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// XULIFrameElement enumerate
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
EnumerateXULIFrameElement(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
return nsJSUtils::nsGenericEnumerate(cx, obj);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// XULIFrameElement resolve
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
ResolveXULIFrameElement(JSContext *cx, JSObject *obj, jsval id)
|
||||
{
|
||||
return nsJSUtils::nsGenericResolve(cx, obj, id);
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************/
|
||||
//
|
||||
// class for XULIFrameElement
|
||||
//
|
||||
JSClass XULIFrameElementClass = {
|
||||
"XULIFrameElement",
|
||||
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
|
||||
JS_PropertyStub,
|
||||
JS_PropertyStub,
|
||||
GetXULIFrameElementProperty,
|
||||
SetXULIFrameElementProperty,
|
||||
EnumerateXULIFrameElement,
|
||||
ResolveXULIFrameElement,
|
||||
JS_ConvertStub,
|
||||
FinalizeXULIFrameElement,
|
||||
nsnull,
|
||||
nsJSUtils::nsCheckAccess
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// XULIFrameElement class properties
|
||||
//
|
||||
static JSPropertySpec XULIFrameElementProperties[] =
|
||||
{
|
||||
{"docShell", XULIFRAMEELEMENT_DOCSHELL, JSPROP_ENUMERATE | JSPROP_READONLY},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// XULIFrameElement class methods
|
||||
//
|
||||
static JSFunctionSpec XULIFrameElementMethods[] =
|
||||
{
|
||||
{0}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// XULIFrameElement constructor
|
||||
//
|
||||
PR_STATIC_CALLBACK(JSBool)
|
||||
XULIFrameElement(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
{
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// XULIFrameElement class initialization
|
||||
//
|
||||
extern "C" NS_DOM nsresult NS_InitXULIFrameElementClass(nsIScriptContext *aContext, void **aPrototype)
|
||||
{
|
||||
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
|
||||
JSObject *proto = nsnull;
|
||||
JSObject *constructor = nsnull;
|
||||
JSObject *parent_proto = nsnull;
|
||||
JSObject *global = JS_GetGlobalObject(jscontext);
|
||||
jsval vp;
|
||||
|
||||
if ((PR_TRUE != JS_LookupProperty(jscontext, global, "XULIFrameElement", &vp)) ||
|
||||
!JSVAL_IS_OBJECT(vp) ||
|
||||
((constructor = JSVAL_TO_OBJECT(vp)) == nsnull) ||
|
||||
(PR_TRUE != JS_LookupProperty(jscontext, JSVAL_TO_OBJECT(vp), "prototype", &vp)) ||
|
||||
!JSVAL_IS_OBJECT(vp)) {
|
||||
|
||||
if (NS_OK != NS_InitXULElementClass(aContext, (void **)&parent_proto)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
proto = JS_InitClass(jscontext, // context
|
||||
global, // global object
|
||||
parent_proto, // parent proto
|
||||
&XULIFrameElementClass, // JSClass
|
||||
XULIFrameElement, // JSNative ctor
|
||||
0, // ctor args
|
||||
XULIFrameElementProperties, // proto props
|
||||
XULIFrameElementMethods, // proto funcs
|
||||
nsnull, // ctor props (static)
|
||||
nsnull); // ctor funcs (static)
|
||||
if (nsnull == proto) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
}
|
||||
else if ((nsnull != constructor) && JSVAL_IS_OBJECT(vp)) {
|
||||
proto = JSVAL_TO_OBJECT(vp);
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (aPrototype) {
|
||||
*aPrototype = proto;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Method for creating a new XULIFrameElement JavaScript object
|
||||
//
|
||||
extern "C" NS_DOM nsresult NS_NewScriptXULIFrameElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptXULIFrameElement");
|
||||
JSObject *proto;
|
||||
JSObject *parent;
|
||||
nsIScriptObjectOwner *owner;
|
||||
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
|
||||
nsresult result = NS_OK;
|
||||
nsIDOMXULIFrameElement *aXULIFrameElement;
|
||||
|
||||
if (nsnull == aParent) {
|
||||
parent = nsnull;
|
||||
}
|
||||
else if (NS_OK == aParent->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) {
|
||||
if (NS_OK != owner->GetScriptObject(aContext, (void **)&parent)) {
|
||||
NS_RELEASE(owner);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
NS_RELEASE(owner);
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (NS_OK != NS_InitXULIFrameElementClass(aContext, (void **)&proto)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
result = aSupports->QueryInterface(kIXULIFrameElementIID, (void **)&aXULIFrameElement);
|
||||
if (NS_OK != result) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// create a js object for this class
|
||||
*aReturn = JS_NewObject(jscontext, &XULIFrameElementClass, proto, parent);
|
||||
if (nsnull != *aReturn) {
|
||||
// connect the native object to the js object
|
||||
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aXULIFrameElement);
|
||||
}
|
||||
else {
|
||||
NS_RELEASE(aXULIFrameElement);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/* -*- 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):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Implementation methods for the XUL tree element APIs.
|
||||
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsXULBrowserElement.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsString.h"
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsXULBrowserElement, nsXULAggregateElement);
|
||||
NS_IMPL_RELEASE_INHERITED(nsXULBrowserElement, nsXULAggregateElement);
|
||||
|
||||
nsresult
|
||||
nsXULBrowserElement::QueryInterface(REFNSIID aIID, void** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsIDOMXULBrowserElement))) {
|
||||
*aResult = NS_STATIC_CAST(nsIDOMXULBrowserElement*, this);
|
||||
}
|
||||
else {
|
||||
return nsXULAggregateElement::QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
NS_ADDREF(NS_REINTERPRET_CAST(nsISupports*, *aResult));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
MOZ_DECL_CTOR_COUNTER(RDF_nsXULBrowserElement);
|
||||
|
||||
nsXULBrowserElement::nsXULBrowserElement(nsIDOMXULElement* aOuter)
|
||||
: nsXULAggregateElement(aOuter)
|
||||
{
|
||||
}
|
||||
|
||||
nsXULBrowserElement::~nsXULBrowserElement()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULBrowserElement::GetWebBrowser(nsIWebBrowser** aWebBrowser)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aWebBrowser);
|
||||
|
||||
NS_ERROR("Not Yet Implemented");
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
An aggregate object that implements the XUL tree widget APIs
|
||||
|
||||
*/
|
||||
|
||||
#ifndef nsXULBrowserElement_h__
|
||||
#define nsXULBrowserElement_h__
|
||||
|
||||
#include "nsXULElement.h"
|
||||
#include "nsIDOMXULBrowserElement.h"
|
||||
#include "nsIXULTreeContent.h"
|
||||
#include "nsRDFDOMNodeList.h"
|
||||
#include "nsIWebBrowser.h"
|
||||
|
||||
class nsXULBrowserElement : public nsXULAggregateElement,
|
||||
public nsIDOMXULBrowserElement
|
||||
{
|
||||
public:
|
||||
nsXULBrowserElement(nsIDOMXULElement* aOuter);
|
||||
~nsXULBrowserElement();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIDOMNode interface
|
||||
NS_FORWARD_IDOMNODE(mOuter->);
|
||||
|
||||
// nsIDOMElement interface
|
||||
NS_FORWARD_IDOMELEMENT(mOuter->);
|
||||
|
||||
// nsIDOMXULElement interface
|
||||
NS_FORWARD_IDOMXULELEMENT(mOuter->);
|
||||
|
||||
// nsIDOMXULBrowserElement interface
|
||||
NS_DECL_IDOMXULBROWSERELEMENT
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIWebBrowser> mWebBrowser;
|
||||
};
|
||||
|
||||
|
||||
#endif // nsXULBrowserElement_h__
|
|
@ -88,6 +88,8 @@
|
|||
#include "nsXPIDLString.h"
|
||||
#include "nsXULAttributes.h"
|
||||
#include "nsXULControllers.h"
|
||||
#include "nsXULIFrameElement.h"
|
||||
#include "nsXULBrowserElement.h"
|
||||
#include "nsXULEditorElement.h"
|
||||
#include "nsXULTreeElement.h"
|
||||
#include "nsXULPopupElement.h"
|
||||
|
@ -278,6 +280,8 @@ nsIAtom* nsXULElement::kTreeChildrenAtom;
|
|||
nsIAtom* nsXULElement::kTreeColAtom;
|
||||
nsIAtom* nsXULElement::kTreeItemAtom;
|
||||
nsIAtom* nsXULElement::kTreeRowAtom;
|
||||
nsIAtom* nsXULElement::kIFrameAtom;
|
||||
nsIAtom* nsXULElement::kBrowserAtom;
|
||||
nsIAtom* nsXULElement::kEditorAtom;
|
||||
nsIAtom* nsXULElement::kWindowAtom;
|
||||
nsIAtom* nsXULElement::kNullAtom;
|
||||
|
@ -340,6 +344,8 @@ nsXULElement::Init()
|
|||
kTreeColAtom = NS_NewAtom("treecol");
|
||||
kTreeItemAtom = NS_NewAtom("treeitem");
|
||||
kTreeRowAtom = NS_NewAtom("treerow");
|
||||
kIFrameAtom = NS_NewAtom("iframe");
|
||||
kBrowserAtom = NS_NewAtom("browser");
|
||||
kEditorAtom = NS_NewAtom("editor");
|
||||
kWindowAtom = NS_NewAtom("window");
|
||||
kNullAtom = NS_NewAtom("");
|
||||
|
@ -412,6 +418,8 @@ nsXULElement::~nsXULElement()
|
|||
NS_IF_RELEASE(kTreeColAtom);
|
||||
NS_IF_RELEASE(kTreeItemAtom);
|
||||
NS_IF_RELEASE(kTreeRowAtom);
|
||||
NS_IF_RELEASE(kIFrameAtom);
|
||||
NS_IF_RELEASE(kBrowserAtom);
|
||||
NS_IF_RELEASE(kEditorAtom);
|
||||
NS_IF_RELEASE(kWindowAtom);
|
||||
NS_IF_RELEASE(kNullAtom);
|
||||
|
@ -615,6 +623,34 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result)
|
|||
|
||||
return InnerXULElement()->QueryInterface(iid, result);
|
||||
}
|
||||
else if (iid.Equals(NS_GET_IID(nsIDOMXULIFrameElement)) &&
|
||||
(NameSpaceID() == kNameSpaceID_XUL) &&
|
||||
(Tag() == kIFrameAtom)) {
|
||||
// We delegate XULIFrameElement APIs to an aggregate object
|
||||
if (! InnerXULElement()) {
|
||||
rv = EnsureSlots();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if ((mSlots->mInnerXULElement = new nsXULIFrameElement(this)) == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return InnerXULElement()->QueryInterface(iid, result);
|
||||
}
|
||||
else if (iid.Equals(NS_GET_IID(nsIDOMXULBrowserElement)) &&
|
||||
(NameSpaceID() == kNameSpaceID_XUL) &&
|
||||
(Tag() == kBrowserAtom)) {
|
||||
// We delegate XULBrowserElement APIs to an aggregate object
|
||||
if (! InnerXULElement()) {
|
||||
rv = EnsureSlots();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if ((mSlots->mInnerXULElement = new nsXULBrowserElement(this)) == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return InnerXULElement()->QueryInterface(iid, result);
|
||||
}
|
||||
else if (iid.Equals(NS_GET_IID(nsIDOMXULEditorElement)) &&
|
||||
(NameSpaceID() == kNameSpaceID_XUL) &&
|
||||
(Tag() == kEditorAtom)) {
|
||||
|
@ -1641,6 +1677,14 @@ nsXULElement::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject)
|
|||
fn = NS_NewScriptXULTreeElement;
|
||||
rootname = "nsXULTreeElement::mScriptObject";
|
||||
}
|
||||
else if (Tag() == kIFrameAtom) {
|
||||
fn = NS_NewScriptXULIFrameElement;
|
||||
rootname = "nsXULIFrameElement::mScriptObject";
|
||||
}
|
||||
else if (Tag() == kBrowserAtom) {
|
||||
fn = NS_NewScriptXULBrowserElement;
|
||||
rootname = "nsXULBrowserElement::mScriptObject";
|
||||
}
|
||||
else if (Tag() == kEditorAtom) {
|
||||
fn = NS_NewScriptXULEditorElement;
|
||||
rootname = "nsXULEditorElement::mScriptObject";
|
||||
|
|
|
@ -347,6 +347,8 @@ protected:
|
|||
static nsIAtom* kTreeColAtom;
|
||||
static nsIAtom* kTreeItemAtom;
|
||||
static nsIAtom* kTreeRowAtom;
|
||||
static nsIAtom* kIFrameAtom;
|
||||
static nsIAtom* kBrowserAtom;
|
||||
static nsIAtom* kEditorAtom;
|
||||
static nsIAtom* kWindowAtom;
|
||||
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
/* -*- 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):
|
||||
* Pierre Phaneuf <pp@ludusdesign.com>
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Implementation methods for the XUL tree element APIs.
|
||||
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsXULIFrameElement.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsString.h"
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsXULIFrameElement, nsXULAggregateElement);
|
||||
NS_IMPL_RELEASE_INHERITED(nsXULIFrameElement, nsXULAggregateElement);
|
||||
|
||||
nsresult
|
||||
nsXULIFrameElement::QueryInterface(REFNSIID aIID, void** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsIDOMXULIFrameElement))) {
|
||||
*aResult = NS_STATIC_CAST(nsIDOMXULIFrameElement*, this);
|
||||
}
|
||||
else {
|
||||
return nsXULAggregateElement::QueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
NS_ADDREF(NS_REINTERPRET_CAST(nsISupports*, *aResult));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
MOZ_DECL_CTOR_COUNTER(RDF_nsXULIFrameElement);
|
||||
|
||||
nsXULIFrameElement::nsXULIFrameElement(nsIDOMXULElement* aOuter)
|
||||
: nsXULAggregateElement(aOuter)
|
||||
{
|
||||
}
|
||||
|
||||
nsXULIFrameElement::~nsXULIFrameElement()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULIFrameElement::GetDocShell(nsIDocShell** aDocShell)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aDocShell);
|
||||
|
||||
NS_ERROR("Not Yet Implemented");
|
||||
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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):
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
An aggregate object that implements the XUL tree widget APIs
|
||||
|
||||
*/
|
||||
|
||||
#ifndef nsXULIFrameElement_h__
|
||||
#define nsXULIFrameElement_h__
|
||||
|
||||
#include "nsXULElement.h"
|
||||
#include "nsIDOMXULIFrameElement.h"
|
||||
#include "nsIXULTreeContent.h"
|
||||
#include "nsRDFDOMNodeList.h"
|
||||
#include "nsIDocShell.h"
|
||||
|
||||
class nsXULIFrameElement : public nsXULAggregateElement,
|
||||
public nsIDOMXULIFrameElement
|
||||
{
|
||||
public:
|
||||
nsXULIFrameElement(nsIDOMXULElement* aOuter);
|
||||
~nsXULIFrameElement();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIDOMNode interface
|
||||
NS_FORWARD_IDOMNODE(mOuter->);
|
||||
|
||||
// nsIDOMElement interface
|
||||
NS_FORWARD_IDOMELEMENT(mOuter->);
|
||||
|
||||
// nsIDOMXULElement interface
|
||||
NS_FORWARD_IDOMXULELEMENT(mOuter->);
|
||||
|
||||
// nsIDOMXULIFrameElement interface
|
||||
NS_DECL_IDOMXULIFRAMEELEMENT
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIDocShell> mDocShell;
|
||||
};
|
||||
|
||||
|
||||
#endif // nsXULIFrameElement_h__
|
Загрузка…
Ссылка в новой задаче