Land TEMPLATE_19990726_BRANCH; RDF C++ content model builder exorcism.

This commit is contained in:
waterson%netscape.com 1999-07-27 17:20:28 +00:00
parent 0d5c0e85fe
commit 91a8ac09e7
92 changed files with 2457 additions and 6471 deletions

View File

@ -79,7 +79,6 @@
#include "nsIStyledContent.h"
#include "nsIStyleRule.h"
#include "nsIURL.h"
#include "nsXULTreeElement.h"
#include "rdfutil.h"
#include "prlog.h"
#include "rdf.h"
@ -317,8 +316,8 @@ private:
PRBool mContentsMustBeGenerated;
nsVoidArray* mBroadcastListeners; // [WEAK]
nsIDOMXULElement* mBroadcaster; // [OWNER]
nsXULElement* mInnerXULElement; // [OWNER]
nsIController* mController; // [OWNER]
nsCOMPtr<nsIRDFCompositeDataSource> mDatabase; // [OWNER]
};
@ -397,7 +396,6 @@ RDFElementImpl::RDFElementImpl(PRInt32 aNameSpaceID, nsIAtom* aTag)
mContentsMustBeGenerated(PR_FALSE),
mBroadcastListeners(nsnull),
mBroadcaster(nsnull),
mInnerXULElement(nsnull),
mController(nsnull)
{
NS_INIT_REFCNT();
@ -514,8 +512,6 @@ RDFElementImpl::~RDFElementImpl()
++entry;
}
}
delete mInnerXULElement;
}
@ -576,16 +572,6 @@ RDFElementImpl::QueryInterface(REFNSIID iid, void** result)
else if (iid.Equals(kIJSScriptObjectIID)) {
*result = NS_STATIC_CAST(nsIJSScriptObject*, this);
}
else if (iid.Equals(nsIDOMXULTreeElement::GetIID()) &&
(mNameSpaceID == kNameSpaceID_XUL) &&
(mTag == kTreeAtom)) {
if (! mInnerXULElement) {
if ((mInnerXULElement = new nsXULTreeElement(this)) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
}
return mInnerXULElement->QueryInterface(iid, result);
}
else {
*result = nsnull;
return NS_NOINTERFACE;
@ -1275,16 +1261,8 @@ RDFElementImpl::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject
if (! mScriptObject) {
nsIScriptGlobalObject *global = aContext->GetGlobalObject();
nsresult (*fn)(nsIScriptContext* aContext, nsISupports* aSupports, nsISupports* aParent, void** aReturn);
rv = NS_NewScriptXULElement(aContext, (nsIDOMXULElement*) this, global, (void**) &mScriptObject);
if (mTag == kTreeAtom) {
fn = NS_NewScriptXULTreeElement;
}
else {
fn = NS_NewScriptXULElement;
}
rv = fn(aContext, (nsIDOMXULElement*) this, global, (void**) &mScriptObject);
NS_RELEASE(global);
// Ensure that a reference exists to this element
@ -2532,6 +2510,36 @@ RDFElementImpl::GetResource(nsIRDFResource** aResource)
return NS_OK;
}
NS_IMETHODIMP
RDFElementImpl::GetDatabase(nsIRDFCompositeDataSource** aDatabase)
{
NS_PRECONDITION(aDatabase != nsnull, "null ptr");
if (! aDatabase)
return NS_ERROR_NULL_POINTER;
*aDatabase = mDatabase;
NS_IF_ADDREF(*aDatabase);
return NS_OK;
}
NS_IMETHODIMP
RDFElementImpl::SetDatabase(nsIRDFCompositeDataSource* aDatabase)
{
// XXX maybe someday you'll be allowed to change it.
NS_PRECONDITION(mDatabase == nsnull, "already initialized");
if (mDatabase)
return NS_ERROR_ALREADY_INITIALIZED;
mDatabase = aDatabase;
// XXX reconstruct the entire tree now!
return NS_OK;
}
////////////////////////////////////////////////////////////////////////
// Implementation methods

View File

@ -1,54 +0,0 @@
/* -*- 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.0 (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.
*/
#include "nsCOMPtr.h"
#include "nsIRDFCompositeDataSource.h"
#include "nsIServiceManager.h"
#include "nsRDFCID.h"
#include "nsXULTreeElement.h"
NS_IMPL_ISUPPORTS_INHERITED(nsXULTreeElement, nsXULElement, nsIDOMXULTreeElement);
NS_IMETHODIMP
nsXULTreeElement::GetDatabase(nsIRDFCompositeDataSource** aDatabase)
{
NS_PRECONDITION(aDatabase != nsnull, "null ptr");
if (! aDatabase)
return NS_ERROR_NULL_POINTER;
*aDatabase = mDatabase;
NS_IF_ADDREF(*aDatabase);
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeElement::SetDatabase(nsIRDFCompositeDataSource* aDatabase)
{
// XXX maybe someday you'll be allowed to change it.
NS_PRECONDITION(mDatabase == nsnull, "already initialized");
if (mDatabase)
return NS_ERROR_ALREADY_INITIALIZED;
mDatabase = aDatabase;
// XXX reconstruct the entire tree now!
return NS_OK;
}

View File

@ -1,55 +0,0 @@
/* -*- 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.0 (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.
*/
#ifndef nsXULTreeElement_h__
#define nsXULTreeElement_h__
#include "nsXULElement.h"
#include "nsIDOMXULTreeElement.h"
#include "nsIRDFCompositeDataSource.h"
class nsXULTreeElement : public nsXULElement,
public nsIDOMXULTreeElement
{
private:
nsCOMPtr<nsIRDFCompositeDataSource> mDatabase;
public:
nsXULTreeElement(nsIDOMXULElement* aOuter)
: nsXULElement(aOuter)
{
}
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode interface
NS_FORWARD_IDOMNODE(mOuter->);
// nsIDOMElement interface
NS_FORWARD_IDOMELEMENT(mOuter->);
// nsIDOMXULElement interface
NS_FORWARD_IDOMXULELEMENT(mOuter->);
// nsIDOMXULTreeElement interface
NS_DECL_IDOMXULTREEELEMENT
};
#endif // nsXULTreeElement_h__

View File

@ -2746,6 +2746,17 @@ XULDocumentImpl::CreateElement(const nsString& aTagName, nsIDOMElement** aReturn
nsresult rv;
#ifdef PR_LOGGING
if (PR_LOG_TEST(gXULLog, PR_LOG_DEBUG)) {
char* tagCStr = aTagName.ToNewCString();
PR_LOG(gXULLog, PR_LOG_DEBUG,
("xul[CreateElement] %s", tagCStr));
delete[] tagCStr;
}
#endif
nsCOMPtr<nsIAtom> name;
PRInt32 nameSpaceID;
@ -2925,6 +2936,19 @@ XULDocumentImpl::CreateElementWithNameSpace(const nsString& aTagName,
nsresult rv;
#ifdef PR_LOGGING
if (PR_LOG_TEST(gXULLog, PR_LOG_DEBUG)) {
char* namespaceCStr = aNameSpace.ToNewCString();
char* tagCStr = aTagName.ToNewCString();
PR_LOG(gXULLog, PR_LOG_DEBUG,
("xul[CreateElementWithNameSpace] [%s]:%s", namespaceCStr, tagCStr));
delete[] tagCStr;
delete[] namespaceCStr;
}
#endif
nsCOMPtr<nsIAtom> name = dont_AddRef(NS_NewAtom(aTagName.GetUnicode()));
if (! name)
return NS_ERROR_OUT_OF_MEMORY;
@ -3005,12 +3029,12 @@ XULDocumentImpl::GetElementById(const nsString& aId, nsIDOMElement** aReturn)
nsresult rv;
nsAutoString uri;
nsCAutoString uri;
rv = nsRDFContentUtils::MakeElementURI(this, aId, uri);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIRDFResource> resource;
if (NS_FAILED(rv = gRDFService->GetUnicodeResource(uri.GetUnicode(), getter_AddRefs(resource)))) {
if (NS_FAILED(rv = gRDFService->GetResource(uri, getter_AddRefs(resource)))) {
NS_ERROR("unable to get resource");
return rv;
}
@ -3209,15 +3233,14 @@ XULDocumentImpl::CreatePopupDocument(nsIContent* aPopupElement, nsIDocument** aR
nsCOMPtr<nsIDOMElement> domRoot = do_QueryInterface(aPopupElement);
domRoot->GetAttribute("id", idValue);
nsAutoString uri;
nsCAutoString uri;
rv = nsRDFContentUtils::MakeElementURI(this, idValue, uri);
if (NS_FAILED(rv)) return rv;
// Use the absolute URL to retrieve a resource from the RDF
// service that corresponds to the root content.
nsCOMPtr<nsIRDFResource> rootResource;
if (NS_FAILED(rv = gRDFService->GetUnicodeResource(uri.GetUnicode(),
getter_AddRefs(rootResource)))) {
if (NS_FAILED(rv = gRDFService->GetResource(uri, getter_AddRefs(rootResource)))) {
NS_ERROR("Uh-oh. Couldn't obtain the resource for the popup doc root.");
return rv;
}

View File

@ -82,7 +82,6 @@
#include "nsIRDFService.h"
#include "rdf.h"
#include "nsIDOMXULTreeElement.h"
#include "nsIDOMXULElement.h"
#include "nsILocale.h"
@ -112,7 +111,6 @@ static NS_DEFINE_IID(kIRDFServiceIID, NS_IRDFSERVICE_IID);
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
static NS_DEFINE_IID(kIRDFLiteralIID, NS_IRDFLITERAL_IID);
static NS_DEFINE_IID(kIDomXulTreeElementIID, NS_IDOMXULTREEELEMENT_IID);
static NS_DEFINE_IID(kIDomXulElementIID, NS_IDOMXULELEMENT_IID);
static NS_DEFINE_CID(kCollationFactoryCID, NS_COLLATIONFACTORY_CID);
@ -1292,7 +1290,7 @@ XULSortServiceImpl::InsertContainerNode(nsIContent *container, nsIContent *node)
if (NS_FAILED(rv = FindTreeElement(container, getter_AddRefs(treeNode)))) return(rv);
// get composite db for tree
nsCOMPtr<nsIDOMXULTreeElement> domXulTree;
nsCOMPtr<nsIDOMXULElement> domXulTree;
sortInfo.rdfService = gRDFService;
sortInfo.db = nsnull;
@ -1300,7 +1298,7 @@ XULSortServiceImpl::InsertContainerNode(nsIContent *container, nsIContent *node)
// that we're sure that we'll hold a reference to it (and actually
// release that reference when the stack frame goes away).
nsCOMPtr<nsIRDFCompositeDataSource> cds;
rv = treeNode->QueryInterface(kIDomXulTreeElementIID, getter_AddRefs(domXulTree));
rv = treeNode->QueryInterface(kIDomXulElementIID, getter_AddRefs(domXulTree));
if (NS_SUCCEEDED(rv))
{
if (NS_SUCCEEDED(rv = domXulTree->GetDatabase(getter_AddRefs(cds))))
@ -1488,7 +1486,7 @@ XULSortServiceImpl::DoSort(nsIDOMNode* node, const nsString& sortResource,
// get composite db for tree
sortInfo.rdfService = gRDFService;
sortInfo.db = nsnull;
nsCOMPtr<nsIDOMXULTreeElement> domXulTree = do_QueryInterface(treeNode);
nsCOMPtr<nsIDOMXULElement> domXulTree = do_QueryInterface(treeNode);
if (!domXulTree) return(NS_ERROR_FAILURE);
nsCOMPtr<nsIRDFCompositeDataSource> cds;
if (NS_SUCCEEDED(rv = domXulTree->GetDatabase(getter_AddRefs(cds))))

File diff suppressed because it is too large Load Diff

View File

@ -2,16 +2,16 @@ interface XULElement : Element {
/* IID: { 0x574ed81, 0xc088, 0x11d2, \
{ 0x96, 0xed, 0x0, 0x10, 0x4b, 0x7b, 0x7d, 0xeb } } */
readonly attribute xpidl nsIRDFResource resource;
attribute xpidl nsIController controller;
attribute DOMString id;
attribute DOMString className;
readonly attribute CSSStyleDeclaration style;
attribute xpidl nsIRDFCompositeDataSource database;
readonly attribute xpidl nsIRDFResource resource;
attribute xpidl nsIController controller;
attribute DOMString id;
attribute DOMString className;
readonly attribute CSSStyleDeclaration style;
void addBroadcastListener(in DOMString attr, in Element element);
void removeBroadcastListener(in DOMString attr, in Element element);
void doCommand();
void addBroadcastListener(in DOMString attr, in Element element);
void removeBroadcastListener(in DOMString attr, in Element element);
void doCommand();
NodeList getElementsByAttribute(in DOMString name, in DOMString value);
NodeList getElementsByAttribute(in DOMString name, in DOMString value);
};

View File

@ -1,5 +0,0 @@
interface XULTreeElement : XULElement {
/* IID: { 0xa6cf90ec, 0x15b3, 0x11d2, \
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} } */
attribute xpidl nsIRDFCompositeDataSource database;
};

View File

@ -28,6 +28,7 @@
class nsIController;
class nsIDOMElement;
class nsIDOMCSSStyleDeclaration;
class nsIRDFCompositeDataSource;
class nsIRDFResource;
class nsIDOMNodeList;
@ -39,11 +40,6 @@ class nsIDOMXULElement : public nsIDOMElement {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMXULELEMENT_IID; return iid; }
NS_IMETHOD GetResource(nsIRDFResource** aResource)=0;
NS_IMETHOD GetController(nsIController** aController)=0;
NS_IMETHOD SetController(nsIController* aController)=0;
NS_IMETHOD GetId(nsString& aId)=0;
NS_IMETHOD SetId(const nsString& aId)=0;
@ -52,6 +48,14 @@ public:
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle)=0;
NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase)=0;
NS_IMETHOD SetDatabase(nsIRDFCompositeDataSource* aDatabase)=0;
NS_IMETHOD GetResource(nsIRDFResource** aResource)=0;
NS_IMETHOD GetController(nsIController** aController)=0;
NS_IMETHOD SetController(nsIController* aController)=0;
NS_IMETHOD AddBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement)=0;
NS_IMETHOD RemoveBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement)=0;
@ -63,14 +67,16 @@ public:
#define NS_DECL_IDOMXULELEMENT \
NS_IMETHOD GetResource(nsIRDFResource** aResource); \
NS_IMETHOD GetController(nsIController** aController); \
NS_IMETHOD SetController(nsIController* aController); \
NS_IMETHOD GetId(nsString& aId); \
NS_IMETHOD SetId(const nsString& aId); \
NS_IMETHOD GetClassName(nsString& aClassName); \
NS_IMETHOD SetClassName(const nsString& aClassName); \
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle); \
NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase); \
NS_IMETHOD SetDatabase(nsIRDFCompositeDataSource* aDatabase); \
NS_IMETHOD GetResource(nsIRDFResource** aResource); \
NS_IMETHOD GetController(nsIController** aController); \
NS_IMETHOD SetController(nsIController* aController); \
NS_IMETHOD AddBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement); \
NS_IMETHOD RemoveBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement); \
NS_IMETHOD DoCommand(); \
@ -79,14 +85,16 @@ public:
#define NS_FORWARD_IDOMXULELEMENT(_to) \
NS_IMETHOD GetResource(nsIRDFResource** aResource) { return _to GetResource(aResource); } \
NS_IMETHOD GetController(nsIController** aController) { return _to GetController(aController); } \
NS_IMETHOD SetController(nsIController* aController) { return _to SetController(aController); } \
NS_IMETHOD GetId(nsString& aId) { return _to GetId(aId); } \
NS_IMETHOD SetId(const nsString& aId) { return _to SetId(aId); } \
NS_IMETHOD GetClassName(nsString& aClassName) { return _to GetClassName(aClassName); } \
NS_IMETHOD SetClassName(const nsString& aClassName) { return _to SetClassName(aClassName); } \
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle) { return _to GetStyle(aStyle); } \
NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase) { return _to GetDatabase(aDatabase); } \
NS_IMETHOD SetDatabase(nsIRDFCompositeDataSource* aDatabase) { return _to SetDatabase(aDatabase); } \
NS_IMETHOD GetResource(nsIRDFResource** aResource) { return _to GetResource(aResource); } \
NS_IMETHOD GetController(nsIController** aController) { return _to GetController(aController); } \
NS_IMETHOD SetController(nsIController* aController) { return _to SetController(aController); } \
NS_IMETHOD AddBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement) { return _to AddBroadcastListener(aAttr, aElement); } \
NS_IMETHOD RemoveBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement) { return _to RemoveBroadcastListener(aAttr, aElement); } \
NS_IMETHOD DoCommand() { return _to DoCommand(); } \

View File

@ -1,58 +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.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#ifndef nsIDOMXULTreeElement_h__
#define nsIDOMXULTreeElement_h__
#include "nsISupports.h"
#include "nsString.h"
#include "nsIScriptContext.h"
#include "nsIDOMXULElement.h"
class nsIRDFCompositeDataSource;
#define NS_IDOMXULTREEELEMENT_IID \
{ 0xa6cf90ec, 0x15b3, 0x11d2, \
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
class nsIDOMXULTreeElement : public nsIDOMXULElement {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMXULTREEELEMENT_IID; return iid; }
NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase)=0;
NS_IMETHOD SetDatabase(nsIRDFCompositeDataSource* aDatabase)=0;
};
#define NS_DECL_IDOMXULTREEELEMENT \
NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase); \
NS_IMETHOD SetDatabase(nsIRDFCompositeDataSource* aDatabase); \
#define NS_FORWARD_IDOMXULTREEELEMENT(_to) \
NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase) { return _to GetDatabase(aDatabase); } \
NS_IMETHOD SetDatabase(nsIRDFCompositeDataSource* aDatabase) { return _to SetDatabase(aDatabase); } \
extern "C" NS_DOM nsresult NS_InitXULTreeElementClass(nsIScriptContext *aContext, void **aPrototype);
extern "C" NS_DOM nsresult NS_NewScriptXULTreeElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
#endif // nsIDOMXULTreeElement_h__

View File

