Updating the HTMLObjectElement interface to DOM Level 2.

This commit is contained in:
jst%netscape.com 2000-04-18 22:57:42 +00:00
Родитель 06684ccb1e
Коммит 304122a1dc
8 изменённых файлов: 95 добавлений и 129 удалений

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

@ -30,6 +30,7 @@
#include "nsIMutableStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsDOMError.h"
static NS_DEFINE_IID(kIDOMHTMLObjectElementIID, NS_IDOMHTMLOBJECTELEMENT_IID);
@ -54,41 +55,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLObjectElement
NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm);
NS_IMETHOD GetCode(nsString& aCode);
NS_IMETHOD SetCode(const nsString& aCode);
NS_IMETHOD GetAlign(nsString& aAlign);
NS_IMETHOD SetAlign(const nsString& aAlign);
NS_IMETHOD GetArchive(nsString& aArchive);
NS_IMETHOD SetArchive(const nsString& aArchive);
NS_IMETHOD GetBorder(nsString& aBorder);
NS_IMETHOD SetBorder(const nsString& aBorder);
NS_IMETHOD GetCodeBase(nsString& aCodeBase);
NS_IMETHOD SetCodeBase(const nsString& aCodeBase);
NS_IMETHOD GetCodeType(nsString& aCodeType);
NS_IMETHOD SetCodeType(const nsString& aCodeType);
NS_IMETHOD GetData(nsString& aData);
NS_IMETHOD SetData(const nsString& aData);
NS_IMETHOD GetDeclare(PRBool* aDeclare);
NS_IMETHOD SetDeclare(PRBool aDeclare);
NS_IMETHOD GetHeight(nsString& aHeight);
NS_IMETHOD SetHeight(const nsString& aHeight);
NS_IMETHOD GetHspace(nsString& aHspace);
NS_IMETHOD SetHspace(const nsString& aHspace);
NS_IMETHOD GetName(nsString& aName);
NS_IMETHOD SetName(const nsString& aName);
NS_IMETHOD GetStandby(nsString& aStandby);
NS_IMETHOD SetStandby(const nsString& aStandby);
NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
NS_IMETHOD GetType(nsString& aType);
NS_IMETHOD SetType(const nsString& aType);
NS_IMETHOD GetUseMap(nsString& aUseMap);
NS_IMETHOD SetUseMap(const nsString& aUseMap);
NS_IMETHOD GetVspace(nsString& aVspace);
NS_IMETHOD SetVspace(const nsString& aVspace);
NS_IMETHOD GetWidth(nsString& aWidth);
NS_IMETHOD SetWidth(const nsString& aWidth);
NS_DECL_IDOMHTMLOBJECTELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -181,6 +148,21 @@ NS_IMPL_STRING_ATTR(nsHTMLObjectElement, UseMap, usemap)
NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Vspace, vspace)
NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Width, width)
NS_IMETHODIMP
nsHTMLObjectElement::GetContentDocument(nsIDOMDocument** aContentDocument)
{
NS_ENSURE_ARG_POINTER(aContentDocument);
*aContentDocument = nsnull;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLObjectElement::SetContentDocument(nsIDOMDocument* aContentDocument)
{
return NS_ERROR_DOM_INVALID_MODIFICATION_ERR;
}
NS_IMETHODIMP
nsHTMLObjectElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,

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

@ -30,6 +30,7 @@
#include "nsIMutableStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsDOMError.h"
static NS_DEFINE_IID(kIDOMHTMLObjectElementIID, NS_IDOMHTMLOBJECTELEMENT_IID);
@ -54,41 +55,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLObjectElement
NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm);
NS_IMETHOD GetCode(nsString& aCode);
NS_IMETHOD SetCode(const nsString& aCode);
NS_IMETHOD GetAlign(nsString& aAlign);
NS_IMETHOD SetAlign(const nsString& aAlign);
NS_IMETHOD GetArchive(nsString& aArchive);
NS_IMETHOD SetArchive(const nsString& aArchive);
NS_IMETHOD GetBorder(nsString& aBorder);
NS_IMETHOD SetBorder(const nsString& aBorder);
NS_IMETHOD GetCodeBase(nsString& aCodeBase);
NS_IMETHOD SetCodeBase(const nsString& aCodeBase);
NS_IMETHOD GetCodeType(nsString& aCodeType);
NS_IMETHOD SetCodeType(const nsString& aCodeType);
NS_IMETHOD GetData(nsString& aData);
NS_IMETHOD SetData(const nsString& aData);
NS_IMETHOD GetDeclare(PRBool* aDeclare);
NS_IMETHOD SetDeclare(PRBool aDeclare);
NS_IMETHOD GetHeight(nsString& aHeight);
NS_IMETHOD SetHeight(const nsString& aHeight);
NS_IMETHOD GetHspace(nsString& aHspace);
NS_IMETHOD SetHspace(const nsString& aHspace);
NS_IMETHOD GetName(nsString& aName);
NS_IMETHOD SetName(const nsString& aName);
NS_IMETHOD GetStandby(nsString& aStandby);
NS_IMETHOD SetStandby(const nsString& aStandby);
NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
NS_IMETHOD GetType(nsString& aType);
NS_IMETHOD SetType(const nsString& aType);
NS_IMETHOD GetUseMap(nsString& aUseMap);
NS_IMETHOD SetUseMap(const nsString& aUseMap);
NS_IMETHOD GetVspace(nsString& aVspace);
NS_IMETHOD SetVspace(const nsString& aVspace);
NS_IMETHOD GetWidth(nsString& aWidth);
NS_IMETHOD SetWidth(const nsString& aWidth);
NS_DECL_IDOMHTMLOBJECTELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -181,6 +148,21 @@ NS_IMPL_STRING_ATTR(nsHTMLObjectElement, UseMap, usemap)
NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Vspace, vspace)
NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Width, width)
NS_IMETHODIMP
nsHTMLObjectElement::GetContentDocument(nsIDOMDocument** aContentDocument)
{
NS_ENSURE_ARG_POINTER(aContentDocument);
*aContentDocument = nsnull;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLObjectElement::SetContentDocument(nsIDOMDocument* aContentDocument)
{
return NS_ERROR_DOM_INVALID_MODIFICATION_ERR;
}
NS_IMETHODIMP
nsHTMLObjectElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,

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

@ -30,6 +30,7 @@
#include "nsIDOMHTMLElement.h"
class nsIDOMHTMLFormElement;
class nsIDOMDocument;
#define NS_IDOMHTMLOBJECTELEMENT_IID \
{ 0xa6cf90ac, 0x15b3, 0x11d2, \
@ -91,6 +92,9 @@ public:
NS_IMETHOD GetWidth(nsString& aWidth)=0;
NS_IMETHOD SetWidth(const nsString& aWidth)=0;
NS_IMETHOD GetContentDocument(nsIDOMDocument** aContentDocument)=0;
NS_IMETHOD SetContentDocument(nsIDOMDocument* aContentDocument)=0;
};
@ -130,6 +134,8 @@ public:
NS_IMETHOD SetVspace(const nsString& aVspace); \
NS_IMETHOD GetWidth(nsString& aWidth); \
NS_IMETHOD SetWidth(const nsString& aWidth); \
NS_IMETHOD GetContentDocument(nsIDOMDocument** aContentDocument); \
NS_IMETHOD SetContentDocument(nsIDOMDocument* aContentDocument); \
@ -169,6 +175,8 @@ public:
NS_IMETHOD SetVspace(const nsString& aVspace) { return _to SetVspace(aVspace); } \
NS_IMETHOD GetWidth(nsString& aWidth) { return _to GetWidth(aWidth); } \
NS_IMETHOD SetWidth(const nsString& aWidth) { return _to SetWidth(aWidth); } \
NS_IMETHOD GetContentDocument(nsIDOMDocument** aContentDocument) { return _to GetContentDocument(aContentDocument); } \
NS_IMETHOD SetContentDocument(nsIDOMDocument* aContentDocument) { return _to SetContentDocument(aContentDocument); } \
extern "C" NS_DOM nsresult NS_InitHTMLObjectElementClass(nsIScriptContext *aContext, void **aPrototype);

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

@ -1,23 +0,0 @@
interface HTMLObjectElement : HTMLElement {
/* IID: { 0xa6cf90ac, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 } } */
readonly attribute HTMLFormElement form;
attribute DOMString code;
attribute DOMString align;
attribute DOMString archive;
attribute DOMString border;
attribute DOMString codeBase;
attribute DOMString codeType;
attribute DOMString data;
attribute boolean declare;
attribute DOMString height;
attribute DOMString hspace;
attribute DOMString name;
attribute DOMString standby;
attribute long tabIndex;
attribute DOMString type;
attribute DOMString useMap;
attribute DOMString vspace;
attribute DOMString width;
};

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

@ -479,6 +479,7 @@ enum nsDOMProp {
NS_DOM_PROP_HTMLOBJECTELEMENT_CODE,
NS_DOM_PROP_HTMLOBJECTELEMENT_CODEBASE,
NS_DOM_PROP_HTMLOBJECTELEMENT_CODETYPE,
NS_DOM_PROP_HTMLOBJECTELEMENT_CONTENTDOCUMENT,
NS_DOM_PROP_HTMLOBJECTELEMENT_DATA,
NS_DOM_PROP_HTMLOBJECTELEMENT_DECLARE,
NS_DOM_PROP_HTMLOBJECTELEMENT_FORM,

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

@ -478,6 +478,7 @@
"htmlobjectelement.code", \
"htmlobjectelement.codebase", \
"htmlobjectelement.codetype", \
"htmlobjectelement.contentdocument", \
"htmlobjectelement.data", \
"htmlobjectelement.declare", \
"htmlobjectelement.form", \

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

@ -35,6 +35,7 @@
#include "nsDOMPropEnums.h"
#include "nsString.h"
#include "nsIDOMHTMLFormElement.h"
#include "nsIDOMDocument.h"
#include "nsIDOMHTMLObjectElement.h"
@ -42,6 +43,7 @@ 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(kIHTMLFormElementIID, NS_IDOMHTMLFORMELEMENT_IID);
static NS_DEFINE_IID(kIDocumentIID, NS_IDOMDOCUMENT_IID);
static NS_DEFINE_IID(kIHTMLObjectElementIID, NS_IDOMHTMLOBJECTELEMENT_IID);
//
@ -65,7 +67,8 @@ enum HTMLObjectElement_slots {
HTMLOBJECTELEMENT_TYPE = -15,
HTMLOBJECTELEMENT_USEMAP = -16,
HTMLOBJECTELEMENT_VSPACE = -17,
HTMLOBJECTELEMENT_WIDTH = -18
HTMLOBJECTELEMENT_WIDTH = -18,
HTMLOBJECTELEMENT_CONTENTDOCUMENT = -19
};
/***********************************************************************/
@ -305,6 +308,19 @@ GetHTMLObjectElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case HTMLOBJECTELEMENT_CONTENTDOCUMENT:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_CONTENTDOCUMENT, PR_FALSE);
if (NS_SUCCEEDED(rv)) {
nsIDOMDocument* prop;
rv = a->GetContentDocument(&prop);
if (NS_SUCCEEDED(rv)) {
// get the js object
nsJSUtils::nsConvertObjectToJSVal((nsISupports *)prop, cx, obj, vp);
}
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, obj, id, vp);
}
@ -550,6 +566,22 @@ SetHTMLObjectElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
}
break;
}
case HTMLOBJECTELEMENT_CONTENTDOCUMENT:
{
rv = secMan->CheckScriptAccess(cx, obj, NS_DOM_PROP_HTMLOBJECTELEMENT_CONTENTDOCUMENT, PR_TRUE);
if (NS_SUCCEEDED(rv)) {
nsIDOMDocument* prop;
if (PR_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&prop,
kIDocumentIID, "Document",
cx, *vp)) {
rv = NS_ERROR_DOM_NOT_OBJECT_ERR;
}
rv = a->SetContentDocument(prop);
NS_IF_RELEASE(prop);
}
break;
}
default:
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, obj, id, vp);
}
@ -637,6 +669,7 @@ static JSPropertySpec HTMLObjectElementProperties[] =
{"useMap", HTMLOBJECTELEMENT_USEMAP, JSPROP_ENUMERATE},
{"vspace", HTMLOBJECTELEMENT_VSPACE, JSPROP_ENUMERATE},
{"width", HTMLOBJECTELEMENT_WIDTH, JSPROP_ENUMERATE},
{"contentDocument", HTMLOBJECTELEMENT_CONTENTDOCUMENT, JSPROP_ENUMERATE},
{0}
};

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

