removing four more XUL content elements (moving their impls into XBL).

This commit is contained in:
hyatt%netscape.com 2000-05-31 07:32:36 +00:00
Родитель 010117965c
Коммит 25e2e4c7fb
30 изменённых файлов: 86 добавлений и 2605 удалений

Просмотреть файл

@ -106,11 +106,7 @@
#include "nsXPIDLString.h"
#include "nsXULAttributes.h"
#include "nsXULControllers.h"
#include "nsXULIFrameElement.h"
#include "nsXULBrowserElement.h"
#include "nsXULEditorElement.h"
#include "nsXULTreeElement.h"
#include "nsXULPopupElement.h"
#include "nsXULMenuListElement.h"
#include "nsIBoxObject.h"
#include "nsPIBoxObject.h"
@ -314,14 +310,14 @@ nsIAtom* nsXULElement::kTreeColAtom;
nsIAtom* nsXULElement::kTreeItemAtom;
nsIAtom* nsXULElement::kTreeRowAtom;
nsIAtom* nsXULElement::kValueAtom;
nsIAtom* nsXULElement::kIFrameAtom;
nsIAtom* nsXULElement::kBrowserAtom;
nsIAtom* nsXULElement::kEditorAtom;
nsIAtom* nsXULElement::kWidthAtom;
nsIAtom* nsXULElement::kWindowAtom;
nsIAtom* nsXULElement::kMenuListAtom;
nsIAtom* nsXULElement::kMenuAtom;
nsIAtom* nsXULElement::kPopupSetAtom;
nsIAtom* nsXULElement::kBrowserAtom;
nsIAtom* nsXULElement::kEditorAtom;
nsIAtom* nsXULElement::kIFrameAtom;
#ifdef XUL_PROTOTYPE_ATTRIBUTE_METERING
PRUint32 nsXULPrototypeAttribute::gNumElements;
@ -394,15 +390,15 @@ nsXULElement::Init()
kTreeItemAtom = NS_NewAtom("treeitem");
kTreeRowAtom = NS_NewAtom("treerow");
kValueAtom = NS_NewAtom("value");
kIFrameAtom = NS_NewAtom("iframe");
kBrowserAtom = NS_NewAtom("browser");
kEditorAtom = NS_NewAtom("editor");
kWidthAtom = NS_NewAtom("width");
kWindowAtom = NS_NewAtom("window");
kMenuListAtom = NS_NewAtom("menulist");
kMenuAtom = NS_NewAtom("menu");
kPopupSetAtom = NS_NewAtom("popupset");
kBrowserAtom = NS_NewAtom("browser");
kIFrameAtom = NS_NewAtom("iframe");
kEditorAtom = NS_NewAtom("editor");
rv = nsComponentManager::CreateInstance(kNameSpaceManagerCID,
nsnull,
kINameSpaceManagerIID,
@ -474,15 +470,15 @@ nsXULElement::~nsXULElement()
NS_IF_RELEASE(kTreeItemAtom);
NS_IF_RELEASE(kTreeRowAtom);
NS_IF_RELEASE(kValueAtom);
NS_IF_RELEASE(kIFrameAtom);
NS_IF_RELEASE(kBrowserAtom);
NS_IF_RELEASE(kEditorAtom);
NS_IF_RELEASE(kWidthAtom);
NS_IF_RELEASE(kWindowAtom);
NS_IF_RELEASE(kMenuListAtom);
NS_IF_RELEASE(kMenuAtom);
NS_IF_RELEASE(kPopupSetAtom);
NS_IF_RELEASE(kBrowserAtom);
NS_IF_RELEASE(kIFrameAtom);
NS_IF_RELEASE(kEditorAtom);
NS_IF_RELEASE(gNameSpaceManager);
if (gXULUtils) {
@ -690,90 +686,6 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result)
else
return NS_NOINTERFACE;
}
else if ((iid.Equals(NS_GET_IID(nsIDOMXULPopupElement))) &&
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
PRInt32 dummy;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag));
if ((tag.get() == kPopupAtom) || (tag.get() == kMenuPopupAtom)) {
// We delegate XULPopupElement APIs to an aggregate object
if (! InnerXULElement()) {
rv = EnsureSlots();
if (NS_FAILED(rv)) return rv;
if ((mSlots->mInnerXULElement = new nsXULPopupElement(this)) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
}
return InnerXULElement()->QueryInterface(iid, result);
}
else
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULIFrameElement)) &&
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
PRInt32 dummy;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag));
if (tag.get() == kIFrameAtom) {
// We delegate XULIFrameElement APIs to an aggregate object
if (! InnerXULElement()) {
rv = EnsureSlots();
if (NS_FAILED(rv)) return rv;
if ((mSlots->mInnerXULElement = new nsXULIFrameElement(this)) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
}
return InnerXULElement()->QueryInterface(iid, result);
}
else
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULBrowserElement)) &&
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
PRInt32 dummy;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag));
if (tag.get() == kBrowserAtom) {
// We delegate XULBrowserElement APIs to an aggregate object
if (! InnerXULElement()) {
rv = EnsureSlots();
if (NS_FAILED(rv)) return rv;
if ((mSlots->mInnerXULElement = new nsXULBrowserElement(this)) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
}
return InnerXULElement()->QueryInterface(iid, result);
}
else
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULEditorElement)) &&
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
PRInt32 dummy;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag));
if (tag.get() == kEditorAtom) {
// We delegate XULEditorElement APIs to an aggregate object
if (! InnerXULElement()) {
rv = EnsureSlots();
if (NS_FAILED(rv)) return rv;
if ((mSlots->mInnerXULElement = new nsXULEditorElement(this)) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
}
return InnerXULElement()->QueryInterface(iid, result);
}
else
return NS_NOINTERFACE;
}
else {
*result = nsnull;
return NS_NOINTERFACE;
@ -2103,26 +2015,10 @@ nsXULElement::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject)
fn = NS_NewScriptXULTreeElement;
rootname = "nsXULTreeElement::mScriptObject";
}
else if (tag.get() == kIFrameAtom) {
fn = NS_NewScriptXULIFrameElement;
rootname = "nsXULIFrameElement::mScriptObject";
}
else if (tag.get() == kBrowserAtom) {
fn = NS_NewScriptXULBrowserElement;
rootname = "nsXULBrowserElement::mScriptObject";
}
else if (tag.get() == kMenuListAtom) {
fn = NS_NewScriptXULMenuListElement;
rootname = "nsXULMenuListElement::mScriptObject";
}
else if (tag.get() == kEditorAtom) {
fn = NS_NewScriptXULEditorElement;
rootname = "nsXULEditorElement::mScriptObject";
}
else if ((tag.get() == kMenuPopupAtom) || (tag.get() == kPopupAtom)) {
fn = NS_NewScriptXULPopupElement;
rootname = "nsXULPopupElement::mScriptObject";
}
else {
fn = NS_NewScriptXULElement;
rootname = "nsXULElement::mScriptObject";
@ -4225,7 +4121,7 @@ nsXULElement::GetBoxObject(nsIBoxObject** aResult)
progID += "-tree";
mBoxObject = do_CreateInstance(progID);
if (mBoxObject)
if (!mBoxObject)
return NS_OK;
nsCOMPtr<nsPIBoxObject> privateBox(do_QueryInterface(mBoxObject));

Просмотреть файл

@ -33,6 +33,7 @@
#include "nsCOMPtr.h"
#include "nsXULAtoms.h"
#include "nsIDOMElement.h"
#include "nsIDOMXULElement.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMNSDocument.h"
#include "nsIXULPopupListener.h"
@ -40,7 +41,6 @@
#include "nsIDOMMouseMotionListener.h"
#include "nsRDFCID.h"
#include "nsIDOMXULPopupElement.h"
#include "nsIScriptGlobalObject.h"
#include "nsIDOMWindow.h"
#include "nsIDOMXULDocument.h"
@ -51,6 +51,10 @@
#include "nsIDOMNSUIEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsIBoxObject.h"
#include "nsIPopupSetBoxObject.h"
#include "nsIMenuBoxObject.h"
////////////////////////////////////////////////////////////////////////
static NS_DEFINE_IID(kXULPopupListenerCID, NS_XULPOPUPLISTENER_CID);
@ -317,8 +321,15 @@ XULPopupListenerImpl::MouseOut(nsIDOMEvent* aMouseEvent)
}
if ( mPopupContent ) {
nsCOMPtr<nsIDOMXULPopupElement> popupElement = do_QueryInterface(mPopupContent);
popupElement->ClosePopup();
nsCOMPtr<nsIDOMNode> parent;
mPopupContent->GetParentNode(getter_AddRefs(parent));
nsCOMPtr<nsIDOMXULElement> popupSetElement(do_QueryInterface(parent));
nsCOMPtr<nsIBoxObject> boxObject;
if (popupSetElement)
popupSetElement->GetBoxObject(getter_AddRefs(boxObject));
nsCOMPtr<nsIPopupSetBoxObject> popupSetObject(do_QueryInterface(boxObject));
if (popupSetObject)
popupSetObject->DestroyPopup();
mPopupContent = nsnull; // release the popup
@ -527,11 +538,20 @@ XULPopupListenerImpl::LaunchPopup(PRInt32 aClientX, PRInt32 aClientY)
mPopupContent = popupContent.get();
nsCOMPtr<nsIDOMXULPopupElement> xulPopup = do_QueryInterface(popupContent);
if (xulPopup)
xulPopup->OpenPopup(mElement,
xPos, yPos,
type, anchorAlignment, popupAlignment);
nsCOMPtr<nsIDOMNode> parent;
mPopupContent->GetParentNode(getter_AddRefs(parent));
nsCOMPtr<nsIDOMXULElement> popupSetElement(do_QueryInterface(parent));
nsCOMPtr<nsIBoxObject> boxObject;
if (popupSetElement)
popupSetElement->GetBoxObject(getter_AddRefs(boxObject));
nsCOMPtr<nsIPopupSetBoxObject> popupSetObject(do_QueryInterface(boxObject));
nsCOMPtr<nsIMenuBoxObject> menuObject(do_QueryInterface(boxObject));
if (popupSetObject)
popupSetObject->CreatePopup(mElement, mPopupContent, xPos, yPos,
type.GetUnicode(), anchorAlignment.GetUnicode(),
popupAlignment.GetUnicode());
else if (menuObject)
menuObject->OpenMenu(PR_TRUE);
}
}
}

