Commit cf64f0f4 authored by Kevin Bracey's avatar Kevin Bracey
Browse files

Updated code to extract attributes from BODY tag, including event info.

parent 2073753b
......@@ -616,24 +616,23 @@ void fetch_preprocess_token(browser_data * b, HStream * tptr)
}
}
if (tptr->style & IMG)
if (tptr->tag == BODY)
{
/* A background image. */
/* The BODY tag. All sorts of exciting stuff in here... */
if (tptr->src)
if (HtmlBODYbackground(tptr))
{
/* If there's a URL for the image, ask the image library for it */
/* and remember the image number in the browser_data structure */
image_new_image(b, tptr->src, tptr, 2);
image_new_image(b, HtmlBODYbackground(tptr), tptr, 2);
}
/* In the case of a background, the maxlen field in the HStream structure */
/* is used to hold a 24-bit background colour, or '-1' for 'default'. */
/* Get the 24-bit background colour, if any. */
if (tptr->maxlen != (unsigned int) - 1)
if (HtmlBODYbgcolour(tptr) != NULL_COLOUR)
{
b->backgroundcol = tptr->maxlen;
b->backgroundcol = HtmlBODYbgcolour(tptr);
#ifdef TRACE
if (tl & (1u<<6)) Printf("fetch_preprocess_token: Background colour set to %d\n", b->backgroundcol);
......@@ -648,13 +647,16 @@ void fetch_preprocess_token(browser_data * b, HStream * tptr)
browser_update_bottom(b, 0);
}
/* In a manner similar to the background colour handling above, */
/* the 'size', 'rows' and 'cols' fields of the HStream struct */
/* are used to hold colour information. */
/* Get the rest of the colour info out. */
if ((tptr->size) != (unsigned int) -1) b->textcol = tptr->size;
if ((tptr->rows) != (unsigned int) -1) b->linkcol = tptr->rows;
if ((tptr->cols) != (unsigned int) -1) b->usedcol = tptr->cols;
if (HtmlBODYtext(tptr) != NULL_COLOUR) b->textcol = HtmlBODYtext(tptr);
if (HtmlBODYlink(tptr) != NULL_COLOUR) b->linkcol = HtmlBODYlink(tptr);
if (HtmlBODYvlink(tptr) != NULL_COLOUR) b->usedcol = HtmlBODYvlink(tptr);
if (HtmlBODYalink(tptr) != NULL_COLOUR) b->follcol = HtmlBODYalink(tptr);
/* Also pull out the onload and onunload scripts. */
if (HtmlBODYonload(tptr)) b->onload = HtmlBODYonload(tptr);
if (HtmlBODYonunload(tptr)) b->onunload = HtmlBODYonunload(tptr);
}
/* Closure of long else to see if the HStream structure represented */
......@@ -1022,6 +1024,9 @@ void fetch_fetcher(browser_data * b)
b->follcol = choices.col_foll; /* Following link default colour */
b->selecol = choices.col_sele; /* Selected (highlighted) link colour */
b->onload = NULL; /* <BODY onload> attribute */
b->onunload = NULL; /* <BODY onunload> attribute */
/* Ensure the nesting level and filling frame counters are reset */
b->nesting_level = 0;
......
......@@ -730,7 +730,7 @@ void image_abort_fetches(browser_data * b)
/* sprite for fast plotting. */
/*************************************************/
_kernel_oserror * image_new_image(browser_data * b, char * url, HStream * token, int background)
_kernel_oserror * image_new_image(browser_data * b, const char * url, HStream * token, int background)
{
int size, ok, ulen, xref;
HStream * tp;
......
......@@ -262,6 +262,11 @@ typedef struct browser_data
bistate_type bistate; /* Type of a bistate button, if one is present. */
int bistate_state; /* Current state of the bistate button. */
/* JavaScript support */
const char * onload; /* The onLoad attribute specified in the BODY start tag. */
const char * onunload; /* The onUnload attribute specified in the BODY start tag. */
/* General page display information */
int backgroundcol; /* Background colour. */
......
......@@ -75,7 +75,7 @@ typedef struct image_info
/* Function prototypes */
_kernel_oserror * image_new_image (browser_data * b, char * url, HStream * token, int background);
_kernel_oserror * image_new_image (browser_data * b, const char * url, HStream * token, int background);
void image_abort_fetches (browser_data * b);
_kernel_oserror * image_process_null (browser_data * b);
_kernel_oserror * image_discard (browser_data * b);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment