lo_FillInImageGeometry( state, image );
lo_BlockedImageLayout(MWContext *context, lo_DocState *state, PA_Tag *tag,                      char *base_url){	LO_ImageStruct *image;	PA_Block buff;	char *str;	int32 val;	/* int32 doc_width; */	PushTagStatus push_status;	char *start, *end;	    XP_ObserverList image_obs_list;   /* List of observers for an image request. */	/* this image layout is going on outside the context	 * of normal layout.  We therfore need to manage the	 * style stack in here as well as in normal layout	 * mode so that we can set image widths	 */	push_status = LO_PushTagOnStyleStack(context, state, tag);	/* 	 * if there are any entities in this tag don't prefetch	 *   it --- wait until we have had a chance to redo it	 */	if (lo_FindMochaExpr((char *)tag->data, &start, &end))	    return;	/*	 * Fill in the image structure with default data	 */    image = lo_new_image_element(context, state, tag->edit_element, NULL);    if (!image)        return;	image->ele_id = NEXT_ELEMENT;	image->border_width = -1;	image->border_vert_space = IMAGE_DEF_VERTICAL_SPACE;	image->border_horiz_space = IMAGE_DEF_HORIZONTAL_SPACE;	/*	 * Check for the ISMAP parameter	 */	buff = lo_FetchParamValue(context, tag, PARAM_ISMAP);	if (buff != NULL)	{		image->image_attr->attrmask |= LO_ATTR_ISMAP;		PA_FREE(buff);	}	/*	 * Check for the USEMAP parameter.  The name is stored in the	 * image attributes immediately, the map pointer will be	 * stored in later.	 */	buff = lo_FetchParamValue(context, tag, PARAM_USEMAP);	if (buff != NULL)	{		char *new_str;		char *map_name;		char *tptr;		map_name = NULL;		PA_LOCK(str, char *, buff);		/*		 * Make this an absolute URL		 */		if (str != NULL)		{			int32 len;			len = lo_StripTextWhitespace(str, XP_STRLEN(str));		}		/*		 * The IETF draft says evaluate #name relative to real,		 * and not the base url.		 */		if ((str != NULL)&&(*str == '#'))		{			new_str = NET_MakeAbsoluteURL(				state->top_state->url, str);		}		else		{			new_str = NET_MakeAbsoluteURL(				base_url, str);		}		/*		 * If we have a local URL, we can use the USEMAP.		 */		if ((new_str != NULL)&&			(lo_IsAnchorInDoc(state, new_str) != FALSE))		{			tptr = strrchr(new_str, '#');			if (tptr == NULL)			{				tptr = new_str;			}			else			{				tptr++;			}			map_name = XP_STRDUP(tptr);			XP_FREE(new_str);		}		/*		 * Else a non-local URL, right now we don't support this.		 */		else if (new_str != NULL)		{			XP_FREE(new_str);		}		PA_UNLOCK(buff);		PA_FREE(buff);		image->image_attr->usemap_name = map_name;	}	/*	 * Check for an align parameter	 */	buff = lo_FetchParamValue(context, tag, PARAM_ALIGN);	if (buff != NULL)	{		Bool floating;		floating = FALSE;		PA_LOCK(str, char *, buff);		image->image_attr->alignment = lo_EvalAlignParam(str,			&floating);		if (floating != FALSE)		{			image->ele_attrmask |= LO_ELE_FLOATING;		}		PA_UNLOCK(buff);		PA_FREE(buff);	}	if(state->top_state->style_stack)	{		Bool floating = FALSE;		lo_EvalStyleSheetAlignment(				STYLESTACK_GetStyleByIndex(state->top_state->style_stack, 0), 				&(image->image_attr->alignment),				&floating);	 				if (floating != FALSE)		{			image->ele_attrmask |= LO_ELE_FLOATING;		}	}	/*	 * Get the required src parameter, and make the resulting	 * url and absolute url.	 */	buff = lo_FetchParamValue(context, tag, PARAM_SRC);	if (buff != NULL)	{		PA_Block new_buff;		char *new_str;		new_buff = NULL;		PA_LOCK(str, char *, buff);		if (str != NULL)		{			int32 len;			len = lo_StripTextWhitespace(str, XP_STRLEN(str));		}		new_str = NET_MakeAbsoluteURL(base_url, str);		if (new_str != NULL)		{			char *url;			new_buff = PA_ALLOC(XP_STRLEN(new_str) + 1);			if (new_buff != NULL)			{				PA_LOCK(url, char *, new_buff);				XP_STRCPY(url, new_str);				PA_UNLOCK(new_buff);			}			XP_FREE(new_str);		}		PA_UNLOCK(buff);		PA_FREE(buff);		buff = new_buff;				if (new_str == NULL || new_buff == NULL)		{	/* clean up all previously allocated objects */			lo_FreeElement(context, (LO_Element *)image, TRUE);			state->top_state->out_of_memory = TRUE;			return;		}	}	image->image_url = buff;	/*	 * Get the optional lowsrc parameter, and make the resulting	 * url and absolute url.	 */	buff = lo_FetchParamValue(context, tag, PARAM_LOWSRC);	if (buff != NULL)	{	    PA_Block new_buff;	    char *new_str;	    new_buff = NULL;	    PA_LOCK(str, char *, buff);	    if (str != NULL)	    {		int32 len;		len = lo_StripTextWhitespace(str, XP_STRLEN(str));	    }	    new_str = NET_MakeAbsoluteURL(base_url, str);	    if (new_str != NULL)	    {		    char *url;		    new_buff = PA_ALLOC(XP_STRLEN(new_str) + 1);		    if (new_buff != NULL)		    {			    PA_LOCK(url, char *, new_buff);			    XP_STRCPY(url, new_str);			    PA_UNLOCK(new_buff);		    }		    XP_FREE(new_str);	    }	    PA_UNLOCK(buff);	    PA_FREE(buff);	    buff = new_buff;	    if (new_str == NULL || new_buff == NULL)	    {       /* clean up all previously allocated objects */		    lo_FreeElement(context, (LO_Element *)image, TRUE);		    state->top_state->out_of_memory = TRUE;		    return;	    }	}	image->lowres_image_url = buff;	/*	 * Get the alt parameter, and store the resulting	 * text, and its length.	 */	buff = lo_FetchParamValue(context, tag, PARAM_ALT);	if (buff != NULL)	{		PA_LOCK(str, char *, buff);		image->alt_len = XP_STRLEN(str);		image->alt_len = (int16)lo_StripTextNewlines(str,						(int32)image->alt_len);		PA_UNLOCK(buff);	}	image->alt = buff;	/*	 * Get the suppress feedback parameter, which suppresses the delayed icon,     * temporary border and alt text when the image is coming in, and also     * suppresses keyboard navigation feedback.	 */	buff = lo_FetchParamValue(context, tag, PARAM_SUPPRESS);	if (buff != NULL)	{		PA_LOCK(str, char *, buff);        if (!XP_STRNCASECMP(str, "true", 4))            image->suppress_mode = LO_SUPPRESS;        else if (!XP_STRNCASECMP(str, "false", 5))            image->suppress_mode = LO_DONT_SUPPRESS;        else            image->suppress_mode = LO_SUPPRESS_UNDEFINED;		PA_UNLOCK(buff);		PA_FREE(buff);	}		/*	doc_width = state->right_margin - state->left_margin;	*/	/*	 * Get the width parameter, in absolute or percentage.	 * If percentage, make it absolute.	 */	/*	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)		{			if (state->allow_percent_width == FALSE)			{				val = 0;			}			else			{				val = doc_width * val / 100;			}		}		else		{			val = FEUNITS_X(val, context);		}		image->width = val;		PA_UNLOCK(buff);		PA_FREE(buff);	}	*/	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)		{			image->percent_width = val;		}		else		{			image->percent_width = 0;			val = FEUNITS_X(val, context);		}		image->width = val;		PA_UNLOCK(buff);		PA_FREE(buff);	}		/* disabled because it is broken by JS threading 	 *	 * val = LO_GetWidthFromStyleSheet(context, state);	 * if(val)	 *	image->width = val;	 */	/*	 * Get the height parameter, in absolute or percentage.	 * If percentage, make it absolute.	 */	/*	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)		{			if (state->allow_percent_height == FALSE)			{				val = 0;			}			else			{				val = state->win_height * val / 100;			}		}		else		{			val = FEUNITS_Y(val, context);		}		image->height = val;		PA_UNLOCK(buff);		PA_FREE(buff);	}	*/	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)		{			image->percent_height = val;		}		else		{			image->percent_height = 0;			val = FEUNITS_Y(val, context);		}		image->height = val;		PA_UNLOCK(buff);		PA_FREE(buff);	}	/* disabled because it is broken by JS threading 	 *	 * val = LO_GetHeightFromStyleSheet(context, state);	 * if(val)	 *	image->height = val;	 */	/*	 * Get the border parameter.	 */	buff = lo_FetchParamValue(context, tag, PARAM_BORDER);	if (buff != NULL)	{		PA_LOCK(str, char *, buff);		val = XP_ATOI(str);		if (val < 0)		{			val = 0;		}		image->border_width = val;		PA_UNLOCK(buff);		PA_FREE(buff);	}	image->border_width = FEUNITS_X(image->border_width, context);	/*	 * 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;		}		image->border_vert_space = val;		PA_UNLOCK(buff);		PA_FREE(buff);	}	image->border_vert_space = FEUNITS_Y(image->border_vert_space, context);	/*	 * Get the extra horizontal space parameter.	 */	if (image->ele_attrmask & LO_ELE_FLOATING)	{		image->border_horiz_space = IMAGE_DEF_FLOAT_HORIZONTAL_SPACE;	}	else	{		image->border_horiz_space = IMAGE_DEF_HORIZONTAL_SPACE;	}	buff = lo_FetchParamValue(context, tag, PARAM_HSPACE);	if (buff != NULL)	{		PA_LOCK(str, char *, buff);		val = XP_ATOI(str);		if (val < 0)		{			val = 0;		}		image->border_horiz_space = val;		PA_UNLOCK(buff);		PA_FREE(buff);	}	image->border_horiz_space = FEUNITS_X(image->border_horiz_space,						context);	/*	 * Make sure we don't load insecure images inside	 * a secure document.	 */	if (state->top_state->security_level > 0)	{		if (image->image_url != NULL)		{			PA_LOCK(str, char *, image->image_url);			if (NET_IsURLSecure(str) == FALSE)			{				PA_UNLOCK(image->image_url);				PA_FREE(image->image_url);				image->image_url = PA_ALLOC(				    XP_STRLEN("internal-icon-insecure") + 1);				if (image->image_url != NULL)				{				    PA_LOCK(str, char *, image->image_url);				    XP_STRCPY(str, "internal-icon-insecure");				    PA_UNLOCK(image->image_url);				}				else				{				    state->top_state->out_of_memory = TRUE;				}				if (state->top_state->insecure_images == FALSE)				{					state->top_state->insecure_images = TRUE;					SECNAV_SecurityDialog(context, SD_INSECURE_DOCS_WITHIN_SECURE_DOCS_NOT_SHOWN);				}			}			else			{				PA_UNLOCK(image->image_url);			}		}	}    if (context->compositor) {        image->layer = lo_CreateImageLayer(context, image, NULL);    }	/* Initiate the loading of this image. */    image_obs_list = lo_NewImageObserverList(context, image);    if (!image_obs_list)        return;	lo_GetImage(context, context->img_cx, image, image_obs_list,                state->top_state->force_reload);	tag->lo_data = (void *)image;    if (state->top_state->style_stack)        STYLESTACK_PopTag(state->top_state->style_stack,                          (char*)pa_PrintTagToken((int32)tag->type));}