Просмотреть файл

@ -1,10 +1,6 @@
nsIDOMXULCommandDispatcher.h
nsIDOMXULDocument.h
nsIDOMXULIFrameElement.h
nsIDOMXULBrowserElement.h
nsIDOMXULEditorElement.h
nsIDOMXULElement.h
nsIDOMXULPopupElement.h
nsIDOMXULTreeElement.h
nsIStreamLoadableDocument.h
nsIXULContentSink.h

Просмотреть файл

@ -31,12 +31,8 @@ MODULE = rdf
EXPORTS = \
nsIDOMXULCommandDispatcher.h \
nsIDOMXULDocument.h \
nsIDOMXULIFrameElement.h \
nsIDOMXULBrowserElement.h \
nsIDOMXULEditorElement.h \
nsIDOMXULElement.h \
nsIDOMXULPopupElement.h \
nsIDOMXULTreeElement.h \
nsIDOMXULElement.h \
nsIDOMXULTreeElement.h \
nsIStreamLoadableDocument.h \
nsIXULContentSink.h \
nsIXULContentUtils.h \

Просмотреть файл

@ -1,5 +0,0 @@
interface XULBrowserElement : XULElement {
/* IID: { 0xd31208d0, 0xe348, 0x11d3, \
{ 0xb0, 0x6b, 0x0, 0xa0, 0x24, 0xff, 0xc0, 0x8c } } */
readonly attribute xpidl nsIWebBrowser webBrowser;
};

Просмотреть файл

@ -1,5 +0,0 @@
interface XULEditorElement : XULElement {
/* IID: { 0x9a248050, 0x82d8, 0x11d3, \
{ 0xaf, 0x76, 0x0, 0xa0, 0x24, 0xff, 0xc0, 0x8c } } */
readonly attribute xpidl nsIEditorShell editorShell;
};

Просмотреть файл

@ -1,5 +0,0 @@
interface XULIFrameElement : XULElement {
/* IID: { 0xd31208d1, 0xe348, 0x11d3, \
{ 0xb0, 0x6b, 0x0, 0xa0, 0x24, 0xff, 0xc0, 0x8c } } */
readonly attribute xpidl nsIDocShell docShell;
};

Просмотреть файл

@ -1,12 +0,0 @@
interface XULPopupElement : XULElement {
/* IID: { 0x8fefe4a1, 0xd334, 0x11d3, \
{0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27} } */
void openPopup(in Element element,
in long xPos, in long yPos,
in DOMString popupType, in DOMString anchorAlignment,
in DOMString popupAlignment);
void closePopup();
};

Просмотреть файл

@ -26,14 +26,10 @@ MODULE=rdf
IDLSRCS = \
XULDocument.idl \
XULBrowserElement.idl \
XULIFrameElement.idl \
XULElement.idl \
XULCommandDispatcher.idl \
XULTreeElement.idl \
XULEditorElement.idl \
XULPopupElement.idl \
XULMenuListElement.idl \
XULTreeElement.idl \
XULMenuListElement.idl \
$(NULL)
XPCOM_DESTDIR=$(DEPTH)\rdf\content\public

Просмотреть файл

@ -30,11 +30,7 @@ EXPORTS = \
nsIXULKeyListener.h \
nsIXULPopupListener.h \
nsIDOMXULDocument.h \
nsIDOMXULIFrameElement.h \
nsIDOMXULBrowserElement.h \
nsIDOMXULEditorElement.h \
nsIDOMXULElement.h \
nsIDOMXULPopupElement.h \
nsIDOMXULTreeElement.h \
nsIXULContentSink.h \
nsIXULContentUtils.h \

Просмотреть файл

@ -1,59 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#ifndef nsIDOMXULBrowserElement_h__
#define nsIDOMXULBrowserElement_h__
#include "nsISupports.h"
#include "nsString.h"
#include "nsIScriptContext.h"
#include "nsIDOMXULElement.h"
class nsIWebBrowser;
#define NS_IDOMXULBROWSERELEMENT_IID \
{ 0xd31208d0, 0xe348, 0x11d3, \
{ 0xb0, 0x6b, 0x0, 0xa0, 0x24, 0xff, 0xc0, 0x8c } }
class nsIDOMXULBrowserElement : public nsIDOMXULElement {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMXULBROWSERELEMENT_IID; return iid; }
NS_IMETHOD GetWebBrowser(nsIWebBrowser** aWebBrowser)=0;
};
#define NS_DECL_IDOMXULBROWSERELEMENT \
NS_IMETHOD GetWebBrowser(nsIWebBrowser** aWebBrowser); \
#define NS_FORWARD_IDOMXULBROWSERELEMENT(_to) \
NS_IMETHOD GetWebBrowser(nsIWebBrowser** aWebBrowser) { return _to GetWebBrowser(aWebBrowser); } \
extern "C" NS_DOM nsresult NS_InitXULBrowserElementClass(nsIScriptContext *aContext, void **aPrototype);
extern "C" NS_DOM nsresult NS_NewScriptXULBrowserElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
#endif // nsIDOMXULBrowserElement_h__

Просмотреть файл

@ -1,59 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#ifndef nsIDOMXULEditorElement_h__
#define nsIDOMXULEditorElement_h__
#include "nsISupports.h"
#include "nsString.h"
#include "nsIScriptContext.h"
#include "nsIDOMXULElement.h"
class nsIEditorShell;
#define NS_IDOMXULEDITORELEMENT_IID \
{ 0x9a248050, 0x82d8, 0x11d3, \
{ 0xaf, 0x76, 0x0, 0xa0, 0x24, 0xff, 0xc0, 0x8c } }
class nsIDOMXULEditorElement : public nsIDOMXULElement {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMXULEDITORELEMENT_IID; return iid; }
NS_IMETHOD GetEditorShell(nsIEditorShell** aEditorShell)=0;
};
#define NS_DECL_IDOMXULEDITORELEMENT \
NS_IMETHOD GetEditorShell(nsIEditorShell** aEditorShell); \
#define NS_FORWARD_IDOMXULEDITORELEMENT(_to) \
NS_IMETHOD GetEditorShell(nsIEditorShell** aEditorShell) { return _to GetEditorShell(aEditorShell); } \
extern "C" NS_DOM nsresult NS_InitXULEditorElementClass(nsIScriptContext *aContext, void **aPrototype);
extern "C" NS_DOM nsresult NS_NewScriptXULEditorElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
#endif // nsIDOMXULEditorElement_h__

Просмотреть файл

@ -1,59 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#ifndef nsIDOMXULIFrameElement_h__
#define nsIDOMXULIFrameElement_h__
#include "nsISupports.h"
#include "nsString.h"
#include "nsIScriptContext.h"
#include "nsIDOMXULElement.h"
class nsIDocShell;
#define NS_IDOMXULIFRAMEELEMENT_IID \
{ 0xd31208d1, 0xe348, 0x11d3, \
{ 0xb0, 0x6b, 0x0, 0xa0, 0x24, 0xff, 0xc0, 0x8c } }
class nsIDOMXULIFrameElement : public nsIDOMXULElement {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMXULIFRAMEELEMENT_IID; return iid; }
NS_IMETHOD GetDocShell(nsIDocShell** aDocShell)=0;
};
#define NS_DECL_IDOMXULIFRAMEELEMENT \
NS_IMETHOD GetDocShell(nsIDocShell** aDocShell); \
#define NS_FORWARD_IDOMXULIFRAMEELEMENT(_to) \
NS_IMETHOD GetDocShell(nsIDocShell** aDocShell) { return _to GetDocShell(aDocShell); } \
extern "C" NS_DOM nsresult NS_InitXULIFrameElementClass(nsIScriptContext *aContext, void **aPrototype);
extern "C" NS_DOM nsresult NS_NewScriptXULIFrameElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
#endif // nsIDOMXULIFrameElement_h__

Просмотреть файл

@ -1,63 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#ifndef nsIDOMXULPopupElement_h__
#define nsIDOMXULPopupElement_h__
#include "nsISupports.h"
#include "nsString.h"
#include "nsIScriptContext.h"
#include "nsIDOMXULElement.h"
class nsIDOMElement;
#define NS_IDOMXULPOPUPELEMENT_IID \
{ 0x8fefe4a1, 0xd334, 0x11d3, \
{0xbf, 0x87, 0x0, 0x10, 0x5a, 0x1b, 0x6, 0x27} }
class nsIDOMXULPopupElement : public nsIDOMXULElement {
public:
static const nsIID& GetIID() { static nsIID iid = NS_IDOMXULPOPUPELEMENT_IID; return iid; }
NS_IMETHOD OpenPopup(nsIDOMElement* aElement, PRInt32 aXPos, PRInt32 aYPos, const nsString& aPopupType, const nsString& aAnchorAlignment, const nsString& aPopupAlignment)=0;
NS_IMETHOD ClosePopup()=0;
};
#define NS_DECL_IDOMXULPOPUPELEMENT \
NS_IMETHOD OpenPopup(nsIDOMElement* aElement, PRInt32 aXPos, PRInt32 aYPos, const nsString& aPopupType, const nsString& aAnchorAlignment, const nsString& aPopupAlignment); \
NS_IMETHOD ClosePopup(); \
#define NS_FORWARD_IDOMXULPOPUPELEMENT(_to) \
NS_IMETHOD OpenPopup(nsIDOMElement* aElement, PRInt32 aXPos, PRInt32 aYPos, const nsString& aPopupType, const nsString& aAnchorAlignment, const nsString& aPopupAlignment) { return _to OpenPopup(aElement, aXPos, aYPos, aPopupType, aAnchorAlignment, aPopupAlignment); } \
NS_IMETHOD ClosePopup() { return _to ClosePopup(); } \
extern "C" NS_DOM nsresult NS_InitXULPopupElementClass(nsIScriptContext *aContext, void **aPrototype);
extern "C" NS_DOM nsresult NS_NewScriptXULPopupElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
#endif // nsIDOMXULPopupElement_h__