@ -30,6 +30,7 @@
#include "nsIMutableStyleContext.h"
#include "nsStyleConsts.h"
#include "nsIPresContext.h"
#include "nsDOMError.h"
static NS_DEFINE_IID(kIDOMHTMLObjectElementIID, NS_IDOMHTMLOBJECTELEMENT_IID);
@ -54,41 +55,7 @@ public:
NS_IMPL_IDOMHTMLELEMENT_USING_GENERIC(mInner)
// nsIDOMHTMLObjectElement
NS_IMETHOD GetForm(nsIDOMHTMLFormElement** aForm);
NS_IMETHOD GetCode(nsString& aCode);
NS_IMETHOD SetCode(const nsString& aCode);
NS_IMETHOD GetAlign(nsString& aAlign);
NS_IMETHOD SetAlign(const nsString& aAlign);
NS_IMETHOD GetArchive(nsString& aArchive);
NS_IMETHOD SetArchive(const nsString& aArchive);
NS_IMETHOD GetBorder(nsString& aBorder);
NS_IMETHOD SetBorder(const nsString& aBorder);
NS_IMETHOD GetCodeBase(nsString& aCodeBase);
NS_IMETHOD SetCodeBase(const nsString& aCodeBase);
NS_IMETHOD GetCodeType(nsString& aCodeType);
NS_IMETHOD SetCodeType(const nsString& aCodeType);
NS_IMETHOD GetData(nsString& aData);
NS_IMETHOD SetData(const nsString& aData);
NS_IMETHOD GetDeclare(PRBool* aDeclare);
NS_IMETHOD SetDeclare(PRBool aDeclare);
NS_IMETHOD GetHeight(nsString& aHeight);
NS_IMETHOD SetHeight(const nsString& aHeight);
NS_IMETHOD GetHspace(nsString& aHspace);
NS_IMETHOD SetHspace(const nsString& aHspace);
NS_IMETHOD GetName(nsString& aName);
NS_IMETHOD SetName(const nsString& aName);
NS_IMETHOD GetStandby(nsString& aStandby);
NS_IMETHOD SetStandby(const nsString& aStandby);
NS_IMETHOD GetTabIndex(PRInt32* aTabIndex);
NS_IMETHOD SetTabIndex(PRInt32 aTabIndex);
NS_IMETHOD GetType(nsString& aType);
NS_IMETHOD SetType(const nsString& aType);
NS_IMETHOD GetUseMap(nsString& aUseMap);
NS_IMETHOD SetUseMap(const nsString& aUseMap);
NS_IMETHOD GetVspace(nsString& aVspace);
NS_IMETHOD SetVspace(const nsString& aVspace);
NS_IMETHOD GetWidth(nsString& aWidth);
NS_IMETHOD SetWidth(const nsString& aWidth);
NS_DECL_IDOMHTMLOBJECTELEMENT
// nsIJSScriptObject
NS_IMPL_IJSSCRIPTOBJECT_USING_GENERIC(mInner)
@ -181,6 +148,21 @@ NS_IMPL_STRING_ATTR(nsHTMLObjectElement, UseMap, usemap)
NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Vspace, vspace)
NS_IMPL_STRING_ATTR(nsHTMLObjectElement, Width, width)
NS_IMETHODIMP
nsHTMLObjectElement::GetContentDocument(nsIDOMDocument** aContentDocument)
{
NS_ENSURE_ARG_POINTER(aContentDocument);
*aContentDocument = nsnull;
return NS_OK;
}
NS_IMETHODIMP
nsHTMLObjectElement::SetContentDocument(nsIDOMDocument* aContentDocument)
{
return NS_ERROR_DOM_INVALID_MODIFICATION_ERR;
}
NS_IMETHODIMP
nsHTMLObjectElement::StringToAttribute(nsIAtom* aAttribute,
const nsString& aValue,