Pass html_content to box_extract_link.
This commit is contained in:
parent
ad273a41e8
commit
3dcf7d80a1
|
@ -334,7 +334,8 @@ struct box *box_pick_text_box(struct html_content *html,
|
||||||
struct box *box_find_by_id(struct box *box, lwc_string *id);
|
struct box *box_find_by_id(struct box *box, lwc_string *id);
|
||||||
bool box_visible(struct box *box);
|
bool box_visible(struct box *box);
|
||||||
void box_dump(FILE *stream, struct box *box, unsigned int depth, bool style);
|
void box_dump(FILE *stream, struct box *box, unsigned int depth, bool style);
|
||||||
bool box_extract_link(const char *rel, struct nsurl *base, struct nsurl **result);
|
bool box_extract_link(const struct html_content *content,
|
||||||
|
const char *rel, struct nsurl *base, struct nsurl **result);
|
||||||
|
|
||||||
bool box_handle_scrollbars(struct content *c, struct box *box,
|
bool box_handle_scrollbars(struct content *c, struct box *box,
|
||||||
bool bottom, bool right);
|
bool bottom, bool right);
|
||||||
|
|
|
@ -1476,7 +1476,7 @@ bool box_a(BOX_SPECIAL_PARAMS)
|
||||||
|
|
||||||
err = dom_element_get_attribute(n, corestring_dom_href, &s);
|
err = dom_element_get_attribute(n, corestring_dom_href, &s);
|
||||||
if (err == DOM_NO_ERR && s != NULL) {
|
if (err == DOM_NO_ERR && s != NULL) {
|
||||||
ok = box_extract_link(dom_string_data(s),
|
ok = box_extract_link(content, dom_string_data(s),
|
||||||
content->base_url, &url);
|
content->base_url, &url);
|
||||||
dom_string_unref(s);
|
dom_string_unref(s);
|
||||||
if (!ok)
|
if (!ok)
|
||||||
|
@ -1590,7 +1590,7 @@ bool box_image(BOX_SPECIAL_PARAMS)
|
||||||
if (err != DOM_NO_ERR || s == NULL)
|
if (err != DOM_NO_ERR || s == NULL)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (box_extract_link(dom_string_data(s), content->base_url,
|
if (box_extract_link(content, dom_string_data(s), content->base_url,
|
||||||
&url) == false) {
|
&url) == false) {
|
||||||
dom_string_unref(s);
|
dom_string_unref(s);
|
||||||
return false;
|
return false;
|
||||||
|
@ -1691,7 +1691,7 @@ bool box_object(BOX_SPECIAL_PARAMS)
|
||||||
* (codebase is the base for the other two) */
|
* (codebase is the base for the other two) */
|
||||||
err = dom_element_get_attribute(n, corestring_dom_codebase, &codebase);
|
err = dom_element_get_attribute(n, corestring_dom_codebase, &codebase);
|
||||||
if (err == DOM_NO_ERR && codebase != NULL) {
|
if (err == DOM_NO_ERR && codebase != NULL) {
|
||||||
if (box_extract_link(dom_string_data(codebase),
|
if (box_extract_link(content, dom_string_data(codebase),
|
||||||
content->base_url,
|
content->base_url,
|
||||||
¶ms->codebase) == false) {
|
¶ms->codebase) == false) {
|
||||||
dom_string_unref(codebase);
|
dom_string_unref(codebase);
|
||||||
|
@ -1704,8 +1704,8 @@ bool box_object(BOX_SPECIAL_PARAMS)
|
||||||
|
|
||||||
err = dom_element_get_attribute(n, corestring_dom_classid, &classid);
|
err = dom_element_get_attribute(n, corestring_dom_classid, &classid);
|
||||||
if (err == DOM_NO_ERR && classid != NULL) {
|
if (err == DOM_NO_ERR && classid != NULL) {
|
||||||
if (box_extract_link(dom_string_data(classid), params->codebase,
|
if (box_extract_link(content, dom_string_data(classid),
|
||||||
¶ms->classid) == false) {
|
params->codebase, ¶ms->classid) == false) {
|
||||||
dom_string_unref(classid);
|
dom_string_unref(classid);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1714,8 +1714,8 @@ bool box_object(BOX_SPECIAL_PARAMS)
|
||||||
|
|
||||||
err = dom_element_get_attribute(n, corestring_dom_data, &data);
|
err = dom_element_get_attribute(n, corestring_dom_data, &data);
|
||||||
if (err == DOM_NO_ERR && data != NULL) {
|
if (err == DOM_NO_ERR && data != NULL) {
|
||||||
if (box_extract_link(dom_string_data(data), params->codebase,
|
if (box_extract_link(content, dom_string_data(data),
|
||||||
¶ms->data) == false) {
|
params->codebase, ¶ms->data) == false) {
|
||||||
dom_string_unref(data);
|
dom_string_unref(data);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2134,7 +2134,7 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
|
||||||
url = NULL;
|
url = NULL;
|
||||||
err = dom_element_get_attribute(c, corestring_dom_src, &s);
|
err = dom_element_get_attribute(c, corestring_dom_src, &s);
|
||||||
if (err == DOM_NO_ERR && s != NULL) {
|
if (err == DOM_NO_ERR && s != NULL) {
|
||||||
box_extract_link(dom_string_data(s),
|
box_extract_link(content, dom_string_data(s),
|
||||||
content->base_url, &url);
|
content->base_url, &url);
|
||||||
dom_string_unref(s);
|
dom_string_unref(s);
|
||||||
}
|
}
|
||||||
|
@ -2270,7 +2270,7 @@ bool box_iframe(BOX_SPECIAL_PARAMS)
|
||||||
err = dom_element_get_attribute(n, corestring_dom_src, &s);
|
err = dom_element_get_attribute(n, corestring_dom_src, &s);
|
||||||
if (err != DOM_NO_ERR || s == NULL)
|
if (err != DOM_NO_ERR || s == NULL)
|
||||||
return true;
|
return true;
|
||||||
if (box_extract_link(dom_string_data(s), content->base_url,
|
if (box_extract_link(content, dom_string_data(s), content->base_url,
|
||||||
&url) == false) {
|
&url) == false) {
|
||||||
dom_string_unref(s);
|
dom_string_unref(s);
|
||||||
return false;
|
return false;
|
||||||
|
@ -2843,7 +2843,7 @@ bool box_embed(BOX_SPECIAL_PARAMS)
|
||||||
err = dom_element_get_attribute(n, corestring_dom_src, &src);
|
err = dom_element_get_attribute(n, corestring_dom_src, &src);
|
||||||
if (err != DOM_NO_ERR || src == NULL)
|
if (err != DOM_NO_ERR || src == NULL)
|
||||||
return true;
|
return true;
|
||||||
if (box_extract_link(dom_string_data(src), content->base_url,
|
if (box_extract_link(content, dom_string_data(src), content->base_url,
|
||||||
¶ms->data) == false) {
|
¶ms->data) == false) {
|
||||||
dom_string_unref(src);
|
dom_string_unref(src);
|
||||||
return false;
|
return false;
|
||||||
|
@ -2996,7 +2996,8 @@ bool box_get_attribute(dom_node *n, const char *attribute,
|
||||||
* \return true on success, false on memory exhaustion
|
* \return true on success, false on memory exhaustion
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool box_extract_link(const char *rel, nsurl *base, nsurl **result)
|
bool box_extract_link(const html_content *content,
|
||||||
|
const char *rel, nsurl *base, nsurl **result)
|
||||||
{
|
{
|
||||||
char *s, *s1, *apos0 = 0, *apos1 = 0, *quot0 = 0, *quot1 = 0;
|
char *s, *s1, *apos0 = 0, *apos1 = 0, *quot0 = 0, *quot1 = 0;
|
||||||
unsigned int i, j, end;
|
unsigned int i, j, end;
|
||||||
|
|
|
@ -274,6 +274,7 @@ void imagemap_dump(html_content *c)
|
||||||
/**
|
/**
|
||||||
* Adds an imagemap entry to the list
|
* Adds an imagemap entry to the list
|
||||||
*
|
*
|
||||||
|
* \param c The html content that the imagemap belongs to
|
||||||
* \param n The xmlNode representing the entry to add
|
* \param n The xmlNode representing the entry to add
|
||||||
* \param base_url Base URL for resolving relative URLs
|
* \param base_url Base URL for resolving relative URLs
|
||||||
* \param entry Pointer to list of entries
|
* \param entry Pointer to list of entries
|
||||||
|
@ -281,7 +282,7 @@ void imagemap_dump(html_content *c)
|
||||||
* \return false on memory exhaustion, true otherwise
|
* \return false on memory exhaustion, true otherwise
|
||||||
*/
|
*/
|
||||||
static bool
|
static bool
|
||||||
imagemap_addtolist(dom_node *n, nsurl *base_url,
|
imagemap_addtolist(const struct html_content *c, dom_node *n, nsurl *base_url,
|
||||||
struct mapentry **entry, dom_string *tagtype)
|
struct mapentry **entry, dom_string *tagtype)
|
||||||
{
|
{
|
||||||
dom_exception exc;
|
dom_exception exc;
|
||||||
|
@ -346,7 +347,7 @@ imagemap_addtolist(dom_node *n, nsurl *base_url,
|
||||||
else
|
else
|
||||||
goto bad_out;
|
goto bad_out;
|
||||||
|
|
||||||
if (box_extract_link(dom_string_data(href),
|
if (box_extract_link(c, dom_string_data(href),
|
||||||
base_url, &new_map->url) == false)
|
base_url, &new_map->url) == false)
|
||||||
goto bad_out;
|
goto bad_out;
|
||||||
|
|
||||||
|
@ -537,7 +538,7 @@ imagemap_extract_map_entries(dom_node *node, html_content *c,
|
||||||
dom_nodelist_unref(nlist);
|
dom_nodelist_unref(nlist);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (imagemap_addtolist(subnode, c->base_url,
|
if (imagemap_addtolist(c, subnode, c->base_url,
|
||||||
entry, tname) == false) {
|
entry, tname) == false) {
|
||||||
dom_node_unref(subnode);
|
dom_node_unref(subnode);
|
||||||
dom_nodelist_unref(nlist);
|
dom_nodelist_unref(nlist);
|
||||||
|
|
Loading…
Reference in New Issue