Просмотреть файл

@ -37,12 +37,8 @@ CPPSRCS = \
nsJSXULDocument.cpp \
nsJSXULElement.cpp \
nsJSXULCommandDispatcher.cpp \
nsJSXULPopupElement.cpp \
nsJSXULTreeElement.cpp \
nsJSXULIFrameElement.cpp \
nsJSXULBrowserElement.cpp \
nsJSXULEditorElement.cpp \
nsJSXULMenuListElement.cpp \
nsJSXULMenuListElement.cpp \
nsRDFDOMNodeList.cpp \
nsRuleNetwork.cpp \
nsXULAtoms.cpp \
@ -56,12 +52,8 @@ CPPSRCS = \
nsXULCommandDispatcher.cpp \
nsXULControllers.cpp \
nsXULKeyListener.cpp \
nsXULPopupElement.cpp \
nsXULTemplateBuilder.cpp \
nsXULTreeElement.cpp \
nsXULIFrameElement.cpp \
nsXULBrowserElement.cpp \
nsXULEditorElement.cpp \
nsXULPrototypeDocument.cpp \
nsXULPrototypeCache.cpp \
nsXULMenuListElement.cpp \

Просмотреть файл

@ -45,11 +45,7 @@ CPP_OBJS=\
.\$(OBJDIR)\nsXULTemplateBuilder.obj \
.\$(OBJDIR)\nsJSXULDocument.obj \
.\$(OBJDIR)\nsJSXULElement.obj \
.\$(OBJDIR)\nsJSXULPopupElement.obj \
.\$(OBJDIR)\nsJSXULTreeElement.obj \
.\$(OBJDIR)\nsJSXULIFrameElement.obj \
.\$(OBJDIR)\nsJSXULBrowserElement.obj \
.\$(OBJDIR)\nsJSXULEditorElement.obj \
.\$(OBJDIR)\nsJSXULMenuListElement.obj \
.\$(OBJDIR)\nsRDFDOMNodeList.obj \
.\$(OBJDIR)\nsXULElement.obj \
@ -59,11 +55,7 @@ CPP_OBJS=\
.\$(OBJDIR)\nsXULKeyListener.obj \
.\$(OBJDIR)\nsXULSortService.obj \
.\$(OBJDIR)\nsXULTreeElement.obj \
.\$(OBJDIR)\nsXULIFrameElement.obj \
.\$(OBJDIR)\nsXULBrowserElement.obj \
.\$(OBJDIR)\nsXULEditorElement.obj \
.\$(OBJDIR)\nsXULPopupElement.obj \
.\$(OBJDIR)\nsXULMenuListElement.obj \
.\$(OBJDIR)\nsXULMenuListElement.obj \
$(NULL)
# XXX we are including layout\html\base\src to get HTML elements

Просмотреть файл

@ -1,312 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#include "jsapi.h"
#include "nsJSUtils.h"
#include "nsDOMError.h"
#include "nscore.h"
#include "nsIServiceManager.h"
#include "nsIScriptContext.h"
#include "nsIScriptSecurityManager.h"
#include "nsIJSScriptObject.h"
#include "nsIScriptObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsCOMPtr.h"
#include "nsDOMPropEnums.h"
#include "nsString.h"
#include "nsIDOMXULBrowserElement.h"
#include "nsIWebBrowser.h"
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
static NS_DEFINE_IID(kIXULBrowserElementIID, NS_IDOMXULBROWSERELEMENT_IID);
static NS_DEFINE_IID(kIWebBrowserIID, NS_IWEBBROWSER_IID);
//
// XULBrowserElement property ids
//
enum XULBrowserElement_slots {
XULBROWSERELEMENT_WEBBROWSER = -1
};
/***********************************************************************/
//
// XULBrowserElement Properties Getter
//
PR_STATIC_CALLBACK(JSBool)
GetXULBrowserElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULBrowserElement *a = (nsIDOMXULBrowserElement*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
nsresult rv = NS_OK;
if (JSVAL_IS_INT(id)) {
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case XULBROWSERELEMENT_WEBBROWSER:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULBROWSERELEMENT_WEBBROWSER, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsIWebBrowser* prop;
rv = a->GetWebBrowser(&prop);
if (NS_SUCCEEDED(rv)) {
// get the js object; n.b., this will do a release on 'prop'
nsJSUtils::nsConvertXPCObjectToJSVal(prop, NS_GET_IID(nsIWebBrowser), cx, obj, vp);
}
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
}
if (NS_FAILED(rv))
return nsJSUtils::nsReportError(cx, obj, rv);
return PR_TRUE;
}
/***********************************************************************/
//
// XULBrowserElement Properties Setter
//
PR_STATIC_CALLBACK(JSBool)
SetXULBrowserElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULBrowserElement *a = (nsIDOMXULBrowserElement*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
nsresult rv = NS_OK;
if (JSVAL_IS_INT(id)) {
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case 0:
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
if (NS_FAILED(rv))
return nsJSUtils::nsReportError(cx, obj, rv);
return PR_TRUE;
}
//
// XULBrowserElement finalizer
//
PR_STATIC_CALLBACK(void)
FinalizeXULBrowserElement(JSContext *cx, JSObject *obj)
{
nsJSUtils::nsGenericFinalize(cx, obj);
}
//
// XULBrowserElement enumerate
//
PR_STATIC_CALLBACK(JSBool)
EnumerateXULBrowserElement(JSContext *cx, JSObject *obj)
{
return nsJSUtils::nsGenericEnumerate(cx, obj);
}
//
// XULBrowserElement resolve
//
PR_STATIC_CALLBACK(JSBool)
ResolveXULBrowserElement(JSContext *cx, JSObject *obj, jsval id)
{
return nsJSUtils::nsGenericResolve(cx, obj, id);
}
/***********************************************************************/
//
// class for XULBrowserElement
//
JSClass XULBrowserElementClass = {
"XULBrowserElement",
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
JS_PropertyStub,
JS_PropertyStub,
GetXULBrowserElementProperty,
SetXULBrowserElementProperty,
EnumerateXULBrowserElement,
ResolveXULBrowserElement,
JS_ConvertStub,
FinalizeXULBrowserElement,
nsnull,
nsJSUtils::nsCheckAccess
};
//
// XULBrowserElement class properties
//
static JSPropertySpec XULBrowserElementProperties[] =
{
{"webBrowser", XULBROWSERELEMENT_WEBBROWSER, JSPROP_ENUMERATE | JSPROP_READONLY},
{0}
};
//
// XULBrowserElement class methods
//
static JSFunctionSpec XULBrowserElementMethods[] =
{
{0}
};
//
// XULBrowserElement constructor
//
PR_STATIC_CALLBACK(JSBool)
XULBrowserElement(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
return JS_FALSE;
}
//
// XULBrowserElement class initialization
//
extern "C" NS_DOM nsresult NS_InitXULBrowserElementClass(nsIScriptContext *aContext, void **aPrototype)
{
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
JSObject *proto = nsnull;
JSObject *constructor = nsnull;
JSObject *parent_proto = nsnull;
JSObject *global = JS_GetGlobalObject(jscontext);
jsval vp;
if ((PR_TRUE != JS_LookupProperty(jscontext, global, "XULBrowserElement", &vp)) ||
!JSVAL_IS_OBJECT(vp) ||
((constructor = JSVAL_TO_OBJECT(vp)) == nsnull) ||
(PR_TRUE != JS_LookupProperty(jscontext, JSVAL_TO_OBJECT(vp), "prototype", &vp)) ||
!JSVAL_IS_OBJECT(vp)) {
if (NS_OK != NS_InitXULElementClass(aContext, (void **)&parent_proto)) {
return NS_ERROR_FAILURE;
}
proto = JS_InitClass(jscontext, // context
global, // global object
parent_proto, // parent proto
&XULBrowserElementClass, // JSClass
XULBrowserElement, // JSNative ctor
0, // ctor args
XULBrowserElementProperties, // proto props
XULBrowserElementMethods, // proto funcs
nsnull, // ctor props (static)
nsnull); // ctor funcs (static)
if (nsnull == proto) {
return NS_ERROR_FAILURE;
}
}
else if ((nsnull != constructor) && JSVAL_IS_OBJECT(vp)) {
proto = JSVAL_TO_OBJECT(vp);
}
else {
return NS_ERROR_FAILURE;
}
if (aPrototype) {
*aPrototype = proto;
}
return NS_OK;
}
//
// Method for creating a new XULBrowserElement JavaScript object
//
extern "C" NS_DOM nsresult NS_NewScriptXULBrowserElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
{
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptXULBrowserElement");
JSObject *proto;
JSObject *parent;
nsIScriptObjectOwner *owner;
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
nsresult result = NS_OK;
nsIDOMXULBrowserElement *aXULBrowserElement;
if (nsnull == aParent) {
parent = nsnull;
}
else if (NS_OK == aParent->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) {
if (NS_OK != owner->GetScriptObject(aContext, (void **)&parent)) {
NS_RELEASE(owner);
return NS_ERROR_FAILURE;
}
NS_RELEASE(owner);
}
else {
return NS_ERROR_FAILURE;
}
if (NS_OK != NS_InitXULBrowserElementClass(aContext, (void **)&proto)) {
return NS_ERROR_FAILURE;
}
result = aSupports->QueryInterface(kIXULBrowserElementIID, (void **)&aXULBrowserElement);
if (NS_OK != result) {
return result;
}
// create a js object for this class
*aReturn = JS_NewObject(jscontext, &XULBrowserElementClass, proto, parent);
if (nsnull != *aReturn) {
// connect the native object to the js object
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aXULBrowserElement);
}
else {
NS_RELEASE(aXULBrowserElement);
return NS_ERROR_FAILURE;
}
return NS_OK;
}

