builtin->layer = lo_CreateEmbeddedObjectLayer(context, state, (LO_Element*)builtin);
lo_FormatBuiltinInternal (MWContext *context, lo_DocState *state, PA_Tag *tag,						  LO_BuiltinStruct *builtin, Bool isObject, Bool streamStarted){	PA_Block buff;	char *str;	int32 val;	int32 doc_width;	XP_Bool widthSpecified = FALSE;	XP_Bool heightSpecified = FALSE;#ifdef DEBUG_SPENCE	printf ("lo_FormatBuiltinInternal\n");#endif    builtin->nextBuiltin = NULL;#ifdef MOCHA    builtin->mocha_object = NULL;#endif	builtin->FE_Data = NULL;	builtin->session_data = NULL;	builtin->line_height = state->line_height;	builtin->builtin_src = NULL;	builtin->alignment = LO_ALIGN_BASELINE;	builtin->border_width = BUILTIN_DEF_BORDER;	builtin->border_vert_space = BUILTIN_DEF_VERTICAL_SPACE;	builtin->border_horiz_space = BUILTIN_DEF_HORIZONTAL_SPACE;	builtin->tag = tag;	builtin->ele_attrmask = 0;	if (streamStarted)		builtin->ele_attrmask |= LO_ELE_STREAM_STARTED;	/* Convert any js in the values */	lo_ConvertAllValues (context, builtin->value_list, builtin->attribute_cnt,						 tag->newline_count);	/* double-counting builtins? XXX */#if 0	/* Assign a unique index and inc the master index */	builtin->builtin_index = state->top_state->builtin_count++;#endif	/*	 * Check for an align parameter	 */	buff = lo_FetchParamValue(context, tag, PARAM_ALIGN);	if (buff != NULL)	{		Bool floating;		floating = FALSE;		PA_LOCK(str, char *, buff);		builtin->alignment = lo_EvalAlignParam(str, &floating);		if (floating != FALSE)		{			builtin->ele_attrmask |= LO_ELE_FLOATING;		}		PA_UNLOCK(buff);		PA_FREE(buff);	}	/*	 * Get the optional src parameter.	 */	buff = lo_FetchParamValue(context, tag, PARAM_SRC);	if (buff != NULL)	{		PA_Block new_buff;		char *new_str;		int32 len;		len = 1;		PA_LOCK(str, char *, buff);		if (str != NULL)		{			len = lo_StripTextWhitespace(str, XP_STRLEN(str));		}		if (str != NULL)		{			/* bing: make sure this deals with "data:" URLs */			new_str = NET_MakeAbsoluteURL(				state->top_state->base_url, str);		}		else		{			new_str = NULL;		}		if ((new_str == NULL)||(len == 0))		{			new_buff = NULL;		}		else		{			char *object_src;			new_buff = PA_ALLOC(XP_STRLEN(new_str) + 1);			if (new_buff != NULL)			{				PA_LOCK(object_src, char *, new_buff);				XP_STRCPY(object_src, new_str);				PA_UNLOCK(new_buff);			}			else			{				state->top_state->out_of_memory = TRUE;			}			XP_FREE(new_str);		}		PA_UNLOCK(buff);		PA_FREE(buff);		buff = new_buff;	}	builtin->builtin_src = buff;	doc_width = state->right_margin - state->left_margin;	/*	 * Get the width parameter, in absolute or percentage.	 * If percentage, make it absolute.  If the height is	 * zero, make the builtin hidden so the FE knows that the	 * size really is zero (zero size normally means that	 * we're blocking).	 */	buff = lo_FetchParamValue(context, tag, PARAM_WIDTH);	if (buff != NULL)	{		Bool is_percent;		PA_LOCK(str, char *, buff);		val = lo_ValueOrPercent(str, &is_percent);		if (is_percent != FALSE)		{			builtin->percent_width = val;		}		else		{			builtin->percent_width = 0;			builtin->width = val;			val = FEUNITS_X(val, context);		}		PA_UNLOCK(buff);		PA_FREE(buff);		widthSpecified = TRUE;	}	val = LO_GetWidthFromStyleSheet(context, state);	if(val)	  {		builtin->width = val;		builtin->percent_width = 0;		widthSpecified = TRUE;	  }	/*	 * Get the height parameter, in absolute or percentage.	 * If percentage, make it absolute.  If the height is	 * zero, make the builtin hidden so the FE knows that the	 * size really is zero (zero size normally means that	 * we're blocking).	 */	buff = lo_FetchParamValue(context, tag, PARAM_HEIGHT);	if (buff != NULL)	{		Bool is_percent;		PA_LOCK(str, char *, buff);		val = lo_ValueOrPercent(str, &is_percent);		if (is_percent != FALSE)		{			builtin->percent_height = val;		}		else		{			builtin->percent_height = 0;			val = FEUNITS_Y(val, context);		}		builtin->height = val;		PA_UNLOCK(buff);		PA_FREE(buff);		heightSpecified = TRUE;	}	val = LO_GetHeightFromStyleSheet(context, state);	if(val)	  {		builtin->height = val;		builtin->percent_height = 0;		heightSpecified = TRUE;	  }	/*	 * If they forgot to specify a width or height, make one up.	 */	if (!widthSpecified)	{		if (heightSpecified)			builtin->width = builtin->height;		else			builtin->width = BUILTIN_DEF_DIM;	}		if (!heightSpecified)	{		if (widthSpecified)			builtin->height = builtin->width;		else			builtin->height = BUILTIN_DEF_DIM;	}	lo_FillInBuiltinGeometry(state, builtin, FALSE);	/*	 * Get the extra vertical space parameter.	 */	buff = lo_FetchParamValue(context, tag, PARAM_VSPACE);	if (buff != NULL)	{		PA_LOCK(str, char *, buff);		val = XP_ATOI(str);		if (val < 0)		{			val = 0;		}		builtin->border_vert_space = val;		PA_UNLOCK(buff);		PA_FREE(buff);	}	builtin->border_vert_space = FEUNITS_Y(builtin->border_vert_space, context);	/*	 * Get the extra horizontal space parameter.	 */	buff = lo_FetchParamValue(context, tag, PARAM_HSPACE);	if (buff != NULL)	{		PA_LOCK(str, char *, buff);		val = XP_ATOI(str);		if (val < 0)		{			val = 0;		}		builtin->border_horiz_space = val;		PA_UNLOCK(buff);		PA_FREE(buff);	}	builtin->border_horiz_space = FEUNITS_X(builtin->border_horiz_space,						context);	/* builtin_list for reflection? XXX */	lo_FinishBuiltin (context, state, builtin);}