diff --git a/mozilla/cmd/macfe/gui/CHTMLView.cp b/mozilla/cmd/macfe/gui/CHTMLView.cp
index dfe42053104..ae6f534cb0c 100644
--- a/mozilla/cmd/macfe/gui/CHTMLView.cp
+++ b/mozilla/cmd/macfe/gui/CHTMLView.cp
@@ -7177,22 +7177,13 @@ void CHTMLView::RestructureGridView(
mContext->Repaginate();
}
-#if defined(OJI)
-#define BUILTIN_ATTRIBUTE_COUNT(builtin) (builtin)->attributes.n
-#define BUILTIN_ATTRIBUTE_NAMES(builtin) (builtin)->attributes.names
-#define BUILTIN_ATTRIBUTE_VALUES(builtin) (builtin)->attributes.values
-#else
-#define BUILTIN_ATTRIBUTE_COUNT(builtin) (builtin)->attribute_cnt
-#define BUILTIN_ATTRIBUTE_NAMES(builtin) (builtin)->attribute_list
-#define BUILTIN_ATTRIBUTE_VALUES(builtin) (builtin)->value_list
-#endif
-
const char*
CHTMLView :: GetBuiltInAttribute ( LO_BuiltinStruct *inBuiltinStruct, const char* inAttribute )
{
- for ( uint16 n = 0; n < BUILTIN_ATTRIBUTE_COUNT(inBuiltinStruct); n++ ) {
- const char* attName = BUILTIN_ATTRIBUTE_NAMES(inBuiltinStruct)[n];
- const char* attValue = BUILTIN_ATTRIBUTE_VALUES(inBuiltinStruct)[n];
+ lo_NVList& attributes = inBuiltinStruct->attributes;
+ for ( uint16 n = 0; n < attributes.n; n++ ) {
+ const char* attName = attributes.names[n];
+ const char* attValue = attributes.values[n];
if ( attName && (XP_STRCASECMP(attName, inAttribute) == 0) )
return attValue;
}
@@ -7238,8 +7229,8 @@ CHTMLView :: DisplayBuiltin ( int /*inLocation*/, LO_BuiltinStruct* inBuiltinStr
tree->PlaceInSuperImageAt ( inBuiltinStruct->x, inBuiltinStruct->y, false );
// set window target and url
- tree->BuildHTPane ( url, BUILTIN_ATTRIBUTE_COUNT(inBuiltinStruct), BUILTIN_ATTRIBUTE_NAMES(inBuiltinStruct),
- BUILTIN_ATTRIBUTE_VALUES(inBuiltinStruct) );
+ lo_NVList& attributes = inBuiltinStruct->attributes;
+ tree->BuildHTPane ( url, attributes.n, attributes.names, attributes.values);
tree->SetTargetFrame ( target );
tree->Refresh();
diff --git a/mozilla/include/lo_ele.h b/mozilla/include/lo_ele.h
index e438a6f0560..b3632101bf8 100644
--- a/mozilla/include/lo_ele.h
+++ b/mozilla/include/lo_ele.h
@@ -946,15 +946,15 @@ struct LO_CellStruct_struct {
Bool isCaption; /* Needed for relayout without reload */
};
-#ifdef OJI
struct lo_NVList {
uint32 n; /* number of name/value pairs */
char** names;
char** values;
};
-#define LO_NVList_Init( pList ) (pList)->n=0; (pList)->names=NULL; (pList)->values=NULL
-#endif
+typedef struct lo_NVList lo_NVList;
+
+#define LO_NVList_Init( pList ) (pList)->n=0, (pList)->names=NULL, (pList)->values=NULL
struct LO_CommonPluginStruct_struct {
int16 type;
@@ -1005,13 +1005,7 @@ struct LO_BuiltinStruct_struct {
void * FE_Data;
void *session_data;
PA_Block builtin_src;
-#if defined(OJI)
- struct lo_NVList attributes;
-#else
- int32 attribute_cnt;
- char **attribute_list;
- char **value_list;
-#endif /* OJI */
+ lo_NVList attributes;
int32 alignment;
int32 border_width;
int32 border_vert_space;
@@ -1034,14 +1028,8 @@ struct LO_EmbedStruct_struct {
struct LO_EmbedStruct_struct *nextEmbed;
PA_Block embed_src;
-#ifdef OJI
- struct lo_NVList attributes;
- struct lo_NVList parameters;
-#else
- int32 attribute_cnt;
- char **attribute_list;
- char **value_list;
-#endif /* OJI */
+ lo_NVList attributes;
+ lo_NVList parameters;
};
#define LO_JAVA_SELECTOR_APPLET 0
@@ -1068,14 +1056,8 @@ struct LO_JavaAppStruct_struct {
PA_Block attr_archive;
PA_Block attr_name;
Bool may_script;
-#ifdef OJI
- struct lo_NVList attributes;
- struct lo_NVList parameters;
-#else /* OJI */
- int32 param_cnt;
- char **param_names;
- char **param_values;
-#endif /* OJI */
+ lo_NVList attributes;
+ lo_NVList parameters;
};
diff --git a/mozilla/lib/layout/laybuiltin.c b/mozilla/lib/layout/laybuiltin.c
index 24d4964c4ba..5ae338cdeb5 100644
--- a/mozilla/lib/layout/laybuiltin.c
+++ b/mozilla/lib/layout/laybuiltin.c
@@ -39,20 +39,6 @@ void lo_FillInBuiltinGeometry(lo_DocState *state, LO_BuiltinStruct *builtin,
void lo_UpdateStateAfterBuiltinLayout (lo_DocState *state, LO_BuiltinStruct *builtin,
int32 line_inc, int32 baseline_inc);
-/**
- * Some accessor macros, to manage the OJI changes.
- */
-
-#if defined(OJI)
-#define BUILTIN_ATTRIBUTE_COUNT(builtin) (builtin)->attributes.n
-#define BUILTIN_ATTRIBUTE_NAMES(builtin) (builtin)->attributes.names
-#define BUILTIN_ATTRIBUTE_VALUES(builtin) (builtin)->attributes.values
-#else
-#define BUILTIN_ATTRIBUTE_COUNT(builtin) (builtin)->attribute_cnt
-#define BUILTIN_ATTRIBUTE_NAMES(builtin) (builtin)->attribute_list
-#define BUILTIN_ATTRIBUTE_VALUES(builtin) (builtin)->value_list
-#endif
-
void
lo_FormatBuiltin (MWContext *context, lo_DocState *state, PA_Tag *tag)
{
@@ -89,12 +75,10 @@ lo_FormatBuiltin (MWContext *context, lo_DocState *state, PA_Tag *tag)
builtin->next = NULL;
builtin->prev = NULL;
- BUILTIN_ATTRIBUTE_COUNT(builtin) = 0;
- BUILTIN_ATTRIBUTE_NAMES(builtin) = NULL;
- BUILTIN_ATTRIBUTE_VALUES(builtin) = NULL;
+ LO_NVList_Init(&builtin->attributes);
- BUILTIN_ATTRIBUTE_COUNT(builtin) = PA_FetchAllNameValues (tag,
- &BUILTIN_ATTRIBUTE_NAMES(builtin), &BUILTIN_ATTRIBUTE_VALUES(builtin), CS_FE_ASCII);
+ builtin->attributes.n = PA_FetchAllNameValues (tag, &builtin->attributes.names,
+ &builtin->attributes.values, CS_FE_ASCII);
lo_FormatBuiltinInternal (context, state, tag, builtin, FALSE, FALSE);
}
@@ -102,18 +86,17 @@ lo_FormatBuiltin (MWContext *context, lo_DocState *state, PA_Tag *tag)
void
lo_appendParams (LO_BuiltinStruct *builtin, uint32 param_count,
char **param_names, char **param_values) {
- int32 newcount = BUILTIN_ATTRIBUTE_COUNT(builtin) + param_count;
- int32 n = BUILTIN_ATTRIBUTE_COUNT(builtin);
- BUILTIN_ATTRIBUTE_NAMES(builtin) = (char**)XP_REALLOC(BUILTIN_ATTRIBUTE_NAMES(builtin),
- newcount * sizeof(char*));
- BUILTIN_ATTRIBUTE_VALUES(builtin) = (char**)XP_REALLOC(BUILTIN_ATTRIBUTE_VALUES(builtin),
- newcount * sizeof(char*));
+ lo_NVList* attributes = &builtin->attributes;
+ int32 newcount = attributes->n + param_count;
+ int32 n = attributes->n;
+ attributes->names = (char**)XP_REALLOC(attributes->names, newcount * sizeof(char*));
+ attributes->values = (char**)XP_REALLOC(attributes->values, newcount * sizeof(char*));
while (n < newcount) {
- *(BUILTIN_ATTRIBUTE_NAMES(builtin) + n) = XP_STRDUP(*(param_names + n - BUILTIN_ATTRIBUTE_COUNT(builtin)));
- *(BUILTIN_ATTRIBUTE_VALUES(builtin) + n) = XP_STRDUP(*(param_values + n - BUILTIN_ATTRIBUTE_COUNT(builtin)));
+ *(attributes->names + n) = XP_STRDUP(*(param_names + n - attributes->n));
+ *(attributes->values + n) = XP_STRDUP(*(param_values + n - attributes->n));
n++;
}
- BUILTIN_ATTRIBUTE_COUNT(builtin) = BUILTIN_ATTRIBUTE_COUNT(builtin) + param_count;
+ attributes->n = newcount;
}
@@ -130,12 +113,10 @@ lo_FormatBuiltinObject (MWContext *context, lo_DocState* state,
printf ("lo_FormatBuiltinObject\n");
#endif
- BUILTIN_ATTRIBUTE_COUNT(builtin) = 0;
- BUILTIN_ATTRIBUTE_NAMES(builtin) = NULL;
- BUILTIN_ATTRIBUTE_VALUES(builtin) = NULL;
+ LO_NVList_Init(&builtin->attributes);
- BUILTIN_ATTRIBUTE_COUNT(builtin) = PA_FetchAllNameValues (tag,
- &(BUILTIN_ATTRIBUTE_NAMES(builtin)), &(BUILTIN_ATTRIBUTE_VALUES(builtin)), CS_FE_ASCII);
+ builtin->attributes.n = PA_FetchAllNameValues (tag, &builtin->attributes.names,
+ &builtin->attributes.values, CS_FE_ASCII);
if (param_count > 0) lo_appendParams(builtin, param_count, param_names, param_values);
lo_FormatBuiltinInternal (context, state, tag, builtin, TRUE, streamStarted);
@@ -221,7 +202,7 @@ lo_FormatBuiltinInternal (MWContext *context, lo_DocState *state, PA_Tag *tag,
builtin->ele_attrmask |= LO_ELE_STREAM_STARTED;
/* Convert any js in the values */
- lo_ConvertAllValues (context, BUILTIN_ATTRIBUTE_VALUES(builtin), BUILTIN_ATTRIBUTE_COUNT(builtin),
+ lo_ConvertAllValues (context, builtin->attributes.values, builtin->attributes.n,
tag->newline_count);
/* double-counting builtins? XXX */
diff --git a/mozilla/lib/layout/layembed.c b/mozilla/lib/layout/layembed.c
index 5e66bd95add..6bdc65bd621 100644
--- a/mozilla/lib/layout/layembed.c
+++ b/mozilla/lib/layout/layembed.c
@@ -244,20 +244,12 @@ lo_FormatEmbed(MWContext *context, lo_DocState *state, PA_Tag *tag)
embed->objTag.height = 0;
embed->objTag.next = NULL;
embed->objTag.prev = NULL;
-#ifdef OJI
+
LO_NVList_Init( &embed->attributes );
LO_NVList_Init( &embed->parameters );
embed->attributes.n = PA_FetchAllNameValues(tag,
&(embed->attributes.names), &(embed->attributes.values), CS_FE_ASCII);
-#else
- embed->attribute_cnt = 0;
- embed->attribute_list = NULL;
- embed->value_list = NULL;
-
- embed->attribute_cnt = PA_FetchAllNameValues(tag,
- &(embed->attribute_list), &(embed->value_list), CS_FE_ASCII);
-#endif
lo_FormatEmbedInternal(context, state, tag, embed, FALSE, FALSE);
#ifdef ANTHRAX
@@ -276,21 +268,11 @@ lo_FormatEmbedObject(MWContext* context, lo_DocState* state,
int32 typeIndex = -1;
int32 classidIndex = -1;
-#ifdef OJI
LO_NVList_Init(&embed->attributes);
embed->attributes.n = PA_FetchAllNameValues(tag,
&(embed->attributes.names), &(embed->attributes.values), CS_FE_ASCII);
-#else
- embed->attribute_cnt = 0;
- embed->attribute_list = NULL;
- embed->value_list = NULL;
-
- embed->attribute_cnt = PA_FetchAllNameValues(tag,
- &(embed->attribute_list), &(embed->value_list), CS_FE_ASCII);
-#endif
-#ifdef OJI
for (count = 0; count < (uint32)embed->attributes.n; count++)
{
if ( (XP_STRCASECMP(embed->attributes.names[count], PARAM_MAYSCRIPT) == 0)
@@ -298,22 +280,25 @@ lo_FormatEmbedObject(MWContext* context, lo_DocState* state,
StrAllocCopy(embed->attributes.values[count], "true");
}
}
-#else
+
+/* beard: should the following still be used? */
+#if !defined(OJI)
/*
* Look through the parameters and replace "id"
* with "name" and "data" with "src", so that
* other code that looks up parameters by name
* can believe this is a normal EMBED.
*/
- for (count = 0; count < (uint32)embed->attribute_cnt; count++)
+ for (count = 0; count < (uint32)embed->attributes.n; count++)
{
- if (XP_STRCASECMP(embed->attribute_list[count], PARAM_ID) == 0)
- StrAllocCopy(embed->attribute_list[count], PARAM_NAME);
- else if (XP_STRCASECMP(embed->attribute_list[count], PARAM_DATA) == 0)
- StrAllocCopy(embed->attribute_list[count], "src");
- else if (XP_STRCASECMP(embed->attribute_list[count], PARAM_TYPE) == 0)
+ char* attrName = embed->attributes.names[count];
+ if (XP_STRCASECMP(attrName, PARAM_ID) == 0)
+ StrAllocCopy(embed->attributes.names[count], PARAM_NAME);
+ else if (XP_STRCASECMP(attrName, PARAM_DATA) == 0)
+ StrAllocCopy(embed->attributes.names[count], "src");
+ else if (XP_STRCASECMP(attrName, PARAM_TYPE) == 0)
typeIndex = count;
- else if (XP_STRCASECMP(embed->attribute_list[count], PARAM_CLASSID) == 0)
+ else if (XP_STRCASECMP(attrName, PARAM_CLASSID) == 0)
classidIndex = count;
}
@@ -326,8 +311,8 @@ lo_FormatEmbedObject(MWContext* context, lo_DocState* state,
if (typeIndex >= 0)
{
/* Change current value of TYPE to application/oleobject */
- if (XP_STRCASECMP(embed->value_list[typeIndex], APPLICATION_OLEOBJECT) != 0)
- StrAllocCopy(embed->value_list[typeIndex], APPLICATION_OLEOBJECT);
+ if (XP_STRCASECMP(embed->attributes.values[typeIndex], APPLICATION_OLEOBJECT) != 0)
+ StrAllocCopy(embed->attributes.values[typeIndex], APPLICATION_OLEOBJECT);
}
else
{
@@ -337,34 +322,31 @@ lo_FormatEmbedObject(MWContext* context, lo_DocState* state,
names[0] = XP_STRDUP(PARAM_TYPE);
values[0] = XP_STRDUP(APPLICATION_OLEOBJECT);
- lo_AppendParamList((uint32*) &(embed->attribute_cnt),
- &(embed->attribute_list),
- &(embed->value_list),
+ lo_AppendParamList((uint32*) &(embed->attributes.n),
+ &(embed->attributes.names),
+ &(embed->attributes.values),
1, names, values);
}
/* Lop off the "clsid:" prefix from the CLASSID attribute */
- if (XP_STRNCASECMP(embed->value_list[classidIndex], "clsid:", 6) == 0)
+ if (XP_STRNCASECMP(embed->attributes.values[classidIndex], "clsid:", 6) == 0)
{
- char* classID = &(embed->value_list[classidIndex][6]);
- XP_MEMMOVE(embed->value_list[classidIndex], classID,
+ char* classID = &(embed->attributes.values[classidIndex][6]);
+ XP_MEMMOVE(embed->attributes.values[classidIndex], classID,
(XP_STRLEN(classID) + 1) * sizeof(char));
}
}
-#endif
+#endif /* !OJI */
/*
* Merge any parameters passed in with the ones in this tag.
* Separate the merged tag attributes from the
*