Просмотреть файл

@ -1,312 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#include "jsapi.h"
#include "nsJSUtils.h"
#include "nsDOMError.h"
#include "nscore.h"
#include "nsIServiceManager.h"
#include "nsIScriptContext.h"
#include "nsIScriptSecurityManager.h"
#include "nsIJSScriptObject.h"
#include "nsIScriptObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsCOMPtr.h"
#include "nsDOMPropEnums.h"
#include "nsString.h"
#include "nsIDOMXULEditorElement.h"
#include "nsIEditorShell.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(kIXULEditorElementIID, NS_IDOMXULEDITORELEMENT_IID);
static NS_DEFINE_IID(kIEditorShellIID, NS_IEDITORSHELL_IID);
//
// XULEditorElement property ids
//
enum XULEditorElement_slots {
XULEDITORELEMENT_EDITORSHELL = -1
};
/***********************************************************************/
//
// XULEditorElement Properties Getter
//
PR_STATIC_CALLBACK(JSBool)
GetXULEditorElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULEditorElement *a = (nsIDOMXULEditorElement*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
nsresult rv = NS_OK;
if (JSVAL_IS_INT(id)) {
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case XULEDITORELEMENT_EDITORSHELL:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULEDITORELEMENT_EDITORSHELL, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsIEditorShell* prop;
rv = a->GetEditorShell(&prop);
if (NS_SUCCEEDED(rv)) {
// get the js object; n.b., this will do a release on 'prop'
nsJSUtils::nsConvertXPCObjectToJSVal(prop, NS_GET_IID(nsIEditorShell), cx, obj, vp);
}
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
}
if (NS_FAILED(rv))
return nsJSUtils::nsReportError(cx, obj, rv);
return PR_TRUE;
}
/***********************************************************************/
//
// XULEditorElement Properties Setter
//
PR_STATIC_CALLBACK(JSBool)
SetXULEditorElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULEditorElement *a = (nsIDOMXULEditorElement*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
nsresult rv = NS_OK;
if (JSVAL_IS_INT(id)) {
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case 0:
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
if (NS_FAILED(rv))
return nsJSUtils::nsReportError(cx, obj, rv);
return PR_TRUE;
}
//
// XULEditorElement finalizer
//
PR_STATIC_CALLBACK(void)
FinalizeXULEditorElement(JSContext *cx, JSObject *obj)
{
nsJSUtils::nsGenericFinalize(cx, obj);
}
//
// XULEditorElement enumerate
//
PR_STATIC_CALLBACK(JSBool)
EnumerateXULEditorElement(JSContext *cx, JSObject *obj)
{
return nsJSUtils::nsGenericEnumerate(cx, obj);
}
//
// XULEditorElement resolve
//
PR_STATIC_CALLBACK(JSBool)
ResolveXULEditorElement(JSContext *cx, JSObject *obj, jsval id)
{
return nsJSUtils::nsGenericResolve(cx, obj, id);
}
/***********************************************************************/
//
// class for XULEditorElement
//
JSClass XULEditorElementClass = {
"XULEditorElement",
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
JS_PropertyStub,
JS_PropertyStub,
GetXULEditorElementProperty,
SetXULEditorElementProperty,
EnumerateXULEditorElement,
ResolveXULEditorElement,
JS_ConvertStub,
FinalizeXULEditorElement,
nsnull,
nsJSUtils::nsCheckAccess
};
//
// XULEditorElement class properties
//
static JSPropertySpec XULEditorElementProperties[] =
{
{"editorShell", XULEDITORELEMENT_EDITORSHELL, JSPROP_ENUMERATE | JSPROP_READONLY},
{0}
};
//
// XULEditorElement class methods
//
static JSFunctionSpec XULEditorElementMethods[] =
{
{0}
};
//
// XULEditorElement constructor
//
PR_STATIC_CALLBACK(JSBool)
XULEditorElement(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
return JS_FALSE;
}
//
// XULEditorElement class initialization
//
extern "C" NS_DOM nsresult NS_InitXULEditorElementClass(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, "XULEditorElement", &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
&XULEditorElementClass, // JSClass
XULEditorElement, // JSNative ctor
0, // ctor args
XULEditorElementProperties, // proto props
XULEditorElementMethods, // 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 XULEditorElement JavaScript object
//
extern "C" NS_DOM nsresult NS_NewScriptXULEditorElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
{
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptXULEditorElement");
JSObject *proto;
JSObject *parent;
nsIScriptObjectOwner *owner;
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
nsresult result = NS_OK;
nsIDOMXULEditorElement *aXULEditorElement;
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_InitXULEditorElementClass(aContext, (void **)&proto)) {
return NS_ERROR_FAILURE;
}
result = aSupports->QueryInterface(kIXULEditorElementIID, (void **)&aXULEditorElement);
if (NS_OK != result) {
return result;
}
// create a js object for this class
*aReturn = JS_NewObject(jscontext, &XULEditorElementClass, proto, parent);
if (nsnull != *aReturn) {
// connect the native object to the js object
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aXULEditorElement);
}
else {
NS_RELEASE(aXULEditorElement);
return NS_ERROR_FAILURE;
}
return NS_OK;
}

Просмотреть файл

@ -1,312 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#include "jsapi.h"
#include "nsJSUtils.h"
#include "nsDOMError.h"
#include "nscore.h"
#include "nsIServiceManager.h"
#include "nsIScriptContext.h"
#include "nsIScriptSecurityManager.h"
#include "nsIJSScriptObject.h"
#include "nsIScriptObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsCOMPtr.h"
#include "nsDOMPropEnums.h"
#include "nsString.h"
#include "nsIDocShell.h"
#include "nsIDOMXULIFrameElement.h"
static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID);
static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID);
static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID);
static NS_DEFINE_IID(kIDocShellIID, NS_IDOCSHELL_IID);
static NS_DEFINE_IID(kIXULIFrameElementIID, NS_IDOMXULIFRAMEELEMENT_IID);
//
// XULIFrameElement property ids
//
enum XULIFrameElement_slots {
XULIFRAMEELEMENT_DOCSHELL = -1
};
/***********************************************************************/
//
// XULIFrameElement Properties Getter
//
PR_STATIC_CALLBACK(JSBool)
GetXULIFrameElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULIFrameElement *a = (nsIDOMXULIFrameElement*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
nsresult rv = NS_OK;
if (JSVAL_IS_INT(id)) {
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case XULIFRAMEELEMENT_DOCSHELL:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULIFRAMEELEMENT_DOCSHELL, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsIDocShell* prop;
rv = a->GetDocShell(&prop);
if (NS_SUCCEEDED(rv)) {
// get the js object; n.b., this will do a release on 'prop'
nsJSUtils::nsConvertXPCObjectToJSVal(prop, NS_GET_IID(nsIDocShell), cx, obj, vp);
}
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
}
if (NS_FAILED(rv))
return nsJSUtils::nsReportError(cx, obj, rv);
return PR_TRUE;
}
/***********************************************************************/
//
// XULIFrameElement Properties Setter
//
PR_STATIC_CALLBACK(JSBool)
SetXULIFrameElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULIFrameElement *a = (nsIDOMXULIFrameElement*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
nsresult rv = NS_OK;
if (JSVAL_IS_INT(id)) {
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case 0:
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
if (NS_FAILED(rv))
return nsJSUtils::nsReportError(cx, obj, rv);
return PR_TRUE;
}
//
// XULIFrameElement finalizer
//
PR_STATIC_CALLBACK(void)
FinalizeXULIFrameElement(JSContext *cx, JSObject *obj)
{
nsJSUtils::nsGenericFinalize(cx, obj);
}
//
// XULIFrameElement enumerate
//
PR_STATIC_CALLBACK(JSBool)
EnumerateXULIFrameElement(JSContext *cx, JSObject *obj)
{
return nsJSUtils::nsGenericEnumerate(cx, obj);
}
//
// XULIFrameElement resolve
//
PR_STATIC_CALLBACK(JSBool)
ResolveXULIFrameElement(JSContext *cx, JSObject *obj, jsval id)
{
return nsJSUtils::nsGenericResolve(cx, obj, id);
}
/***********************************************************************/
//
// class for XULIFrameElement
//
JSClass XULIFrameElementClass = {
"XULIFrameElement",
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
JS_PropertyStub,
JS_PropertyStub,
GetXULIFrameElementProperty,
SetXULIFrameElementProperty,
EnumerateXULIFrameElement,
ResolveXULIFrameElement,
JS_ConvertStub,
FinalizeXULIFrameElement,
nsnull,
nsJSUtils::nsCheckAccess
};
//
// XULIFrameElement class properties
//
static JSPropertySpec XULIFrameElementProperties[] =
{
{"docShell", XULIFRAMEELEMENT_DOCSHELL, JSPROP_ENUMERATE | JSPROP_READONLY},
{0}
};
//
// XULIFrameElement class methods
//
static JSFunctionSpec XULIFrameElementMethods[] =
{
{0}
};
//
// XULIFrameElement constructor
//
PR_STATIC_CALLBACK(JSBool)
XULIFrameElement(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
return JS_FALSE;
}
//
// XULIFrameElement class initialization
//
extern "C" NS_DOM nsresult NS_InitXULIFrameElementClass(nsIScriptContext *aContext, void **aPrototype)
{
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
JSObject *proto = nsnull;
JSObject *constructor = nsnull;
JSObject *parent_proto = nsnull;
JSObject *global = JS_GetGlobalObject(jscontext);
jsval vp;
if ((PR_TRUE != JS_LookupProperty(jscontext, global, "XULIFrameElement", &vp)) ||
!JSVAL_IS_OBJECT(vp) ||
((constructor = JSVAL_TO_OBJECT(vp)) == nsnull) ||
(PR_TRUE != JS_LookupProperty(jscontext, JSVAL_TO_OBJECT(vp), "prototype", &vp)) ||
!JSVAL_IS_OBJECT(vp)) {
if (NS_OK != NS_InitXULElementClass(aContext, (void **)&parent_proto)) {
return NS_ERROR_FAILURE;
}
proto = JS_InitClass(jscontext, // context
global, // global object
parent_proto, // parent proto
&XULIFrameElementClass, // JSClass
XULIFrameElement, // JSNative ctor
0, // ctor args
XULIFrameElementProperties, // proto props
XULIFrameElementMethods, // proto funcs
nsnull, // ctor props (static)
nsnull); // ctor funcs (static)
if (nsnull == proto) {
return NS_ERROR_FAILURE;
}
}
else if ((nsnull != constructor) && JSVAL_IS_OBJECT(vp)) {
proto = JSVAL_TO_OBJECT(vp);
}
else {
return NS_ERROR_FAILURE;
}
if (aPrototype) {
*aPrototype = proto;
}
return NS_OK;
}
//
// Method for creating a new XULIFrameElement JavaScript object
//
extern "C" NS_DOM nsresult NS_NewScriptXULIFrameElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
{
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptXULIFrameElement");
JSObject *proto;
JSObject *parent;
nsIScriptObjectOwner *owner;
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
nsresult result = NS_OK;
nsIDOMXULIFrameElement *aXULIFrameElement;
if (nsnull == aParent) {
parent = nsnull;
}
else if (NS_OK == aParent->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) {
if (NS_OK != owner->GetScriptObject(aContext, (void **)&parent)) {
NS_RELEASE(owner);
return NS_ERROR_FAILURE;
}
NS_RELEASE(owner);
}
else {
return NS_ERROR_FAILURE;
}
if (NS_OK != NS_InitXULIFrameElementClass(aContext, (void **)&proto)) {
return NS_ERROR_FAILURE;
}
result = aSupports->QueryInterface(kIXULIFrameElementIID, (void **)&aXULIFrameElement);
if (NS_OK != result) {
return result;
}
// create a js object for this class
*aReturn = JS_NewObject(jscontext, &XULIFrameElementClass, proto, parent);
if (nsnull != *aReturn) {
// connect the native object to the js object
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aXULIFrameElement);
}
else {
NS_RELEASE(aXULIFrameElement);
return NS_ERROR_FAILURE;
}
return NS_OK;
}

Просмотреть файл

@ -1,391 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/* AUTO-GENERATED. DO NOT EDIT!!! */
#include "jsapi.h"
#include "nsJSUtils.h"
#include "nsDOMError.h"
#include "nscore.h"
#include "nsIServiceManager.h"
#include "nsIScriptContext.h"
#include "nsIScriptSecurityManager.h"
#include "nsIJSScriptObject.h"
#include "nsIScriptObjectOwner.h"
#include "nsIScriptGlobalObject.h"
#include "nsCOMPtr.h"
#include "nsDOMPropEnums.h"
#include "nsString.h"
#include "nsIDOMElement.h"
#include "nsIDOMXULPopupElement.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(kIElementIID, NS_IDOMELEMENT_IID);
static NS_DEFINE_IID(kIXULPopupElementIID, NS_IDOMXULPOPUPELEMENT_IID);
/***********************************************************************/
//
// XULPopupElement Properties Getter
//
PR_STATIC_CALLBACK(JSBool)
GetXULPopupElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULPopupElement *a = (nsIDOMXULPopupElement*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
nsresult rv = NS_OK;
if (JSVAL_IS_INT(id)) {
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case 0:
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
}
if (NS_FAILED(rv))
return nsJSUtils::nsReportError(cx, obj, rv);
return PR_TRUE;
}
/***********************************************************************/
//
// XULPopupElement Properties Setter
//
PR_STATIC_CALLBACK(JSBool)
SetXULPopupElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
nsIDOMXULPopupElement *a = (nsIDOMXULPopupElement*)nsJSUtils::nsGetNativeThis(cx, obj);
// If there's no private data, this must be the prototype, so ignore
if (nsnull == a) {
return JS_TRUE;
}
nsresult rv = NS_OK;
if (JSVAL_IS_INT(id)) {
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
switch(JSVAL_TO_INT(id)) {
case 0:
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
}
else {
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
if (NS_FAILED(rv))
return nsJSUtils::nsReportError(cx, obj, rv);
return PR_TRUE;
}
//
// XULPopupElement finalizer
//
PR_STATIC_CALLBACK(void)
FinalizeXULPopupElement(JSContext *cx, JSObject *obj)
{
nsJSUtils::nsGenericFinalize(cx, obj);
}
//
// XULPopupElement enumerate
//
PR_STATIC_CALLBACK(JSBool)
EnumerateXULPopupElement(JSContext *cx, JSObject *obj)
{
return nsJSUtils::nsGenericEnumerate(cx, obj);
}
//
// XULPopupElement resolve
//
PR_STATIC_CALLBACK(JSBool)
ResolveXULPopupElement(JSContext *cx, JSObject *obj, jsval id)
{
return nsJSUtils::nsGenericResolve(cx, obj, id);
}
//
// Native method OpenPopup
//
PR_STATIC_CALLBACK(JSBool)
XULPopupElementOpenPopup(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMXULPopupElement *nativeThis = (nsIDOMXULPopupElement*)nsJSUtils::nsGetNativeThis(cx, obj);
nsresult result = NS_OK;
nsCOMPtr<nsIDOMElement> b0;
PRInt32 b1;
PRInt32 b2;
nsAutoString b3;
nsAutoString b4;
nsAutoString b5;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
{
*rval = JSVAL_NULL;
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULPOPUPELEMENT_OPENPOPUP, PR_FALSE);
if (NS_FAILED(result)) {
return nsJSUtils::nsReportError(cx, obj, result);
}
if (argc < 6) {
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR);
}
if (JS_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)(void**)getter_AddRefs(b0),
kIElementIID,
NS_ConvertASCIItoUCS2("Element"),
cx,
argv[0])) {
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_OBJECT_ERR);
}
if (!JS_ValueToInt32(cx, argv[1], (int32 *)&b1)) {
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_NUMBER_ERR);
}
if (!JS_ValueToInt32(cx, argv[2], (int32 *)&b2)) {
return nsJSUtils::nsReportError(cx, obj, NS_ERROR_DOM_NOT_NUMBER_ERR);
}
nsJSUtils::nsConvertJSValToString(b3, cx, argv[3]);
nsJSUtils::nsConvertJSValToString(b4, cx, argv[4]);
nsJSUtils::nsConvertJSValToString(b5, cx, argv[5]);
result = nativeThis->OpenPopup(b0, b1, b2, b3, b4, b5);
if (NS_FAILED(result)) {
return nsJSUtils::nsReportError(cx, obj, result);
}
*rval = JSVAL_VOID;
}
return JS_TRUE;
}
//
// Native method ClosePopup
//
PR_STATIC_CALLBACK(JSBool)
XULPopupElementClosePopup(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
nsIDOMXULPopupElement *nativeThis = (nsIDOMXULPopupElement*)nsJSUtils::nsGetNativeThis(cx, obj);
nsresult result = NS_OK;
// If there's no private data, this must be the prototype, so ignore
if (nsnull == nativeThis) {
return JS_TRUE;
}
{
*rval = JSVAL_NULL;
nsIScriptSecurityManager *secMan = nsJSUtils::nsGetSecurityManager(cx, obj);
if (!secMan)
return PR_FALSE;
result = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_XULPOPUPELEMENT_CLOSEPOPUP, PR_FALSE);
if (NS_FAILED(result)) {
return nsJSUtils::nsReportError(cx, obj, result);
}
result = nativeThis->ClosePopup();
if (NS_FAILED(result)) {
return nsJSUtils::nsReportError(cx, obj, result);
}
*rval = JSVAL_VOID;
}
return JS_TRUE;
}
/***********************************************************************/
//
// class for XULPopupElement
//
JSClass XULPopupElementClass = {
"XULPopupElement",
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
JS_PropertyStub,
JS_PropertyStub,
GetXULPopupElementProperty,
SetXULPopupElementProperty,
EnumerateXULPopupElement,
ResolveXULPopupElement,
JS_ConvertStub,
FinalizeXULPopupElement,
nsnull,
nsJSUtils::nsCheckAccess
};
//
// XULPopupElement class properties
//
static JSPropertySpec XULPopupElementProperties[] =
{
{0}
};
//
// XULPopupElement class methods
//
static JSFunctionSpec XULPopupElementMethods[] =
{
{"openPopup", XULPopupElementOpenPopup, 6},
{"closePopup", XULPopupElementClosePopup, 0},
{0}
};
//
// XULPopupElement constructor
//
PR_STATIC_CALLBACK(JSBool)
XULPopupElement(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
return JS_FALSE;
}
//
// XULPopupElement class initialization
//
extern "C" NS_DOM nsresult NS_InitXULPopupElementClass(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, "XULPopupElement", &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
&XULPopupElementClass, // JSClass
XULPopupElement, // JSNative ctor
0, // ctor args
XULPopupElementProperties, // proto props
XULPopupElementMethods, // 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 XULPopupElement JavaScript object
//
extern "C" NS_DOM nsresult NS_NewScriptXULPopupElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
{
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptXULPopupElement");
JSObject *proto;
JSObject *parent;
nsIScriptObjectOwner *owner;
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
nsresult result = NS_OK;
nsIDOMXULPopupElement *aXULPopupElement;
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_InitXULPopupElementClass(aContext, (void **)&proto)) {
return NS_ERROR_FAILURE;
}
result = aSupports->QueryInterface(kIXULPopupElementIID, (void **)&aXULPopupElement);
if (NS_OK != result) {
return result;
}
// create a js object for this class
*aReturn = JS_NewObject(jscontext, &XULPopupElementClass, proto, parent);
if (nsnull != *aReturn) {
// connect the native object to the js object
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aXULPopupElement);
}
else {
NS_RELEASE(aXULPopupElement);
return NS_ERROR_FAILURE;
}
return NS_OK;
}

