mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-27 00:40:15 +03:00
Use corestrings in box construction.
This commit is contained in:
parent
20e789955d
commit
72510f550b
@ -339,8 +339,6 @@ bool box_handle_scrollbars(struct content *c, struct box *box,
|
||||
bool box_vscrollbar_present(const struct box *box);
|
||||
bool box_hscrollbar_present(const struct box *box);
|
||||
|
||||
nserror box_construct_init(void);
|
||||
void box_construct_fini(void);
|
||||
nserror dom_to_box(struct dom_node *n, struct html_content *c,
|
||||
box_construct_complete_cb cb);
|
||||
|
||||
|
@ -210,134 +210,13 @@ static const box_type box_map[] = {
|
||||
BOX_NONE /*CSS_DISPLAY_NONE*/
|
||||
};
|
||||
|
||||
/** Key for box userdata on DOM elements (== '__ns_box') */
|
||||
static dom_string *kstr_box_key;
|
||||
static dom_string *kstr_title;
|
||||
static dom_string *kstr_id;
|
||||
static dom_string *kstr_colspan;
|
||||
static dom_string *kstr_rowspan;
|
||||
static dom_string *kstr_style;
|
||||
static dom_string *kstr_href;
|
||||
static dom_string *kstr_name;
|
||||
static dom_string *kstr_target;
|
||||
static dom_string *kstr_alt;
|
||||
static dom_string *kstr_src;
|
||||
static dom_string *kstr_codebase;
|
||||
static dom_string *kstr_classid;
|
||||
static dom_string *kstr_data;
|
||||
static dom_string *kstr_rows;
|
||||
static dom_string *kstr_cols;
|
||||
static dom_string *kstr_border;
|
||||
static dom_string *kstr_frameborder;
|
||||
static dom_string *kstr_bordercolor;
|
||||
static dom_string *kstr_noresize;
|
||||
static dom_string *kstr_scrolling;
|
||||
static dom_string *kstr_marginwidth;
|
||||
static dom_string *kstr_marginheight;
|
||||
static dom_string *kstr_type;
|
||||
static dom_string *kstr_value;
|
||||
static dom_string *kstr_selected;
|
||||
|
||||
nserror box_construct_init(void)
|
||||
{
|
||||
dom_exception err;
|
||||
|
||||
err = dom_string_create_interned((const uint8_t *) "__ns_box",
|
||||
SLEN("__ns_box"), &kstr_box_key);
|
||||
if (err != DOM_NO_ERR || kstr_box_key == NULL)
|
||||
goto error;
|
||||
|
||||
#define BOX_CONSTRUCT_STRING_INTERN(NAME) \
|
||||
err = dom_string_create_interned((const uint8_t *)#NAME, \
|
||||
sizeof(#NAME) - 1, \
|
||||
&kstr_##NAME ); \
|
||||
if ((err != DOM_NO_ERR) || (kstr_##NAME == NULL)) \
|
||||
goto error
|
||||
|
||||
BOX_CONSTRUCT_STRING_INTERN(title);
|
||||
BOX_CONSTRUCT_STRING_INTERN(id);
|
||||
BOX_CONSTRUCT_STRING_INTERN(colspan);
|
||||
BOX_CONSTRUCT_STRING_INTERN(rowspan);
|
||||
BOX_CONSTRUCT_STRING_INTERN(style);
|
||||
BOX_CONSTRUCT_STRING_INTERN(href);
|
||||
BOX_CONSTRUCT_STRING_INTERN(name);
|
||||
BOX_CONSTRUCT_STRING_INTERN(target);
|
||||
BOX_CONSTRUCT_STRING_INTERN(alt);
|
||||
BOX_CONSTRUCT_STRING_INTERN(src);
|
||||
BOX_CONSTRUCT_STRING_INTERN(codebase);
|
||||
BOX_CONSTRUCT_STRING_INTERN(classid);
|
||||
BOX_CONSTRUCT_STRING_INTERN(data);
|
||||
BOX_CONSTRUCT_STRING_INTERN(rows);
|
||||
BOX_CONSTRUCT_STRING_INTERN(cols);
|
||||
BOX_CONSTRUCT_STRING_INTERN(border);
|
||||
BOX_CONSTRUCT_STRING_INTERN(frameborder);
|
||||
BOX_CONSTRUCT_STRING_INTERN(bordercolor);
|
||||
BOX_CONSTRUCT_STRING_INTERN(noresize);
|
||||
BOX_CONSTRUCT_STRING_INTERN(scrolling);
|
||||
BOX_CONSTRUCT_STRING_INTERN(marginwidth);
|
||||
BOX_CONSTRUCT_STRING_INTERN(marginheight);
|
||||
BOX_CONSTRUCT_STRING_INTERN(type);
|
||||
BOX_CONSTRUCT_STRING_INTERN(value);
|
||||
BOX_CONSTRUCT_STRING_INTERN(selected);
|
||||
|
||||
#undef BOX_CONSTRUCT_STRING_INTERN
|
||||
|
||||
return NSERROR_OK;
|
||||
|
||||
error:
|
||||
return NSERROR_NOMEM;
|
||||
}
|
||||
|
||||
void box_construct_fini(void)
|
||||
{
|
||||
if (kstr_box_key != NULL) {
|
||||
dom_string_unref(kstr_box_key);
|
||||
kstr_box_key = NULL;
|
||||
}
|
||||
|
||||
#define BOX_CONSTRUCT_STRING_UNREF(NAME) \
|
||||
do { \
|
||||
if (kstr_##NAME != NULL) { \
|
||||
dom_string_unref(kstr_##NAME); \
|
||||
kstr_##NAME = NULL; \
|
||||
} \
|
||||
} while (0) \
|
||||
|
||||
BOX_CONSTRUCT_STRING_UNREF(title);
|
||||
BOX_CONSTRUCT_STRING_UNREF(id);
|
||||
BOX_CONSTRUCT_STRING_UNREF(colspan);
|
||||
BOX_CONSTRUCT_STRING_UNREF(rowspan);
|
||||
BOX_CONSTRUCT_STRING_UNREF(style);
|
||||
BOX_CONSTRUCT_STRING_UNREF(href);
|
||||
BOX_CONSTRUCT_STRING_UNREF(name);
|
||||
BOX_CONSTRUCT_STRING_UNREF(target);
|
||||
BOX_CONSTRUCT_STRING_UNREF(alt);
|
||||
BOX_CONSTRUCT_STRING_UNREF(src);
|
||||
BOX_CONSTRUCT_STRING_UNREF(codebase);
|
||||
BOX_CONSTRUCT_STRING_UNREF(classid);
|
||||
BOX_CONSTRUCT_STRING_UNREF(data);
|
||||
BOX_CONSTRUCT_STRING_UNREF(rows);
|
||||
BOX_CONSTRUCT_STRING_UNREF(cols);
|
||||
BOX_CONSTRUCT_STRING_UNREF(border);
|
||||
BOX_CONSTRUCT_STRING_UNREF(frameborder);
|
||||
BOX_CONSTRUCT_STRING_UNREF(bordercolor);
|
||||
BOX_CONSTRUCT_STRING_UNREF(noresize);
|
||||
BOX_CONSTRUCT_STRING_UNREF(scrolling);
|
||||
BOX_CONSTRUCT_STRING_UNREF(marginwidth);
|
||||
BOX_CONSTRUCT_STRING_UNREF(marginheight);
|
||||
BOX_CONSTRUCT_STRING_UNREF(type);
|
||||
BOX_CONSTRUCT_STRING_UNREF(value);
|
||||
BOX_CONSTRUCT_STRING_UNREF(selected);
|
||||
|
||||
#undef BOX_CONSTRUCT_DOM_STRING_UNREF
|
||||
}
|
||||
|
||||
static inline struct box *box_for_node(dom_node *n)
|
||||
{
|
||||
struct box *box = NULL;
|
||||
dom_exception err;
|
||||
|
||||
err = dom_node_get_user_data(n, kstr_box_key, (void *) &box);
|
||||
err = dom_node_get_user_data(n, corestring_dom___ns_key_box_node_data,
|
||||
(void *) &box);
|
||||
if (err != DOM_NO_ERR)
|
||||
return NULL;
|
||||
|
||||
@ -859,7 +738,7 @@ bool box_construct_element(struct box_construct_ctx *ctx,
|
||||
return false;
|
||||
|
||||
/* Extract title attribute, if present */
|
||||
err = dom_element_get_attribute(ctx->n, kstr_title, &title0);
|
||||
err = dom_element_get_attribute(ctx->n, corestring_dom_title, &title0);
|
||||
if (err != DOM_NO_ERR)
|
||||
return false;
|
||||
|
||||
@ -880,7 +759,7 @@ bool box_construct_element(struct box_construct_ctx *ctx,
|
||||
}
|
||||
|
||||
/* Extract id attribute, if present */
|
||||
err = dom_element_get_attribute(ctx->n, kstr_id, &s);
|
||||
err = dom_element_get_attribute(ctx->n, corestring_dom_id, &s);
|
||||
if (err != DOM_NO_ERR)
|
||||
return false;
|
||||
|
||||
@ -903,7 +782,7 @@ bool box_construct_element(struct box_construct_ctx *ctx,
|
||||
ctx->root_box = box;
|
||||
|
||||
/* Deal with colspan/rowspan */
|
||||
err = dom_element_get_attribute(ctx->n, kstr_colspan, &s);
|
||||
err = dom_element_get_attribute(ctx->n, corestring_dom_colspan, &s);
|
||||
if (err != DOM_NO_ERR)
|
||||
return false;
|
||||
|
||||
@ -916,7 +795,7 @@ bool box_construct_element(struct box_construct_ctx *ctx,
|
||||
dom_string_unref(s);
|
||||
}
|
||||
|
||||
err = dom_element_get_attribute(ctx->n, kstr_rowspan, &s);
|
||||
err = dom_element_get_attribute(ctx->n, corestring_dom_rowspan, &s);
|
||||
if (err != DOM_NO_ERR)
|
||||
return false;
|
||||
|
||||
@ -1000,7 +879,8 @@ bool box_construct_element(struct box_construct_ctx *ctx,
|
||||
}
|
||||
|
||||
/* Attach DOM node to box */
|
||||
err = dom_node_set_user_data(ctx->n, kstr_box_key, box, NULL,
|
||||
err = dom_node_set_user_data(ctx->n,
|
||||
corestring_dom___ns_key_box_node_data, box, NULL,
|
||||
(void *) &old_box);
|
||||
if (err != DOM_NO_ERR)
|
||||
return false;
|
||||
@ -1433,7 +1313,7 @@ css_select_results *box_get_style(html_content *c,
|
||||
nscss_select_ctx ctx;
|
||||
|
||||
/* Firstly, construct inline stylesheet, if any */
|
||||
err = dom_element_get_attribute(n, kstr_style, &s);
|
||||
err = dom_element_get_attribute(n, corestring_dom_style, &s);
|
||||
if (err != DOM_NO_ERR)
|
||||
return NULL;
|
||||
|
||||
@ -1575,7 +1455,7 @@ bool box_a(BOX_SPECIAL_PARAMS)
|
||||
dom_string *s;
|
||||
dom_exception err;
|
||||
|
||||
err = dom_element_get_attribute(n, kstr_href, &s);
|
||||
err = dom_element_get_attribute(n, corestring_dom_href, &s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
ok = box_extract_link(dom_string_data(s),
|
||||
content->base_url, &url);
|
||||
@ -1590,7 +1470,7 @@ bool box_a(BOX_SPECIAL_PARAMS)
|
||||
}
|
||||
|
||||
/* name and id share the same namespace */
|
||||
err = dom_element_get_attribute(n, kstr_name, &s);
|
||||
err = dom_element_get_attribute(n, corestring_dom_name, &s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
lwc_string *lwc_name;
|
||||
|
||||
@ -1609,7 +1489,7 @@ bool box_a(BOX_SPECIAL_PARAMS)
|
||||
}
|
||||
|
||||
/* target frame [16.3] */
|
||||
err = dom_element_get_attribute(n, kstr_target, &s);
|
||||
err = dom_element_get_attribute(n, corestring_dom_target, &s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
if (dom_string_caseless_lwc_isequal(s,
|
||||
corestring_lwc__blank))
|
||||
@ -1663,7 +1543,7 @@ bool box_image(BOX_SPECIAL_PARAMS)
|
||||
return true;
|
||||
|
||||
/* handle alt text */
|
||||
err = dom_element_get_attribute(n, kstr_alt, &s);
|
||||
err = dom_element_get_attribute(n, corestring_dom_alt, &s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
char *alt = squash_whitespace(dom_string_data(s));
|
||||
dom_string_unref(s);
|
||||
@ -1687,7 +1567,7 @@ bool box_image(BOX_SPECIAL_PARAMS)
|
||||
box->usemap++;
|
||||
|
||||
/* get image URL */
|
||||
err = dom_element_get_attribute(n, kstr_src, &s);
|
||||
err = dom_element_get_attribute(n, corestring_dom_src, &s);
|
||||
if (err != DOM_NO_ERR || s == NULL)
|
||||
return true;
|
||||
|
||||
@ -1790,7 +1670,7 @@ bool box_object(BOX_SPECIAL_PARAMS)
|
||||
|
||||
/* codebase, classid, and data are URLs
|
||||
* (codebase is the base for the other two) */
|
||||
err = dom_element_get_attribute(n, kstr_codebase, &codebase);
|
||||
err = dom_element_get_attribute(n, corestring_dom_codebase, &codebase);
|
||||
if (err == DOM_NO_ERR && codebase != NULL) {
|
||||
if (box_extract_link(dom_string_data(codebase),
|
||||
content->base_url,
|
||||
@ -1803,7 +1683,7 @@ bool box_object(BOX_SPECIAL_PARAMS)
|
||||
if (params->codebase == NULL)
|
||||
params->codebase = nsurl_ref(content->base_url);
|
||||
|
||||
err = dom_element_get_attribute(n, kstr_classid, &classid);
|
||||
err = dom_element_get_attribute(n, corestring_dom_classid, &classid);
|
||||
if (err == DOM_NO_ERR && classid != NULL) {
|
||||
if (box_extract_link(dom_string_data(classid), params->codebase,
|
||||
¶ms->classid) == false) {
|
||||
@ -1813,7 +1693,7 @@ bool box_object(BOX_SPECIAL_PARAMS)
|
||||
dom_string_unref(classid);
|
||||
}
|
||||
|
||||
err = dom_element_get_attribute(n, kstr_data, &data);
|
||||
err = dom_element_get_attribute(n, corestring_dom_data, &data);
|
||||
if (err == DOM_NO_ERR && data != NULL) {
|
||||
if (box_extract_link(dom_string_data(data), params->codebase,
|
||||
¶ms->data) == false) {
|
||||
@ -2052,7 +1932,7 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
|
||||
colour default_border_colour = 0x000000;
|
||||
|
||||
/* parse rows and columns */
|
||||
err = dom_element_get_attribute(n, kstr_rows, &s);
|
||||
err = dom_element_get_attribute(n, corestring_dom_rows, &s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
row_height = box_parse_multi_lengths(dom_string_data(s), &rows);
|
||||
dom_string_unref(s);
|
||||
@ -2066,7 +1946,7 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
|
||||
row_height->unit = FRAME_DIMENSION_PERCENT;
|
||||
}
|
||||
|
||||
err = dom_element_get_attribute(n, kstr_cols, &s);
|
||||
err = dom_element_get_attribute(n, corestring_dom_cols, &s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
col_width = box_parse_multi_lengths(dom_string_data(s), &cols);
|
||||
dom_string_unref(s);
|
||||
@ -2085,7 +1965,7 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
|
||||
}
|
||||
|
||||
/* common extension: border="0|1" to control all children */
|
||||
err = dom_element_get_attribute(n, kstr_border, &s);
|
||||
err = dom_element_get_attribute(n, corestring_dom_border, &s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
if ((dom_string_data(s)[0] == '0') &&
|
||||
(dom_string_data(s)[1] == '\0'))
|
||||
@ -2094,7 +1974,7 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
|
||||
}
|
||||
|
||||
/* common extension: frameborder="yes|no" to control all children */
|
||||
err = dom_element_get_attribute(n, kstr_frameborder, &s);
|
||||
err = dom_element_get_attribute(n, corestring_dom_frameborder, &s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
if (dom_string_caseless_lwc_isequal(s,
|
||||
corestring_lwc_no) == 0)
|
||||
@ -2104,7 +1984,7 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
|
||||
|
||||
/* common extension: bordercolor="#RRGGBB|<named colour>" to control
|
||||
*all children */
|
||||
err = dom_element_get_attribute(n, kstr_bordercolor, &s);
|
||||
err = dom_element_get_attribute(n, corestring_dom_bordercolor, &s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
css_color color;
|
||||
|
||||
@ -2233,7 +2113,7 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
|
||||
|
||||
/* get frame URL (not required) */
|
||||
url = NULL;
|
||||
err = dom_element_get_attribute(c, kstr_src, &s);
|
||||
err = dom_element_get_attribute(c, corestring_dom_src, &s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
box_extract_link(dom_string_data(s),
|
||||
content->base_url, &url);
|
||||
@ -2250,17 +2130,17 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
|
||||
}
|
||||
|
||||
/* fill in specified values */
|
||||
err = dom_element_get_attribute(c, kstr_name, &s);
|
||||
err = dom_element_get_attribute(c, corestring_dom_name, &s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
frame->name = talloc_strdup(content->bctx,
|
||||
dom_string_data(s));
|
||||
dom_string_unref(s);
|
||||
}
|
||||
|
||||
dom_element_has_attribute(c, kstr_noresize,
|
||||
dom_element_has_attribute(c, corestring_dom_noresize,
|
||||
&frame->no_resize);
|
||||
|
||||
err = dom_element_get_attribute(c, kstr_frameborder,
|
||||
err = dom_element_get_attribute(c, corestring_dom_frameborder,
|
||||
&s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
i = atoi(dom_string_data(s));
|
||||
@ -2268,7 +2148,7 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
|
||||
dom_string_unref(s);
|
||||
}
|
||||
|
||||
err = dom_element_get_attribute(c, kstr_scrolling, &s);
|
||||
err = dom_element_get_attribute(c, corestring_dom_scrolling, &s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
if (dom_string_caseless_lwc_isequal(s,
|
||||
corestring_lwc_yes))
|
||||
@ -2279,21 +2159,21 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
|
||||
dom_string_unref(s);
|
||||
}
|
||||
|
||||
err = dom_element_get_attribute(c, kstr_marginwidth,
|
||||
err = dom_element_get_attribute(c, corestring_dom_marginwidth,
|
||||
&s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
frame->margin_width = atoi(dom_string_data(s));
|
||||
dom_string_unref(s);
|
||||
}
|
||||
|
||||
err = dom_element_get_attribute(c, kstr_marginheight,
|
||||
err = dom_element_get_attribute(c, corestring_dom_marginheight,
|
||||
&s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
frame->margin_height = atoi(dom_string_data(s));
|
||||
dom_string_unref(s);
|
||||
}
|
||||
|
||||
err = dom_element_get_attribute(c, kstr_bordercolor,
|
||||
err = dom_element_get_attribute(c, corestring_dom_bordercolor,
|
||||
&s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
css_color color;
|
||||
@ -2363,7 +2243,7 @@ bool box_iframe(BOX_SPECIAL_PARAMS)
|
||||
return true;
|
||||
|
||||
/* get frame URL */
|
||||
err = dom_element_get_attribute(n, kstr_src, &s);
|
||||
err = dom_element_get_attribute(n, corestring_dom_src, &s);
|
||||
if (err != DOM_NO_ERR || s == NULL)
|
||||
return true;
|
||||
if (box_extract_link(dom_string_data(s), content->base_url,
|
||||
@ -2403,20 +2283,20 @@ bool box_iframe(BOX_SPECIAL_PARAMS)
|
||||
content->iframe = iframe;
|
||||
|
||||
/* fill in specified values */
|
||||
err = dom_element_get_attribute(n, kstr_name, &s);
|
||||
err = dom_element_get_attribute(n, corestring_dom_name, &s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
iframe->name = talloc_strdup(content->bctx, dom_string_data(s));
|
||||
dom_string_unref(s);
|
||||
}
|
||||
|
||||
err = dom_element_get_attribute(n, kstr_frameborder, &s);
|
||||
err = dom_element_get_attribute(n, corestring_dom_frameborder, &s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
i = atoi(dom_string_data(s));
|
||||
iframe->border = (i != 0);
|
||||
dom_string_unref(s);
|
||||
}
|
||||
|
||||
err = dom_element_get_attribute(n, kstr_bordercolor, &s);
|
||||
err = dom_element_get_attribute(n, corestring_dom_bordercolor, &s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
css_color color;
|
||||
|
||||
@ -2426,7 +2306,7 @@ bool box_iframe(BOX_SPECIAL_PARAMS)
|
||||
dom_string_unref(s);
|
||||
}
|
||||
|
||||
err = dom_element_get_attribute(n, kstr_scrolling, &s);
|
||||
err = dom_element_get_attribute(n, corestring_dom_scrolling, &s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
if (dom_string_caseless_lwc_isequal(s,
|
||||
corestring_lwc_yes))
|
||||
@ -2437,13 +2317,13 @@ bool box_iframe(BOX_SPECIAL_PARAMS)
|
||||
dom_string_unref(s);
|
||||
}
|
||||
|
||||
err = dom_element_get_attribute(n, kstr_marginwidth, &s);
|
||||
err = dom_element_get_attribute(n, corestring_dom_marginwidth, &s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
iframe->margin_width = atoi(dom_string_data(s));
|
||||
dom_string_unref(s);
|
||||
}
|
||||
|
||||
err = dom_element_get_attribute(n, kstr_marginheight, &s);
|
||||
err = dom_element_get_attribute(n, corestring_dom_marginheight, &s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
iframe->margin_height = atoi(dom_string_data(s));
|
||||
dom_string_unref(s);
|
||||
@ -2504,7 +2384,7 @@ bool box_input(BOX_SPECIAL_PARAMS)
|
||||
nsurl *url;
|
||||
nserror error;
|
||||
|
||||
dom_element_get_attribute(n, kstr_type, &type);
|
||||
dom_element_get_attribute(n, corestring_dom_type, &type);
|
||||
|
||||
gadget = html_forms_get_control_for_node(content->forms, n);
|
||||
if (gadget == NULL)
|
||||
@ -2589,7 +2469,7 @@ bool box_input(BOX_SPECIAL_PARAMS)
|
||||
nsoption_bool(foreground_images) == true) {
|
||||
dom_string *s;
|
||||
|
||||
err = dom_element_get_attribute(n, kstr_src, &s);
|
||||
err = dom_element_get_attribute(n, corestring_dom_src, &s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
error = nsurl_join(content->base_url,
|
||||
dom_string_data(s), &url);
|
||||
@ -2837,7 +2717,7 @@ bool box_select_add_option(struct form_control *control, dom_node *n)
|
||||
if (text == NULL)
|
||||
goto no_memory;
|
||||
|
||||
err = dom_element_get_attribute(n, kstr_value, &s);
|
||||
err = dom_element_get_attribute(n, corestring_dom_value, &s);
|
||||
if (err == DOM_NO_ERR && s != NULL) {
|
||||
value = strdup(dom_string_data(s));
|
||||
dom_string_unref(s);
|
||||
@ -2848,7 +2728,7 @@ bool box_select_add_option(struct form_control *control, dom_node *n)
|
||||
if (value == NULL)
|
||||
goto no_memory;
|
||||
|
||||
dom_element_has_attribute(n, kstr_selected, &selected);
|
||||
dom_element_has_attribute(n, corestring_dom_selected, &selected);
|
||||
|
||||
/* replace spaces/TABs with hard spaces to prevent line wrapping */
|
||||
text_nowrap = cnv_space2nbsp(text);
|
||||
@ -2924,7 +2804,7 @@ bool box_embed(BOX_SPECIAL_PARAMS)
|
||||
params->params = NULL;
|
||||
|
||||
/* src is a URL */
|
||||
err = dom_element_get_attribute(n, kstr_src, &src);
|
||||
err = dom_element_get_attribute(n, corestring_dom_src, &src);
|
||||
if (err != DOM_NO_ERR || src == NULL)
|
||||
return true;
|
||||
if (box_extract_link(dom_string_data(src), content->base_url,
|
||||
|
@ -2180,8 +2180,6 @@ static content_type html_content_type(void)
|
||||
|
||||
static void html_fini(void)
|
||||
{
|
||||
box_construct_fini();
|
||||
|
||||
html_css_fini();
|
||||
}
|
||||
|
||||
@ -2221,10 +2219,6 @@ nserror html_init(void)
|
||||
if (error != NSERROR_OK)
|
||||
goto error;
|
||||
|
||||
error = box_construct_init();
|
||||
if (error != NSERROR_OK)
|
||||
goto error;
|
||||
|
||||
for (i = 0; i < NOF_ELEMENTS(html_types); i++) {
|
||||
error = content_factory_register_handler(html_types[i],
|
||||
&html_content_handler);
|
||||
|
@ -116,6 +116,7 @@ lwc_string *corestring_lwc__top;
|
||||
|
||||
/* dom_string strings */
|
||||
dom_string *corestring_dom_a;
|
||||
dom_string *corestring_dom_alt;
|
||||
dom_string *corestring_dom_abort;
|
||||
dom_string *corestring_dom_afterprint;
|
||||
dom_string *corestring_dom_align;
|
||||
@ -136,14 +137,18 @@ dom_string *corestring_dom_cellspacing;
|
||||
dom_string *corestring_dom_change;
|
||||
dom_string *corestring_dom_charset;
|
||||
dom_string *corestring_dom_class;
|
||||
dom_string *corestring_dom_classid;
|
||||
dom_string *corestring_dom_click;
|
||||
dom_string *corestring_dom_close;
|
||||
dom_string *corestring_dom_codebase;
|
||||
dom_string *corestring_dom_color;
|
||||
dom_string *corestring_dom_cols;
|
||||
dom_string *corestring_dom_colspan;
|
||||
dom_string *corestring_dom_content;
|
||||
dom_string *corestring_dom_contextmenu;
|
||||
dom_string *corestring_dom_coords;
|
||||
dom_string *corestring_dom_cuechange;
|
||||
dom_string *corestring_dom_data;
|
||||
dom_string *corestring_dom_dblclick;
|
||||
dom_string *corestring_dom_defer;
|
||||
dom_string *corestring_dom_DOMAttrModified;
|
||||
@ -162,6 +167,7 @@ dom_string *corestring_dom_emptied;
|
||||
dom_string *corestring_dom_ended;
|
||||
dom_string *corestring_dom_error;
|
||||
dom_string *corestring_dom_focus;
|
||||
dom_string *corestring_dom_frameborder;
|
||||
dom_string *corestring_dom_hashchange;
|
||||
dom_string *corestring_dom_height;
|
||||
dom_string *corestring_dom_href;
|
||||
@ -180,6 +186,8 @@ dom_string *corestring_dom_loadeddata;
|
||||
dom_string *corestring_dom_loadedmetadata;
|
||||
dom_string *corestring_dom_loadstart;
|
||||
dom_string *corestring_dom_map;
|
||||
dom_string *corestring_dom_marginheight;
|
||||
dom_string *corestring_dom_marginwidth;
|
||||
dom_string *corestring_dom_media;
|
||||
dom_string *corestring_dom_message;
|
||||
dom_string *corestring_dom_mousedown;
|
||||
@ -190,6 +198,7 @@ dom_string *corestring_dom_mouseup;
|
||||
dom_string *corestring_dom_mousewheel;
|
||||
dom_string *corestring_dom_name;
|
||||
dom_string *corestring_dom_nohref;
|
||||
dom_string *corestring_dom_noresize;
|
||||
dom_string *corestring_dom_offline;
|
||||
dom_string *corestring_dom_online;
|
||||
dom_string *corestring_dom_pagehide;
|
||||
@ -206,10 +215,13 @@ dom_string *corestring_dom_rel;
|
||||
dom_string *corestring_dom_reset;
|
||||
dom_string *corestring_dom_resize;
|
||||
dom_string *corestring_dom_rows;
|
||||
dom_string *corestring_dom_rowspan;
|
||||
dom_string *corestring_dom_scroll;
|
||||
dom_string *corestring_dom_scrolling;
|
||||
dom_string *corestring_dom_seeked;
|
||||
dom_string *corestring_dom_seeking;
|
||||
dom_string *corestring_dom_select;
|
||||
dom_string *corestring_dom_selected;
|
||||
dom_string *corestring_dom_shape;
|
||||
dom_string *corestring_dom_show;
|
||||
dom_string *corestring_dom_size;
|
||||
@ -224,9 +236,11 @@ dom_string *corestring_dom_target;
|
||||
dom_string *corestring_dom_text;
|
||||
dom_string *corestring_dom_text_javascript;
|
||||
dom_string *corestring_dom_timeupdate;
|
||||
dom_string *corestring_dom_title;
|
||||
dom_string *corestring_dom_type;
|
||||
dom_string *corestring_dom_unload;
|
||||
dom_string *corestring_dom_valign;
|
||||
dom_string *corestring_dom_value;
|
||||
dom_string *corestring_dom_vlink;
|
||||
dom_string *corestring_dom_volumechange;
|
||||
dom_string *corestring_dom_vspace;
|
||||
@ -242,6 +256,7 @@ dom_string *corestring_dom_radio;
|
||||
dom_string *corestring_dom_checkbox;
|
||||
dom_string *corestring_dom_file;
|
||||
dom_string *corestring_dom_on;
|
||||
dom_string *corestring_dom___ns_key_box_node_data;
|
||||
dom_string *corestring_dom___ns_key_libcss_node_data;
|
||||
dom_string *corestring_dom___ns_key_file_name_node_data;
|
||||
dom_string *corestring_dom___ns_key_image_coords_node_data;
|
||||
@ -361,6 +376,7 @@ void corestrings_fini(void)
|
||||
CSS_DOM_STRING_UNREF(abort);
|
||||
CSS_DOM_STRING_UNREF(afterprint);
|
||||
CSS_DOM_STRING_UNREF(align);
|
||||
CSS_DOM_STRING_UNREF(alt);
|
||||
CSS_DOM_STRING_UNREF(area);
|
||||
CSS_DOM_STRING_UNREF(async);
|
||||
CSS_DOM_STRING_UNREF(background);
|
||||
@ -378,14 +394,18 @@ void corestrings_fini(void)
|
||||
CSS_DOM_STRING_UNREF(change);
|
||||
CSS_DOM_STRING_UNREF(charset);
|
||||
CSS_DOM_STRING_UNREF(class);
|
||||
CSS_DOM_STRING_UNREF(classid);
|
||||
CSS_DOM_STRING_UNREF(click);
|
||||
CSS_DOM_STRING_UNREF(close);
|
||||
CSS_DOM_STRING_UNREF(codebase);
|
||||
CSS_DOM_STRING_UNREF(color);
|
||||
CSS_DOM_STRING_UNREF(cols);
|
||||
CSS_DOM_STRING_UNREF(colspan);
|
||||
CSS_DOM_STRING_UNREF(content);
|
||||
CSS_DOM_STRING_UNREF(contextmenu);
|
||||
CSS_DOM_STRING_UNREF(coords);
|
||||
CSS_DOM_STRING_UNREF(cuechange);
|
||||
CSS_DOM_STRING_UNREF(data);
|
||||
CSS_DOM_STRING_UNREF(dblclick);
|
||||
CSS_DOM_STRING_UNREF(defer);
|
||||
CSS_DOM_STRING_UNREF(DOMAttrModified);
|
||||
@ -404,6 +424,7 @@ void corestrings_fini(void)
|
||||
CSS_DOM_STRING_UNREF(ended);
|
||||
CSS_DOM_STRING_UNREF(error);
|
||||
CSS_DOM_STRING_UNREF(focus);
|
||||
CSS_DOM_STRING_UNREF(frameborder);
|
||||
CSS_DOM_STRING_UNREF(hashchange);
|
||||
CSS_DOM_STRING_UNREF(height);
|
||||
CSS_DOM_STRING_UNREF(href);
|
||||
@ -422,6 +443,8 @@ void corestrings_fini(void)
|
||||
CSS_DOM_STRING_UNREF(loadedmetadata);
|
||||
CSS_DOM_STRING_UNREF(loadstart);
|
||||
CSS_DOM_STRING_UNREF(map);
|
||||
CSS_DOM_STRING_UNREF(marginheight);
|
||||
CSS_DOM_STRING_UNREF(marginwidth);
|
||||
CSS_DOM_STRING_UNREF(media);
|
||||
CSS_DOM_STRING_UNREF(message);
|
||||
CSS_DOM_STRING_UNREF(mousedown);
|
||||
@ -432,6 +455,7 @@ void corestrings_fini(void)
|
||||
CSS_DOM_STRING_UNREF(mousewheel);
|
||||
CSS_DOM_STRING_UNREF(name);
|
||||
CSS_DOM_STRING_UNREF(nohref);
|
||||
CSS_DOM_STRING_UNREF(noresize);
|
||||
CSS_DOM_STRING_UNREF(offline);
|
||||
CSS_DOM_STRING_UNREF(online);
|
||||
CSS_DOM_STRING_UNREF(pagehide);
|
||||
@ -448,10 +472,13 @@ void corestrings_fini(void)
|
||||
CSS_DOM_STRING_UNREF(reset);
|
||||
CSS_DOM_STRING_UNREF(resize);
|
||||
CSS_DOM_STRING_UNREF(rows);
|
||||
CSS_DOM_STRING_UNREF(rowspan);
|
||||
CSS_DOM_STRING_UNREF(scroll);
|
||||
CSS_DOM_STRING_UNREF(scrolling);
|
||||
CSS_DOM_STRING_UNREF(seeked);
|
||||
CSS_DOM_STRING_UNREF(seeking);
|
||||
CSS_DOM_STRING_UNREF(select);
|
||||
CSS_DOM_STRING_UNREF(selected);
|
||||
CSS_DOM_STRING_UNREF(shape);
|
||||
CSS_DOM_STRING_UNREF(show);
|
||||
CSS_DOM_STRING_UNREF(size);
|
||||
@ -466,9 +493,11 @@ void corestrings_fini(void)
|
||||
CSS_DOM_STRING_UNREF(text);
|
||||
CSS_DOM_STRING_UNREF(text_javascript);
|
||||
CSS_DOM_STRING_UNREF(timeupdate);
|
||||
CSS_DOM_STRING_UNREF(title);
|
||||
CSS_DOM_STRING_UNREF(type);
|
||||
CSS_DOM_STRING_UNREF(unload);
|
||||
CSS_DOM_STRING_UNREF(valign);
|
||||
CSS_DOM_STRING_UNREF(value);
|
||||
CSS_DOM_STRING_UNREF(vlink);
|
||||
CSS_DOM_STRING_UNREF(volumechange);
|
||||
CSS_DOM_STRING_UNREF(vspace);
|
||||
@ -487,6 +516,7 @@ void corestrings_fini(void)
|
||||
CSS_DOM_STRING_UNREF(file);
|
||||
CSS_DOM_STRING_UNREF(on);
|
||||
/* DOM userdata keys, not really CSS */
|
||||
CSS_DOM_STRING_UNREF(__ns_key_box_node_data);
|
||||
CSS_DOM_STRING_UNREF(__ns_key_libcss_node_data);
|
||||
CSS_DOM_STRING_UNREF(__ns_key_file_name_node_data);
|
||||
CSS_DOM_STRING_UNREF(__ns_key_image_coords_node_data);
|
||||
@ -638,6 +668,7 @@ nserror corestrings_init(void)
|
||||
CSS_DOM_STRING_INTERN(abort);
|
||||
CSS_DOM_STRING_INTERN(afterprint);
|
||||
CSS_DOM_STRING_INTERN(align);
|
||||
CSS_DOM_STRING_INTERN(alt);
|
||||
CSS_DOM_STRING_INTERN(area);
|
||||
CSS_DOM_STRING_INTERN(async);
|
||||
CSS_DOM_STRING_INTERN(background);
|
||||
@ -655,14 +686,18 @@ nserror corestrings_init(void)
|
||||
CSS_DOM_STRING_INTERN(change);
|
||||
CSS_DOM_STRING_INTERN(charset);
|
||||
CSS_DOM_STRING_INTERN(class);
|
||||
CSS_DOM_STRING_INTERN(classid);
|
||||
CSS_DOM_STRING_INTERN(click);
|
||||
CSS_DOM_STRING_INTERN(close);
|
||||
CSS_DOM_STRING_INTERN(codebase);
|
||||
CSS_DOM_STRING_INTERN(color);
|
||||
CSS_DOM_STRING_INTERN(cols);
|
||||
CSS_DOM_STRING_INTERN(colspan);
|
||||
CSS_DOM_STRING_INTERN(content);
|
||||
CSS_DOM_STRING_INTERN(contextmenu);
|
||||
CSS_DOM_STRING_INTERN(coords);
|
||||
CSS_DOM_STRING_INTERN(cuechange);
|
||||
CSS_DOM_STRING_INTERN(data);
|
||||
CSS_DOM_STRING_INTERN(dblclick);
|
||||
CSS_DOM_STRING_INTERN(defer);
|
||||
CSS_DOM_STRING_INTERN(DOMAttrModified);
|
||||
@ -681,6 +716,7 @@ nserror corestrings_init(void)
|
||||
CSS_DOM_STRING_INTERN(ended);
|
||||
CSS_DOM_STRING_INTERN(error);
|
||||
CSS_DOM_STRING_INTERN(focus);
|
||||
CSS_DOM_STRING_INTERN(frameborder);
|
||||
CSS_DOM_STRING_INTERN(hashchange);
|
||||
CSS_DOM_STRING_INTERN(height);
|
||||
CSS_DOM_STRING_INTERN(href);
|
||||
@ -699,6 +735,8 @@ nserror corestrings_init(void)
|
||||
CSS_DOM_STRING_INTERN(loadedmetadata);
|
||||
CSS_DOM_STRING_INTERN(loadstart);
|
||||
CSS_DOM_STRING_INTERN(map);
|
||||
CSS_DOM_STRING_INTERN(marginheight);
|
||||
CSS_DOM_STRING_INTERN(marginwidth);
|
||||
CSS_DOM_STRING_INTERN(media);
|
||||
CSS_DOM_STRING_INTERN(message);
|
||||
CSS_DOM_STRING_INTERN(mousedown);
|
||||
@ -709,6 +747,7 @@ nserror corestrings_init(void)
|
||||
CSS_DOM_STRING_INTERN(mousewheel);
|
||||
CSS_DOM_STRING_INTERN(name);
|
||||
CSS_DOM_STRING_INTERN(nohref);
|
||||
CSS_DOM_STRING_INTERN(noresize);
|
||||
CSS_DOM_STRING_INTERN(offline);
|
||||
CSS_DOM_STRING_INTERN(online);
|
||||
CSS_DOM_STRING_INTERN(pagehide);
|
||||
@ -725,10 +764,13 @@ nserror corestrings_init(void)
|
||||
CSS_DOM_STRING_INTERN(reset);
|
||||
CSS_DOM_STRING_INTERN(resize);
|
||||
CSS_DOM_STRING_INTERN(rows);
|
||||
CSS_DOM_STRING_INTERN(rowspan);
|
||||
CSS_DOM_STRING_INTERN(scroll);
|
||||
CSS_DOM_STRING_INTERN(scrolling);
|
||||
CSS_DOM_STRING_INTERN(seeked);
|
||||
CSS_DOM_STRING_INTERN(seeking);
|
||||
CSS_DOM_STRING_INTERN(select);
|
||||
CSS_DOM_STRING_INTERN(selected);
|
||||
CSS_DOM_STRING_INTERN(shape);
|
||||
CSS_DOM_STRING_INTERN(show);
|
||||
CSS_DOM_STRING_INTERN(size);
|
||||
@ -742,9 +784,11 @@ nserror corestrings_init(void)
|
||||
CSS_DOM_STRING_INTERN(target);
|
||||
CSS_DOM_STRING_INTERN(text);
|
||||
CSS_DOM_STRING_INTERN(timeupdate);
|
||||
CSS_DOM_STRING_INTERN(title);
|
||||
CSS_DOM_STRING_INTERN(type);
|
||||
CSS_DOM_STRING_INTERN(unload);
|
||||
CSS_DOM_STRING_INTERN(valign);
|
||||
CSS_DOM_STRING_INTERN(value);
|
||||
CSS_DOM_STRING_INTERN(vlink);
|
||||
CSS_DOM_STRING_INTERN(volumechange);
|
||||
CSS_DOM_STRING_INTERN(vspace);
|
||||
@ -763,6 +807,7 @@ nserror corestrings_init(void)
|
||||
CSS_DOM_STRING_INTERN(file);
|
||||
CSS_DOM_STRING_INTERN(on);
|
||||
/* DOM userdata keys, not really CSS */
|
||||
CSS_DOM_STRING_INTERN(__ns_key_box_node_data);
|
||||
CSS_DOM_STRING_INTERN(__ns_key_libcss_node_data);
|
||||
CSS_DOM_STRING_INTERN(__ns_key_file_name_node_data);
|
||||
CSS_DOM_STRING_INTERN(__ns_key_image_coords_node_data);
|
||||
|
@ -122,6 +122,7 @@ struct dom_string;
|
||||
|
||||
/* dom_string strings */
|
||||
extern struct dom_string *corestring_dom_a;
|
||||
extern struct dom_string *corestring_dom_alt;
|
||||
extern struct dom_string *corestring_dom_abort;
|
||||
extern struct dom_string *corestring_dom_afterprint;
|
||||
extern struct dom_string *corestring_dom_align;
|
||||
@ -142,14 +143,18 @@ extern struct dom_string *corestring_dom_cellspacing;
|
||||
extern struct dom_string *corestring_dom_change;
|
||||
extern struct dom_string *corestring_dom_charset;
|
||||
extern struct dom_string *corestring_dom_class;
|
||||
extern struct dom_string *corestring_dom_classid;
|
||||
extern struct dom_string *corestring_dom_click;
|
||||
extern struct dom_string *corestring_dom_close;
|
||||
extern struct dom_string *corestring_dom_codebase;
|
||||
extern struct dom_string *corestring_dom_color;
|
||||
extern struct dom_string *corestring_dom_cols;
|
||||
extern struct dom_string *corestring_dom_colspan;
|
||||
extern struct dom_string *corestring_dom_content;
|
||||
extern struct dom_string *corestring_dom_contextmenu;
|
||||
extern struct dom_string *corestring_dom_coords;
|
||||
extern struct dom_string *corestring_dom_cuechange;
|
||||
extern struct dom_string *corestring_dom_data;
|
||||
extern struct dom_string *corestring_dom_dblclick;
|
||||
extern struct dom_string *corestring_dom_defer;
|
||||
extern struct dom_string *corestring_dom_DOMAttrModified;
|
||||
@ -168,6 +173,7 @@ extern struct dom_string *corestring_dom_emptied;
|
||||
extern struct dom_string *corestring_dom_ended;
|
||||
extern struct dom_string *corestring_dom_error;
|
||||
extern struct dom_string *corestring_dom_focus;
|
||||
extern struct dom_string *corestring_dom_frameborder;
|
||||
extern struct dom_string *corestring_dom_hashchange;
|
||||
extern struct dom_string *corestring_dom_height;
|
||||
extern struct dom_string *corestring_dom_href;
|
||||
@ -186,6 +192,8 @@ extern struct dom_string *corestring_dom_loadeddata;
|
||||
extern struct dom_string *corestring_dom_loadedmetadata;
|
||||
extern struct dom_string *corestring_dom_loadstart;
|
||||
extern struct dom_string *corestring_dom_map;
|
||||
extern struct dom_string *corestring_dom_marginheight;
|
||||
extern struct dom_string *corestring_dom_marginwidth;
|
||||
extern struct dom_string *corestring_dom_media;
|
||||
extern struct dom_string *corestring_dom_message;
|
||||
extern struct dom_string *corestring_dom_mousedown;
|
||||
@ -196,6 +204,7 @@ extern struct dom_string *corestring_dom_mouseup;
|
||||
extern struct dom_string *corestring_dom_mousewheel;
|
||||
extern struct dom_string *corestring_dom_name;
|
||||
extern struct dom_string *corestring_dom_nohref;
|
||||
extern struct dom_string *corestring_dom_noresize;
|
||||
extern struct dom_string *corestring_dom_offline;
|
||||
extern struct dom_string *corestring_dom_online;
|
||||
extern struct dom_string *corestring_dom_pagehide;
|
||||
@ -212,10 +221,13 @@ extern struct dom_string *corestring_dom_rel;
|
||||
extern struct dom_string *corestring_dom_reset;
|
||||
extern struct dom_string *corestring_dom_resize;
|
||||
extern struct dom_string *corestring_dom_rows;
|
||||
extern struct dom_string *corestring_dom_rowspan;
|
||||
extern struct dom_string *corestring_dom_scroll;
|
||||
extern struct dom_string *corestring_dom_scrolling;
|
||||
extern struct dom_string *corestring_dom_seeked;
|
||||
extern struct dom_string *corestring_dom_seeking;
|
||||
extern struct dom_string *corestring_dom_select;
|
||||
extern struct dom_string *corestring_dom_selected;
|
||||
extern struct dom_string *corestring_dom_shape;
|
||||
extern struct dom_string *corestring_dom_show;
|
||||
extern struct dom_string *corestring_dom_size;
|
||||
@ -230,9 +242,11 @@ extern struct dom_string *corestring_dom_target;
|
||||
extern struct dom_string *corestring_dom_text;
|
||||
extern struct dom_string *corestring_dom_text_javascript;
|
||||
extern struct dom_string *corestring_dom_timeupdate;
|
||||
extern struct dom_string *corestring_dom_title;
|
||||
extern struct dom_string *corestring_dom_type;
|
||||
extern struct dom_string *corestring_dom_unload;
|
||||
extern struct dom_string *corestring_dom_valign;
|
||||
extern struct dom_string *corestring_dom_value;
|
||||
extern struct dom_string *corestring_dom_vlink;
|
||||
extern struct dom_string *corestring_dom_volumechange;
|
||||
extern struct dom_string *corestring_dom_vspace;
|
||||
@ -253,6 +267,7 @@ extern struct dom_string *corestring_dom_checkbox;
|
||||
extern struct dom_string *corestring_dom_file;
|
||||
extern struct dom_string *corestring_dom_on;
|
||||
/* DOM userdata keys */
|
||||
extern struct dom_string *corestring_dom___ns_key_box_node_data;
|
||||
extern struct dom_string *corestring_dom___ns_key_libcss_node_data;
|
||||
extern struct dom_string *corestring_dom___ns_key_file_name_node_data;
|
||||
extern struct dom_string *corestring_dom___ns_key_image_coords_node_data;
|
||||
|
Loading…
Reference in New Issue
Block a user