793 lines
22 KiB
C++
793 lines
22 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
*
|
|
* The contents of this file are subject to the Netscape Public License
|
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
* http://www.mozilla.org/NPL/
|
|
*
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
* for the specific language governing rights and limitations under the
|
|
* NPL.
|
|
*
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
* Communications Corporation. Portions created by Netscape are
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
* Reserved.
|
|
*/
|
|
/* AUTO-GENERATED. DO NOT EDIT!!! */
|
|
|
|
#include "jsapi.h"
|
|
#include "nsJSUtils.h"
|
|
#include "nscore.h"
|
|
#include "nsIScriptContext.h"
|
|
#include "nsIScriptSecurityManager.h"
|
|
#include "nsIJSScriptObject.h"
|
|
#include "nsIScriptObjectOwner.h"
|
|
#include "nsIScriptGlobalObject.h"
|
|
#include "nsIPtr.h"
|
|
#include "nsString.h"
|
|
#include "nsIDOMHTMLTableCellElement.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(kIHTMLTableCellElementIID, NS_IDOMHTMLTABLECELLELEMENT_IID);
|
|
|
|
NS_DEF_PTR(nsIDOMHTMLTableCellElement);
|
|
|
|
//
|
|
// HTMLTableCellElement property ids
|
|
//
|
|
enum HTMLTableCellElement_slots {
|
|
HTMLTABLECELLELEMENT_CELLINDEX = -1,
|
|
HTMLTABLECELLELEMENT_ABBR = -2,
|
|
HTMLTABLECELLELEMENT_ALIGN = -3,
|
|
HTMLTABLECELLELEMENT_AXIS = -4,
|
|
HTMLTABLECELLELEMENT_BGCOLOR = -5,
|
|
HTMLTABLECELLELEMENT_CH = -6,
|
|
HTMLTABLECELLELEMENT_CHOFF = -7,
|
|
HTMLTABLECELLELEMENT_COLSPAN = -8,
|
|
HTMLTABLECELLELEMENT_HEADERS = -9,
|
|
HTMLTABLECELLELEMENT_HEIGHT = -10,
|
|
HTMLTABLECELLELEMENT_NOWRAP = -11,
|
|
HTMLTABLECELLELEMENT_ROWSPAN = -12,
|
|
HTMLTABLECELLELEMENT_SCOPE = -13,
|
|
HTMLTABLECELLELEMENT_VALIGN = -14,
|
|
HTMLTABLECELLELEMENT_WIDTH = -15
|
|
};
|
|
|
|
/***********************************************************************/
|
|
//
|
|
// HTMLTableCellElement Properties Getter
|
|
//
|
|
PR_STATIC_CALLBACK(JSBool)
|
|
GetHTMLTableCellElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|
{
|
|
nsIDOMHTMLTableCellElement *a = (nsIDOMHTMLTableCellElement*)JS_GetPrivate(cx, obj);
|
|
|
|
// If there's no private data, this must be the prototype, so ignore
|
|
if (nsnull == a) {
|
|
return JS_TRUE;
|
|
}
|
|
|
|
if (JSVAL_IS_INT(id)) {
|
|
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
|
nsIScriptSecurityManager *secMan;
|
|
PRBool ok = PR_FALSE;
|
|
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
|
|
return JS_FALSE;
|
|
}
|
|
switch(JSVAL_TO_INT(id)) {
|
|
case HTMLTABLECELLELEMENT_CELLINDEX:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.cellindex", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
PRInt32 prop;
|
|
if (NS_OK == a->GetCellIndex(&prop)) {
|
|
*vp = INT_TO_JSVAL(prop);
|
|
}
|
|
else {
|
|
return JS_FALSE;
|
|
}
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_ABBR:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.abbr", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
if (NS_OK == a->GetAbbr(prop)) {
|
|
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
|
}
|
|
else {
|
|
return JS_FALSE;
|
|
}
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_ALIGN:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.align", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
if (NS_OK == a->GetAlign(prop)) {
|
|
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
|
}
|
|
else {
|
|
return JS_FALSE;
|
|
}
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_AXIS:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.axis", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
if (NS_OK == a->GetAxis(prop)) {
|
|
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
|
}
|
|
else {
|
|
return JS_FALSE;
|
|
}
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_BGCOLOR:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.bgcolor", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
if (NS_OK == a->GetBgColor(prop)) {
|
|
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
|
}
|
|
else {
|
|
return JS_FALSE;
|
|
}
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_CH:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.ch", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
if (NS_OK == a->GetCh(prop)) {
|
|
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
|
}
|
|
else {
|
|
return JS_FALSE;
|
|
}
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_CHOFF:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.choff", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
if (NS_OK == a->GetChOff(prop)) {
|
|
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
|
}
|
|
else {
|
|
return JS_FALSE;
|
|
}
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_COLSPAN:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.colspan", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
PRInt32 prop;
|
|
if (NS_OK == a->GetColSpan(&prop)) {
|
|
*vp = INT_TO_JSVAL(prop);
|
|
}
|
|
else {
|
|
return JS_FALSE;
|
|
}
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_HEADERS:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.headers", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
if (NS_OK == a->GetHeaders(prop)) {
|
|
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
|
}
|
|
else {
|
|
return JS_FALSE;
|
|
}
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_HEIGHT:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.height", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
if (NS_OK == a->GetHeight(prop)) {
|
|
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
|
}
|
|
else {
|
|
return JS_FALSE;
|
|
}
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_NOWRAP:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.nowrap", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
PRBool prop;
|
|
if (NS_OK == a->GetNoWrap(&prop)) {
|
|
*vp = BOOLEAN_TO_JSVAL(prop);
|
|
}
|
|
else {
|
|
return JS_FALSE;
|
|
}
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_ROWSPAN:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.rowspan", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
PRInt32 prop;
|
|
if (NS_OK == a->GetRowSpan(&prop)) {
|
|
*vp = INT_TO_JSVAL(prop);
|
|
}
|
|
else {
|
|
return JS_FALSE;
|
|
}
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_SCOPE:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.scope", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
if (NS_OK == a->GetScope(prop)) {
|
|
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
|
}
|
|
else {
|
|
return JS_FALSE;
|
|
}
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_VALIGN:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.valign", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
if (NS_OK == a->GetVAlign(prop)) {
|
|
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
|
}
|
|
else {
|
|
return JS_FALSE;
|
|
}
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_WIDTH:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.width", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
if (NS_OK == a->GetWidth(prop)) {
|
|
nsJSUtils::nsConvertStringToJSVal(prop, cx, vp);
|
|
}
|
|
else {
|
|
return JS_FALSE;
|
|
}
|
|
break;
|
|
}
|
|
default:
|
|
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
|
|
}
|
|
NS_RELEASE(secMan);
|
|
}
|
|
else {
|
|
return nsJSUtils::nsCallJSScriptObjectGetProperty(a, cx, id, vp);
|
|
}
|
|
|
|
return PR_TRUE;
|
|
}
|
|
|
|
/***********************************************************************/
|
|
//
|
|
// HTMLTableCellElement Properties Setter
|
|
//
|
|
PR_STATIC_CALLBACK(JSBool)
|
|
SetHTMLTableCellElementProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
|
|
{
|
|
nsIDOMHTMLTableCellElement *a = (nsIDOMHTMLTableCellElement*)JS_GetPrivate(cx, obj);
|
|
|
|
// If there's no private data, this must be the prototype, so ignore
|
|
if (nsnull == a) {
|
|
return JS_TRUE;
|
|
}
|
|
|
|
if (JSVAL_IS_INT(id)) {
|
|
nsIScriptContext *scriptCX = (nsIScriptContext *)JS_GetContextPrivate(cx);
|
|
nsIScriptSecurityManager *secMan;
|
|
PRBool ok = PR_FALSE;
|
|
if (NS_OK != scriptCX->GetSecurityManager(&secMan)) {
|
|
return JS_FALSE;
|
|
}
|
|
switch(JSVAL_TO_INT(id)) {
|
|
case HTMLTABLECELLELEMENT_CELLINDEX:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.cellindex", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
PRInt32 prop;
|
|
int32 temp;
|
|
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
|
prop = (PRInt32)temp;
|
|
}
|
|
else {
|
|
JS_ReportError(cx, "Parameter must be a number");
|
|
return JS_FALSE;
|
|
}
|
|
|
|
a->SetCellIndex(prop);
|
|
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_ABBR:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.abbr", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
|
|
|
a->SetAbbr(prop);
|
|
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_ALIGN:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.align", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
|
|
|
a->SetAlign(prop);
|
|
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_AXIS:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.axis", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
|
|
|
a->SetAxis(prop);
|
|
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_BGCOLOR:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.bgcolor", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
|
|
|
a->SetBgColor(prop);
|
|
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_CH:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.ch", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
|
|
|
a->SetCh(prop);
|
|
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_CHOFF:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.choff", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
|
|
|
a->SetChOff(prop);
|
|
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_COLSPAN:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.colspan", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
PRInt32 prop;
|
|
int32 temp;
|
|
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
|
prop = (PRInt32)temp;
|
|
}
|
|
else {
|
|
JS_ReportError(cx, "Parameter must be a number");
|
|
return JS_FALSE;
|
|
}
|
|
|
|
a->SetColSpan(prop);
|
|
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_HEADERS:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.headers", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
|
|
|
a->SetHeaders(prop);
|
|
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_HEIGHT:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.height", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
|
|
|
a->SetHeight(prop);
|
|
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_NOWRAP:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.nowrap", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
PRBool prop;
|
|
if (PR_FALSE == nsJSUtils::nsConvertJSValToBool(&prop, cx, *vp)) {
|
|
return JS_FALSE;
|
|
}
|
|
|
|
a->SetNoWrap(prop);
|
|
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_ROWSPAN:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.rowspan", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
PRInt32 prop;
|
|
int32 temp;
|
|
if (JSVAL_IS_NUMBER(*vp) && JS_ValueToInt32(cx, *vp, &temp)) {
|
|
prop = (PRInt32)temp;
|
|
}
|
|
else {
|
|
JS_ReportError(cx, "Parameter must be a number");
|
|
return JS_FALSE;
|
|
}
|
|
|
|
a->SetRowSpan(prop);
|
|
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_SCOPE:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.scope", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
|
|
|
a->SetScope(prop);
|
|
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_VALIGN:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.valign", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
|
|
|
a->SetVAlign(prop);
|
|
|
|
break;
|
|
}
|
|
case HTMLTABLECELLELEMENT_WIDTH:
|
|
{
|
|
secMan->CheckScriptAccess(scriptCX, obj, "htmltablecellelement.width", &ok);
|
|
if (!ok) {
|
|
//Need to throw error here
|
|
return JS_FALSE;
|
|
}
|
|
nsAutoString prop;
|
|
nsJSUtils::nsConvertJSValToString(prop, cx, *vp);
|
|
|
|
a->SetWidth(prop);
|
|
|
|
break;
|
|
}
|
|
default:
|
|
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
|
|
}
|
|
NS_RELEASE(secMan);
|
|
}
|
|
else {
|
|
return nsJSUtils::nsCallJSScriptObjectSetProperty(a, cx, id, vp);
|
|
}
|
|
|
|
return PR_TRUE;
|
|
}
|
|
|
|
|
|
//
|
|
// HTMLTableCellElement finalizer
|
|
//
|
|
PR_STATIC_CALLBACK(void)
|
|
FinalizeHTMLTableCellElement(JSContext *cx, JSObject *obj)
|
|
{
|
|
nsJSUtils::nsGenericFinalize(cx, obj);
|
|
}
|
|
|
|
|
|
//
|
|
// HTMLTableCellElement enumerate
|
|
//
|
|
PR_STATIC_CALLBACK(JSBool)
|
|
EnumerateHTMLTableCellElement(JSContext *cx, JSObject *obj)
|
|
{
|
|
return nsJSUtils::nsGenericEnumerate(cx, obj);
|
|
}
|
|
|
|
|
|
//
|
|
// HTMLTableCellElement resolve
|
|
//
|
|
PR_STATIC_CALLBACK(JSBool)
|
|
ResolveHTMLTableCellElement(JSContext *cx, JSObject *obj, jsval id)
|
|
{
|
|
return nsJSUtils::nsGenericResolve(cx, obj, id);
|
|
}
|
|
|
|
|
|
/***********************************************************************/
|
|
//
|
|
// class for HTMLTableCellElement
|
|
//
|
|
JSClass HTMLTableCellElementClass = {
|
|
"HTMLTableCellElement",
|
|
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
|
|
JS_PropertyStub,
|
|
JS_PropertyStub,
|
|
GetHTMLTableCellElementProperty,
|
|
SetHTMLTableCellElementProperty,
|
|
EnumerateHTMLTableCellElement,
|
|
ResolveHTMLTableCellElement,
|
|
JS_ConvertStub,
|
|
FinalizeHTMLTableCellElement
|
|
};
|
|
|
|
|
|
//
|
|
// HTMLTableCellElement class properties
|
|
//
|
|
static JSPropertySpec HTMLTableCellElementProperties[] =
|
|
{
|
|
{"cellIndex", HTMLTABLECELLELEMENT_CELLINDEX, JSPROP_ENUMERATE},
|
|
{"abbr", HTMLTABLECELLELEMENT_ABBR, JSPROP_ENUMERATE},
|
|
{"align", HTMLTABLECELLELEMENT_ALIGN, JSPROP_ENUMERATE},
|
|
{"axis", HTMLTABLECELLELEMENT_AXIS, JSPROP_ENUMERATE},
|
|
{"bgColor", HTMLTABLECELLELEMENT_BGCOLOR, JSPROP_ENUMERATE},
|
|
{"ch", HTMLTABLECELLELEMENT_CH, JSPROP_ENUMERATE},
|
|
{"chOff", HTMLTABLECELLELEMENT_CHOFF, JSPROP_ENUMERATE},
|
|
{"colSpan", HTMLTABLECELLELEMENT_COLSPAN, JSPROP_ENUMERATE},
|
|
{"headers", HTMLTABLECELLELEMENT_HEADERS, JSPROP_ENUMERATE},
|
|
{"height", HTMLTABLECELLELEMENT_HEIGHT, JSPROP_ENUMERATE},
|
|
{"noWrap", HTMLTABLECELLELEMENT_NOWRAP, JSPROP_ENUMERATE},
|
|
{"rowSpan", HTMLTABLECELLELEMENT_ROWSPAN, JSPROP_ENUMERATE},
|
|
{"scope", HTMLTABLECELLELEMENT_SCOPE, JSPROP_ENUMERATE},
|
|
{"vAlign", HTMLTABLECELLELEMENT_VALIGN, JSPROP_ENUMERATE},
|
|
{"width", HTMLTABLECELLELEMENT_WIDTH, JSPROP_ENUMERATE},
|
|
{0}
|
|
};
|
|
|
|
|
|
//
|
|
// HTMLTableCellElement class methods
|
|
//
|
|
static JSFunctionSpec HTMLTableCellElementMethods[] =
|
|
{
|
|
{0}
|
|
};
|
|
|
|
|
|
//
|
|
// HTMLTableCellElement constructor
|
|
//
|
|
PR_STATIC_CALLBACK(JSBool)
|
|
HTMLTableCellElement(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
|
{
|
|
return JS_FALSE;
|
|
}
|
|
|
|
|
|
//
|
|
// HTMLTableCellElement class initialization
|
|
//
|
|
extern "C" NS_DOM nsresult NS_InitHTMLTableCellElementClass(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, "HTMLTableCellElement", &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_InitHTMLElementClass(aContext, (void **)&parent_proto)) {
|
|
return NS_ERROR_FAILURE;
|
|
}
|
|
proto = JS_InitClass(jscontext, // context
|
|
global, // global object
|
|
parent_proto, // parent proto
|
|
&HTMLTableCellElementClass, // JSClass
|
|
HTMLTableCellElement, // JSNative ctor
|
|
0, // ctor args
|
|
HTMLTableCellElementProperties, // proto props
|
|
HTMLTableCellElementMethods, // 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 HTMLTableCellElement JavaScript object
|
|
//
|
|
extern "C" NS_DOM nsresult NS_NewScriptHTMLTableCellElement(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn)
|
|
{
|
|
NS_PRECONDITION(nsnull != aContext && nsnull != aSupports && nsnull != aReturn, "null argument to NS_NewScriptHTMLTableCellElement");
|
|
JSObject *proto;
|
|
JSObject *parent;
|
|
nsIScriptObjectOwner *owner;
|
|
JSContext *jscontext = (JSContext *)aContext->GetNativeContext();
|
|
nsresult result = NS_OK;
|
|
nsIDOMHTMLTableCellElement *aHTMLTableCellElement;
|
|
|
|
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_InitHTMLTableCellElementClass(aContext, (void **)&proto)) {
|
|
return NS_ERROR_FAILURE;
|
|
}
|
|
|
|
result = aSupports->QueryInterface(kIHTMLTableCellElementIID, (void **)&aHTMLTableCellElement);
|
|
if (NS_OK != result) {
|
|
return result;
|
|
}
|
|
|
|
// create a js object for this class
|
|
*aReturn = JS_NewObject(jscontext, &HTMLTableCellElementClass, proto, parent);
|
|
if (nsnull != *aReturn) {
|
|
// connect the native object to the js object
|
|
JS_SetPrivate(jscontext, (JSObject *)*aReturn, aHTMLTableCellElement);
|
|
}
|
|
else {
|
|
NS_RELEASE(aHTMLTableCellElement);
|
|
return NS_ERROR_FAILURE;
|
|
}
|
|
|
|
return NS_OK;
|
|
}
|