Просмотреть файл

@ -1,97 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
*/
/*
Implementation methods for the XUL tree element APIs.
*/
#include "nsCOMPtr.h"
#include "nsRDFCID.h"
#include "nsXULBrowserElement.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsINameSpaceManager.h"
#include "nsIServiceManager.h"
#include "nsString.h"
NS_IMPL_ADDREF_INHERITED(nsXULBrowserElement, nsXULAggregateElement);
NS_IMPL_RELEASE_INHERITED(nsXULBrowserElement, nsXULAggregateElement);
nsresult
nsXULBrowserElement::QueryInterface(REFNSIID aIID, void** aResult)
{
NS_PRECONDITION(aResult != nsnull, "null ptr");
if (! aResult)
return NS_ERROR_NULL_POINTER;
if (aIID.Equals(NS_GET_IID(nsIDOMXULBrowserElement))) {
*aResult = NS_STATIC_CAST(nsIDOMXULBrowserElement*, this);
}
else {
return nsXULAggregateElement::QueryInterface(aIID, aResult);
}
NS_ADDREF(NS_REINTERPRET_CAST(nsISupports*, *aResult));
return NS_OK;
}
MOZ_DECL_CTOR_COUNTER(RDF_nsXULBrowserElement);
nsXULBrowserElement::nsXULBrowserElement(nsIDOMXULElement* aOuter)
: nsXULAggregateElement(aOuter)
{
}
nsXULBrowserElement::~nsXULBrowserElement()
{
}
NS_IMETHODIMP
nsXULBrowserElement::GetWebBrowser(nsIWebBrowser** aWebBrowser)
{
NS_ENSURE_ARG_POINTER(aWebBrowser);
nsCOMPtr<nsIContent> content(do_QueryInterface(mOuter));
nsCOMPtr<nsIDocument> document;
content->GetDocument(*getter_AddRefs(document));
// First we need to obtain the popup set frame that encapsulates the target popup.
// Without a popup set, we're dead in the water.
nsCOMPtr<nsIPresShell> presShell = getter_AddRefs(document->GetShellAt(0));
if(!presShell)
return NS_OK;
nsCOMPtr<nsISupports> subShell;
presShell->GetSubShellFor(content, getter_AddRefs(subShell));
if(!subShell)
return NS_OK;
CallQueryInterface(subShell, aWebBrowser);
return NS_OK;
}

Просмотреть файл

@ -1,67 +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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
*/
/*
An aggregate object that implements the XUL tree widget APIs
*/
#ifndef nsXULBrowserElement_h__
#define nsXULBrowserElement_h__
#include "nsXULElement.h"
#include "nsIDOMXULBrowserElement.h"
#include "nsIXULTreeContent.h"
#include "nsRDFDOMNodeList.h"
#include "nsIWebBrowser.h"
class nsXULBrowserElement : public nsXULAggregateElement,
public nsIDOMXULBrowserElement
{
public:
nsXULBrowserElement(nsIDOMXULElement* aOuter);
~nsXULBrowserElement();
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode interface
NS_FORWARD_IDOMNODE(mOuter->);
// nsIDOMElement interface
NS_FORWARD_IDOMELEMENT(mOuter->);
// nsIDOMXULElement interface
NS_FORWARD_IDOMXULELEMENT(mOuter->);
// nsIDOMXULBrowserElement interface
NS_DECL_IDOMXULBROWSERELEMENT
protected:
nsCOMPtr<nsIWebBrowser> mWebBrowser;
};
#endif // nsXULBrowserElement_h__

Просмотреть файл

@ -1,90 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
*/
/*
Implementation methods for the XUL tree element APIs.
*/
#include "nsCOMPtr.h"
#include "nsRDFCID.h"
#include "nsXULEditorElement.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsINameSpaceManager.h"
#include "nsIServiceManager.h"
#include "nsString.h"
NS_IMPL_ADDREF_INHERITED(nsXULEditorElement, nsXULAggregateElement);
NS_IMPL_RELEASE_INHERITED(nsXULEditorElement, nsXULAggregateElement);
nsresult
nsXULEditorElement::QueryInterface(REFNSIID aIID, void** aResult)
{
NS_PRECONDITION(aResult != nsnull, "null ptr");
if (! aResult)
return NS_ERROR_NULL_POINTER;
if (aIID.Equals(NS_GET_IID(nsIDOMXULEditorElement))) {
*aResult = NS_STATIC_CAST(nsIDOMXULEditorElement*, this);
}
else {
return nsXULAggregateElement::QueryInterface(aIID, aResult);
}
NS_ADDREF(NS_REINTERPRET_CAST(nsISupports*, *aResult));
return NS_OK;
}
MOZ_DECL_CTOR_COUNTER(RDF_nsXULEditorElement);
nsXULEditorElement::nsXULEditorElement(nsIDOMXULElement* aOuter)
: nsXULAggregateElement(aOuter)
{
}
nsXULEditorElement::~nsXULEditorElement()
{
}
NS_IMETHODIMP
nsXULEditorElement::GetEditorShell(nsIEditorShell** aEditorShell)
{
NS_ENSURE_ARG_POINTER(aEditorShell);
if(!mEditorShell)
{
NS_ENSURE_SUCCESS(nsComponentManager::CreateInstance("component://netscape/editor/editorshell",
nsnull,
NS_GET_IID(nsIEditorShell),
getter_AddRefs(mEditorShell)),
NS_ERROR_FAILURE);
}
*aEditorShell = mEditorShell;
NS_ADDREF(*aEditorShell);
return NS_OK;
}

Просмотреть файл

@ -1,64 +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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
/*
An aggregate object that implements the XUL tree widget APIs
*/
#ifndef nsXULEditorElement_h__
#define nsXULEditorElement_h__
#include "nsXULElement.h"
#include "nsIDOMXULEditorElement.h"
#include "nsIXULTreeContent.h"
#include "nsRDFDOMNodeList.h"
#include "nsIEditorShell.h"
class nsXULEditorElement : public nsXULAggregateElement,
public nsIDOMXULEditorElement
{
public:
nsXULEditorElement(nsIDOMXULElement* aOuter);
~nsXULEditorElement();
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode interface
NS_FORWARD_IDOMNODE(mOuter->);
// nsIDOMElement interface
NS_FORWARD_IDOMELEMENT(mOuter->);
// nsIDOMXULElement interface
NS_FORWARD_IDOMXULELEMENT(mOuter->);
// nsIDOMXULEditorElement interface
NS_DECL_IDOMXULEDITORELEMENT
protected:
nsCOMPtr<nsIEditorShell> mEditorShell;
};
#endif // nsXULEditorElement_h__

Просмотреть файл

