summaryrefslogtreecommitdiff
path: root/render/box_construct.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2007-03-22 22:47:24 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2007-03-22 22:47:24 +0000
commit64b229d0d6fb3ab4c650fb4bc27618104e79f10c (patch)
treecf0ad72c5a02cf98ec3d771b03b6417f28986ae3 /render/box_construct.c
parent9c048ad076267066cbe89c0bb6218d637a92349b (diff)
downloadnetsurf-64b229d0d6fb3ab4c650fb4bc27618104e79f10c.tar.gz
netsurf-64b229d0d6fb3ab4c650fb4bc27618104e79f10c.tar.bz2
Make <object> attribute handling more spec compliant
svn path=/trunk/netsurf/; revision=3215
Diffstat (limited to 'render/box_construct.c')
-rw-r--r--render/box_construct.c41
1 files changed, 31 insertions, 10 deletions
diff --git a/render/box_construct.c b/render/box_construct.c
index da03d5449..d034fd546 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -1375,18 +1375,19 @@ bool box_object(BOX_SPECIAL_PARAMS)
params->classid = 0;
params->params = 0;
- /* codebase, classid, and data are URLs (codebase is the base for the
- * other two) */
+ /* codebase, classid, and data are URLs
+ * (codebase is the base for the other two) */
if ((codebase = xmlGetProp(n, (const xmlChar *) "codebase"))) {
if (!box_extract_link((char *) codebase,
- content->data.html.base_url, &params->codebase))
+ content->data.html.base_url,
+ &params->codebase))
return false;
xmlFree(codebase);
}
if (!params->codebase)
params->codebase = content->data.html.base_url;
- if ((classid = xmlGetProp(n, (const xmlChar *) "codebase"))) {
+ if ((classid = xmlGetProp(n, (const xmlChar *) "classid"))) {
if (!box_extract_link((char *) classid, params->codebase,
&params->classid))
return false;
@@ -1399,12 +1400,20 @@ bool box_object(BOX_SPECIAL_PARAMS)
return false;
xmlFree(data);
}
- if (!params->data)
- /* objects without data are ignored */
+
+ if (!params->classid && !params->data)
+ /* nothing to embed; ignore */
return true;
/* Don't include ourself */
- if (strcmp(content->data.html.base_url, params->data) == 0)
+ if (params->classid &&
+ strcmp(content->data.html.base_url,
+ params->classid) == 0)
+ return true;
+
+ if (params->data &&
+ strcmp(content->data.html.base_url,
+ params->data) == 0)
return true;
/* codetype and type are MIME types */
@@ -1412,7 +1421,18 @@ bool box_object(BOX_SPECIAL_PARAMS)
return false;
if (!box_get_attribute(n, "type", params, &params->type))
return false;
- if (params->type && content_lookup(params->type) == CONTENT_OTHER)
+
+ /* classid && !data => classid is used (consult codetype)
+ * (classid || !classid) && data => data is used (consult type)
+ * !classid && !data => invalid; ignored */
+
+ if (params->classid && !params->data && params->codetype &&
+ content_lookup(params->codetype) == CONTENT_OTHER)
+ /* can't handle this MIME type */
+ return true;
+
+ if (params->data && params->type &&
+ content_lookup(params->type) == CONTENT_OTHER)
/* can't handle this MIME type */
return true;
@@ -1456,8 +1476,9 @@ bool box_object(BOX_SPECIAL_PARAMS)
box->object_params = params;
/* start fetch (MIME type is ok or not specified) */
- if (!html_fetch_object(content, params->data, box, 0,
- content->available_width, 1000, false))
+ if (!html_fetch_object(content,
+ params->data ? params->data : params->classid,
+ box, 0, content->available_width, 1000, false))
return false;
/* convert children and place into fallback */