@ -51,11 +51,8 @@ NS_DEF_PTR(nsIDOMNodeList);
//
enum XULDocument_slots {
XULDOCUMENT_POPUPELEMENT = -1,
XULDOCUMENT_TOOLTIPELEMENT = -2,
XULDOCUMENT_FOCUS = -3
};
/***********************************************************************/
@ -67,86 +64,45 @@ GetXULDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULDocument *a = (nsIDOMXULDocument*)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)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
PRBool ok = PR_FALSE;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE;
}
switch(JSVAL_TO_INT(id)) {
case XULDOCUMENT_POPUPELEMENT:
{
secMan->CheckScriptAccess(scriptCX, obj, "xuldocument.popupelement", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIDOMElement* prop;
if (NS_OK == a->GetPopupElement(&prop)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, vp);
}
else {
return JS_FALSE;
}
break;
}
case XULDOCUMENT_TOOLTIPELEMENT:
{
secMan->CheckScriptAccess(scriptCX, obj, "xuldocument.tooltipelement", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIDOMElement* prop;
if (NS_OK == a->GetTooltipElement(&prop)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, vp);
}
@ -193,100 +149,52 @@ SetXULDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULDocument *a = (nsIDOMXULDocument*)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)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
PRBool ok = PR_FALSE;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE;
}
switch(JSVAL_TO_INT(id)) {
case XULDOCUMENT_POPUPELEMENT:
{
secMan->CheckScriptAccess(scriptCX, obj, "xuldocument.popupelement", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIDOMElement* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
kIElementIID, "Element",
cx, *vp)) {
return JS_FALSE;
}
a->SetPopupElement(prop);
NS_IF_RELEASE(prop);
break;
}
case XULDOCUMENT_TOOLTIPELEMENT:
{
secMan->CheckScriptAccess(scriptCX, obj, "xuldocument.tooltipelement", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIDOMElement* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
kIElementIID, "Element",
cx, *vp)) {
return JS_FALSE;
}
a->SetTooltipElement(prop);
NS_IF_RELEASE(prop);
break;
}
@ -340,8 +248,6 @@ PR_STATIC_CALLBACK(JSBool)
XULDocumentGetElementById(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMXULDocument *nativeThis = (nsIDOMXULDocument*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMElement* nativeRet;
nsAutoString b0;
@ -393,8 +299,6 @@ PR_STATIC_CALLBACK(JSBool)
XULDocumentGetElementsByAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMXULDocument *nativeThis = (nsIDOMXULDocument*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMNodeList* nativeRet;
nsAutoString b0;
nsAutoString b1;
@ -466,9 +370,7 @@ JSClass XULDocumentClass = {
static JSPropertySpec XULDocumentProperties[] =
{
{"popupElement", XULDOCUMENT_POPUPELEMENT, JSPROP_ENUMERATE},
{"tooltipElement", XULDOCUMENT_TOOLTIPELEMENT, JSPROP_ENUMERATE},
{"focus", XULDOCUMENT_FOCUS, JSPROP_ENUMERATE | JSPROP_READONLY},
{0}
};

View File

@ -30,6 +30,7 @@
#include "nsIController.h"
#include "nsIDOMElement.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsIRDFCompositeDataSource.h"
#include "nsIDOMXULElement.h"
#include "nsIRDFResource.h"
#include "nsIDOMNodeList.h"
@ -41,6 +42,7 @@ static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
static NS_DEFINE_IID(kIControllerIID, NS_ICONTROLLER_IID);
static NS_DEFINE_IID(kIElementIID, NS_IDOMELEMENT_IID);
static NS_DEFINE_IID(kICSSStyleDeclarationIID, NS_IDOMCSSSTYLEDECLARATION_IID);
static NS_DEFINE_IID(kIRDFCompositeDataSourceIID, NS_IRDFCOMPOSITEDATASOURCE_IID);
static NS_DEFINE_IID(kIXULElementIID, NS_IDOMXULELEMENT_IID);
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
static NS_DEFINE_IID(kINodeListIID, NS_IDOMNODELIST_IID);
@ -48,6 +50,7 @@ static NS_DEFINE_IID(kINodeListIID, NS_IDOMNODELIST_IID);
NS_DEF_PTR(nsIController);
NS_DEF_PTR(nsIDOMElement);
NS_DEF_PTR(nsIDOMCSSStyleDeclaration);
NS_DEF_PTR(nsIRDFCompositeDataSource);
NS_DEF_PTR(nsIDOMXULElement);
NS_DEF_PTR(nsIRDFResource);
NS_DEF_PTR(nsIDOMNodeList);
@ -56,11 +59,12 @@ NS_DEF_PTR(nsIDOMNodeList);
// XULElement property ids
//
enum XULElement_slots {
XULELEMENT_RESOURCE = -1,
XULELEMENT_CONTROLLER = -2,
XULELEMENT_ID = -3,
XULELEMENT_CLASSNAME = -4,
XULELEMENT_STYLE = -5
XULELEMENT_ID = -1,
XULELEMENT_CLASSNAME = -2,
XULELEMENT_STYLE = -3,
XULELEMENT_DATABASE = -4,
XULELEMENT_RESOURCE = -5,
XULELEMENT_CONTROLLER = -6
};
/***********************************************************************/
@ -70,7 +74,7 @@ enum XULElement_slots {
PR_STATIC_CALLBACK(JSBool)
GetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULElement *a = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
nsIDOMXULElement *a = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
@ -80,45 +84,11 @@ GetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (JSVAL_IS_INT(id)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
PRBool ok;
PRBool ok = PR_FALSE;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE;
}
switch(JSVAL_TO_INT(id)) {
case XULELEMENT_RESOURCE:
{
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.resource", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIRDFResource* prop;
if (NS_OK == a->GetResource(&prop)) {
// get the js object; n.b., this will do a release on 'prop'
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIRDFResource::GetIID(), cx, vp);
}
else {
return JS_FALSE;
}
break;
}
case XULELEMENT_CONTROLLER:
{
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.controller", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIController* prop;
if (NS_OK == a->GetController(&prop)) {
// get the js object; n.b., this will do a release on 'prop'
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIController::GetIID(), cx, vp);
}
else {
return JS_FALSE;
}
break;
}
case XULELEMENT_ID:
{
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.id", &ok);
@ -168,6 +138,57 @@ GetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case XULELEMENT_DATABASE:
{
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.database", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIRDFCompositeDataSource* prop;
if (NS_OK == a->GetDatabase(&prop)) {
// get the js object; n.b., this will do a release on 'prop'
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIRDFCompositeDataSource::GetIID(), cx, vp);
}
else {
return JS_FALSE;
}
break;
}
case XULELEMENT_RESOURCE:
{
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.resource", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIRDFResource* prop;
if (NS_OK == a->GetResource(&prop)) {
// get the js object; n.b., this will do a release on 'prop'
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIRDFResource::GetIID(), cx, vp);
}
else {
return JS_FALSE;
}
break;
}
case XULELEMENT_CONTROLLER:
{
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.controller", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIController* prop;
if (NS_OK == a->GetController(&prop)) {
// get the js object; n.b., this will do a release on 'prop'
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIController::GetIID(), cx, vp);
}
else {
return JS_FALSE;
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
}
@ -187,7 +208,7 @@ GetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
PR_STATIC_CALLBACK(JSBool)
SetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULElement *a = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
nsIDOMXULElement *a = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
@ -197,28 +218,11 @@ SetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (JSVAL_IS_INT(id)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
PRBool ok;
PRBool ok = PR_FALSE;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE;
}
switch(JSVAL_TO_INT(id)) {
case XULELEMENT_CONTROLLER:
{
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.controller", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIController* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToXPCObject((nsISupports **) &prop,
kIControllerIID, cx, *vp)) {
return JS_FALSE;
}
a->SetController(prop);
NS_IF_RELEASE(prop);
break;
}
case XULELEMENT_ID:
{
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.id", &ok);
@ -247,6 +251,40 @@ SetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
break;
}
case XULELEMENT_DATABASE:
{
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.database", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIRDFCompositeDataSource* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToXPCObject((nsISupports **) &prop,
kIRDFCompositeDataSourceIID, cx, *vp)) {
return JS_FALSE;
}
a->SetDatabase(prop);
NS_IF_RELEASE(prop);
break;
}
case XULELEMENT_CONTROLLER:
{
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.controller", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIController* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToXPCObject((nsISupports **) &prop,
kIControllerIID, cx, *vp)) {
return JS_FALSE;
}
a->SetController(prop);
NS_IF_RELEASE(prop);
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
}
@ -296,8 +334,7 @@ ResolveXULElement(JSContext *cx, JSObject *obj, jsval id)
PR_STATIC_CALLBACK(JSBool)
XULElementAddBroadcastListener(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
nsAutoString b0;
nsIDOMElementPtr b1;
@ -356,8 +393,7 @@ XULElementAddBroadcastListener(JSContext *cx, JSObject *obj, uintN argc, jsval *
PR_STATIC_CALLBACK(JSBool)
XULElementRemoveBroadcastListener(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
nsAutoString b0;
nsIDOMElementPtr b1;
@ -416,8 +452,7 @@ XULElementRemoveBroadcastListener(JSContext *cx, JSObject *obj, uintN argc, jsva
PR_STATIC_CALLBACK(JSBool)
XULElementDoCommand(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
*rval = JSVAL_NULL;
@ -464,8 +499,7 @@ XULElementDoCommand(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
PR_STATIC_CALLBACK(JSBool)
XULElementGetElementsByAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
nsIDOMNodeList* nativeRet;
nsAutoString b0;
nsAutoString b1;
@ -536,11 +570,12 @@ JSClass XULElementClass = {
//
static JSPropertySpec XULElementProperties[] =
{
{"resource", XULELEMENT_RESOURCE, JSPROP_ENUMERATE | JSPROP_READONLY},
{"controller", XULELEMENT_CONTROLLER, JSPROP_ENUMERATE},
{"id", XULELEMENT_ID, JSPROP_ENUMERATE},
{"className", XULELEMENT_CLASSNAME, JSPROP_ENUMERATE},
{"style", XULELEMENT_STYLE, JSPROP_ENUMERATE | JSPROP_READONLY},
{"database", XULELEMENT_DATABASE, JSPROP_ENUMERATE},
{"resource", XULELEMENT_RESOURCE, JSPROP_ENUMERATE | JSPROP_READONLY},
{"controller", XULELEMENT_CONTROLLER, JSPROP_ENUMERATE},
{0}
};

View File

@ -1,328 +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.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#include "jsapi.h"
#include "nsJSUtils.h"
#include "nscore.h"
#include "nsIScriptContext.h"
#include "nsIScriptSecurityManager.h"
#include "nsIJSScriptObject.h"
#include "nsIScriptObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsIPtr.h"
#include "nsString.h"
#include "nsIRDFCompositeDataSource.h"
#include "nsIDOMXULTreeElement.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(kIRDFCompositeDataSourceIID, NS_IRDFCOMPOSITEDATASOURCE_IID);
static NS_DEFINE_IID(kIXULTreeElementIID, NS_IDOMXULTREEELEMENT_IID);
NS_DEF_PTR(nsIRDFCompositeDataSource);
NS_DEF_PTR(nsIDOMXULTreeElement);
//
// XULTreeElement property ids
//
enum XULTreeElement_slots {
XULTREEELEMENT_DATABASE = -1
};
/***********************************************************************/
//
// XULTreeElement Properties Getter
//
PR_STATIC_CALLBACK(JSBool)
GetXULTreeElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULTreeElement *a = (nsIDOMXULTreeElement*)JS_GetPrivate(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)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
PRBool ok;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE;
}
switch(JSVAL_TO_INT(id)) {
case XULTREEELEMENT_DATABASE:
{
secMan->CheckScriptAccess(scriptCX, obj, "xultreeelement.database", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIRDFCompositeDataSource* prop;
if (NS_OK == a->GetDatabase(&prop)) {
// get the js object; n.b., this will do a release on 'prop'
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIRDFCompositeDataSource::GetIID(), cx, vp);
}
else {
return JS_FALSE;
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
}
NS_RELEASE(secMan);
}
else {
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
}
return PR_TRUE;
}
/***********************************************************************/
//
// XULTreeElement Properties Setter
//
PR_STATIC_CALLBACK(JSBool)
SetXULTreeElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULTreeElement *a = (nsIDOMXULTreeElement*)JS_GetPrivate(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)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
PRBool ok;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE;
}
switch(JSVAL_TO_INT(id)) {
case XULTREEELEMENT_DATABASE:
{
secMan->CheckScriptAccess(scriptCX, obj, "xultreeelement.database", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIRDFCompositeDataSource* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToXPCObject((nsISupports **) &prop,
kIRDFCompositeDataSourceIID, cx, *vp)) {
return JS_FALSE;
}
a->SetDatabase(prop);
NS_IF_RELEASE(prop);
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
}
NS_RELEASE(secMan);
}
else {
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
}
return PR_TRUE;
}
//
// XULTreeElement finalizer
//
PR_STATIC_CALLBACK(void)
FinalizeXULTreeElement(JSContext *cx, JSObject *obj)
{
nsJSUtils::nsGenericFinalize(cx, obj);
}
//
// XULTreeElement enumerate
//
PR_STATIC_CALLBACK(JSBool)
EnumerateXULTreeElement(JSContext *cx, JSObject *obj)
{
return nsJSUtils::nsGenericEnumerate(cx, obj);
}
//
// XULTreeElement resolve
//
PR_STATIC_CALLBACK(JSBool)
ResolveXULTreeElement(JSContext *cx, JSObject *obj, jsval id)
{
return nsJSUtils::nsGenericResolve(cx, obj, id);
}
/***********************************************************************/
//
// class for XULTreeElement
//
JSClass XULTreeElementClass = {
"XULTreeElement",
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
JS_PropertyStub,
JS_PropertyStub,
GetXULTreeElementProperty,
SetXULTreeElementProperty,
EnumerateXULTreeElement,
ResolveXULTreeElement,
JS_ConvertStub,
FinalizeXULTreeElement
};
//
// XULTreeElement class properties
//
static JSPropertySpec XULTreeElementProperties[] =
{
{"database", XULTREEELEMENT_DATABASE, JSPROP_ENUMERATE},
{0}
};
//
// XULTreeElement class methods
//
static JSFunctionSpec XULTreeElementMethods[] =
{
{0}
};
//
// XULTreeElement constructor
//
PR_STATIC_CALLBACK(JSBool)
XULTreeElement(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
return JS_FALSE;
}
//
// XULTreeElement class initialization
//
extern "C" NS_DOM nsresult NS_InitXULTreeElementClass(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, "XULTreeElement", &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
&XULTreeElementClass, // JSClass
XULTreeElement, // JSNative ctor
0, // ctor args
XULTreeElementProperties, // proto props
XULTreeElementMethods, // 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 XULTreeElement JavaScript object
//
extern "C" NS_DOM nsresult NS_NewScriptXULTreeElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
{
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptXULTreeElement");
JSObject *proto;
JSObject *parent;
nsIScriptObjectOwner *owner;
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
nsresult result = NS_OK;
nsIDOMXULTreeElement *aXULTreeElement;
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_InitXULTreeElementClass(aContext, (void **)&proto)) {
return NS_ERROR_FAILURE;
}
result = aSupports->QueryInterface(kIXULTreeElementIID, (void **)&aXULTreeElement);
if (NS_OK != result) {
return result;
}
// create a js object for this class
*aReturn = JS_NewObject(jscontext, &XULTreeElementClass, proto, parent);
if (nsnull != *aReturn) {
// connect the native object to the js object
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aXULTreeElement);
}
else {
NS_RELEASE(aXULTreeElement);
return NS_ERROR_FAILURE;
}
return NS_OK;
}

View File

@ -24,15 +24,14 @@
%{C++
#include "nsIDOMNodeList.h"
#include "nsIDOMXULTreeElement.h"
#include "nsIDOMXULElement.h"
%}
[scriptable, uuid(D60B84F1-2A8C-11d3-9E07-00A0C92B5F0D)]
interface nsIAddressBook : nsISupports {
void DeleteCards(in nsIDOMXULTreeElement tree, in nsIDOMXULElement srcDir, in nsIDOMNodeList node);
void DeleteCards(in nsIDOMXULElement tree, in nsIDOMXULElement srcDir, in nsIDOMNodeList node);
void NewAddressBook(in nsIRDFCompositeDataSource db, in nsIDOMXULElement srcDir, in string name);
void DeleteAddressBook(in nsIDOMXULTreeElement tree, in nsIDOMXULElement srcDir, in nsIDOMNodeList node);
void DeleteAddressBook(in nsIDOMXULElement tree, in nsIDOMXULElement srcDir, in nsIDOMNodeList node);
};

View File

@ -9,11 +9,5 @@ function ChangeDirectoryByURI(uri)
{
var tree = top.window.frames[0].frames[1].document.getElementById('resultTree');
//dump("tree = " + tree + "\n");
var treechildrenList = tree.getElementsByTagName('treechildren');
if ( treechildrenList.length == 1 )
{
var body = treechildrenList[0];
body.setAttribute('id', uri);// body no longer valid after setting id.
}
tree.setAttribute('ref', uri);// body no longer valid after setting id.
}

View File

@ -18,7 +18,8 @@
<tree class="abDirectory" rdf:datasources="rdf:addressdirectory" id="dirTree" onclick="return ChangeDirectoryByDOMNode(event.target.parentNode.parentNode)">
<template>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<rule>
<treechildren>
<treeitem uri="...">
<treerow >
<treecell>
@ -27,6 +28,7 @@
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>

View File

@ -23,7 +23,8 @@
rdf:containment="http://home.netscape.com/NC-rdf#CardChild">
<template>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<rule>
<treechildren>
<treeitem uri="...">
<treerow >
<treecell>
@ -38,6 +39,7 @@
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>

View File

@ -121,13 +121,7 @@ function saChangeDirectoryByURI(uri)
{
var tree = frames["resultsFrame"].document.getElementById('resultTree');
//dump("tree = " + tree + "\n");
var treechildrenList = tree.getElementsByTagName('treechildren');
if ( treechildrenList.length == 1 )
{
var body = treechildrenList[0];
body.setAttribute('id', uri);// body no longer valid after setting id.
}
tree.setAttribute('ref', uri);// body no longer valid after setting id.
}

View File

@ -93,6 +93,16 @@ Rights Reserved.
<tree id="dirTree" class="abDirectory" flex="100%"
rdf:datasources="rdf:addressdirectory"
onclick="return saChangeDirectoryByDOMNode(event.target.parentNode.parentNode)">
<template>
<treechildren>
<treeitem uri="...">
<treerow>
<treecell><text value="http://home.netscape.com/NC-rdf#DirName" /></treecell>
</treerow>
</treeitem>
</treechildren>
</template>
<treecol style="width:100%" rdf:resource="http://home.netscape.com/NC-rdf#DirName" />
<treehead>
<treerow>

View File

@ -27,7 +27,7 @@
#include "prprf.h"
#include "nsCOMPtr.h"
#include "nsIDOMXULTreeElement.h"
#include "nsIDOMXULElement.h"
#include "nsIRDFCompositeDataSource.h"
#include "nsIRDFResource.h"
#include "nsIRDFService.h"
@ -55,7 +55,7 @@ static nsresult ConvertDOMListToResourceArray(nsIDOMNodeList *nodeList, nsISuppo
nsresult rv = NS_OK;
PRUint32 listLength;
nsIDOMNode *node;
nsIDOMXULTreeElement *xulElement;
nsIDOMXULElement *xulElement;
nsIRDFResource *resource;
if(!resourceArray)
@ -109,7 +109,7 @@ NS_IMPL_ISUPPORTS(nsAddressBook, nsIAddressBook::GetIID());
//
NS_IMETHODIMP nsAddressBook::DeleteCards
(nsIDOMXULTreeElement *tree, nsIDOMXULElement *srcDirectory, nsIDOMNodeList *nodeList)
(nsIDOMXULElement *tree, nsIDOMXULElement *srcDirectory, nsIDOMNodeList *nodeList)
{
nsresult rv;
@ -206,7 +206,7 @@ NS_IMETHODIMP nsAddressBook::NewAddressBook
}
NS_IMETHODIMP nsAddressBook::DeleteAddressBook
(nsIDOMXULTreeElement *tree, nsIDOMXULElement *srcDirectory, nsIDOMNodeList *nodeList)
(nsIDOMXULElement *tree, nsIDOMXULElement *srcDirectory, nsIDOMNodeList *nodeList)
{
nsresult rv;

View File

@ -39,9 +39,9 @@ public:
NS_DECL_ISUPPORTS
// nsIAddressBook
NS_IMETHOD DeleteCards(nsIDOMXULTreeElement *tree, nsIDOMXULElement *srcDirectory, nsIDOMNodeList *nodeList);
NS_IMETHOD DeleteCards(nsIDOMXULElement *tree, nsIDOMXULElement *srcDirectory, nsIDOMNodeList *nodeList);
NS_IMETHOD NewAddressBook(nsIRDFCompositeDataSource* db, nsIDOMXULElement *srcDirectory, const char *name);
NS_IMETHOD DeleteAddressBook(nsIDOMXULTreeElement *tree, nsIDOMXULElement *srcDirectory, nsIDOMNodeList *nodeList);
NS_IMETHOD DeleteAddressBook(nsIDOMXULElement *tree, nsIDOMXULElement *srcDirectory, nsIDOMNodeList *nodeList);
protected:
nsresult DoCommand(nsIRDFCompositeDataSource *db, char * command, nsISupportsArray *srcArray,

View File

@ -22,7 +22,8 @@
<tree rdf:datasources="rdf:msgaccountmanager" onclick="showPage(event)" id="accounttree">
<template>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<rule>
<treechildren>
<treeitem uri="...">
<treerow >
<treecell>
@ -30,6 +31,7 @@
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>

View File

@ -24,7 +24,6 @@
%{C++
#include "nsIDOMWindow.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMXULTreeElement.h"
#include "nsIDOMXULElement.h"
%}
@ -39,12 +38,12 @@ interface nsIMessenger : nsISupports {
void Open3PaneWindow();
void SetWindow(in nsIDOMWindow ptr);
void OpenURL(in string str);
void DeleteMessages(in nsIDOMXULTreeElement tree, in nsIDOMXULElement srcFolder, in nsIDOMNodeList node);
void DeleteMessages(in nsIDOMXULElement tree, in nsIDOMXULElement srcFolder, in nsIDOMNodeList node);
void DeleteFolders(in nsIRDFCompositeDataSource db, in nsIDOMXULElement parentFolder, in nsIDOMXULElement folder);
void CopyMessages(in nsIRDFCompositeDataSource database, in nsIDOMXULElement srcFolderElement,
in nsIDOMXULElement dstFolderElement, in nsIDOMNodeList messages,
in boolean isMove);
nsISupports GetRDFResourceForMessage(in nsIDOMXULTreeElement tree, in nsIDOMNodeList node);
nsISupports GetRDFResourceForMessage(in nsIDOMXULElement tree, in nsIDOMNodeList node);
void Exit();
void Close();
void OnUnload();

View File

@ -71,7 +71,7 @@ function GetThreadTree()
function GetThreadTreeFolder()
{
var tree = GetThreadTree();
return tree.childNodes[9];
return tree;
}
function FindMessenger()
@ -194,7 +194,7 @@ function ChangeFolderByURI(uri)
{
var folder = GetThreadTreeFolder();
var beforeTime = new Date();
folder.setAttribute('id', uri);
folder.setAttribute('ref', uri);
var afterTime = new Date();
var timeToLoad = (afterTime.getTime() - beforeTime.getTime())/1000;
if(showPerformance)

View File

@ -37,7 +37,8 @@
<html:div flex="100%">
<tree style="height: 100%" rdf:datasources="rdf:mailnewsfolders rdf:msgaccountmanager" id="folderTree" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild" onclick="return top.ChangeFolderByDOMNode(event.target.parentNode.parentNode)">
<template>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<rule>
<treechildren>
<treeitem uri="..."
SpecialFolder="rdf:http://home.netscape.com/NC-rdf#SpecialFolder"
BiffState="rdf:http://home.netscape.com/NC-rdf#BiffState">
@ -57,6 +58,7 @@
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>

View File

@ -477,9 +477,25 @@ Rights Reserved.
<separator/>
<menu name="&moveMsgMenu.label;" datasources="rdf:mailnewsfolders rdf:msgaccountmanager" ref="msgaccounts:/" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild"
onclick="MsgMoveMessage(event.target)">
<template>
<rule iscontainer="true" isempty="false">
<menu uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
</rule>
<rule>
<menuitem uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name" onclick="MsgCopyMessage(event.target)" />
</rule>
</template>
</menu>
<menu name="&copyMsgMenu.label;" datasources="rdf:mailnewsfolders rdf:msgaccountmanager" ref="msgaccounts:/" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild"
onclick="MsgCopyMessage(event.target)">
<template>
<rule iscontainer="true" isempty="false">
<menu uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
</rule>
<rule>
<menuitem uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name" onclick="MsgCopyMessage(event.target)" />
</rule>
</template>
</menu>
<separator/>
<menuitem name="&addSenderToAddressBookCmd.label;" onclick="MsgAddSenderToAddressBook();"/>

View File

@ -42,7 +42,8 @@ Rights Reserved.
<tree style="height: 100%" datasources="rdf:mailnewsfolders rdf:mailnewsmessages" id="threadTree" onclick="return parent.parent.parent.LoadMessage(event.target.parentNode.parentNode)" containment="http://home.netscape.com/NC-rdf#MessageChild">
<template>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<rule>
<treechildren>
<treeitem uri="..."
Status="rdf:http://home.netscape.com/NC-rdf#Status">
<treerow >
@ -70,6 +71,7 @@ Rights Reserved.
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
@ -93,10 +95,6 @@ Rights Reserved.
<treecell onclick="return top.SortThreadPane('TotalColumn', 'http://home.netscape.com/NC-rdf#TotalMessages');">&totalColumn.label;</treecell>
</treerow>
</treehead>
<treechildren id="" name="threadTreeBody" open="true">
</treechildren>
</tree>
</html:div>
</window>

View File

@ -46,7 +46,7 @@
#include "nsIMsgFolder.h"
#include "nsIPop3Service.h"
#include "nsIDOMXULTreeElement.h"
#include "nsIDOMXULElement.h"
#include "nsIRDFCompositeDataSource.h"
#include "nsIRDFResource.h"
#include "nsIRDFService.h"
@ -100,12 +100,12 @@ public:
NS_IMETHOD GetNewMessages(nsIRDFCompositeDataSource *db, nsIDOMXULElement *folderElement);
NS_IMETHOD SetWindow(nsIDOMWindow* aWin);
NS_IMETHOD OpenURL(const char * url);
NS_IMETHOD DeleteMessages(nsIDOMXULTreeElement *tree, nsIDOMXULElement *srcFolderElement, nsIDOMNodeList *nodeList);
NS_IMETHOD DeleteMessages(nsIDOMXULElement *tree, nsIDOMXULElement *srcFolderElement, nsIDOMNodeList *nodeList);
NS_IMETHOD DeleteFolders(nsIRDFCompositeDataSource *db, nsIDOMXULElement *parentFolder, nsIDOMXULElement *folder);
NS_IMETHOD CopyMessages(nsIRDFCompositeDataSource *database, nsIDOMXULElement *srcFolderElement,
nsIDOMXULElement *dstFolderElement, nsIDOMNodeList *messages, PRBool isMove);
NS_IMETHOD GetRDFResourceForMessage(nsIDOMXULTreeElement *tree,
NS_IMETHOD GetRDFResourceForMessage(nsIDOMXULElement *tree,
nsIDOMNodeList *nodeList, nsISupports
**aSupport);
NS_IMETHOD Exit();
@ -150,7 +150,7 @@ static nsresult ConvertDOMListToResourceArray(nsIDOMNodeList *nodeList, nsISuppo
nsresult rv = NS_OK;
PRUint32 listLength;
nsIDOMNode *node;
nsIDOMXULTreeElement *xulElement;
nsIDOMXULElement *xulElement;
nsIRDFResource *resource;
if(!resourceArray)
@ -465,7 +465,7 @@ nsMessenger::DoCommand(nsIRDFCompositeDataSource* db, char *command,
}
NS_IMETHODIMP
nsMessenger::DeleteMessages(nsIDOMXULTreeElement *tree, nsIDOMXULElement *srcFolderElement, nsIDOMNodeList *nodeList)
nsMessenger::DeleteMessages(nsIDOMXULElement *tree, nsIDOMXULElement *srcFolderElement, nsIDOMNodeList *nodeList)
{
nsresult rv;
@ -664,7 +664,7 @@ nsMessenger::CopyMessages(nsIRDFCompositeDataSource *database, nsIDOMXULElement
}
NS_IMETHODIMP
nsMessenger::GetRDFResourceForMessage(nsIDOMXULTreeElement *tree,
nsMessenger::GetRDFResourceForMessage(nsIDOMXULElement *tree,
nsIDOMNodeList *nodeList, nsISupports
**aSupport)
{

View File

@ -156,6 +156,14 @@ Rights Reserved.
<separator/>
<menu name="&fileCarbonCopyCmd.label;" datasources="rdf:mailnewsfolders rdf:msgaccountmanager" ref="msgaccounts:/" rdf:ignore="http://home.netscape.com/NC-rdf#MessageChild"
onclick="MessageFcc(event.target)">
<template>
<rule iscontainer="true" isempty="false">
<menu uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
</rule>
<rule>
<menuitem uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name" onclick="MsgCopyMessage(event.target)" />
</rule>
</template>
</menu>
</menu>
<menu id="tasksMenu"/>

View File

@ -529,10 +529,6 @@ RDFContentSinkImpl::OpenContainer(const nsIParserNode& aNode)
NS_IMETHODIMP
RDFContentSinkImpl::CloseContainer(const nsIParserNode& aNode)
{
#ifdef DEBUG
const nsString& text = aNode.GetText();
#endif
FlushText();
nsIRDFResource* resource;
@ -540,13 +536,14 @@ RDFContentSinkImpl::CloseContainer(const nsIParserNode& aNode)
// XXX parser didn't catch unmatched tags?
#ifdef PR_LOGGING
if (PR_LOG_TEST(gLog, PR_LOG_ALWAYS)) {
char* tag = text.ToNewCString();
const nsString& tagStr = aNode.GetText();
char* tagCStr = tagStr.ToNewCString();
PR_LOG(gLog, PR_LOG_ALWAYS,
("rdfxml: extra close tag '%s' at line %d",
tag, aNode.GetSourceLineNumber()));
tagCStr, aNode.GetSourceLineNumber()));
delete[] tag;
delete[] tagCStr;
}
#endif

View File

@ -26,6 +26,7 @@
void XXXNeverCalled()
{
nsAutoString s;
nsCAutoString cs;
// nsRDFParserUtils
nsRDFParserUtils::EntityToUnicode("");
@ -36,12 +37,12 @@ void XXXNeverCalled()
// nsRDFContentUtils
nsRDFContentUtils::AttachTextNode(nsnull, nsnull);
nsRDFContentUtils::FindChildByTag(nsnull, 0, nsnull, nsnull);
nsRDFContentUtils::FindChildByTagAndResource(nsnull, 0, nsnull, nsnull, nsnull);
nsRDFContentUtils::FindChildByResource(nsnull, nsnull, nsnull);
nsRDFContentUtils::GetElementResource(nsnull, nsnull);
nsRDFContentUtils::GetElementRefResource(nsnull, nsnull);
nsRDFContentUtils::GetTextForNode(nsnull, s);
nsRDFContentUtils::GetElementLogString(nsnull, s);
nsRDFContentUtils::MakeElementURI(nsnull, s, s);
nsRDFContentUtils::MakeElementURI(nsnull, s, cs);
nsRDFContentUtils::MakeElementID(nsnull, s, s);
// rdfutils

View File

@ -66,22 +66,10 @@
#define NS_RDFCOMPOSITEDATASOURCE_CID \
{ 0xe638d761, 0x8687, 0x11d2, { 0xb5, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
// {954F0813-81DC-11d2-B52A-000000000000}
#define NS_RDFHTMLBUILDER_CID \
{ 0x954f0813, 0x81dc, 0x11d2, { 0xb5, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
// {3D262D00-8B5A-11d2-8EB0-00805F29F370}
#define NS_RDFTREEBUILDER_CID \
#define NS_XULTEMPLATEBUILDER_CID \
{ 0x3d262d00, 0x8b5a, 0x11d2, { 0x8e, 0xb0, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
// {CF6547E1-D427-11d2-96ED-00104B7B7DEB}
#define NS_RDFMENUBUILDER_CID \
{ 0xcf6547e1, 0xd427, 0x11d2, { 0x96, 0xed, 0x0, 0x10, 0x4b, 0x7b, 0x7d, 0xeb } }
// {FEA36A61-D48F-11d2-96ED-00104B7B7DEB}
#define NS_RDFTOOLBARBUILDER_CID \
{ 0xfea36a61, 0xd48f, 0x11d2, { 0x96, 0xed, 0x0, 0x10, 0x4b, 0x7b, 0x7d, 0xeb } }
// {7BAF62E0-8E61-11d2-8EB1-00805F29F370}
#define NS_RDFXMLDATASOURCE_CID \
{ 0x7baf62e0, 0x8e61, 0x11d2, { 0x8e, 0xb1, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }

View File

@ -65,12 +65,8 @@ static NS_DEFINE_CID(kRDFFileSystemDataSourceCID, NS_RDFFILESYSTEMDATASO
static NS_DEFINE_CID(kRDFSearchDataSourceCID, NS_RDFSEARCHDATASOURCE_CID);
static NS_DEFINE_CID(kRDFFindDataSourceCID, NS_RDFFINDDATASOURCE_CID);
static NS_DEFINE_CID(kRDFFTPDataSourceCID, NS_RDFFTPDATASOURCE_CID);
static NS_DEFINE_CID(kRDFHTMLBuilderCID, NS_RDFHTMLBUILDER_CID);
static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID);
static NS_DEFINE_CID(kRDFMenuBuilderCID, NS_RDFMENUBUILDER_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kRDFToolbarBuilderCID, NS_RDFTOOLBARBUILDER_CID);
static NS_DEFINE_CID(kRDFTreeBuilderCID, NS_RDFTREEBUILDER_CID);
static NS_DEFINE_CID(kRDFXMLDataSourceCID, NS_RDFXMLDATASOURCE_CID);
static NS_DEFINE_CID(kRDFXULBuilderCID, NS_RDFXULBUILDER_CID);
static NS_DEFINE_CID(kXULContentSinkCID, NS_XULCONTENTSINK_CID);
@ -80,6 +76,7 @@ static NS_DEFINE_CID(kXULDocumentInfoCID, NS_XULDOCUMENTINFO_CID
static NS_DEFINE_CID(kXULPopupListenerCID, NS_XULPOPUPLISTENER_CID);
static NS_DEFINE_CID(kXULKeyListenerCID, NS_XULKEYLISTENER_CID);
static NS_DEFINE_CID(kXULFocusTrackerCID, NS_XULFOCUSTRACKER_CID);
static NS_DEFINE_CID(kXULTemplateBuilderCID, NS_XULTEMPLATEBUILDER_CID);
class RDFFactoryImpl : public nsIFactory
{
@ -224,20 +221,8 @@ RDFFactoryImpl::CreateInstance(nsISupports *aOuter,
if (NS_FAILED(rv = NS_NewXULDocumentInfo((nsIXULDocumentInfo**) &inst)))
return rv;
}
else if (mClassID.Equals(kRDFHTMLBuilderCID)) {
if (NS_FAILED(rv = NS_NewRDFHTMLBuilder((nsIRDFContentModelBuilder**) &inst)))
return rv;
}
else if (mClassID.Equals(kRDFMenuBuilderCID)) {
if (NS_FAILED(rv = NS_NewRDFMenuBuilder((nsIRDFContentModelBuilder**) &inst)))
return rv;
}
else if (mClassID.Equals(kRDFToolbarBuilderCID)) {
if (NS_FAILED(rv = NS_NewRDFToolbarBuilder((nsIRDFContentModelBuilder**) &inst)))
return rv;
}
else if (mClassID.Equals(kRDFTreeBuilderCID)) {
if (NS_FAILED(rv = NS_NewRDFTreeBuilder((nsIRDFContentModelBuilder**) &inst)))
else if (mClassID.Equals(kXULTemplateBuilderCID)) {
if (NS_FAILED(rv = NS_NewXULTemplateBuilder((nsIRDFContentModelBuilder**) &inst)))
return rv;
}
else if (mClassID.Equals(kRDFXULBuilderCID)) {
@ -415,11 +400,6 @@ NSRegisterSelf(nsISupports* aServMgr , const char* aPath)
NS_RDF_PROGID "/container-utils",
aPath, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) goto done;
rv = compMgr->RegisterComponent(kRDFHTMLBuilderCID,
"RDF HTML Builder",
NS_RDF_PROGID "/html-builder",
aPath, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) goto done;
rv = compMgr->RegisterComponent(kRDFServiceCID,
"RDF Service",
NS_RDF_PROGID "/rdf-service",
@ -430,19 +410,9 @@ NSRegisterSelf(nsISupports* aServMgr , const char* aPath)
NS_RDF_PROGID "/xul-sort-service",
aPath, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) goto done;
rv = compMgr->RegisterComponent(kRDFTreeBuilderCID,
"RDF Tree Builder",
NS_RDF_PROGID "/tree-builder",
aPath, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) goto done;
rv = compMgr->RegisterComponent(kRDFMenuBuilderCID,
"RDF Menu Builder",
NS_RDF_PROGID "/menu-builder",
aPath, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) goto done;
rv = compMgr->RegisterComponent(kRDFToolbarBuilderCID,
"RDF Toolbar Builder",
NS_RDF_PROGID "/toolbar-builder",
rv = compMgr->RegisterComponent(kXULTemplateBuilderCID,
"XUL Template Builder",
NS_RDF_PROGID "/xul-template-builder",
aPath, PR_TRUE, PR_TRUE);
if (NS_FAILED(rv)) goto done;
rv = compMgr->RegisterComponent(kRDFXULBuilderCID,
@ -524,17 +494,11 @@ NSUnregisterSelf(nsISupports* aServMgr, const char* aPath)
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kRDFContentSinkCID, aPath);
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kRDFHTMLBuilderCID, aPath);
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kRDFServiceCID, aPath);
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kXULSortServiceCID, aPath);
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kRDFTreeBuilderCID, aPath);
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kRDFMenuBuilderCID, aPath);
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kRDFToolbarBuilderCID, aPath);
rv = compMgr->UnregisterComponent(kXULTemplateBuilderCID, aPath);
if (NS_FAILED(rv)) goto done;
rv = compMgr->UnregisterComponent(kRDFXULBuilderCID, aPath);
if (NS_FAILED(rv)) goto done;

View File

@ -3,7 +3,6 @@ nsIDOMElementObserver.h
nsIDOMNodeObserver.h
nsIDOMXULDocument.h
nsIDOMXULElement.h
nsIDOMXULTreeElement.h
nsIRDFContentModelBuilder.h
nsIRDFDocument.h
nsIXULSortService.h

View File

@ -29,7 +29,6 @@ EXPORTS = \
nsIDOMNodeObserver.h \
nsIDOMXULDocument.h \
nsIDOMXULElement.h \
nsIDOMXULTreeElement.h \
nsIRDFContentModelBuilder.h \
nsIRDFDocument.h \
nsIXULSortService.h \

View File

@ -2,16 +2,16 @@ interface XULElement : Element {
/* IID: { 0x574ed81, 0xc088, 0x11d2, \
{ 0x96, 0xed, 0x0, 0x10, 0x4b, 0x7b, 0x7d, 0xeb } } */
readonly attribute xpidl nsIRDFResource resource;
attribute xpidl nsIController controller;
attribute DOMString id;
attribute DOMString className;
readonly attribute CSSStyleDeclaration style;
attribute xpidl nsIRDFCompositeDataSource database;
readonly attribute xpidl nsIRDFResource resource;
attribute xpidl nsIController controller;
attribute DOMString id;
attribute DOMString className;
readonly attribute CSSStyleDeclaration style;
void addBroadcastListener(in DOMString attr, in Element element);
void removeBroadcastListener(in DOMString attr, in Element element);
void doCommand();
void addBroadcastListener(in DOMString attr, in Element element);
void removeBroadcastListener(in DOMString attr, in Element element);
void doCommand();
NodeList getElementsByAttribute(in DOMString name, in DOMString value);
NodeList getElementsByAttribute(in DOMString name, in DOMString value);
};

View File

@ -1,5 +0,0 @@
interface XULTreeElement : XULElement {
/* IID: { 0xa6cf90ec, 0x15b3, 0x11d2, \
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} } */
attribute xpidl nsIRDFCompositeDataSource database;
};

View File

@ -25,8 +25,7 @@ IDLSRCS = \
NodeObserver.idl \
XULDocument.idl \
XULElement.idl \
XULTreeElement.idl \
XULFocusTracker.idl \
XULFocusTracker.idl \
$(NULL)
XPCOM_DESTDIR=$(DEPTH)\rdf\content\public

View File

@ -25,7 +25,6 @@ EXPORTS = \
nsIDOMNodeObserver.h \
nsIDOMXULDocument.h \
nsIDOMXULElement.h \
nsIDOMXULTreeElement.h \
nsIRDFContentModelBuilder.h \
nsIRDFDocument.h \
nsIXULSortService.h \

View File

@ -28,6 +28,7 @@
class nsIController;
class nsIDOMElement;
class nsIDOMCSSStyleDeclaration;
class nsIRDFCompositeDataSource;
class nsIRDFResource;
class nsIDOMNodeList;
@ -39,11 +40,6 @@ class nsIDOMXULElement : public nsIDOMElement {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMXULELEMENT_IID; return iid; }
NS_IMETHOD GetResource(nsIRDFResource** aResource)=0;
NS_IMETHOD GetController(nsIController** aController)=0;
NS_IMETHOD SetController(nsIController* aController)=0;
NS_IMETHOD GetId(nsString& aId)=0;
NS_IMETHOD SetId(const nsString& aId)=0;
@ -52,6 +48,14 @@ public:
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle)=0;
NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase)=0;
NS_IMETHOD SetDatabase(nsIRDFCompositeDataSource* aDatabase)=0;
NS_IMETHOD GetResource(nsIRDFResource** aResource)=0;
NS_IMETHOD GetController(nsIController** aController)=0;
NS_IMETHOD SetController(nsIController* aController)=0;
NS_IMETHOD AddBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement)=0;
NS_IMETHOD RemoveBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement)=0;
@ -63,14 +67,16 @@ public:
#define NS_DECL_IDOMXULELEMENT \
NS_IMETHOD GetResource(nsIRDFResource** aResource); \
NS_IMETHOD GetController(nsIController** aController); \
NS_IMETHOD SetController(nsIController* aController); \
NS_IMETHOD GetId(nsString& aId); \
NS_IMETHOD SetId(const nsString& aId); \
NS_IMETHOD GetClassName(nsString& aClassName); \
NS_IMETHOD SetClassName(const nsString& aClassName); \
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle); \
NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase); \
NS_IMETHOD SetDatabase(nsIRDFCompositeDataSource* aDatabase); \
NS_IMETHOD GetResource(nsIRDFResource** aResource); \
NS_IMETHOD GetController(nsIController** aController); \
NS_IMETHOD SetController(nsIController* aController); \
NS_IMETHOD AddBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement); \
NS_IMETHOD RemoveBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement); \
NS_IMETHOD DoCommand(); \
@ -79,14 +85,16 @@ public:
#define NS_FORWARD_IDOMXULELEMENT(_to) \
NS_IMETHOD GetResource(nsIRDFResource** aResource) { return _to GetResource(aResource); } \
NS_IMETHOD GetController(nsIController** aController) { return _to GetController(aController); } \
NS_IMETHOD SetController(nsIController* aController) { return _to SetController(aController); } \
NS_IMETHOD GetId(nsString& aId) { return _to GetId(aId); } \
NS_IMETHOD SetId(const nsString& aId) { return _to SetId(aId); } \
NS_IMETHOD GetClassName(nsString& aClassName) { return _to GetClassName(aClassName); } \
NS_IMETHOD SetClassName(const nsString& aClassName) { return _to SetClassName(aClassName); } \
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle) { return _to GetStyle(aStyle); } \
NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase) { return _to GetDatabase(aDatabase); } \
NS_IMETHOD SetDatabase(nsIRDFCompositeDataSource* aDatabase) { return _to SetDatabase(aDatabase); } \
NS_IMETHOD GetResource(nsIRDFResource** aResource) { return _to GetResource(aResource); } \
NS_IMETHOD GetController(nsIController** aController) { return _to GetController(aController); } \
NS_IMETHOD SetController(nsIController* aController) { return _to SetController(aController); } \
NS_IMETHOD AddBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement) { return _to AddBroadcastListener(aAttr, aElement); } \
NS_IMETHOD RemoveBroadcastListener(const nsString& aAttr, nsIDOMElement* aElement) { return _to RemoveBroadcastListener(aAttr, aElement); } \
NS_IMETHOD DoCommand() { return _to DoCommand(); } \

View File

@ -1,58 +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.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#ifndef nsIDOMXULTreeElement_h__
#define nsIDOMXULTreeElement_h__
#include "nsISupports.h"
#include "nsString.h"
#include "nsIScriptContext.h"
#include "nsIDOMXULElement.h"
class nsIRDFCompositeDataSource;
#define NS_IDOMXULTREEELEMENT_IID \
{ 0xa6cf90ec, 0x15b3, 0x11d2, \
{0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32} }
class nsIDOMXULTreeElement : public nsIDOMXULElement {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMXULTREEELEMENT_IID; return iid; }
NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase)=0;
NS_IMETHOD SetDatabase(nsIRDFCompositeDataSource* aDatabase)=0;
};
#define NS_DECL_IDOMXULTREEELEMENT \
NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase); \
NS_IMETHOD SetDatabase(nsIRDFCompositeDataSource* aDatabase); \
#define NS_FORWARD_IDOMXULTREEELEMENT(_to) \
NS_IMETHOD GetDatabase(nsIRDFCompositeDataSource** aDatabase) { return _to GetDatabase(aDatabase); } \
NS_IMETHOD SetDatabase(nsIRDFCompositeDataSource* aDatabase) { return _to SetDatabase(aDatabase); } \
extern "C" NS_DOM nsresult NS_InitXULTreeElementClass(nsIScriptContext *aContext, void **aPrototype);
extern "C" NS_DOM nsresult NS_NewScriptXULTreeElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
#endif // nsIDOMXULTreeElement_h__

View File

@ -78,10 +78,7 @@ public:
nsIContent** aResult) = 0;
};
extern nsresult NS_NewRDFHTMLBuilder(nsIRDFContentModelBuilder** aResult);
extern nsresult NS_NewRDFMenuBuilder(nsIRDFContentModelBuilder** aResult);
extern nsresult NS_NewRDFToolbarBuilder(nsIRDFContentModelBuilder** aResult);
extern nsresult NS_NewRDFTreeBuilder(nsIRDFContentModelBuilder** aResult);
extern nsresult NS_NewXULTemplateBuilder(nsIRDFContentModelBuilder** aResult);
extern nsresult NS_NewRDFXULBuilder(nsIRDFContentModelBuilder** aResult);
#endif // nsIRDFContentModelBuilder_h__

View File

@ -31,21 +31,15 @@ CPPSRCS = \
nsJSNodeObserver.cpp \
nsJSXULDocument.cpp \
nsJSXULElement.cpp \
nsJSXULTreeElement.cpp \
nsJSXULFocusTracker.cpp \
nsRDFContentUtils.cpp \
nsRDFDOMNodeList.cpp \
nsRDFElement.cpp \
nsRDFGenericBuilder.cpp \
nsRDFHTMLBuilder.cpp \
nsRDFMenuBuilder.cpp \
nsRDFToolbarBuilder.cpp \
nsRDFTreeBuilder.cpp \
nsRDFXULBuilder.cpp \
nsXULAttributes.cpp \
nsXULDocument.cpp \
nsXULSortService.cpp \
nsXULTreeElement.cpp \
nsXULSortService.cpp \
nsXULDocumentInfo.cpp \
nsXULPopupListener.cpp \
nsXULFocusTracker.cpp \

View File

@ -27,29 +27,23 @@ LCFLAGS = \
$(NULL)
CPP_OBJS=\
.\$(OBJDIR)\nsJSXULFocusTracker.obj \
.\$(OBJDIR)\nsRDFGenericBuilder.obj \
.\$(OBJDIR)\nsRDFMenuBuilder.obj \
.\$(OBJDIR)\nsRDFToolbarBuilder.obj \
.\$(OBJDIR)\nsXULAttributes.obj \
.\$(OBJDIR)\nsXULFocusTracker.obj \
.\$(OBJDIR)\nsXULPopupListener.obj \
.\$(OBJDIR)\nsJSElementObserver.obj \
.\$(OBJDIR)\nsJSNodeObserver.obj \
.\$(OBJDIR)\nsJSXULDocument.obj \
.\$(OBJDIR)\nsJSXULElement.obj \
.\$(OBJDIR)\nsJSXULTreeElement.obj \
.\$(OBJDIR)\nsJSXULFocusTracker.obj \
.\$(OBJDIR)\nsRDFContentUtils.obj \
.\$(OBJDIR)\nsRDFDOMNodeList.obj \
.\$(OBJDIR)\nsRDFElement.obj \
.\$(OBJDIR)\nsRDFHTMLBuilder.obj \
.\$(OBJDIR)\nsRDFTreeBuilder.obj \
.\$(OBJDIR)\nsRDFXULBuilder.obj \
.\$(OBJDIR)\nsXULDocument.obj \
.\$(OBJDIR)\nsXULDocumentInfo.obj \
.\$(OBJDIR)\nsXULPopupListener.obj \
.\$(OBJDIR)\nsXULFocusTracker.obj \
.\$(OBJDIR)\nsXULSortService.obj \
.\$(OBJDIR)\nsXULTreeElement.obj \
.\$(OBJDIR)\nsXULDocumentInfo.obj \
.\$(OBJDIR)\nsXULKeyListener.obj \
.\$(OBJDIR)\nsXULSortService.obj \
$(NULL)
# XXX we are including layout\html\base\src to get HTML elements

View File

@ -51,7 +51,7 @@ NS_DEF_PTR(nsIDOMElementObserver);
PR_STATIC_CALLBACK(JSBool)
GetElementObserverProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMElementObserver *a = (nsIDOMElementObserver*)JS_GetPrivate(cx, obj);
nsIDOMElementObserver *a = (nsIDOMElementObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
@ -61,6 +61,7 @@ GetElementObserverProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (JSVAL_IS_INT(id)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
PRBool ok = PR_FALSE;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE;
}
@ -85,7 +86,7 @@ GetElementObserverProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
PR_STATIC_CALLBACK(JSBool)
SetElementObserverProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMElementObserver *a = (nsIDOMElementObserver*)JS_GetPrivate(cx, obj);
nsIDOMElementObserver *a = (nsIDOMElementObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
@ -95,6 +96,7 @@ SetElementObserverProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (JSVAL_IS_INT(id)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
PRBool ok = PR_FALSE;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE;
}
@ -149,7 +151,7 @@ ResolveElementObserver(JSContext *cx, JSObject *obj, jsval id)
PR_STATIC_CALLBACK(JSBool)
ElementObserverOnSetAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMElementObserver *nativeThis = (nsIDOMElementObserver*)JS_GetPrivate(cx, obj);
nsIDOMElementObserver *nativeThis = (nsIDOMElementObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
nsIDOMElementPtr b0;
nsAutoString b1;
nsAutoString b2;
@ -211,7 +213,7 @@ ElementObserverOnSetAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *a
PR_STATIC_CALLBACK(JSBool)
ElementObserverOnRemoveAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMElementObserver *nativeThis = (nsIDOMElementObserver*)JS_GetPrivate(cx, obj);
nsIDOMElementObserver *nativeThis = (nsIDOMElementObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
nsIDOMElementPtr b0;
nsAutoString b1;
@ -270,7 +272,7 @@ ElementObserverOnRemoveAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval
PR_STATIC_CALLBACK(JSBool)
ElementObserverOnSetAttributeNode(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMElementObserver *nativeThis = (nsIDOMElementObserver*)JS_GetPrivate(cx, obj);
nsIDOMElementObserver *nativeThis = (nsIDOMElementObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
nsIDOMElementPtr b0;
nsIDOMAttrPtr b1;
@ -335,7 +337,7 @@ ElementObserverOnSetAttributeNode(JSContext *cx, JSObject *obj, uintN argc, jsva
PR_STATIC_CALLBACK(JSBool)
ElementObserverOnRemoveAttributeNode(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMElementObserver *nativeThis = (nsIDOMElementObserver*)JS_GetPrivate(cx, obj);
nsIDOMElementObserver *nativeThis = (nsIDOMElementObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
nsIDOMElementPtr b0;
nsIDOMAttrPtr b1;

View File

@ -48,7 +48,7 @@ NS_DEF_PTR(nsIDOMNodeObserver);
PR_STATIC_CALLBACK(JSBool)
GetNodeObserverProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMNodeObserver *a = (nsIDOMNodeObserver*)JS_GetPrivate(cx, obj);
nsIDOMNodeObserver *a = (nsIDOMNodeObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
@ -58,6 +58,7 @@ GetNodeObserverProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (JSVAL_IS_INT(id)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
PRBool ok = PR_FALSE;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE;
}
@ -82,7 +83,7 @@ GetNodeObserverProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
PR_STATIC_CALLBACK(JSBool)
SetNodeObserverProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMNodeObserver *a = (nsIDOMNodeObserver*)JS_GetPrivate(cx, obj);
nsIDOMNodeObserver *a = (nsIDOMNodeObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
@ -92,6 +93,7 @@ SetNodeObserverProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (JSVAL_IS_INT(id)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
PRBool ok = PR_FALSE;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE;
}
@ -146,8 +148,7 @@ ResolveNodeObserver(JSContext *cx, JSObject *obj, jsval id)
PR_STATIC_CALLBACK(JSBool)
NodeObserverOnSetNodeValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMNodeObserver *nativeThis = (nsIDOMNodeObserver*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMNodeObserver *nativeThis = (nsIDOMNodeObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
nsIDOMNodePtr b0;
nsAutoString b1;
@ -206,8 +207,7 @@ NodeObserverOnSetNodeValue(JSContext *cx, JSObject *obj, uintN argc, jsval *argv
PR_STATIC_CALLBACK(JSBool)
NodeObserverOnInsertBefore(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMNodeObserver *nativeThis = (nsIDOMNodeObserver*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMNodeObserver *nativeThis = (nsIDOMNodeObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
nsIDOMNodePtr b0;
nsIDOMNodePtr b1;
nsIDOMNodePtr b2;
@ -281,8 +281,7 @@ NodeObserverOnInsertBefore(JSContext *cx, JSObject *obj, uintN argc, jsval *argv
PR_STATIC_CALLBACK(JSBool)
NodeObserverOnReplaceChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMNodeObserver *nativeThis = (nsIDOMNodeObserver*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMNodeObserver *nativeThis = (nsIDOMNodeObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
nsIDOMNodePtr b0;
nsIDOMNodePtr b1;
nsIDOMNodePtr b2;
@ -356,8 +355,7 @@ NodeObserverOnReplaceChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv
PR_STATIC_CALLBACK(JSBool)
NodeObserverOnRemoveChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMNodeObserver *nativeThis = (nsIDOMNodeObserver*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMNodeObserver *nativeThis = (nsIDOMNodeObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
nsIDOMNodePtr b0;
nsIDOMNodePtr b1;
@ -422,8 +420,7 @@ NodeObserverOnRemoveChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv,
PR_STATIC_CALLBACK(JSBool)
NodeObserverOnAppendChild(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMNodeObserver *nativeThis = (nsIDOMNodeObserver*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMNodeObserver *nativeThis = (nsIDOMNodeObserver*)nsJSUtils::nsGetNativeThis(cx, obj);
nsIDOMNodePtr b0;
nsIDOMNodePtr b1;

View File

@ -51,11 +51,8 @@ NS_DEF_PTR(nsIDOMNodeList);
//
enum XULDocument_slots {
XULDOCUMENT_POPUPELEMENT = -1,
XULDOCUMENT_TOOLTIPELEMENT = -2,
XULDOCUMENT_FOCUS = -3
};
/***********************************************************************/
@ -67,86 +64,45 @@ GetXULDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULDocument *a = (nsIDOMXULDocument*)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)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
PRBool ok = PR_FALSE;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE;
}
switch(JSVAL_TO_INT(id)) {
case XULDOCUMENT_POPUPELEMENT:
{
secMan->CheckScriptAccess(scriptCX, obj, "xuldocument.popupelement", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIDOMElement* prop;
if (NS_OK == a->GetPopupElement(&prop)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, vp);
}
else {
return JS_FALSE;
}
break;
}
case XULDOCUMENT_TOOLTIPELEMENT:
{
secMan->CheckScriptAccess(scriptCX, obj, "xuldocument.tooltipelement", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIDOMElement* prop;
if (NS_OK == a->GetTooltipElement(&prop)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, vp);
}
@ -193,100 +149,52 @@ SetXULDocumentProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULDocument *a = (nsIDOMXULDocument*)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)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
PRBool ok = PR_FALSE;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE;
}
switch(JSVAL_TO_INT(id)) {
case XULDOCUMENT_POPUPELEMENT:
{
secMan->CheckScriptAccess(scriptCX, obj, "xuldocument.popupelement", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIDOMElement* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
kIElementIID, "Element",
cx, *vp)) {
return JS_FALSE;
}
a->SetPopupElement(prop);
NS_IF_RELEASE(prop);
break;
}
case XULDOCUMENT_TOOLTIPELEMENT:
{
secMan->CheckScriptAccess(scriptCX, obj, "xuldocument.tooltipelement", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIDOMElement* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
kIElementIID, "Element",
cx, *vp)) {
return JS_FALSE;
}
a->SetTooltipElement(prop);
NS_IF_RELEASE(prop);
break;
}
@ -340,8 +248,6 @@ PR_STATIC_CALLBACK(JSBool)
XULDocumentGetElementById(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMXULDocument *nativeThis = (nsIDOMXULDocument*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMElement* nativeRet;
nsAutoString b0;
@ -393,8 +299,6 @@ PR_STATIC_CALLBACK(JSBool)
XULDocumentGetElementsByAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMXULDocument *nativeThis = (nsIDOMXULDocument*)nsJSUtils::nsGetNativeThis(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMNodeList* nativeRet;
nsAutoString b0;
nsAutoString b1;
@ -466,9 +370,7 @@ JSClass XULDocumentClass = {
static JSPropertySpec XULDocumentProperties[] =
{
{"popupElement", XULDOCUMENT_POPUPELEMENT, JSPROP_ENUMERATE},
{"tooltipElement", XULDOCUMENT_TOOLTIPELEMENT, JSPROP_ENUMERATE},
{"focus", XULDOCUMENT_FOCUS, JSPROP_ENUMERATE | JSPROP_READONLY},
{0}
};

View File

@ -30,6 +30,7 @@
#include "nsIController.h"
#include "nsIDOMElement.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsIRDFCompositeDataSource.h"
#include "nsIDOMXULElement.h"
#include "nsIRDFResource.h"
#include "nsIDOMNodeList.h"
@ -41,6 +42,7 @@ static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
static NS_DEFINE_IID(kIControllerIID, NS_ICONTROLLER_IID);
static NS_DEFINE_IID(kIElementIID, NS_IDOMELEMENT_IID);
static NS_DEFINE_IID(kICSSStyleDeclarationIID, NS_IDOMCSSSTYLEDECLARATION_IID);
static NS_DEFINE_IID(kIRDFCompositeDataSourceIID, NS_IRDFCOMPOSITEDATASOURCE_IID);
static NS_DEFINE_IID(kIXULElementIID, NS_IDOMXULELEMENT_IID);
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
static NS_DEFINE_IID(kINodeListIID, NS_IDOMNODELIST_IID);
@ -48,6 +50,7 @@ static NS_DEFINE_IID(kINodeListIID, NS_IDOMNODELIST_IID);
NS_DEF_PTR(nsIController);
NS_DEF_PTR(nsIDOMElement);
NS_DEF_PTR(nsIDOMCSSStyleDeclaration);
NS_DEF_PTR(nsIRDFCompositeDataSource);
NS_DEF_PTR(nsIDOMXULElement);
NS_DEF_PTR(nsIRDFResource);
NS_DEF_PTR(nsIDOMNodeList);
@ -56,11 +59,12 @@ NS_DEF_PTR(nsIDOMNodeList);
// XULElement property ids
//
enum XULElement_slots {
XULELEMENT_RESOURCE = -1,
XULELEMENT_CONTROLLER = -2,
XULELEMENT_ID = -3,
XULELEMENT_CLASSNAME = -4,
XULELEMENT_STYLE = -5
XULELEMENT_ID = -1,
XULELEMENT_CLASSNAME = -2,
XULELEMENT_STYLE = -3,
XULELEMENT_DATABASE = -4,
XULELEMENT_RESOURCE = -5,
XULELEMENT_CONTROLLER = -6
};
/***********************************************************************/
@ -70,7 +74,7 @@ enum XULElement_slots {
PR_STATIC_CALLBACK(JSBool)
GetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULElement *a = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
nsIDOMXULElement *a = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
@ -80,45 +84,11 @@ GetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (JSVAL_IS_INT(id)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
PRBool ok;
PRBool ok = PR_FALSE;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE;
}
switch(JSVAL_TO_INT(id)) {
case XULELEMENT_RESOURCE:
{
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.resource", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIRDFResource* prop;
if (NS_OK == a->GetResource(&prop)) {
// get the js object; n.b., this will do a release on 'prop'
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIRDFResource::GetIID(), cx, vp);
}
else {
return JS_FALSE;
}
break;
}
case XULELEMENT_CONTROLLER:
{
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.controller", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIController* prop;
if (NS_OK == a->GetController(&prop)) {
// get the js object; n.b., this will do a release on 'prop'
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIController::GetIID(), cx, vp);
}
else {
return JS_FALSE;
}
break;
}
case XULELEMENT_ID:
{
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.id", &ok);
@ -168,6 +138,57 @@ GetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case XULELEMENT_DATABASE:
{
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.database", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIRDFCompositeDataSource* prop;
if (NS_OK == a->GetDatabase(&prop)) {
// get the js object; n.b., this will do a release on 'prop'
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIRDFCompositeDataSource::GetIID(), cx, vp);
}
else {
return JS_FALSE;
}
break;
}
case XULELEMENT_RESOURCE:
{
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.resource", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIRDFResource* prop;
if (NS_OK == a->GetResource(&prop)) {
// get the js object; n.b., this will do a release on 'prop'
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIRDFResource::GetIID(), cx, vp);
}
else {
return JS_FALSE;
}
break;
}
case XULELEMENT_CONTROLLER:
{
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.controller", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIController* prop;
if (NS_OK == a->GetController(&prop)) {
// get the js object; n.b., this will do a release on 'prop'
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIController::GetIID(), cx, vp);
}
else {
return JS_FALSE;
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
}
@ -187,7 +208,7 @@ GetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
PR_STATIC_CALLBACK(JSBool)
SetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULElement *a = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
nsIDOMXULElement *a = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
@ -197,28 +218,11 @@ SetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (JSVAL_IS_INT(id)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
PRBool ok;
PRBool ok = PR_FALSE;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE;
}
switch(JSVAL_TO_INT(id)) {
case XULELEMENT_CONTROLLER:
{
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.controller", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIController* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToXPCObject((nsISupports **) &prop,
kIControllerIID, cx, *vp)) {
return JS_FALSE;
}
a->SetController(prop);
NS_IF_RELEASE(prop);
break;
}
case XULELEMENT_ID:
{
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.id", &ok);
@ -247,6 +251,40 @@ SetXULElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
break;
}
case XULELEMENT_DATABASE:
{
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.database", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIRDFCompositeDataSource* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToXPCObject((nsISupports **) &prop,
kIRDFCompositeDataSourceIID, cx, *vp)) {
return JS_FALSE;
}
a->SetDatabase(prop);
NS_IF_RELEASE(prop);
break;
}
case XULELEMENT_CONTROLLER:
{
secMan->CheckScriptAccess(scriptCX, obj, "xulelement.controller", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIController* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToXPCObject((nsISupports **) &prop,
kIControllerIID, cx, *vp)) {
return JS_FALSE;
}
a->SetController(prop);
NS_IF_RELEASE(prop);
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
}
@ -296,8 +334,7 @@ ResolveXULElement(JSContext *cx, JSObject *obj, jsval id)
PR_STATIC_CALLBACK(JSBool)
XULElementAddBroadcastListener(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
nsAutoString b0;
nsIDOMElementPtr b1;
@ -356,8 +393,7 @@ XULElementAddBroadcastListener(JSContext *cx, JSObject *obj, uintN argc, jsval *
PR_STATIC_CALLBACK(JSBool)
XULElementRemoveBroadcastListener(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
nsAutoString b0;
nsIDOMElementPtr b1;
@ -416,8 +452,7 @@ XULElementRemoveBroadcastListener(JSContext *cx, JSObject *obj, uintN argc, jsva
PR_STATIC_CALLBACK(JSBool)
XULElementDoCommand(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
*rval = JSVAL_NULL;
@ -464,8 +499,7 @@ XULElementDoCommand(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval
PR_STATIC_CALLBACK(JSBool)
XULElementGetElementsByAttribute(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)JS_GetPrivate(cx, obj);
JSBool rBool = JS_FALSE;
nsIDOMXULElement *nativeThis = (nsIDOMXULElement*)nsJSUtils::nsGetNativeThis(cx, obj);
nsIDOMNodeList* nativeRet;
nsAutoString b0;
nsAutoString b1;
@ -536,11 +570,12 @@ JSClass XULElementClass = {
//
static JSPropertySpec XULElementProperties[] =
{
{"resource", XULELEMENT_RESOURCE, JSPROP_ENUMERATE | JSPROP_READONLY},
{"controller", XULELEMENT_CONTROLLER, JSPROP_ENUMERATE},
{"id", XULELEMENT_ID, JSPROP_ENUMERATE},
{"className", XULELEMENT_CLASSNAME, JSPROP_ENUMERATE},
{"style", XULELEMENT_STYLE, JSPROP_ENUMERATE | JSPROP_READONLY},
{"database", XULELEMENT_DATABASE, JSPROP_ENUMERATE},
{"resource", XULELEMENT_RESOURCE, JSPROP_ENUMERATE | JSPROP_READONLY},
{"controller", XULELEMENT_CONTROLLER, JSPROP_ENUMERATE},
{0}
};

View File

@ -57,7 +57,7 @@ enum XULFocusTracker_slots {
PR_STATIC_CALLBACK(JSBool)
GetXULFocusTrackerProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULFocusTracker *a = (nsIDOMXULFocusTracker*)JS_GetPrivate(cx, obj);
nsIDOMXULFocusTracker *a = (nsIDOMXULFocusTracker*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
@ -67,7 +67,7 @@ GetXULFocusTrackerProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (JSVAL_IS_INT(id)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
PRBool ok;
PRBool ok = PR_FALSE;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE;
}
@ -108,7 +108,7 @@ GetXULFocusTrackerProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
PR_STATIC_CALLBACK(JSBool)
SetXULFocusTrackerProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULFocusTracker *a = (nsIDOMXULFocusTracker*)JS_GetPrivate(cx, obj);
nsIDOMXULFocusTracker *a = (nsIDOMXULFocusTracker*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
@ -118,7 +118,7 @@ SetXULFocusTrackerProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
if (JSVAL_IS_INT(id)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
PRBool ok;
PRBool ok = PR_FALSE;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE;
}
@ -190,7 +190,7 @@ ResolveXULFocusTracker(JSContext *cx, JSObject *obj, jsval id)
PR_STATIC_CALLBACK(JSBool)
XULFocusTrackerAddFocusListener(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMXULFocusTracker *nativeThis = (nsIDOMXULFocusTracker*)JS_GetPrivate(cx, obj);
nsIDOMXULFocusTracker *nativeThis = (nsIDOMXULFocusTracker*)nsJSUtils::nsGetNativeThis(cx, obj);
nsIDOMElementPtr b0;
*rval = JSVAL_NULL;
@ -246,7 +246,7 @@ XULFocusTrackerAddFocusListener(JSContext *cx, JSObject *obj, uintN argc, jsval
PR_STATIC_CALLBACK(JSBool)
XULFocusTrackerRemoveFocusListener(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMXULFocusTracker *nativeThis = (nsIDOMXULFocusTracker*)JS_GetPrivate(cx, obj);
nsIDOMXULFocusTracker *nativeThis = (nsIDOMXULFocusTracker*)nsJSUtils::nsGetNativeThis(cx, obj);
nsIDOMElementPtr b0;
*rval = JSVAL_NULL;
@ -302,7 +302,7 @@ XULFocusTrackerRemoveFocusListener(JSContext *cx, JSObject *obj, uintN argc, jsv
PR_STATIC_CALLBACK(JSBool)
XULFocusTrackerFocusChanged(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMXULFocusTracker *nativeThis = (nsIDOMXULFocusTracker*)JS_GetPrivate(cx, obj);
nsIDOMXULFocusTracker *nativeThis = (nsIDOMXULFocusTracker*)nsJSUtils::nsGetNativeThis(cx, obj);
*rval = JSVAL_NULL;
@ -349,7 +349,7 @@ XULFocusTrackerFocusChanged(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
PR_STATIC_CALLBACK(JSBool)
XULFocusTrackerGetController(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMXULFocusTracker *nativeThis = (nsIDOMXULFocusTracker*)JS_GetPrivate(cx, obj);
nsIDOMXULFocusTracker *nativeThis = (nsIDOMXULFocusTracker*)nsJSUtils::nsGetNativeThis(cx, obj);
nsIController* nativeRet;
*rval = JSVAL_NULL;
@ -398,7 +398,7 @@ XULFocusTrackerGetController(JSContext *cx, JSObject *obj, uintN argc, jsval *ar
PR_STATIC_CALLBACK(JSBool)
XULFocusTrackerSetController(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMXULFocusTracker *nativeThis = (nsIDOMXULFocusTracker*)JS_GetPrivate(cx, obj);
nsIDOMXULFocusTracker *nativeThis = (nsIDOMXULFocusTracker*)nsJSUtils::nsGetNativeThis(cx, obj);
nsIControllerPtr b0;
*rval = JSVAL_NULL;
@ -425,7 +425,7 @@ XULFocusTrackerSetController(JSContext *cx, JSObject *obj, uintN argc, jsval *ar
if (argc >= 1) {
if (JS_FALSE == nsJSUtils::nsConvertJSValToXPCObject((nsISupports**)&b0,
if (JS_FALSE == nsJSUtils::nsConvertJSValToXPCObject((nsISupports**) &b0,
kIControllerIID, cx, argv[0])) {
return JS_FALSE;
}

View File

@ -1,328 +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.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#include "jsapi.h"
#include "nsJSUtils.h"
#include "nscore.h"
#include "nsIScriptContext.h"
#include "nsIScriptSecurityManager.h"
#include "nsIJSScriptObject.h"
#include "nsIScriptObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsIPtr.h"
#include "nsString.h"
#include "nsIRDFCompositeDataSource.h"
#include "nsIDOMXULTreeElement.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(kIRDFCompositeDataSourceIID, NS_IRDFCOMPOSITEDATASOURCE_IID);
static NS_DEFINE_IID(kIXULTreeElementIID, NS_IDOMXULTREEELEMENT_IID);
NS_DEF_PTR(nsIRDFCompositeDataSource);
NS_DEF_PTR(nsIDOMXULTreeElement);
//
// XULTreeElement property ids
//
enum XULTreeElement_slots {
XULTREEELEMENT_DATABASE = -1
};
/***********************************************************************/
//
// XULTreeElement Properties Getter
//
PR_STATIC_CALLBACK(JSBool)
GetXULTreeElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULTreeElement *a = (nsIDOMXULTreeElement*)JS_GetPrivate(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)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
PRBool ok;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE;
}
switch(JSVAL_TO_INT(id)) {
case XULTREEELEMENT_DATABASE:
{
secMan->CheckScriptAccess(scriptCX, obj, "xultreeelement.database", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIRDFCompositeDataSource* prop;
if (NS_OK == a->GetDatabase(&prop)) {
// get the js object; n.b., this will do a release on 'prop'
nsJSUtils::nsConvertXPCObjectToJSVal(prop, nsIRDFCompositeDataSource::GetIID(), cx, vp);
}
else {
return JS_FALSE;
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
}
NS_RELEASE(secMan);
}
else {
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
}
return PR_TRUE;
}
/***********************************************************************/
//
// XULTreeElement Properties Setter
//
PR_STATIC_CALLBACK(JSBool)
SetXULTreeElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULTreeElement *a = (nsIDOMXULTreeElement*)JS_GetPrivate(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)) {
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
nsIScriptSecurityManager *secMan;
PRBool ok;
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
return JS_FALSE;
}
switch(JSVAL_TO_INT(id)) {
case XULTREEELEMENT_DATABASE:
{
secMan->CheckScriptAccess(scriptCX, obj, "xultreeelement.database", &ok);
if (!ok) {
//Need to throw error here
return JS_FALSE;
}
nsIRDFCompositeDataSource* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToXPCObject((nsISupports **) &prop,
kIRDFCompositeDataSourceIID, cx, *vp)) {
return JS_FALSE;
}
a->SetDatabase(prop);
NS_IF_RELEASE(prop);
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
}
NS_RELEASE(secMan);
}
else {
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
}
return PR_TRUE;
}
//
// XULTreeElement finalizer
//
PR_STATIC_CALLBACK(void)
FinalizeXULTreeElement(JSContext *cx, JSObject *obj)
{
nsJSUtils::nsGenericFinalize(cx, obj);
}
//
// XULTreeElement enumerate
//
PR_STATIC_CALLBACK(JSBool)
EnumerateXULTreeElement(JSContext *cx, JSObject *obj)
{
return nsJSUtils::nsGenericEnumerate(cx, obj);
}
//
// XULTreeElement resolve
//
PR_STATIC_CALLBACK(JSBool)
ResolveXULTreeElement(JSContext *cx, JSObject *obj, jsval id)
{
return nsJSUtils::nsGenericResolve(cx, obj, id);
}
/***********************************************************************/
//
// class for XULTreeElement
//
JSClass XULTreeElementClass = {
"XULTreeElement",
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
JS_PropertyStub,
JS_PropertyStub,
GetXULTreeElementProperty,
SetXULTreeElementProperty,
EnumerateXULTreeElement,
ResolveXULTreeElement,
JS_ConvertStub,
FinalizeXULTreeElement
};
//
// XULTreeElement class properties
//
static JSPropertySpec XULTreeElementProperties[] =
{
{"database", XULTREEELEMENT_DATABASE, JSPROP_ENUMERATE},
{0}
};
//
// XULTreeElement class methods
//
static JSFunctionSpec XULTreeElementMethods[] =
{
{0}
};
//
// XULTreeElement constructor
//
PR_STATIC_CALLBACK(JSBool)
XULTreeElement(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
return JS_FALSE;
}
//
// XULTreeElement class initialization
//
extern "C" NS_DOM nsresult NS_InitXULTreeElementClass(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, "XULTreeElement", &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
&XULTreeElementClass, // JSClass
XULTreeElement, // JSNative ctor
0, // ctor args
XULTreeElementProperties, // proto props
XULTreeElementMethods, // 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 XULTreeElement JavaScript object
//
extern "C" NS_DOM nsresult NS_NewScriptXULTreeElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
{
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptXULTreeElement");
JSObject *proto;
JSObject *parent;
nsIScriptObjectOwner *owner;
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
nsresult result = NS_OK;
nsIDOMXULTreeElement *aXULTreeElement;
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_InitXULTreeElementClass(aContext, (void **)&proto)) {
return NS_ERROR_FAILURE;
}
result = aSupports->QueryInterface(kIXULTreeElementIID, (void **)&aXULTreeElement);
if (NS_OK != result) {
return result;
}
// create a js object for this class
*aReturn = JS_NewObject(jscontext, &XULTreeElementClass, proto, parent);
if (nsnull != *aReturn) {
// connect the native object to the js object
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aXULTreeElement);
}
else {
NS_RELEASE(aXULTreeElement);
return NS_ERROR_FAILURE;
}
return NS_OK;
}

View File

@ -71,8 +71,6 @@ static NS_DEFINE_IID(kILocaleIID, NS_ILOCALE_IID);
static NS_DEFINE_CID(kDateTimeFormatCID, NS_DATETIMEFORMAT_CID);
static NS_DEFINE_CID(kDateTimeFormatIID, NS_IDATETIMEFORMAT_IID);
nsresult
nsRDFContentUtils::AttachTextNode(nsIContent* parent, nsIRDFNode* value)
{
@ -142,11 +140,9 @@ nsRDFContentUtils::FindChildByTag(nsIContent* aElement,
nsresult
nsRDFContentUtils::FindChildByTagAndResource(nsIContent* aElement,
PRInt32 aNameSpaceID,
nsIAtom* aTag,
nsIRDFResource* aResource,
nsIContent** aResult)
nsRDFContentUtils::FindChildByResource(nsIContent* aElement,
nsIRDFResource* aResource,
nsIContent** aResult)
{
nsresult rv;
@ -159,28 +155,12 @@ nsRDFContentUtils::FindChildByTagAndResource(nsIContent* aElement,
if (NS_FAILED(rv = aElement->ChildAt(i, *getter_AddRefs(kid))))
return rv; // XXX fatal
// Make sure it's a <xul:treecell>
PRInt32 nameSpaceID;
if (NS_FAILED(rv = kid->GetNameSpaceID(nameSpaceID)))
return rv; // XXX fatal
if (nameSpaceID != aNameSpaceID)
continue; // wrong namespace
nsCOMPtr<nsIAtom> tag;
if (NS_FAILED(rv = kid->GetTag(*getter_AddRefs(tag))))
return rv; // XXX fatal
if (tag.get() != aTag)
continue; // wrong tag
// Now get the resource ID from the RDF:ID attribute. We do it
// via the content model, because you're never sure who
// might've added this stuff in...
nsCOMPtr<nsIRDFResource> resource;
rv = GetElementResource(kid, getter_AddRefs(resource));
NS_ASSERTION(NS_SUCCEEDED(rv), "severe error retrieving resource");
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv)) continue;
if (resource.get() != aResource)
continue; // not the resource we want
@ -221,14 +201,18 @@ nsRDFContentUtils::GetElementResource(nsIContent* aElement, nsIRDFResource** aRe
if (! doc)
return NS_ERROR_FAILURE;
nsAutoString uri;
char buf[256];
nsCAutoString uri;
nsStr::Initialize(uri, buf, sizeof(buf) - 1, 0, eOneByte, PR_FALSE);
buf[0] = 0;
rv = nsRDFContentUtils::MakeElementURI(doc, id, uri);
if (NS_FAILED(rv)) return rv;
NS_WITH_SERVICE(nsIRDFService, rdf, kRDFServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
rv = rdf->GetUnicodeResource(uri.GetUnicode(), aResult);
rv = rdf->GetResource(uri, aResult);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create resource");
if (NS_FAILED(rv)) return rv;
@ -452,7 +436,7 @@ nsRDFContentUtils::GetAttributeLogString(nsIContent* aElement, PRInt32 aNameSpac
nsresult
nsRDFContentUtils::MakeElementURI(nsIDocument* aDocument, const nsString& aElementID, nsString& aURI)
nsRDFContentUtils::MakeElementURI(nsIDocument* aDocument, const nsString& aElementID, nsCString& aURI)
{
// Convert an element's ID to a URI that can be used to refer to
// the element in the XUL graph.
@ -477,11 +461,12 @@ nsRDFContentUtils::MakeElementURI(nsIDocument* aDocument, const nsString& aEleme
if (! spec)
return NS_ERROR_FAILURE;
aURI = spec; // copied by nsString, right
aURI = spec;
#ifdef NECKO
nsCRT::free(spec);
#endif
if (aElementID.First() != PRUnichar('#')) {
if (aElementID.First() != '#') {
aURI += '#';
}
aURI += aElementID;

View File

@ -33,6 +33,7 @@ class nsIContent;
class nsIDocument;
class nsIDOMNodeList;
class nsIRDFNode;
class nsCString;
class nsString;
@ -50,11 +51,9 @@ public:
nsIContent **aResult);
static nsresult
FindChildByTagAndResource(nsIContent* aElement,
PRInt32 aNameSpaceID,
nsIAtom* aTag,
nsIRDFResource* aResource,
nsIContent** aResult);
FindChildByResource(nsIContent* aElement,
nsIRDFResource* aResource,
nsIContent** aResult);
static nsresult
GetElementResource(nsIContent* aElement, nsIRDFResource** aResult);
@ -72,7 +71,7 @@ public:
GetAttributeLogString(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aTag, nsString& aResult);
static nsresult
MakeElementURI(nsIDocument* aDocument, const nsString& aElementID, nsString& aURI);
MakeElementURI(nsIDocument* aDocument, const nsString& aElementID, nsCString& aURI);
static nsresult
MakeElementID(nsIDocument* aDocument, const nsString& aURI, nsString& aElementID);

View File

@ -79,7 +79,6 @@
#include "nsIStyledContent.h"
#include "nsIStyleRule.h"
#include "nsIURL.h"
#include "nsXULTreeElement.h"
#include "rdfutil.h"
#include "prlog.h"
#include "rdf.h"
@ -317,8 +316,8 @@ private:
PRBool mContentsMustBeGenerated;
nsVoidArray* mBroadcastListeners; // [WEAK]
nsIDOMXULElement* mBroadcaster; // [OWNER]
nsXULElement* mInnerXULElement; // [OWNER]
nsIController* mController; // [OWNER]
nsCOMPtr<nsIRDFCompositeDataSource> mDatabase; // [OWNER]
};
@ -397,7 +396,6 @@ RDFElementImpl::RDFElementImpl(PRInt32 aNameSpaceID, nsIAtom* aTag)
mContentsMustBeGenerated(PR_FALSE),
mBroadcastListeners(nsnull),
mBroadcaster(nsnull),
mInnerXULElement(nsnull),
mController(nsnull)
{
NS_INIT_REFCNT();
@ -514,8 +512,6 @@ RDFElementImpl::~RDFElementImpl()
++entry;
}
}
delete mInnerXULElement;
}
@ -576,16 +572,6 @@ RDFElementImpl::QueryInterface(REFNSIID iid, void** result)
else if (iid.Equals(kIJSScriptObjectIID)) {
*result = NS_STATIC_CAST(nsIJSScriptObject*, this);
}
else if (iid.Equals(nsIDOMXULTreeElement::GetIID()) &&
(mNameSpaceID == kNameSpaceID_XUL) &&
(mTag == kTreeAtom)) {
if (! mInnerXULElement) {
if ((mInnerXULElement = new nsXULTreeElement(this)) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
}
return mInnerXULElement->QueryInterface(iid, result);
}
else {
*result = nsnull;
return NS_NOINTERFACE;
@ -1275,16 +1261,8 @@ RDFElementImpl::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject
if (! mScriptObject) {
nsIScriptGlobalObject *global = aContext->GetGlobalObject();
nsresult (*fn)(nsIScriptContext* aContext, nsISupports* aSupports, nsISupports* aParent, void** aReturn);
rv = NS_NewScriptXULElement(aContext, (nsIDOMXULElement*) this, global, (void**) &mScriptObject);
if (mTag == kTreeAtom) {
fn = NS_NewScriptXULTreeElement;
}
else {
fn = NS_NewScriptXULElement;
}
rv = fn(aContext, (nsIDOMXULElement*) this, global, (void**) &mScriptObject);
NS_RELEASE(global);
// Ensure that a reference exists to this element
@ -2532,6 +2510,36 @@ RDFElementImpl::GetResource(nsIRDFResource** aResource)
return NS_OK;
}
NS_IMETHODIMP
RDFElementImpl::GetDatabase(nsIRDFCompositeDataSource** aDatabase)
{
NS_PRECONDITION(aDatabase != nsnull, "null ptr");
if (! aDatabase)
return NS_ERROR_NULL_POINTER;
*aDatabase = mDatabase;
NS_IF_ADDREF(*aDatabase);
return NS_OK;
}
NS_IMETHODIMP
RDFElementImpl::SetDatabase(nsIRDFCompositeDataSource* aDatabase)
{
// XXX maybe someday you'll be allowed to change it.
NS_PRECONDITION(mDatabase == nsnull, "already initialized");
if (mDatabase)
return NS_ERROR_ALREADY_INITIALIZED;
mDatabase = aDatabase;
// XXX reconstruct the entire tree now!
return NS_OK;
}
////////////////////////////////////////////////////////////////////////
// Implementation methods

File diff suppressed because it is too large Load Diff

View File

@ -51,6 +51,8 @@ public:
RDFGenericBuilderImpl();
virtual ~RDFGenericBuilderImpl();
nsresult Init();
// nsISupports interface
NS_DECL_ISUPPORTS
@ -91,30 +93,42 @@ public:
// nsIDOMElementObserver interface
NS_DECL_IDOMELEMENTOBSERVER
// nsITimerCallback interface
virtual void Notify(nsITimer* aTimer);
// Implementation methods
nsresult
SetAllAttributesOnElement(nsIContent *aParentNode, nsIContent *aNode, nsIRDFResource *res);
nsresult
FindTemplateForResource(nsIRDFResource *aNode, nsIContent **theTemplate);
FindTemplate(nsIContent* aElement,
nsIRDFResource* aProperty,
nsIRDFResource* aChild,
nsIContent **theTemplate);
nsresult
IsTemplateRuleMatch(nsIRDFResource *aNode, nsIContent *aRule, PRBool *matchingRuleFound);
IsTemplateRuleMatch(nsIContent* aElement,
nsIRDFResource* aProperty,
nsIRDFResource* aChild,
nsIContent *aRule,
PRBool *isMatch);
PRBool
IsIgnoreableAttribute(PRInt32 aNameSpaceID, nsIAtom* aAtom);
nsresult
GetSubstitutionText(nsIRDFResource* aResource,
const nsString& aSubstitution,
nsString& aResult);
nsresult
BuildContentFromTemplate(nsIContent *aTemplateNode,
nsIContent *aRealNode,
PRBool aIsUnique,
nsIRDFResource* aValue,
nsIRDFResource* aChild,
PRInt32 aNaturalOrderPos);
nsresult
CreateWidgetItem(nsIContent* aElement,
nsIRDFResource* aProperty,
nsIRDFResource* aValue,
nsIRDFResource* aChild,
PRInt32 aNaturalOrderPos);
enum eUpdateAction { eSet, eClear };
@ -126,6 +140,11 @@ public:
nsIRDFResource* aProperty,
nsIRDFNode* aValue);
nsresult
RemoveWidgetItem(nsIContent* aElement,
nsIRDFResource* aProperty,
nsIRDFResource* aValue);
nsresult
CreateContainerContents(nsIContent* aElement, nsIRDFResource* aResource);
@ -138,27 +157,6 @@ public:
nsIAtom* aTag,
nsIContent** aResult);
virtual nsresult
AddWidgetItem(nsIContent* aWidgetElement,
nsIRDFResource* aProperty,
nsIRDFResource* aValue,
PRInt32 naturalOrderPos) = 0;
virtual nsresult
RemoveWidgetItem(nsIContent* aWidgetElement,
nsIRDFResource* aProperty,
nsIRDFResource* aValue) = 0;
virtual nsresult
SetWidgetAttribute(nsIContent* aWidgetElement,
nsIRDFResource* aProperty,
nsIRDFNode* aValue) = 0;
virtual nsresult
UnsetWidgetAttribute(nsIContent* aWidgetElement,
nsIRDFResource* aProperty,
nsIRDFNode* aValue) = 0;
virtual PRBool
IsContainmentProperty(nsIContent* aElement, nsIRDFResource* aProperty);
@ -178,11 +176,8 @@ public:
IsElementInWidget(nsIContent* aElement);
PRBool
IsItemOrFolder(nsIContent* aElement);
IsResourceElement(nsIContent* aElement);
PRBool
IsWidgetInsertionRootElement(nsIContent* aElement);
nsresult
GetDOMNodeResource(nsIDOMNode* aNode, nsIRDFResource** aResource);
@ -198,20 +193,8 @@ public:
CloseWidgetItem(nsIContent* aElement);
virtual nsresult
GetRootWidgetAtom(nsIAtom** aResult) = 0;
virtual nsresult
GetWidgetItemAtom(nsIAtom** aResult) = 0;
virtual nsresult
GetWidgetFolderAtom(nsIAtom** aResult) = 0;
virtual nsresult
GetInsertionRootAtom(nsIAtom** aResult) = 0;
virtual nsresult
GetItemAtomThatContainsTheChildren(nsIAtom** aResult) = 0;
// Well, you come up with a better name.
RemoveAndRebuildGeneratedChildren(nsIContent* aElement);
protected:
nsIRDFDocument* mDocument;
@ -220,9 +203,6 @@ protected:
nsITimer *mTimer;
virtual void
Notify(nsITimer *timer) = 0;
// pseudo-constants
static nsrefcnt gRefCnt;
static nsIRDFService* gRDFService;
@ -232,6 +212,7 @@ protected:
static nsIAtom* kContainerAtom;
static nsIAtom* kLazyContentAtom;
static nsIAtom* kIsContainerAtom;
static nsIAtom* kIsEmptyAtom;
static nsIAtom* kXULContentsGeneratedAtom;
static nsIAtom* kTemplateContentsGeneratedAtom;
static nsIAtom* kContainerContentsGeneratedAtom;
@ -244,9 +225,8 @@ protected:
static nsIAtom* kContainmentAtom;
static nsIAtom* kIgnoreAtom;
static nsIAtom* kRefAtom;
static nsIAtom* kValueAtom;
static nsIAtom* kSubcontainmentAtom;
static nsIAtom* kRootcontainmentAtom;
static nsIAtom* kTemplateAtom;
static nsIAtom* kRuleAtom;
static nsIAtom* kTextAtom;

View File

@ -1,447 +0,0 @@
/* -*- 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.0 (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.
*/
#include "nsCOMPtr.h"
#include "nsCRT.h"
#include "nsIAtom.h"
#include "nsIContent.h"
#include "nsIDOMElement.h"
#include "nsIDOMElementObserver.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeObserver.h"
#include "nsIDocument.h"
#include "nsINameSpaceManager.h"
#include "nsIRDFContentModelBuilder.h"
#include "nsIRDFCompositeDataSource.h"
#include "nsIRDFDocument.h"
#include "nsIRDFNode.h"
#include "nsIRDFObserver.h"
#include "nsIRDFService.h"
#include "nsIServiceManager.h"
#include "nsINameSpaceManager.h"
#include "nsIServiceManager.h"
#include "nsISupportsArray.h"
#include "nsIURL.h"
#include "nsLayoutCID.h"
#include "nsRDFCID.h"
#include "nsRDFContentUtils.h"
#include "nsString.h"
#include "nsXPIDLString.h"
#include "rdf.h"
#include "rdfutil.h"
#include "nsITimer.h"
#include "nsVoidArray.h"
#include "nsRDFGenericBuilder.h"
////////////////////////////////////////////////////////////////////////
static NS_DEFINE_IID(kIContentIID, NS_ICONTENT_IID);
static NS_DEFINE_IID(kIDocumentIID, NS_IDOCUMENT_IID);
static NS_DEFINE_IID(kINameSpaceManagerIID, NS_INAMESPACEMANAGER_IID);
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
static NS_DEFINE_IID(kIRDFLiteralIID, NS_IRDFLITERAL_IID);
static NS_DEFINE_IID(kIRDFContentModelBuilderIID, NS_IRDFCONTENTMODELBUILDER_IID);
static NS_DEFINE_IID(kIRDFObserverIID, NS_IRDFOBSERVER_IID);
static NS_DEFINE_IID(kIRDFServiceIID, NS_IRDFSERVICE_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
////////////////////////////////////////////////////////////////////////
class RDFMenuBuilderImpl : public RDFGenericBuilderImpl
{
public:
RDFMenuBuilderImpl();
virtual ~RDFMenuBuilderImpl();
// Implementation methods
nsresult
AddWidgetItem(nsIContent* aMenuItemElement,
nsIRDFResource* aProperty,
nsIRDFResource* aValue, PRInt32 aNaturalOrderPos);
nsresult
RemoveWidgetItem(nsIContent* aMenuItemElement,
nsIRDFResource* aProperty,
nsIRDFResource* aValue);
nsresult
SetWidgetAttribute(nsIContent* aMenuItemElement,
nsIRDFResource* aProperty,
nsIRDFNode* aValue);
nsresult
UnsetWidgetAttribute(nsIContent* aMenuItemElement,
nsIRDFResource* aProperty,
nsIRDFNode* aValue);
nsresult
GetRootWidgetAtom(nsIAtom** aResult) {
NS_ADDREF(kMenuAtom);
*aResult = kMenuAtom;
return NS_OK;
}
nsresult
GetWidgetItemAtom(nsIAtom** aResult) {
NS_ADDREF(kMenuItemAtom);
*aResult = kMenuItemAtom;
return NS_OK;
}
nsresult
GetWidgetFolderAtom(nsIAtom** aResult) {
NS_ADDREF(kMenuAtom);
*aResult = kMenuAtom;
return NS_OK;
}
nsresult
GetInsertionRootAtom(nsIAtom** aResult) {
NS_ADDREF(kMenuAtom);
*aResult = kMenuAtom;
return NS_OK;
}
nsresult
GetItemAtomThatContainsTheChildren(nsIAtom** aResult) {
NS_ADDREF(kMenuAtom);
*aResult = kMenuAtom;
return NS_OK;
}
void
Notify(nsITimer *timer);
// pseudo-constants
static nsrefcnt gRefCnt;
static nsIAtom* kMenuBarAtom;
static nsIAtom* kMenuAtom;
static nsIAtom* kMenuItemAtom;
static nsIAtom* kNameAtom;
};
////////////////////////////////////////////////////////////////////////
nsrefcnt RDFMenuBuilderImpl::gRefCnt = 0;
nsIAtom* RDFMenuBuilderImpl::kMenuAtom;
nsIAtom* RDFMenuBuilderImpl::kMenuItemAtom;
nsIAtom* RDFMenuBuilderImpl::kMenuBarAtom;
nsIAtom* RDFMenuBuilderImpl::kNameAtom;
////////////////////////////////////////////////////////////////////////
nsresult
NS_NewRDFMenuBuilder(nsIRDFContentModelBuilder** result)
{
NS_PRECONDITION(result != nsnull, "null ptr");
if (! result)
return NS_ERROR_NULL_POINTER;
RDFMenuBuilderImpl* builder = new RDFMenuBuilderImpl();
if (! builder)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(builder);
*result = builder;
return NS_OK;
}
RDFMenuBuilderImpl::RDFMenuBuilderImpl(void)
: RDFGenericBuilderImpl()
{
if (gRefCnt == 0) {
kMenuAtom = NS_NewAtom("menu");
kMenuItemAtom = NS_NewAtom("menuitem");
kMenuBarAtom = NS_NewAtom("menubar");
kNameAtom = NS_NewAtom("name");
}
++gRefCnt;
}
RDFMenuBuilderImpl::~RDFMenuBuilderImpl(void)
{
--gRefCnt;
if (gRefCnt == 0) {
NS_RELEASE(kMenuAtom);
NS_RELEASE(kMenuItemAtom);
NS_RELEASE(kMenuBarAtom);
NS_RELEASE(kNameAtom);
}
}
void
RDFMenuBuilderImpl::Notify(nsITimer *timer)
{
}
////////////////////////////////////////////////////////////////////////
// Implementation methods
nsresult
RDFMenuBuilderImpl::AddWidgetItem(nsIContent* aElement,
nsIRDFResource* aProperty,
nsIRDFResource* aValue,
PRInt32 naturalOrderPos)
{
nsresult rv;
nsCOMPtr<nsIContent> menuParent;
menuParent = dont_QueryInterface(aElement);
if (!IsItemOrFolder(aElement) && !IsWidgetInsertionRootElement(aElement))
{
NS_ERROR("Can't add something here!");
return NS_ERROR_UNEXPECTED;
}
// Find out if we're a container or not.
PRBool markAsContainer = IsContainer(aElement, aValue) && !IsEmpty(aElement, aValue);
nsCOMPtr<nsIAtom> itemAtom;
// Figure out what atom to use based on whether or not we're a container
// or leaf
if (markAsContainer)
{
// We're a menu element
GetWidgetFolderAtom(getter_AddRefs(itemAtom));
}
else
{
// We're a menuitem element
GetWidgetItemAtom(getter_AddRefs(itemAtom));
}
// Create the <xul:menuitem> element
nsCOMPtr<nsIContent> menuItem;
if (NS_FAILED(rv = CreateElement(kNameSpaceID_XUL,
itemAtom,
aValue,
getter_AddRefs(menuItem))))
return rv;
// Add the new menu item to the <xul:menu> element.
menuParent->AppendChildTo(menuItem, PR_TRUE);
// Add miscellaneous attributes by iterating _all_ of the
// properties out of the resource.
nsCOMPtr<nsISimpleEnumerator> arcs;
rv = mDB->ArcLabelsOut(aValue, getter_AddRefs(arcs));
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get arcs out");
if (NS_FAILED(rv)) return rv;
while (1) {
PRBool hasMore;
rv = arcs->HasMoreElements(&hasMore);
if (NS_FAILED(rv)) return rv;
if (! hasMore)
break;
nsCOMPtr<nsISupports> isupports;
rv = arcs->GetNext(getter_AddRefs(isupports));
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get cursor value");
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIRDFResource> property = do_QueryInterface(isupports);
// Ignore properties that are used to indicate containment
if (IsContainmentProperty(aElement, property))
continue;
// Ignore properties that we have been explicitly _asked_ to
// ignore.
if (IsIgnoredProperty(aElement, property))
continue;
PRInt32 nameSpaceID;
nsCOMPtr<nsIAtom> tag;
if (NS_FAILED(rv = mDocument->SplitProperty(property, &nameSpaceID, getter_AddRefs(tag)))) {
NS_ERROR("unable to split property");
return rv;
}
nsCOMPtr<nsIRDFNode> value;
if (NS_FAILED(rv = mDB->GetTarget(aValue, property, PR_TRUE, getter_AddRefs(value)))) {
NS_ERROR("unable to get target");
return rv;
}
// ArcsLabelsOut is allowed to be promiscuous, giving back
// potential arc labels that may not currently have a value.
if (rv == NS_RDF_NO_VALUE)
continue;
nsAutoString s;
rv = nsRDFContentUtils::GetTextForNode(value, s);
if (NS_FAILED(rv)) return rv;
rv = menuItem->SetAttribute(nameSpaceID, tag, s, PR_FALSE);
if (NS_FAILED(rv)) return rv;
// XXX This should go away and just be determined dynamically;
// e.g., by setting an attribute on the "xul:menu" tag
nsAutoString tagStr;
tag->ToString(tagStr);
if (tagStr.EqualsIgnoreCase("name")) {
// Hack to ensure that we add in a lowercase name attribute also.
menuItem->SetAttribute(kNameSpaceID_None, kNameAtom, s, PR_FALSE);
}
}
// XXX: This is a hack until the menu folks get their act together.
menuItem->SetAttribute(kNameSpaceID_None, kOpenAtom, "true", PR_FALSE);
// Finally, mark this as a "container" so that we know to
// recursively generate kids if they're asked for.
if (markAsContainer == PR_TRUE)
{
// Finally, mark this as a "container" so that we know to
// recursively generate kids if they're asked for.
if (NS_FAILED(rv = menuItem->SetAttribute(kNameSpaceID_None, kLazyContentAtom, "true", PR_FALSE)))
return rv;
}
return NS_OK;
}
nsresult
RDFMenuBuilderImpl::RemoveWidgetItem(nsIContent* aMenuItemElement,
nsIRDFResource* aProperty,
nsIRDFResource* aValue)
{
nsresult rv;
// Find the doomed kid and blow it away.
PRInt32 count;
if (NS_FAILED(rv = aMenuItemElement->ChildCount(count)))
return rv;
for (PRInt32 i = 0; i < count; ++i) {
nsCOMPtr<nsIContent> kid;
rv = aMenuItemElement->ChildAt(i, *getter_AddRefs(kid));
if (NS_FAILED(rv)) return rv;
// Make sure it's a <xul:menu> or <xul:menuitem>
PRInt32 nameSpaceID;
rv = kid->GetNameSpaceID(nameSpaceID);
if (NS_FAILED(rv)) return rv;
if (nameSpaceID != kNameSpaceID_XUL)
continue; // wrong namespace
nsCOMPtr<nsIAtom> tag;
rv = kid->GetTag(*getter_AddRefs(tag));
if (NS_FAILED(rv)) return rv;
if ((tag.get() != kMenuItemAtom) &&
(tag.get() != kMenuAtom))
continue; // wrong tag
// Now get the resource ID from the RDF:ID attribute. We do it
// via the content model, because you're never sure who
// might've added this stuff in...
nsCOMPtr<nsIRDFResource> resource;
rv = nsRDFContentUtils::GetElementRefResource(kid, getter_AddRefs(resource));
NS_ASSERTION(NS_SUCCEEDED(rv), "severe error retrieving resource");
if(NS_FAILED(rv)) return rv;
if (resource.get() != aValue)
continue; // not the resource we want
// Fount it! Now kill it.
rv = aMenuItemElement->RemoveChildAt(i, PR_TRUE);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to remove xul:menu[item] from xul:menu");
if (NS_FAILED(rv)) return rv;
return NS_OK;
}
// XXX make this a warning
NS_WARNING("unable to find child to remove");
return NS_OK;
}
nsresult
RDFMenuBuilderImpl::SetWidgetAttribute(nsIContent* aMenuItemElement,
nsIRDFResource* aProperty,
nsIRDFNode* aValue)
{
nsresult rv;
PRInt32 nameSpaceID;
nsCOMPtr<nsIAtom> tag;
rv = mDocument->SplitProperty(aProperty, &nameSpaceID, getter_AddRefs(tag));
if (NS_FAILED(rv)) return rv;
nsAutoString value;
rv = nsRDFContentUtils::GetTextForNode(aValue, value);
if (NS_FAILED(rv)) return rv;
rv = aMenuItemElement->SetAttribute(nameSpaceID, tag, value, PR_TRUE);
if (NS_FAILED(rv)) return rv;
// XXX This should go away and just be determined dynamically;
// e.g., by setting an attribute on the "xul:menu" tag.
nsAutoString tagStr;
tag->ToString(tagStr);
if (tagStr.EqualsIgnoreCase("name")) {
// Hack to ensure that we add in a lowercase name attribute also.
aMenuItemElement->SetAttribute(kNameSpaceID_None, kNameAtom, value, PR_TRUE);
}
return NS_OK;
}
nsresult
RDFMenuBuilderImpl::UnsetWidgetAttribute(nsIContent* aMenuItemElement,
nsIRDFResource* aProperty,
nsIRDFNode* aValue)
{
nsresult rv;
PRInt32 nameSpaceID;
nsCOMPtr<nsIAtom> tag;
rv = mDocument->SplitProperty(aProperty, &nameSpaceID, getter_AddRefs(tag));
if (NS_FAILED(rv)) return rv;
rv = aMenuItemElement->UnsetAttribute(nameSpaceID, tag, PR_TRUE);
if (NS_FAILED(rv)) return rv;
// XXX This should go away and just be determined dynamically;
// e.g., by setting an attribute on the "xul:menu" tag.
nsAutoString tagStr;
tag->ToString(tagStr);
if (tagStr.EqualsIgnoreCase("name")) {
// Hack to ensure that we add in a lowercase name attribute also.
aMenuItemElement->UnsetAttribute(kNameSpaceID_None, kNameAtom, PR_TRUE);
}
return NS_OK;
}

View File

@ -1,441 +0,0 @@
/* -*- 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.0 (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.
*/
/* XXX: Teach this how to make toolboxes as well as toolbars. */
#include "nsCOMPtr.h"
#include "nsCRT.h"
#include "nsIAtom.h"
#include "nsIContent.h"
#include "nsIDOMElement.h"
#include "nsIDOMElementObserver.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeObserver.h"
#include "nsIDocument.h"
#include "nsINameSpaceManager.h"
#include "nsIRDFContentModelBuilder.h"
#include "nsIRDFCompositeDataSource.h"
#include "nsIRDFDocument.h"
#include "nsIRDFNode.h"
#include "nsIRDFObserver.h"
#include "nsIRDFService.h"
#include "nsIServiceManager.h"
#include "nsINameSpaceManager.h"
#include "nsIServiceManager.h"
#include "nsISupportsArray.h"
#include "nsIURL.h"
#include "nsLayoutCID.h"
#include "nsRDFCID.h"
#include "nsRDFContentUtils.h"
#include "nsString.h"
#include "nsXPIDLString.h"
#include "rdf.h"
#include "rdfutil.h"
#include "nsVoidArray.h"
#include "nsRDFGenericBuilder.h"
////////////////////////////////////////////////////////////////////////
static NS_DEFINE_IID(kIContentIID, NS_ICONTENT_IID);
static NS_DEFINE_IID(kIDocumentIID, NS_IDOCUMENT_IID);
static NS_DEFINE_IID(kINameSpaceManagerIID, NS_INAMESPACEMANAGER_IID);
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
static NS_DEFINE_IID(kIRDFLiteralIID, NS_IRDFLITERAL_IID);
static NS_DEFINE_IID(kIRDFContentModelBuilderIID, NS_IRDFCONTENTMODELBUILDER_IID);
static NS_DEFINE_IID(kIRDFObserverIID, NS_IRDFOBSERVER_IID);
static NS_DEFINE_IID(kIRDFServiceIID, NS_IRDFSERVICE_IID);
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
////////////////////////////////////////////////////////////////////////
class RDFToolbarBuilderImpl : public RDFGenericBuilderImpl
{
public:
RDFToolbarBuilderImpl();
virtual ~RDFToolbarBuilderImpl();
// Implementation methods
nsresult
AddWidgetItem(nsIContent* aToolbarItemElement,
nsIRDFResource* aProperty,
nsIRDFResource* aValue, PRInt32 aNaturalOrderPos);
nsresult
RemoveWidgetItem(nsIContent* aTreeItemElement,
nsIRDFResource* aProperty,
nsIRDFResource* aValue);
nsresult
SetWidgetAttribute(nsIContent* aToolbarItemElement,
nsIRDFResource* aProperty,
nsIRDFNode* aValue);
nsresult
UnsetWidgetAttribute(nsIContent* aToolbarItemElement,
nsIRDFResource* aProperty,
nsIRDFNode* aValue);
nsresult
GetRootWidgetAtom(nsIAtom** aResult) {
NS_ADDREF(kToolbarAtom);
*aResult = kToolbarAtom;
return NS_OK;
}
nsresult
GetWidgetItemAtom(nsIAtom** aResult) {
NS_ADDREF(kTitledButtonAtom);
*aResult = kTitledButtonAtom;
return NS_OK;
}
nsresult
GetWidgetFolderAtom(nsIAtom** aResult) {
NS_ADDREF(kTitledButtonAtom);
*aResult = kTitledButtonAtom;
return NS_OK;
}
nsresult
GetInsertionRootAtom(nsIAtom** aResult) {
NS_ADDREF(kToolbarAtom);
*aResult = kToolbarAtom;
return NS_OK;
}
nsresult
GetItemAtomThatContainsTheChildren(nsIAtom** aResult) {
NS_ADDREF(kTitledButtonAtom);
*aResult = kTitledButtonAtom;
return NS_OK;
}
void
Notify(nsITimer *timer);
// pseudo-constants
static nsrefcnt gRefCnt;
static nsIAtom* kToolbarAtom;
static nsIAtom* kTitledButtonAtom;
static nsIAtom* kAlignAtom;
static nsIAtom* kSrcAtom;
static nsIAtom* kValueAtom;
};
////////////////////////////////////////////////////////////////////////
nsrefcnt RDFToolbarBuilderImpl::gRefCnt = 0;
nsIAtom* RDFToolbarBuilderImpl::kToolbarAtom;
nsIAtom* RDFToolbarBuilderImpl::kTitledButtonAtom;
nsIAtom* RDFToolbarBuilderImpl::kAlignAtom;
nsIAtom* RDFToolbarBuilderImpl::kSrcAtom;
nsIAtom* RDFToolbarBuilderImpl::kValueAtom;
////////////////////////////////////////////////////////////////////////
nsresult
NS_NewRDFToolbarBuilder(nsIRDFContentModelBuilder** result)
{
NS_PRECONDITION(result != nsnull, "null ptr");
if (! result)
return NS_ERROR_NULL_POINTER;
RDFToolbarBuilderImpl* builder = new RDFToolbarBuilderImpl();
if (! builder)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(builder);
*result = builder;
return NS_OK;
}
RDFToolbarBuilderImpl::RDFToolbarBuilderImpl(void)
: RDFGenericBuilderImpl()
{
if (gRefCnt == 0) {
kToolbarAtom = NS_NewAtom("toolbar");
kTitledButtonAtom = NS_NewAtom("titledbutton");
kAlignAtom = NS_NewAtom("align");
kSrcAtom = NS_NewAtom("src");
kValueAtom = NS_NewAtom("value");
}
++gRefCnt;
}
RDFToolbarBuilderImpl::~RDFToolbarBuilderImpl(void)
{
--gRefCnt;
if (gRefCnt == 0) {
NS_RELEASE(kToolbarAtom);
NS_RELEASE(kTitledButtonAtom);
NS_RELEASE(kAlignAtom);
NS_RELEASE(kSrcAtom);
NS_RELEASE(kValueAtom);
}
}
void
RDFToolbarBuilderImpl::Notify(nsITimer *timer)
{
}
////////////////////////////////////////////////////////////////////////
// Implementation methods
nsresult
RDFToolbarBuilderImpl::AddWidgetItem(nsIContent* aElement,
nsIRDFResource* aProperty,
nsIRDFResource* aValue,
PRInt32 naturalOrderPos)
{
nsresult rv;
nsCOMPtr<nsIContent> toolbarParent;
toolbarParent = dont_QueryInterface(aElement);
if (!IsItemOrFolder(aElement) && !IsWidgetInsertionRootElement(aElement))
{
NS_ERROR("Can't add something here!");
return NS_ERROR_UNEXPECTED;
}
PRBool markAsContainer = IsContainer(aElement, aValue);
// Create the <xul:titledbutton> element
nsCOMPtr<nsIContent> toolbarItem;
if (NS_FAILED(rv = CreateElement(kNameSpaceID_XUL,
kTitledButtonAtom,
aValue,
getter_AddRefs(toolbarItem))))
return rv;
// Add the <xul:titledbutton> to the <xul:toolbar> element.
toolbarParent->AppendChildTo(toolbarItem, PR_TRUE);
// Add miscellaneous attributes by iterating _all_ of the
// properties out of the resource.
// XXX Per Bug 3367, this'll have to be fixed.
nsCOMPtr<nsISimpleEnumerator> arcs;
rv = mDB->ArcLabelsOut(aValue, getter_AddRefs(arcs));
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get arcs out");
if (NS_FAILED(rv)) return rv;
while (1) {
PRBool hasMore;
rv = arcs->HasMoreElements(&hasMore);
if (NS_FAILED(rv)) return rv;
if (! hasMore)
break;
nsCOMPtr<nsISupports> isupports;
rv = arcs->GetNext(getter_AddRefs(isupports));
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get cursor value");
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIRDFResource> property = do_QueryInterface(isupports);
// Ignore properties that are used to indicate containment
if (IsContainmentProperty(aElement, property))
continue;
// Ignore properties that we have been explicitly _asked_ to
// ignore.
if (IsIgnoredProperty(aElement, property))
continue;
PRInt32 nameSpaceID;
nsCOMPtr<nsIAtom> tag;
if (NS_FAILED(rv = mDocument->SplitProperty(property, &nameSpaceID, getter_AddRefs(tag)))) {
NS_ERROR("unable to split property");
return rv;
}
nsCOMPtr<nsIRDFNode> value;
if (NS_FAILED(rv = mDB->GetTarget(aValue, property, PR_TRUE, getter_AddRefs(value)))) {
NS_ERROR("unable to get target");
return rv;
}
// ArcsLabelsOut is allowed to be promiscuous, giving back
// potential arc labels that may not currently have a value.
if (rv == NS_RDF_NO_VALUE)
continue;
nsAutoString s;
rv = nsRDFContentUtils::GetTextForNode(value, s);
if (NS_FAILED(rv)) return rv;
toolbarItem->SetAttribute(nameSpaceID, tag, s, PR_FALSE);
nsString tagStr;
tag->ToString(tagStr);
if (tagStr.EqualsIgnoreCase("name")) {
// Hack to ensure that we add in a lowercase value attribute also.
toolbarItem->SetAttribute(kNameSpaceID_None, kValueAtom, s, PR_FALSE);
}
// XXX (Dave) I want these to go away. Style sheets should be used for these.
toolbarItem->SetAttribute(kNameSpaceID_None, kAlignAtom, "right", PR_FALSE);
toolbarItem->SetAttribute(kNameSpaceID_None, kSrcAtom, "resource:/res/toolbar/TB_Location.gif", PR_FALSE);
}
// Finally, mark this as a "container" so that we know to
// recursively generate kids if they're asked for.
if (markAsContainer == PR_TRUE)
{
// Finally, mark this as a "container" so that we know to
// recursively generate kids if they're asked for.
if (NS_FAILED(rv = toolbarItem->SetAttribute(kNameSpaceID_None, kLazyContentAtom, "true", PR_FALSE)))
return rv;
}
return NS_OK;
}
nsresult
RDFToolbarBuilderImpl::RemoveWidgetItem(nsIContent* aToolbarItemElement,
nsIRDFResource* aProperty,
nsIRDFResource* aValue)
{
nsresult rv;
// Find the doomed kid and blow it away.
PRInt32 count;
if (NS_FAILED(rv = aToolbarItemElement->ChildCount(count)))
return rv;
for (PRInt32 i = 0; i < count; ++i) {
nsCOMPtr<nsIContent> kid;
rv = aToolbarItemElement->ChildAt(i, *getter_AddRefs(kid));
if (NS_FAILED(rv)) return rv;
// Make sure it's a <xul:toolbar> or <xul:titledbutton>
PRInt32 nameSpaceID;
rv = kid->GetNameSpaceID(nameSpaceID);
if (NS_FAILED(rv)) return rv;
if (nameSpaceID != kNameSpaceID_XUL)
continue; // wrong namespace
nsCOMPtr<nsIAtom> tag;
rv = kid->GetTag(*getter_AddRefs(tag));
if (NS_FAILED(rv)) return rv;
if ((tag.get() != kTitledButtonAtom) &&
(tag.get() != kToolbarAtom))
continue; // wrong tag
// Now get the resource ID from the RDF:ID attribute. We do it
// via the content model, because you're never sure who
// might've added this stuff in...
nsCOMPtr<nsIRDFResource> resource;
rv = nsRDFContentUtils::GetElementRefResource(kid, getter_AddRefs(resource));
NS_ASSERTION(NS_SUCCEEDED(rv), "severe error retrieving resource");
if(NS_FAILED(rv)) return rv;
if (resource.get() != aValue)
continue; // not the resource we want
// Fount it! Now kill it.
rv = aToolbarItemElement->RemoveChildAt(i, PR_TRUE);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to remove xul:toolbar/titledbutton from xul:toolbar");
if (NS_FAILED(rv)) return rv;
return NS_OK;
}
// XXX make this a warning
NS_WARNING("unable to find child to remove");
return NS_OK;
}
nsresult
RDFToolbarBuilderImpl::SetWidgetAttribute(nsIContent* aToolbarItemElement,
nsIRDFResource* aProperty,
nsIRDFNode* aValue)
{
nsresult rv;
PRInt32 nameSpaceID;
nsCOMPtr<nsIAtom> tag;
rv = mDocument->SplitProperty(aProperty, &nameSpaceID, getter_AddRefs(tag));
if (NS_FAILED(rv)) return rv;
nsAutoString value;
rv = nsRDFContentUtils::GetTextForNode(aValue, value);
if (NS_FAILED(rv)) return rv;
rv = aToolbarItemElement->SetAttribute(nameSpaceID, tag, value, PR_TRUE);
if (NS_FAILED(rv)) return rv;
// XXX This should go away and just be determined dynamically;
// e.g., by setting an attribute on the "xul:menu" tag.
nsAutoString tagStr;
tag->ToString(tagStr);
if (tagStr.EqualsIgnoreCase("name")) {
// Hack to ensure that we add in a lowercase name attribute also.
aToolbarItemElement->SetAttribute(kNameSpaceID_None, kValueAtom, value, PR_TRUE);
}
return NS_OK;
}
nsresult
RDFToolbarBuilderImpl::UnsetWidgetAttribute(nsIContent* aToolbarItemElement,
nsIRDFResource* aProperty,
nsIRDFNode* aValue)
{
nsresult rv;
PRInt32 nameSpaceID;
nsCOMPtr<nsIAtom> tag;
rv = mDocument->SplitProperty(aProperty, &nameSpaceID, getter_AddRefs(tag));
if (NS_FAILED(rv)) return rv;
rv = aToolbarItemElement->UnsetAttribute(nameSpaceID, tag, PR_TRUE);
if (NS_FAILED(rv)) return rv;
// XXX This should go away and just be determined dynamically;
// e.g., by setting an attribute on the "xul:menu" tag.
nsAutoString tagStr;
tag->ToString(tagStr);
if (tagStr.EqualsIgnoreCase("name")) {
// Hack to ensure that we add in a lowercase name attribute also.
aToolbarItemElement->UnsetAttribute(kNameSpaceID_None, kValueAtom, PR_TRUE);
}
return NS_OK;
}

File diff suppressed because it is too large Load Diff

View File

@ -109,9 +109,7 @@ static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
static NS_DEFINE_CID(kRDFCompositeDataSourceCID, NS_RDFCOMPOSITEDATASOURCE_CID);
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
static NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
static NS_DEFINE_CID(kRDFTreeBuilderCID, NS_RDFTREEBUILDER_CID);
static NS_DEFINE_CID(kRDFMenuBuilderCID, NS_RDFMENUBUILDER_CID);
static NS_DEFINE_CID(kRDFToolbarBuilderCID, NS_RDFTOOLBARBUILDER_CID);
static NS_DEFINE_CID(kXULTemplateBuilderCID, NS_XULTEMPLATEBUILDER_CID);
static NS_DEFINE_CID(kXULDocumentCID, NS_XULDOCUMENT_CID);
static NS_DEFINE_CID(kXULDocumentInfoCID, NS_XULDOCUMENTINFO_CID);
static NS_DEFINE_CID(kXULKeyListenerCID, NS_XULKEYLISTENER_CID);
@ -317,8 +315,8 @@ public:
nsIRDFResource* aProperty,
nsIRDFNode* aValue);
nsresult CreateBuilder(const nsCID& aBuilderCID, nsIContent* aElement,
const nsString& aDataSources);
nsresult CreateTemplateBuilder(nsIContent* aElement,
const nsString& aDataSources);
nsresult
GetRDFResourceFromXULElement(nsIDOMNode* aNode, nsIRDFResource** aResult);
@ -430,7 +428,7 @@ RDFXULBuilderImpl::Init()
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register RDF namespace");
if (NS_FAILED(rv)) return rv;
kLazyContentAtom = NS_NewAtom("lazycontent");
kLazyContentAtom = NS_NewAtom("lazycontent");
kDataSourcesAtom = NS_NewAtom("datasources");
kIdAtom = NS_NewAtom("id");
kInstanceOfAtom = NS_NewAtom("instanceof");
@ -1669,63 +1667,6 @@ RDFXULBuilderImpl::OnSetAttribute(nsIDOMElement* aElement, const nsString& aName
return NS_OK;
}
if ((nameSpaceID == kNameSpaceID_None) && (nameAtom.get() == kRefAtom)) {
// They're changing the RDF 'ref=' of the element. Do some
// trickery so that any generic builders that are referring to
// this element will reconstruct the contents of the
// element. Blow away _all_ of the children, and re-annotate
// the node s.t. children will be reconstructed properly.
PRInt32 count;
rv = element->ChildCount(count);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get element's child count");
if (NS_FAILED(rv)) return rv;
while (--count >= 0) {
nsCOMPtr<nsIContent> child;
rv = element->ChildAt(count, *getter_AddRefs(child));
if (NS_FAILED(rv)) return rv;
rv = element->RemoveChildAt(count, PR_TRUE);
NS_ASSERTION(NS_SUCCEEDED(rv), "error removing child");
if (! IsXULElement(child)) {
// If it's _not_ a XUL element, then we want to blow
// it and all of its kids out of the XUL document's
// resource-to-element map.
rv = child->SetDocument(nsnull, PR_TRUE);
if (NS_FAILED(rv)) return rv;
}
}
// Clear the contents-generated attribute so that the next time we
// come back, we'll regenerate the kids we just killed.
rv = element->UnsetAttribute(kNameSpaceID_None,
kTemplateContentsGeneratedAtom,
PR_FALSE);
if (NS_FAILED(rv)) return rv;
rv = element->UnsetAttribute(kNameSpaceID_None,
kContainerContentsGeneratedAtom,
PR_FALSE);
if (NS_FAILED(rv)) return rv;
// This is a _total_ hack to make sure that any XUL we blow away
// gets rebuilt.
rv = element->UnsetAttribute(kNameSpaceID_None,
kXULContentsGeneratedAtom,
PR_FALSE);
if (NS_FAILED(rv)) return rv;
rv = element->SetAttribute(kNameSpaceID_RDF,
kLazyContentAtom,
"true",
PR_FALSE);
if (NS_FAILED(rv)) return rv;
// Fall through and change the property "normally" now.
}
// If we get here, it's a vanilla property that we need to go into
// the RDF graph to update. So, build an RDF resource from the
// property name...
@ -2643,15 +2584,7 @@ RDFXULBuilderImpl::CreateXULElement(nsINameSpace* aContainingNameSpace,
kDataSourcesAtom,
dataSources)) {
nsCID builderCID;
if (aTagName == kTreeAtom)
builderCID = kRDFTreeBuilderCID;
else if (aTagName == kMenuAtom || aTagName == kMenuBarAtom)
builderCID = kRDFMenuBuilderCID;
else if (aTagName == kToolbarAtom)
builderCID = kRDFToolbarBuilderCID;
rv = CreateBuilder(builderCID, element, dataSources);
rv = CreateTemplateBuilder(element, dataSources);
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to add datasources");
}
}
@ -2928,20 +2861,19 @@ RDFXULBuilderImpl::RemoveAttribute(nsIContent* aElement,
}
nsresult
RDFXULBuilderImpl::CreateBuilder(const nsCID& aBuilderCID, nsIContent* aElement,
const nsString& aDataSources)
RDFXULBuilderImpl::CreateTemplateBuilder(nsIContent* aElement,
const nsString& aDataSources)
{
nsresult rv;
// construct a new builder
nsCOMPtr<nsIRDFContentModelBuilder> builder;
if (NS_FAILED(rv = nsComponentManager::CreateInstance(aBuilderCID,
nsnull,
kIRDFContentModelBuilderIID,
(void**) getter_AddRefs(builder)))) {
NS_ERROR("unable to create tree content model builder");
return rv;
}
rv = nsComponentManager::CreateInstance(kXULTemplateBuilderCID,
nsnull,
kIRDFContentModelBuilderIID,
(void**) getter_AddRefs(builder));
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create tree content model builder");
if (NS_FAILED(rv)) return rv;
if (NS_FAILED(rv = builder->SetRootContent(aElement))) {
NS_ERROR("unable to set builder's root content element");
@ -2981,6 +2913,14 @@ RDFXULBuilderImpl::CreateBuilder(const nsCID& aBuilderCID, nsIContent* aElement,
//
PRInt32 first = 0;
nsCOMPtr<nsIDocument> document = do_QueryInterface(mDocument);
if (! document)
return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsIURI> docURL = dont_AddRef( document->GetDocumentURL() );
if (! docURL)
return NS_ERROR_UNEXPECTED;
while(1) {
while (first < aDataSources.Length() && nsString::IsSpace(aDataSources.CharAt(first)))
++first;
@ -2996,6 +2936,9 @@ RDFXULBuilderImpl::CreateBuilder(const nsCID& aBuilderCID, nsIContent* aElement,
aDataSources.Mid(uri, first, last - first);
first = last + 1;
rv = rdf_MakeAbsoluteURI(docURL, uri);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIRDFDataSource> ds;
// Some monkey business to convert the nsAutoString to a

View File

@ -2746,6 +2746,17 @@ XULDocumentImpl::CreateElement(const nsString& aTagName, nsIDOMElement** aReturn
nsresult rv;
#ifdef PR_LOGGING
if (PR_LOG_TEST(gXULLog, PR_LOG_DEBUG)) {
char* tagCStr = aTagName.ToNewCString();
PR_LOG(gXULLog, PR_LOG_DEBUG,
("xul[CreateElement] %s", tagCStr));
delete[] tagCStr;
}
#endif
nsCOMPtr<nsIAtom> name;
PRInt32 nameSpaceID;
@ -2925,6 +2936,19 @@ XULDocumentImpl::CreateElementWithNameSpace(const nsString& aTagName,
nsresult rv;
#ifdef PR_LOGGING
if (PR_LOG_TEST(gXULLog, PR_LOG_DEBUG)) {
char* namespaceCStr = aNameSpace.ToNewCString();
char* tagCStr = aTagName.ToNewCString();
PR_LOG(gXULLog, PR_LOG_DEBUG,
("xul[CreateElementWithNameSpace] [%s]:%s", namespaceCStr, tagCStr));
delete[] tagCStr;
delete[] namespaceCStr;
}
#endif
nsCOMPtr<nsIAtom> name = dont_AddRef(NS_NewAtom(aTagName.GetUnicode()));
if (! name)
return NS_ERROR_OUT_OF_MEMORY;
@ -3005,12 +3029,12 @@ XULDocumentImpl::GetElementById(const nsString& aId, nsIDOMElement** aReturn)
nsresult rv;
nsAutoString uri;
nsCAutoString uri;
rv = nsRDFContentUtils::MakeElementURI(this, aId, uri);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIRDFResource> resource;
if (NS_FAILED(rv = gRDFService->GetUnicodeResource(uri.GetUnicode(), getter_AddRefs(resource)))) {
if (NS_FAILED(rv = gRDFService->GetResource(uri, getter_AddRefs(resource)))) {
NS_ERROR("unable to get resource");
return rv;
}
@ -3209,15 +3233,14 @@ XULDocumentImpl::CreatePopupDocument(nsIContent* aPopupElement, nsIDocument** aR
nsCOMPtr<nsIDOMElement> domRoot = do_QueryInterface(aPopupElement);
domRoot->GetAttribute("id", idValue);
nsAutoString uri;
nsCAutoString uri;
rv = nsRDFContentUtils::MakeElementURI(this, idValue, uri);
if (NS_FAILED(rv)) return rv;
// Use the absolute URL to retrieve a resource from the RDF
// service that corresponds to the root content.
nsCOMPtr<nsIRDFResource> rootResource;
if (NS_FAILED(rv = gRDFService->GetUnicodeResource(uri.GetUnicode(),
getter_AddRefs(rootResource)))) {
if (NS_FAILED(rv = gRDFService->GetResource(uri, getter_AddRefs(rootResource)))) {
NS_ERROR("Uh-oh. Couldn't obtain the resource for the popup doc root.");
return rv;
}

View File

@ -79,7 +79,6 @@
#include "nsIStyledContent.h"
#include "nsIStyleRule.h"
#include "nsIURL.h"
#include "nsXULTreeElement.h"
#include "rdfutil.h"
#include "prlog.h"
#include "rdf.h"
@ -317,8 +316,8 @@ private:
PRBool mContentsMustBeGenerated;
nsVoidArray* mBroadcastListeners; // [WEAK]
nsIDOMXULElement* mBroadcaster; // [OWNER]
nsXULElement* mInnerXULElement; // [OWNER]
nsIController* mController; // [OWNER]
nsCOMPtr<nsIRDFCompositeDataSource> mDatabase; // [OWNER]
};
@ -397,7 +396,6 @@ RDFElementImpl::RDFElementImpl(PRInt32 aNameSpaceID, nsIAtom* aTag)
mContentsMustBeGenerated(PR_FALSE),
mBroadcastListeners(nsnull),
mBroadcaster(nsnull),
mInnerXULElement(nsnull),
mController(nsnull)
{
NS_INIT_REFCNT();
@ -514,8 +512,6 @@ RDFElementImpl::~RDFElementImpl()
++entry;
}
}
delete mInnerXULElement;
}
@ -576,16 +572,6 @@ RDFElementImpl::QueryInterface(REFNSIID iid, void** result)
else if (iid.Equals(kIJSScriptObjectIID)) {
*result = NS_STATIC_CAST(nsIJSScriptObject*, this);
}
else if (iid.Equals(nsIDOMXULTreeElement::GetIID()) &&
(mNameSpaceID == kNameSpaceID_XUL) &&
(mTag == kTreeAtom)) {
if (! mInnerXULElement) {
if ((mInnerXULElement = new nsXULTreeElement(this)) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
}
return mInnerXULElement->QueryInterface(iid, result);
}
else {
*result = nsnull;
return NS_NOINTERFACE;
@ -1275,16 +1261,8 @@ RDFElementImpl::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject
if (! mScriptObject) {
nsIScriptGlobalObject *global = aContext->GetGlobalObject();
nsresult (*fn)(nsIScriptContext* aContext, nsISupports* aSupports, nsISupports* aParent, void** aReturn);
rv = NS_NewScriptXULElement(aContext, (nsIDOMXULElement*) this, global, (void**) &mScriptObject);
if (mTag == kTreeAtom) {
fn = NS_NewScriptXULTreeElement;
}
else {
fn = NS_NewScriptXULElement;
}
rv = fn(aContext, (nsIDOMXULElement*) this, global, (void**) &mScriptObject);
NS_RELEASE(global);
// Ensure that a reference exists to this element
@ -2532,6 +2510,36 @@ RDFElementImpl::GetResource(nsIRDFResource** aResource)
return NS_OK;
}
NS_IMETHODIMP
RDFElementImpl::GetDatabase(nsIRDFCompositeDataSource** aDatabase)
{
NS_PRECONDITION(aDatabase != nsnull, "null ptr");
if (! aDatabase)
return NS_ERROR_NULL_POINTER;
*aDatabase = mDatabase;
NS_IF_ADDREF(*aDatabase);
return NS_OK;
}
NS_IMETHODIMP
RDFElementImpl::SetDatabase(nsIRDFCompositeDataSource* aDatabase)
{
// XXX maybe someday you'll be allowed to change it.
NS_PRECONDITION(mDatabase == nsnull, "already initialized");
if (mDatabase)
return NS_ERROR_ALREADY_INITIALIZED;
mDatabase = aDatabase;
// XXX reconstruct the entire tree now!
return NS_OK;
}
////////////////////////////////////////////////////////////////////////
// Implementation methods

View File

@ -82,7 +82,6 @@
#include "nsIRDFService.h"
#include "rdf.h"
#include "nsIDOMXULTreeElement.h"
#include "nsIDOMXULElement.h"
#include "nsILocale.h"
@ -112,7 +111,6 @@ static NS_DEFINE_IID(kIRDFServiceIID, NS_IRDFSERVICE_IID);
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
static NS_DEFINE_IID(kIRDFLiteralIID, NS_IRDFLITERAL_IID);
static NS_DEFINE_IID(kIDomXulTreeElementIID, NS_IDOMXULTREEELEMENT_IID);
static NS_DEFINE_IID(kIDomXulElementIID, NS_IDOMXULELEMENT_IID);
static NS_DEFINE_CID(kCollationFactoryCID, NS_COLLATIONFACTORY_CID);
@ -1292,7 +1290,7 @@ XULSortServiceImpl::InsertContainerNode(nsIContent *container, nsIContent *node)
if (NS_FAILED(rv = FindTreeElement(container, getter_AddRefs(treeNode)))) return(rv);
// get composite db for tree
nsCOMPtr<nsIDOMXULTreeElement> domXulTree;
nsCOMPtr<nsIDOMXULElement> domXulTree;
sortInfo.rdfService = gRDFService;
sortInfo.db = nsnull;
@ -1300,7 +1298,7 @@ XULSortServiceImpl::InsertContainerNode(nsIContent *container, nsIContent *node)
// that we're sure that we'll hold a reference to it (and actually
// release that reference when the stack frame goes away).
nsCOMPtr<nsIRDFCompositeDataSource> cds;
rv = treeNode->QueryInterface(kIDomXulTreeElementIID, getter_AddRefs(domXulTree));
rv = treeNode->QueryInterface(kIDomXulElementIID, getter_AddRefs(domXulTree));
if (NS_SUCCEEDED(rv))
{
if (NS_SUCCEEDED(rv = domXulTree->GetDatabase(getter_AddRefs(cds))))
@ -1488,7 +1486,7 @@ XULSortServiceImpl::DoSort(nsIDOMNode* node, const nsString& sortResource,
// get composite db for tree
sortInfo.rdfService = gRDFService;
sortInfo.db = nsnull;
nsCOMPtr<nsIDOMXULTreeElement> domXulTree = do_QueryInterface(treeNode);
nsCOMPtr<nsIDOMXULElement> domXulTree = do_QueryInterface(treeNode);
if (!domXulTree) return(NS_ERROR_FAILURE);
nsCOMPtr<nsIRDFCompositeDataSource> cds;
if (NS_SUCCEEDED(rv = domXulTree->GetDatabase(getter_AddRefs(cds))))

File diff suppressed because it is too large Load Diff

View File

@ -1,54 +0,0 @@
/* -*- 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.0 (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.
*/
#include "nsCOMPtr.h"
#include "nsIRDFCompositeDataSource.h"
#include "nsIServiceManager.h"
#include "nsRDFCID.h"
#include "nsXULTreeElement.h"
NS_IMPL_ISUPPORTS_INHERITED(nsXULTreeElement, nsXULElement, nsIDOMXULTreeElement);
NS_IMETHODIMP
nsXULTreeElement::GetDatabase(nsIRDFCompositeDataSource** aDatabase)
{
NS_PRECONDITION(aDatabase != nsnull, "null ptr");
if (! aDatabase)
return NS_ERROR_NULL_POINTER;
*aDatabase = mDatabase;
NS_IF_ADDREF(*aDatabase);
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeElement::SetDatabase(nsIRDFCompositeDataSource* aDatabase)
{
// XXX maybe someday you'll be allowed to change it.
NS_PRECONDITION(mDatabase == nsnull, "already initialized");
if (mDatabase)
return NS_ERROR_ALREADY_INITIALIZED;
mDatabase = aDatabase;
// XXX reconstruct the entire tree now!
return NS_OK;
}

View File

@ -1,55 +0,0 @@
/* -*- 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.0 (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.
*/
#ifndef nsXULTreeElement_h__
#define nsXULTreeElement_h__
#include "nsXULElement.h"
#include "nsIDOMXULTreeElement.h"
#include "nsIRDFCompositeDataSource.h"
class nsXULTreeElement : public nsXULElement,
public nsIDOMXULTreeElement
{
private:
nsCOMPtr<nsIRDFCompositeDataSource> mDatabase;
public:
nsXULTreeElement(nsIDOMXULElement* aOuter)
: nsXULElement(aOuter)
{
}
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode interface
NS_FORWARD_IDOMNODE(mOuter->);
// nsIDOMElement interface
NS_FORWARD_IDOMELEMENT(mOuter->);
// nsIDOMXULElement interface
NS_FORWARD_IDOMXULELEMENT(mOuter->);
// nsIDOMXULTreeElement interface
NS_DECL_IDOMXULTREEELEMENT
};
#endif // nsXULTreeElement_h__

View File

@ -1292,10 +1292,10 @@ XULContentSinkImpl::GetXULIDAttribute(const nsIParserNode& aNode,
nsAutoString id = aNode.GetValueAt(i);
nsRDFParserUtils::StripAndConvert(id);
nsAutoString uri;
nsCAutoString uri;
nsRDFContentUtils::MakeElementURI(mDocument, id, uri);
return gRDFService->GetUnicodeResource(uri.GetUnicode(), aResource);
return gRDFService->GetResource(uri, aResource);
}
// Otherwise, we couldn't find anything, so just gensym one...

Binary file not shown.

View File

@ -53,11 +53,13 @@
<tree id="other-panels" style="width:15em;height:15em;"
datasources="resource://res/rdf/sidebar-registry.rdf"
onclick="selected()" >
onclick="selected()"
ref="NC:SidebarRoot" >
<!-- The template we'll use to build rows in the content model. -->
<template>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<rule>
<treechildren>
<treeitem uri="..." type="rdf:http://home.netscape.com/NC-rdf#type">
<treerow>
<treecell>
@ -67,6 +69,7 @@
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
@ -75,9 +78,6 @@
<treecell>Name</treecell>
</treerow>
</treehead>
<!-- The tree body: it's rooted at sitemap1.rdf's root -->
<treechildren id="other-panels-children" ref="NC:SidebarRoot" open="true"/>
</tree>
<box align="vertical" class="button-group">

View File

@ -71,17 +71,14 @@
var tree = document.getElementById("tree");
dump("tree = " + tree + "\n");
var body = tree.childNodes[2]; // template, treehead, treechildren
dump("body = " + body + "\n");
var currentRef = body.getAttribute("ref");
var currentRef = tree.getAttribute("ref");
dump("currentRef = " + currentRef + "\n");
if (currentRef == "NC:BookmarksRoot") {
body.setAttribute("ref", "NC:PersonalToolbarFolder");
tree.setAttribute("ref", "NC:PersonalToolbarFolder");
}
else {
body.setAttribute("ref", "NC:BookmarksRoot");
tree.setAttribute("ref", "NC:BookmarksRoot");
}
}
</html:script>
@ -92,31 +89,35 @@
<html:button onclick="MutateBody();">Swap Body (Bookmarks Root/Personal Toolbar Folder)</html:button>
</box>
<tree id="tree" datasources="rdf:bookmarks" onclick="return OpenURL(event,event.target.parentNode);">
<tree id="tree" datasources="rdf:bookmarks" onclick="return OpenURL(event,event.target.parentNode);" ref="NC:BookmarksRoot">
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator" rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treerow>
</treeitem>
</rule>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<treechildren>
<treeitem uri="...">
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL" align="right" style="list-style-image: none;" />
</treecell>
</treerow>
</treeitem>
</rule>
<rule>
<treechildren>
<treeitem uri="...">
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL" align="right" style="list-style-image: none;" />
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
<treehead>
@ -125,8 +126,6 @@
<treecell>URL</treecell>
</treerow>
</treehead>
<treechildren id="treeroot" ref="NC:BookmarksRoot" open="true" />
</tree>
</window>

View File

@ -38,31 +38,35 @@
<html:script src="flash.js" />
<tree id="tree"
ref="NC:FlashRoot"
flex="100%"
style="height: 100%"
style="height: 100%"
datasources="rdf:null"
rdf:containment="http://home.netscape.com/NC-rdf#child"
onclick="OpenURL(event.target.parentNode.parentNode);">
<template>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="..." type="rdf:http://home.netscape.com/NC-rdf#type">
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#source" align="right" />
</treecell>
<rule>
<treechildren>
<treeitem uri="..." type="rdf:http://home.netscape.com/NC-rdf#type">
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#source" align="right" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#description" align="right"
style="list-style-image: none;" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#description" align="right"
style="list-style-image: none;" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#timestamp" align="right"
style="list-style-image: none;" />
</treecell>
</treerow>
</treeitem>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#timestamp" align="right"
style="list-style-image: none;" />
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
@ -78,7 +82,5 @@
<treecell>&tree.header.time.label;</treecell>
</treerow>
</treehead>
<treechildren ref="NC:FlashRoot" rdf:containment="http://home.netscape.com/NC-rdf#child" open="true" />
</tree>
</window>

View File

@ -484,7 +484,7 @@ Contributor(s): ______________________________________. -->
datasources="rdf:bookmarks rdf:files rdf:find" id="NC:BookmarksRoot">
<template>
<rule iscontainer="true">
<rule iscontainer="true" isempty="false">
<menu uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
</rule>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
@ -499,7 +499,18 @@ Contributor(s): ______________________________________. -->
<menuitem name="&manBookmarksCmd.label;" onclick="BrowserEditBookmarks();"/>
<separator/>
</menu>
<menu name="&tasksMenu.label;" onclick="ShowWindowFromResource(event.target)" datasources="rdf:window-mediator" id="NC:WindowMediatorRoot" open="true" >
<menu name="&tasksMenu.label;" onclick="ShowWindowFromResource(event.target)" datasources="rdf:window-mediator" ref="NC:WindowMediatorRoot" >
<template>
<rule iscontainer="true" isempty="false">
<menu uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
</rule>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<separator uri="..." />
</rule>
<rule>
<menuitem uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
</rule>
</template>
<menuitem name="&navigatorCmd.label;" onclick="BrowserReload();"/>
<menuitem name="&messengerCmd.label;" onclick="OpenMessenger();" />
<menuitem name="&editorCmd.label;" onclick="OpenEditor();" />

View File

@ -347,18 +347,20 @@ Contributor(s): ______________________________________. -->
onclick="return opener.BookmarkPopupSingleClick(window,event.target.parentNode.parentNode);" flex="100%">
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
rootcontainment="treechildren" subcontainment="treechildren">
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<treechildren>
<treeitem uri="..." type="rdf:http://home.netscape.com/NC-rdf#type">
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treerow>
</treeitem>
</treeitem>
</treechildren>
</rule>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<rule>
<treechildren>
<treeitem uri="..." type="rdf:http://home.netscape.com/NC-rdf#type">
<treerow>
<treecell>
@ -368,13 +370,12 @@ Contributor(s): ______________________________________. -->
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
<treecol id="NameColumn"
rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
<treechildren id="cascade:treechildren" ref="" open="true" />
</tree>
</window>
</popup>

View File

@ -33,38 +33,40 @@
<menu />
</popup>
<tree id="bookmarksTree" context="contextual"
<tree id="bookmarksTree" context="contextual" ref="NC:BookmarksRoot"
datasources="rdf:bookmarks rdf:files rdf:ftp rdf:find rdf:internetsearch"
ondblclick="return OpenURL(event, event.target.parentNode.parentNode);">
<!-- Commented out until new tree content model and template builder can play nice -->
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treerow>
</treeitem>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<treechildren>
<treeitem uri="...">
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name"
align="right" />
</treecell>
</treerow>
</treeitem>
<rule>
<treechildren>
<treeitem uri="...">
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name"
align="right" />
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
<treecol id="NameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
<treechildren id="NC:BookmarksRoot" open="true" />
</tree>
</window>

View File

@ -153,8 +153,8 @@ function doSort(sortColName)
ondblclick="return OpenURL(event,event.target.parentNode.parentNode);">
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
rootcontainment="treechildren" subcontainment="treechildren">
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<treechildren>
<treeitem uri="...">
<treerow>
<treecell>
@ -164,9 +164,11 @@ function doSort(sortColName)
<treecell></treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<rule>
<treechildren>
<treeitem uri="...">
<treerow>
<treecell>
@ -185,6 +187,7 @@ function doSort(sortColName)
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>

View File

@ -22,6 +22,12 @@
<?xml-stylesheet href="chrome://sidebar/skin/" type="text/css"?>
<?xml-stylesheet href="resource:/res/samples/related-panel.css" type="text/css"?>
<!DOCTYPE window
[
<!ENTITY related.row.label "Related Links">
<!ENTITY sitemap.row.label "Sitemap">
]>
<window
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@ -42,30 +48,31 @@
ondblclick="return OnDblClick(event.target.parentNode.parentNode);">
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
rootcontainment="treechildren"
subcontainment="treechildren">
<treeitem uri="...">
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treerow>
</treeitem>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<treechildren>
<treeitem uri="...">
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="..."
<rule>
<treechildren>
<treeitem uri="..."
loading="rdf:http://home.netscape.com/NC-rdf#loading"
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type">
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
</treecell>
</treerow>
</treeitem>
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
@ -74,13 +81,13 @@
<treechildren>
<treeitem id="NC:RelatedLinks">
<treerow>
<treecell><treeindentation/><titledbutton />Related Links</treecell>
<treecell><treeindentation/><titledbutton />&related.row.label;</treecell>
</treerow>
</treeitem>
<treeitem id="NC:SiteMapRoot">
<treerow>
<treecell><treeindentation/><titledbutton />Site Map</treecell>
<treecell><treeindentation/><titledbutton />&sitemap.row.label;</treecell>
</treerow>
</treeitem>
</treechildren>

View File

@ -33,17 +33,20 @@
<treecol id="EngineColumn" rdf:resource="http://home.netscape.com/NC-rdf#Engine"/>
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator" rootcontainment="treechildren" subcontainment="treechildren">
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<treechildren>
<treeitem uri="...">
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treerow>
</treeitem>
</treeitem>
</treechildren>
</rule>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<rule>
<treechildren>
<treeitem uri="...">
<treerow>
<treecell>
@ -62,6 +65,7 @@
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
@ -89,8 +93,5 @@
</treecell>
</treerow>
</treehead>
<treechildren open="true" />
</tree>
</window>

View File

@ -347,18 +347,20 @@ Contributor(s): ______________________________________. -->
onclick="return opener.BookmarkPopupSingleClick(window,event.target.parentNode.parentNode);" flex="100%">
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
rootcontainment="treechildren" subcontainment="treechildren">
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<treechildren>
<treeitem uri="..." type="rdf:http://home.netscape.com/NC-rdf#type">
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treerow>
</treeitem>
</treeitem>
</treechildren>
</rule>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<rule>
<treechildren>
<treeitem uri="..." type="rdf:http://home.netscape.com/NC-rdf#type">
<treerow>
<treecell>
@ -368,13 +370,12 @@ Contributor(s): ______________________________________. -->
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
<treecol id="NameColumn"
rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
<treechildren id="cascade:treechildren" ref="" open="true" />
</tree>
</window>
</popup>

View File

@ -0,0 +1,39 @@
#
# The contents of this file are subject to the Netscape Public License
# Version 1.0 (the "NPL"); you may not use this file except in
# compliance with the NPL. You may obtain a copy of the NPL at
# http://www.mozilla.org/NPL/
#
# Software distributed under the NPL is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
# for the specific language governing rights and limitations under the
# NPL.
#
# The Initial Developer of this code under the NPL is Netscape
# Communications Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
# Reserved.
#
DEPTH = ../../../..
topsrcdir = /export/waterson/seamonkey-merge/mozilla
VPATH = /export/waterson/seamonkey-merge/mozilla/xpfe/browser/resources/skin
srcdir = /export/waterson/seamonkey-merge/mozilla/xpfe/browser/resources/skin
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
EXPORT_RESOURCE_CONTENT = \
$(srcdir)/alertl.gif \
$(srcdir)/errorl.gif \
$(srcdir)/messagel.gif \
$(srcdir)/navigator.css \
$(srcdir)/questionl.gif \
$(srcdir)/contentframe.css \
$(srcdir)/animthrob.gif \
$(srcdir)/animthrob_single.gif \
$(NULL)
install::
$(INSTALL) $(EXPORT_RESOURCE_CONTENT) $(DIST)/bin/chrome/navigator/skin/default

View File

@ -33,38 +33,40 @@
<menu />
</popup>
<tree id="bookmarksTree" context="contextual"
<tree id="bookmarksTree" context="contextual" ref="NC:BookmarksRoot"
datasources="rdf:bookmarks rdf:files rdf:ftp rdf:find rdf:internetsearch"
ondblclick="return OpenURL(event, event.target.parentNode.parentNode);">
<!-- Commented out until new tree content model and template builder can play nice -->
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treerow>
</treeitem>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<treechildren>
<treeitem uri="...">
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="...">
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name"
align="right" />
</treecell>
</treerow>
</treeitem>
<rule>
<treechildren>
<treeitem uri="...">
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name"
align="right" />
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
<treecol id="NameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
<treechildren id="NC:BookmarksRoot" open="true" />
</tree>
</window>

View File

@ -25,7 +25,7 @@ function BookmarkPopupFillTree(popup,node) {
}
var uri = node.getAttribute('id');
var treechildren = document.getElementById('cascade:treechildren');
var treechildren = document.getElementById('bmpopuptree');
treechildren.setAttribute('ref', uri);
gBookmarkPopup = popup;
}

View File

@ -95,14 +95,15 @@
<menu />
</popup>
<tree id="bookmarksTree" context="contextual"
<tree id="bookmarksTree" ref="NC:BookmarksRoot" context="contextual"
datasources="rdf:bookmarks rdf:files rdf:ftp rdf:find rdf:internetsearch"
onclick="return DoSingleClick(event, event.target);"
ondblclick="return OpenURL(event,event.target.parentNode.parentNode.parentNode);"
style="height:100%;">
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator" rootcontainment="treechildren" subcontainment="treechildren">
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<treechildren>
<treeitem uri="..." rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type" loading="rdf:http://home.netscape.com/NC-rdf#loading">
<treerow>
<treecell>
@ -110,9 +111,11 @@
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<rule>
<treechildren>
<treeitem uri="..." rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type" loading="rdf:http://home.netscape.com/NC-rdf#loading">
<treerow>
<treecell>
@ -140,6 +143,7 @@
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
@ -184,8 +188,6 @@
</treerow>
</treehead>
<treechildren ref="NC:BookmarksRoot" open="true" />
</tree>
</xul:window>

View File

@ -153,8 +153,8 @@ function doSort(sortColName)
ondblclick="return OpenURL(event,event.target.parentNode.parentNode);">
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
rootcontainment="treechildren" subcontainment="treechildren">
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<treechildren>
<treeitem uri="...">
<treerow>
<treecell>
@ -164,9 +164,11 @@ function doSort(sortColName)
<treecell></treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<rule>
<treechildren>
<treeitem uri="...">
<treerow>
<treecell>
@ -185,6 +187,7 @@ function doSort(sortColName)
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>

View File

@ -22,6 +22,12 @@
<?xml-stylesheet href="chrome://sidebar/skin/" type="text/css"?>
<?xml-stylesheet href="resource:/res/samples/related-panel.css" type="text/css"?>
<!DOCTYPE window
[
<!ENTITY related.row.label "Related Links">
<!ENTITY sitemap.row.label "Sitemap">
]>
<window
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
@ -42,30 +48,31 @@
ondblclick="return OnDblClick(event.target.parentNode.parentNode);">
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator"
rootcontainment="treechildren"
subcontainment="treechildren">
<treeitem uri="...">
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treerow>
</treeitem>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<treechildren>
<treeitem uri="...">
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<treeitem uri="..."
<rule>
<treechildren>
<treeitem uri="..."
loading="rdf:http://home.netscape.com/NC-rdf#loading"
type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type">
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
</treecell>
</treerow>
</treeitem>
<treerow>
<treecell>
<treeindentation />
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
@ -74,13 +81,13 @@
<treechildren>
<treeitem id="NC:RelatedLinks">
<treerow>
<treecell><treeindentation/><titledbutton />Related Links</treecell>
<treecell><treeindentation/><titledbutton />&related.row.label;</treecell>
</treerow>
</treeitem>
<treeitem id="NC:SiteMapRoot">
<treerow>
<treecell><treeindentation/><titledbutton />Site Map</treecell>
<treecell><treeindentation/><titledbutton />&sitemap.row.label;</treecell>
</treerow>
</treeitem>
</treechildren>

View File

@ -45,13 +45,7 @@ function doFind()
// load find URL into results pane
var resultsTree = parent.frames[1].document.getElementById("findresultstree");
if (!resultsTree) return(false);
x = resultsTree.childNodes.length;
if (x < 1) return(false);
// XXX shouldn't assume that treebody is the last child node in the tree!
resultsTree.childNodes[x-1].setAttribute("id", url);
// resultsTree.childNodes[x-1].setAttribute("open", "true");
tree.setAttribute("ref", url);
dump("doFind done.\n");
return(true);

View File

@ -28,17 +28,20 @@
<treecol id="DescriptionColumn" rdf:resource="http://home.netscape.com/NC-rdf#Description"/>
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator" rootcontainment="treechildren" subcontainment="treechildren">
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<treechildren>
<treeitem uri="...">
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treerow>
</treeitem>
</treeitem>
</treechildren>
</rule>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<rule>
<treechildren>
<treeitem uri="...">
<treerow>
<treecell>
@ -56,6 +59,7 @@
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>

View File

@ -58,10 +58,7 @@ function doSearch()
// load find URL into results pane
var resultsTree = parent.frames[1].document.getElementById("internetresultstree");
if (!resultsTree) return(false);
x = resultsTree.childNodes.length;
if (x < 1) return(false);
// XXX shouldn't assume that treebody is the last child node in the tree!
resultsTree.childNodes[x-1].setAttribute("id", searchURL);
tree.setAttribute("ref", searchURL);
// enable "Save Search" button
var searchButton = document.getElementById("SaveSearch");
@ -103,10 +100,7 @@ function saveSearch()
{
var resultsTree = parent.frames[1].document.getElementById("internetresultstree");
if (!resultsTree) return(false);
x = resultsTree.childNodes.length;
if (x < 1) return(false);
// XXX shouldn't assume that treebody is the last child node in the tree!
var searchURL = resultsTree.childNodes[x-1].getAttribute("id");
var searchURL = tree.getAttribute("ref");
if (!searchURL) return(false);
dump("Bookmark search URL: " + searchURL + "\n");

View File

@ -34,11 +34,12 @@
<box align="horizontal" style="height: 85%; width: 100%;" flex="100%" >
<spring align="horizontal" flex="100%" />
<tree align="horizontal" id="searchengines" border="1" style="height: 90%;" flex="100%" datasources="rdf:internetsearch" >
<tree align="horizontal" id="searchengines" border="1" style="height: 90%;" flex="100%" datasources="rdf:internetsearch" ref="NC:SearchEngineRoot">
<treecol id="CheckboxColumn" />
<treecol id="NameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Name" sortActive="true" sortDirection="ascending" />
<template rootcontainment="treechildren" subcontainment="treechildren">
<template>
<treechildren>
<treeitem uri="...">
<treerow>
<treecell treeallowevents="true">
@ -49,6 +50,7 @@
</treecell>
</treerow>
</treeitem>
</treechildren>
</template>
<treehead>
@ -63,8 +65,6 @@
</treecell>
</treerow>
</treehead>
<treechildren id="NC:SearchEngineRoot" open="true" />
</tree>
<spring align="horizontal" flex="100%" />
</box>

View File

@ -33,17 +33,20 @@
<treecol id="EngineColumn" rdf:resource="http://home.netscape.com/NC-rdf#Engine"/>
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator" rootcontainment="treechildren" subcontainment="treechildren">
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<treechildren>
<treeitem uri="...">
<treerow>
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treerow>
</treeitem>
</treeitem>
</treechildren>
</rule>
<rule rootcontainment="treechildren" subcontainment="treechildren">
<rule>
<treechildren>
<treeitem uri="...">
<treerow>
<treecell>
@ -62,6 +65,7 @@
</treecell>
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
@ -89,8 +93,5 @@
</treecell>
</treerow>
</treehead>
<treechildren open="true" />
</tree>
</window>

View File

@ -484,7 +484,7 @@ Contributor(s): ______________________________________. -->
datasources="rdf:bookmarks rdf:files rdf:find" id="NC:BookmarksRoot">
<template>
<rule iscontainer="true">
<rule iscontainer="true" isempty="false">
<menu uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
</rule>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
@ -499,7 +499,18 @@ Contributor(s): ______________________________________. -->
<menuitem name="&manBookmarksCmd.label;" onclick="BrowserEditBookmarks();"/>
<separator/>
</menu>
<menu name="&tasksMenu.label;" onclick="ShowWindowFromResource(event.target)" datasources="rdf:window-mediator" id="NC:WindowMediatorRoot" open="true" >
<menu name="&tasksMenu.label;" onclick="ShowWindowFromResource(event.target)" datasources="rdf:window-mediator" ref="NC:WindowMediatorRoot" >
<template>
<rule iscontainer="true" isempty="false">
<menu uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
</rule>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<separator uri="..." />
</rule>
<rule>
<menuitem uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
</rule>
</template>
<menuitem name="&navigatorCmd.label;" onclick="BrowserReload();"/>
<menuitem name="&messengerCmd.label;" onclick="OpenMessenger();" />
<menuitem name="&editorCmd.label;" onclick="OpenEditor();" />

View File

@ -47,6 +47,18 @@
<!-- Tasks Menu -->
<menu id="tasksMenu" name="&tasksMenu.label;" onclick="ShowWindowFromResource(event.target)" datasources="rdf:window-mediator" ref="NC:WindowMediatorRoot">
<template>
<rule iscontainer="true" isempty="false">
<menu uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
</rule>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<separator uri="..." />
</rule>
<rule>
<menuitem uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
</rule>
</template>
<menuitem name="&navigatorCmd.label;" onclick="toNavigator()"/>
<menuitem name="&messengerCmd.label;" onclick="toMessengerWindow()"/>
<menuitem name="&editorCmd.label;" onclick="toEditor();" />
@ -87,6 +99,17 @@
<popup id="windowPopup" >
<menu onclick="ShowWindowFromResource(event.target)" datasources="rdf:window-mediator" ref="NC:WindowMediatorRoot" >
<template>
<rule iscontainer="true" isempty="false">
<menu uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
</rule>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<separator uri="..." />
</rule>
<rule>
<menuitem uri="..." name="rdf:http://home.netscape.com/NC-rdf#Name"/>
</rule>
</template>
</menu>
</popup>

View File

@ -18,7 +18,7 @@
// the location of the flash registry.
var localSoftwareUpdateRegistry = 'resource:/res/rdf/SoftwareUpdates.rdf';
var localSoftwareUpdateRegistry = 'resource:/res/xpinstall/SoftwareUpdates.rdf';
function Init()
@ -145,8 +145,7 @@
// TODO
// XXX hack to force the tree to rebuild
var treebody = document.getElementById('NC:SoftwareUpdateRoot');
treebody.setAttribute('id', 'NC:SoftwareUpdateRoot');
tree.setAttribute('ref', 'NC:SoftwareUpdateRoot');
}
}

View File

@ -41,8 +41,20 @@
flex="100%"
style="height: 100%"
datasources="rdf:softwareupdates"
onclick="OpenURL(event, event.target.parentNode);">
onclick="OpenURL(event, event.target.parentNode);"
ref="NC:SoftwareUpdateRoot">
<template>
<treechildren>
<treeitem uri="...">
<treerow>
<treecell><treeindentation/><titledbutton /><text value="rdf:http://home.netscape.com/NC-rdf#title"/></treecell>
<treecell><text value="rdf:http://home.netscape.com/NC-rdf#description"/></treecell>
<treecell><text value="rdf:http://home.netscape.com/NC-rdf#version"/></treecell>
</treerow>
</treeitem>
</treechildren>
</template>
@ -57,8 +69,5 @@
<treecell>&tree.header.version.label;</treecell>
</treerow>
</treehead>
<treechildren ref="NC:SoftwareUpdateRoot" rdf:containment="http://home.netscape.com/NC-rdf#child" open="true" />
</tree>
</window>