@ -106,11 +106,7 @@
#include "nsXPIDLString.h"
#include "nsXULAttributes.h"
#include "nsXULControllers.h"
#include "nsXULIFrameElement.h"
#include "nsXULBrowserElement.h"
#include "nsXULEditorElement.h"
#include "nsXULTreeElement.h"
#include "nsXULPopupElement.h"
#include "nsXULMenuListElement.h"
#include "nsIBoxObject.h"
#include "nsPIBoxObject.h"
@ -314,14 +310,14 @@ nsIAtom* nsXULElement::kTreeColAtom;
nsIAtom* nsXULElement::kTreeItemAtom;
nsIAtom* nsXULElement::kTreeRowAtom;
nsIAtom* nsXULElement::kValueAtom;
nsIAtom* nsXULElement::kIFrameAtom;
nsIAtom* nsXULElement::kBrowserAtom;
nsIAtom* nsXULElement::kEditorAtom;
nsIAtom* nsXULElement::kWidthAtom;
nsIAtom* nsXULElement::kWindowAtom;
nsIAtom* nsXULElement::kMenuListAtom;
nsIAtom* nsXULElement::kMenuAtom;
nsIAtom* nsXULElement::kPopupSetAtom;
nsIAtom* nsXULElement::kBrowserAtom;
nsIAtom* nsXULElement::kEditorAtom;
nsIAtom* nsXULElement::kIFrameAtom;
#ifdef XUL_PROTOTYPE_ATTRIBUTE_METERING
PRUint32 nsXULPrototypeAttribute::gNumElements;
@ -394,15 +390,15 @@ nsXULElement::Init()
kTreeItemAtom = NS_NewAtom("treeitem");
kTreeRowAtom = NS_NewAtom("treerow");
kValueAtom = NS_NewAtom("value");
kIFrameAtom = NS_NewAtom("iframe");
kBrowserAtom = NS_NewAtom("browser");
kEditorAtom = NS_NewAtom("editor");
kWidthAtom = NS_NewAtom("width");
kWindowAtom = NS_NewAtom("window");
kMenuListAtom = NS_NewAtom("menulist");
kMenuAtom = NS_NewAtom("menu");
kPopupSetAtom = NS_NewAtom("popupset");
kBrowserAtom = NS_NewAtom("browser");
kIFrameAtom = NS_NewAtom("iframe");
kEditorAtom = NS_NewAtom("editor");
rv = nsComponentManager::CreateInstance(kNameSpaceManagerCID,
nsnull,
kINameSpaceManagerIID,
@ -474,15 +470,15 @@ nsXULElement::~nsXULElement()
NS_IF_RELEASE(kTreeItemAtom);
NS_IF_RELEASE(kTreeRowAtom);
NS_IF_RELEASE(kValueAtom);
NS_IF_RELEASE(kIFrameAtom);
NS_IF_RELEASE(kBrowserAtom);
NS_IF_RELEASE(kEditorAtom);
NS_IF_RELEASE(kWidthAtom);
NS_IF_RELEASE(kWindowAtom);
NS_IF_RELEASE(kMenuListAtom);
NS_IF_RELEASE(kMenuAtom);
NS_IF_RELEASE(kPopupSetAtom);
NS_IF_RELEASE(kBrowserAtom);
NS_IF_RELEASE(kIFrameAtom);
NS_IF_RELEASE(kEditorAtom);
NS_IF_RELEASE(gNameSpaceManager);
if (gXULUtils) {
@ -690,90 +686,6 @@ nsXULElement::QueryInterface(REFNSIID iid, void** result)
else
return NS_NOINTERFACE;
}
else if ((iid.Equals(NS_GET_IID(nsIDOMXULPopupElement))) &&
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
PRInt32 dummy;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag));
if ((tag.get() == kPopupAtom) || (tag.get() == kMenuPopupAtom)) {
// We delegate XULPopupElement APIs to an aggregate object
if (! InnerXULElement()) {
rv = EnsureSlots();
if (NS_FAILED(rv)) return rv;
if ((mSlots->mInnerXULElement = new nsXULPopupElement(this)) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
}
return InnerXULElement()->QueryInterface(iid, result);
}
else
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULIFrameElement)) &&
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
PRInt32 dummy;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag));
if (tag.get() == kIFrameAtom) {
// We delegate XULIFrameElement APIs to an aggregate object
if (! InnerXULElement()) {
rv = EnsureSlots();
if (NS_FAILED(rv)) return rv;
if ((mSlots->mInnerXULElement = new nsXULIFrameElement(this)) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
}
return InnerXULElement()->QueryInterface(iid, result);
}
else
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULBrowserElement)) &&
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
PRInt32 dummy;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag));
if (tag.get() == kBrowserAtom) {
// We delegate XULBrowserElement APIs to an aggregate object
if (! InnerXULElement()) {
rv = EnsureSlots();
if (NS_FAILED(rv)) return rv;
if ((mSlots->mInnerXULElement = new nsXULBrowserElement(this)) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
}
return InnerXULElement()->QueryInterface(iid, result);
}
else
return NS_NOINTERFACE;
}
else if (iid.Equals(NS_GET_IID(nsIDOMXULEditorElement)) &&
(NodeInfo()->NamespaceEquals(kNameSpaceID_XUL))) {
nsCOMPtr<nsIAtom> tag;
PRInt32 dummy;
NS_WITH_SERVICE(nsIXBLService, xblService, "component://netscape/xbl", &rv);
xblService->ResolveTag(NS_STATIC_CAST(nsIStyledContent*, this), &dummy, getter_AddRefs(tag));
if (tag.get() == kEditorAtom) {
// We delegate XULEditorElement APIs to an aggregate object
if (! InnerXULElement()) {
rv = EnsureSlots();
if (NS_FAILED(rv)) return rv;
if ((mSlots->mInnerXULElement = new nsXULEditorElement(this)) == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
}
return InnerXULElement()->QueryInterface(iid, result);
}
else
return NS_NOINTERFACE;
}
else {
*result = nsnull;
return NS_NOINTERFACE;
@ -2103,26 +2015,10 @@ nsXULElement::GetScriptObject(nsIScriptContext* aContext, void** aScriptObject)
fn = NS_NewScriptXULTreeElement;
rootname = "nsXULTreeElement::mScriptObject";
}
else if (tag.get() == kIFrameAtom) {
fn = NS_NewScriptXULIFrameElement;
rootname = "nsXULIFrameElement::mScriptObject";
}
else if (tag.get() == kBrowserAtom) {
fn = NS_NewScriptXULBrowserElement;
rootname = "nsXULBrowserElement::mScriptObject";
}
else if (tag.get() == kMenuListAtom) {
fn = NS_NewScriptXULMenuListElement;
rootname = "nsXULMenuListElement::mScriptObject";
}
else if (tag.get() == kEditorAtom) {
fn = NS_NewScriptXULEditorElement;
rootname = "nsXULEditorElement::mScriptObject";
}
else if ((tag.get() == kMenuPopupAtom) || (tag.get() == kPopupAtom)) {
fn = NS_NewScriptXULPopupElement;
rootname = "nsXULPopupElement::mScriptObject";
}
else {
fn = NS_NewScriptXULElement;
rootname = "nsXULElement::mScriptObject";
@ -4225,7 +4121,7 @@ nsXULElement::GetBoxObject(nsIBoxObject** aResult)
progID += "-tree";
mBoxObject = do_CreateInstance(progID);
if (mBoxObject)
if (!mBoxObject)
return NS_OK;
nsCOMPtr<nsPIBoxObject> privateBox(do_QueryInterface(mBoxObject));

Просмотреть файл

@ -1,97 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
*/
/*
Implementation methods for the XUL tree element APIs.
*/
#include "nsCOMPtr.h"
#include "nsRDFCID.h"
#include "nsXULIFrameElement.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsINameSpaceManager.h"
#include "nsIServiceManager.h"
#include "nsString.h"
NS_IMPL_ADDREF_INHERITED(nsXULIFrameElement, nsXULAggregateElement);
NS_IMPL_RELEASE_INHERITED(nsXULIFrameElement, nsXULAggregateElement);
nsresult
nsXULIFrameElement::QueryInterface(REFNSIID aIID, void** aResult)
{
NS_PRECONDITION(aResult != nsnull, "null ptr");
if (! aResult)
return NS_ERROR_NULL_POINTER;
if (aIID.Equals(NS_GET_IID(nsIDOMXULIFrameElement))) {
*aResult = NS_STATIC_CAST(nsIDOMXULIFrameElement*, this);
}
else {
return nsXULAggregateElement::QueryInterface(aIID, aResult);
}
NS_ADDREF(NS_REINTERPRET_CAST(nsISupports*, *aResult));
return NS_OK;
}
MOZ_DECL_CTOR_COUNTER(RDF_nsXULIFrameElement);
nsXULIFrameElement::nsXULIFrameElement(nsIDOMXULElement* aOuter)
: nsXULAggregateElement(aOuter)
{
}
nsXULIFrameElement::~nsXULIFrameElement()
{
}
NS_IMETHODIMP
nsXULIFrameElement::GetDocShell(nsIDocShell** aDocShell)
{
NS_ENSURE_ARG_POINTER(aDocShell);
nsCOMPtr<nsIContent> content(do_QueryInterface(mOuter));
nsCOMPtr<nsIDocument> document;
content->GetDocument(*getter_AddRefs(document));
// First we need to obtain the popup set frame that encapsulates the target popup.
// Without a popup set, we're dead in the water.
nsCOMPtr<nsIPresShell> presShell = getter_AddRefs(document->GetShellAt(0));
if(!presShell)
return NS_OK;
nsCOMPtr<nsISupports> subShell;
presShell->GetSubShellFor(content, getter_AddRefs(subShell));
if(!subShell)
return NS_OK;
CallQueryInterface(subShell, aDocShell);
return NS_OK;
}

Просмотреть файл

@ -1,66 +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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
*/
/*
An aggregate object that implements the XUL tree widget APIs
*/
#ifndef nsXULIFrameElement_h__
#define nsXULIFrameElement_h__
#include "nsXULElement.h"
#include "nsIDOMXULIFrameElement.h"
#include "nsIXULTreeContent.h"
#include "nsRDFDOMNodeList.h"
#include "nsIDocShell.h"
class nsXULIFrameElement : public nsXULAggregateElement,
public nsIDOMXULIFrameElement
{
public:
nsXULIFrameElement(nsIDOMXULElement* aOuter);
~nsXULIFrameElement();
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode interface
NS_FORWARD_IDOMNODE(mOuter->);
// nsIDOMElement interface
NS_FORWARD_IDOMELEMENT(mOuter->);
// nsIDOMXULElement interface
NS_FORWARD_IDOMXULELEMENT(mOuter->);
// nsIDOMXULIFrameElement interface
NS_DECL_IDOMXULIFRAMEELEMENT
protected:
nsCOMPtr<nsIDocShell> mDocShell;
};
#endif // nsXULIFrameElement_h__

Просмотреть файл

@ -1,180 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
* Pierre Phaneuf <pp@ludusdesign.com>
*/
/*
Implementation methods for the XUL tree element APIs.
*/
#include "nsCOMPtr.h"
#include "nsRDFCID.h"
#include "nsXULPopupElement.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIPresContext.h"
#include "nsIPresShell.h"
#include "nsINameSpaceManager.h"
#include "nsIServiceManager.h"
#include "nsString.h"
#include "nsIPopupSetFrame.h"
#include "nsIMenuFrame.h"
#include "nsIFrame.h"
NS_IMPL_ADDREF_INHERITED(nsXULPopupElement, nsXULAggregateElement);
NS_IMPL_RELEASE_INHERITED(nsXULPopupElement, nsXULAggregateElement);
nsresult
nsXULPopupElement::QueryInterface(REFNSIID aIID, void** aResult)
{
NS_PRECONDITION(aResult != nsnull, "null ptr");
if (! aResult)
return NS_ERROR_NULL_POINTER;
if (aIID.Equals(NS_GET_IID(nsIDOMXULPopupElement))) {
*aResult = NS_STATIC_CAST(nsIDOMXULPopupElement*, this);
}
else {
return nsXULAggregateElement::QueryInterface(aIID, aResult);
}
NS_ADDREF(NS_REINTERPRET_CAST(nsISupports*, *aResult));
return NS_OK;
}
MOZ_DECL_CTOR_COUNTER(RDF_nsXULPopupElement);
nsXULPopupElement::nsXULPopupElement(nsIDOMXULElement* aOuter)
: nsXULAggregateElement(aOuter)
{
}
nsXULPopupElement::~nsXULPopupElement()
{
}
NS_IMETHODIMP
nsXULPopupElement::OpenPopup(nsIDOMElement* aElement, PRInt32 aXPos, PRInt32 aYPos,
const nsString& aPopupType, const nsString& aAnchorAlignment,
const nsString& aPopupAlignment)
{
nsCOMPtr<nsIContent> content = do_QueryInterface(mOuter);
nsCOMPtr<nsIDocument> document;
content->GetDocument(*getter_AddRefs(document));
// First we need to obtain the popup set frame that encapsulates the target popup.
// Without a popup set, we're dead in the water.
nsCOMPtr<nsIPresShell> presShell = getter_AddRefs(document->GetShellAt(0));
if (!presShell)
return NS_OK;
// Get the parent of the popup content.
nsCOMPtr<nsIDOMNode> popupSet;
mOuter->GetParentNode(getter_AddRefs(popupSet));
if (!popupSet)
return NS_OK;
// Do a sanity check to ensure we have a popup set or menu element.
nsString tagName;
nsCOMPtr<nsIDOMElement> popupSetElement = do_QueryInterface(popupSet);
popupSetElement->GetTagName(tagName);
if (!tagName.EqualsWithConversion("popupset") && !tagName.EqualsWithConversion("menu"))
return NS_OK;
// Now obtain the popup set frame.
nsCOMPtr<nsIContent> popupSetContent = do_QueryInterface(popupSet);
nsIFrame* frame;
presShell->GetPrimaryFrameFor(popupSetContent, &frame);
if (!frame)
return NS_OK;
// Obtain the element frame.
nsCOMPtr<nsIContent> elementContent = do_QueryInterface(aElement);
nsIFrame* elementFrame;
presShell->GetPrimaryFrameFor(elementContent, &elementFrame);
if (!elementFrame)
return NS_OK;
// Pass this all off to the popup set frame.
nsCOMPtr<nsIPopupSetFrame> popupSetFrame = do_QueryInterface(frame);
if (popupSetFrame)
popupSetFrame->CreatePopup(elementFrame, content, aXPos, aYPos,
aPopupType, aAnchorAlignment,
aPopupAlignment);
else {
nsCOMPtr<nsIMenuFrame> menuFrame = do_QueryInterface(frame);
menuFrame->OpenMenu(PR_TRUE);
}
return NS_OK;
}
NS_IMETHODIMP
nsXULPopupElement::ClosePopup()
{
// Close the popup by simulating proper dismissal.
nsCOMPtr<nsIContent> content = do_QueryInterface(mOuter);
nsCOMPtr<nsIDocument> document;
content->GetDocument(*getter_AddRefs(document));
// First we need to obtain the popup set frame that encapsulates the target popup.
// Without a popup set, we're dead in the water.
nsCOMPtr<nsIPresShell> presShell = getter_AddRefs(document->GetShellAt(0));
if (!presShell)
return NS_OK;
// Retrieve the popup set.
// Get the parent of the popup content.
nsCOMPtr<nsIDOMNode> popupSet;
mOuter->GetParentNode(getter_AddRefs(popupSet));
if (!popupSet)
return NS_OK;
// Do a sanity check to ensure we have a popup set or menu element.
nsString tagName;
nsCOMPtr<nsIDOMElement> popupSetElement = do_QueryInterface(popupSet);
popupSetElement->GetTagName(tagName);
if (!tagName.EqualsWithConversion("popupset") && !tagName.EqualsWithConversion("menu"))
return NS_OK;
// Now obtain the popup set frame.
nsCOMPtr<nsIContent> popupSetContent = do_QueryInterface(popupSet);
nsIFrame* frame;
presShell->GetPrimaryFrameFor(popupSetContent, &frame);
if (!frame)
return NS_OK;
nsCOMPtr<nsIPopupSetFrame> popupSetFrame = do_QueryInterface(frame);
if (popupSetFrame)
popupSetFrame->DestroyPopup();
else {
nsCOMPtr<nsIMenuFrame> menuFrame = do_QueryInterface(frame);
menuFrame->OpenMenu(PR_FALSE);
}
return NS_OK;
}

Просмотреть файл

@ -1,64 +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.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Contributor(s):
*/
/*
An aggregate object that implements the XUL tree widget APIs
*/
#ifndef nsXULPopupElement_h__
#define nsXULPopupElement_h__
#include "nsXULElement.h"
#include "nsIDOMXULPopupElement.h"
#include "nsIXULTreeContent.h"
#include "nsRDFDOMNodeList.h"
class nsXULPopupElement : public nsXULAggregateElement,
public nsIDOMXULPopupElement
{
public:
nsXULPopupElement(nsIDOMXULElement* aOuter);
~nsXULPopupElement();
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode interface
NS_FORWARD_IDOMNODE(mOuter->);
// nsIDOMElement interface
NS_FORWARD_IDOMELEMENT(mOuter->);
// nsIDOMXULElement interface
NS_FORWARD_IDOMXULELEMENT(mOuter->);
// nsIDOMXULPopupElement interface
NS_DECL_IDOMXULPOPUPELEMENT
protected:
};
#endif // nsXULPopupElement_h__

Просмотреть файл

@ -33,6 +33,7 @@
#include "nsCOMPtr.h"
#include "nsXULAtoms.h"
#include "nsIDOMElement.h"
#include "nsIDOMXULElement.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMNSDocument.h"
#include "nsIXULPopupListener.h"
@ -40,7 +41,6 @@
#include "nsIDOMMouseMotionListener.h"
#include "nsRDFCID.h"
#include "nsIDOMXULPopupElement.h"
#include "nsIScriptGlobalObject.h"
#include "nsIDOMWindow.h"
#include "nsIDOMXULDocument.h"
@ -51,6 +51,10 @@
#include "nsIDOMNSUIEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsIBoxObject.h"
#include "nsIPopupSetBoxObject.h"
#include "nsIMenuBoxObject.h"
////////////////////////////////////////////////////////////////////////
static NS_DEFINE_IID(kXULPopupListenerCID, NS_XULPOPUPLISTENER_CID);
@ -317,8 +321,15 @@ XULPopupListenerImpl::MouseOut(nsIDOMEvent* aMouseEvent)
}
if ( mPopupContent ) {
nsCOMPtr<nsIDOMXULPopupElement> popupElement = do_QueryInterface(mPopupContent);
popupElement->ClosePopup();
nsCOMPtr<nsIDOMNode> parent;
mPopupContent->GetParentNode(getter_AddRefs(parent));
nsCOMPtr<nsIDOMXULElement> popupSetElement(do_QueryInterface(parent));
nsCOMPtr<nsIBoxObject> boxObject;
if (popupSetElement)
popupSetElement->GetBoxObject(getter_AddRefs(boxObject));
nsCOMPtr<nsIPopupSetBoxObject> popupSetObject(do_QueryInterface(boxObject));
if (popupSetObject)
popupSetObject->DestroyPopup();
mPopupContent = nsnull; // release the popup
@ -527,11 +538,20 @@ XULPopupListenerImpl::LaunchPopup(PRInt32 aClientX, PRInt32 aClientY)
mPopupContent = popupContent.get();
nsCOMPtr<nsIDOMXULPopupElement> xulPopup = do_QueryInterface(popupContent);
if (xulPopup)
xulPopup->OpenPopup(mElement,
xPos, yPos,
type, anchorAlignment, popupAlignment);
nsCOMPtr<nsIDOMNode> parent;
mPopupContent->GetParentNode(getter_AddRefs(parent));
nsCOMPtr<nsIDOMXULElement> popupSetElement(do_QueryInterface(parent));
nsCOMPtr<nsIBoxObject> boxObject;
if (popupSetElement)
popupSetElement->GetBoxObject(getter_AddRefs(boxObject));
nsCOMPtr<nsIPopupSetBoxObject> popupSetObject(do_QueryInterface(boxObject));
nsCOMPtr<nsIMenuBoxObject> menuObject(do_QueryInterface(boxObject));
if (popupSetObject)
popupSetObject->CreatePopup(mElement, mPopupContent, xPos, yPos,
type.GetUnicode(), anchorAlignment.GetUnicode(),
popupAlignment.GetUnicode());
else if (menuObject)
menuObject->OpenMenu(PR_TRUE);
}
}
}