summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/box.c4
-rw-r--r--render/box_construct.c29
-rw-r--r--render/box_normalise.c27
-rw-r--r--render/box_textarea.c4
-rw-r--r--render/form.c142
-rw-r--r--render/html.c82
-rw-r--r--render/html_css.c43
-rw-r--r--render/html_css_fetcher.c11
-rw-r--r--render/html_interaction.c36
-rw-r--r--render/html_object.c35
-rw-r--r--render/html_script.c98
-rw-r--r--render/imagemap.c24
-rw-r--r--render/layout.c261
-rw-r--r--render/search.c4
-rw-r--r--render/table.c59
-rw-r--r--render/textplain.c16
16 files changed, 506 insertions, 369 deletions
diff --git a/render/box.c b/render/box.c
index 77cc15bc3..8b9c89ee6 100644
--- a/render/box.c
+++ b/render/box.c
@@ -1155,7 +1155,7 @@ bool box_handle_scrollbars(struct content *c, struct box *box,
if (box->scroll_y == NULL) {
data = malloc(sizeof(struct html_scrollbar_data));
if (data == NULL) {
- LOG("malloc failed");
+ NSLOG(netsurf, INFO, "malloc failed");
guit->misc->warning("NoMemory", 0);
return false;
}
@@ -1176,7 +1176,7 @@ bool box_handle_scrollbars(struct content *c, struct box *box,
if (box->scroll_x == NULL) {
data = malloc(sizeof(struct html_scrollbar_data));
if (data == NULL) {
- LOG("malloc failed");
+ NSLOG(netsurf, INFO, "malloc failed");
guit->misc->warning("NoMemory", 0);
return false;
}
diff --git a/render/box_construct.c b/render/box_construct.c
index d0ffd9d83..1982622f9 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -46,6 +46,7 @@
#include "content/content_protected.h"
#include "css/hints.h"
#include "css/select.h"
+#include "css/utils.h"
#include "desktop/gui_internal.h"
#include "render/box.h"
@@ -612,7 +613,7 @@ static void box_construct_generate(dom_node *n, html_content *content,
}
/* create box for this element */
- computed_display = css_computed_display(style, box_is_root(n));
+ computed_display = ns_computed_display(style, box_is_root(n));
if (computed_display == CSS_DISPLAY_BLOCK ||
computed_display == CSS_DISPLAY_TABLE) {
/* currently only support block level boxes */
@@ -625,7 +626,7 @@ static void box_construct_generate(dom_node *n, html_content *content,
}
/* set box type from computed display */
- gen->type = box_map[css_computed_display(
+ gen->type = box_map[ns_computed_display(
style, box_is_root(n))];
box_add_child(box, gen);
@@ -831,11 +832,11 @@ bool box_construct_element(struct box_construct_ctx *ctx,
if ((css_computed_position(box->style) == CSS_POSITION_ABSOLUTE ||
css_computed_position(box->style) ==
CSS_POSITION_FIXED) &&
- (css_computed_display_static(box->style) ==
+ (ns_computed_display_static(box->style) ==
CSS_DISPLAY_INLINE ||
- css_computed_display_static(box->style) ==
+ ns_computed_display_static(box->style) ==
CSS_DISPLAY_INLINE_BLOCK ||
- css_computed_display_static(box->style) ==
+ ns_computed_display_static(box->style) ==
CSS_DISPLAY_INLINE_TABLE)) {
/* Special case for absolute positioning: make absolute inlines
* into inline block so that the boxes are constructed in an
@@ -848,7 +849,7 @@ bool box_construct_element(struct box_construct_ctx *ctx,
box->type = BOX_BLOCK;
} else {
/* Normal mapping */
- box->type = box_map[css_computed_display(box->style,
+ box->type = box_map[ns_computed_display(box->style,
props.node_is_root)];
}
@@ -876,7 +877,7 @@ bool box_construct_element(struct box_construct_ctx *ctx,
box->styles->styles[CSS_PSEUDO_ELEMENT_BEFORE]);
}
- if (box->type == BOX_NONE || (css_computed_display(box->style,
+ if (box->type == BOX_NONE || (ns_computed_display(box->style,
props.node_is_root) == CSS_DISPLAY_NONE &&
props.node_is_root == false)) {
css_select_results_destroy(styles);
@@ -968,7 +969,7 @@ bool box_construct_element(struct box_construct_ctx *ctx,
box_add_child(props.inline_container, box);
} else {
- if (css_computed_display(box->style, props.node_is_root) ==
+ if (ns_computed_display(box->style, props.node_is_root) ==
CSS_DISPLAY_LIST_ITEM) {
/* List item: compute marker */
if (box_construct_marker(box, props.title, ctx,
@@ -1559,7 +1560,7 @@ bool box_image(BOX_SPECIAL_PARAMS)
css_unit wunit = CSS_UNIT_PX;
css_unit hunit = CSS_UNIT_PX;
- if (box->style && css_computed_display(box->style,
+ if (box->style && ns_computed_display(box->style,
box_is_root(n)) == CSS_DISPLAY_NONE)
return true;
@@ -1666,7 +1667,7 @@ bool box_object(BOX_SPECIAL_PARAMS)
dom_node *c;
dom_exception err;
- if (box->style && css_computed_display(box->style,
+ if (box->style && ns_computed_display(box->style,
box_is_root(n)) == CSS_DISPLAY_NONE)
return true;
@@ -1900,7 +1901,7 @@ bool box_frameset(BOX_SPECIAL_PARAMS)
bool ok;
if (content->frameset) {
- LOG("Error: multiple framesets in document.");
+ NSLOG(netsurf, INFO, "Error: multiple framesets in document.");
/* Don't convert children */
if (convert_children)
*convert_children = false;
@@ -2316,7 +2317,7 @@ bool box_iframe(BOX_SPECIAL_PARAMS)
struct content_html_iframe *iframe;
int i;
- if (box->style && css_computed_display(box->style,
+ if (box->style && ns_computed_display(box->style,
box_is_root(n)) == CSS_DISPLAY_NONE)
return true;
@@ -2551,7 +2552,7 @@ bool box_input(BOX_SPECIAL_PARAMS)
corestring_lwc_image)) {
gadget->type = GADGET_IMAGE;
- if (box->style && css_computed_display(box->style,
+ if (box->style && ns_computed_display(box->style,
box_is_root(n)) != CSS_DISPLAY_NONE &&
nsoption_bool(foreground_images) == true) {
dom_string *s;
@@ -2887,7 +2888,7 @@ bool box_embed(BOX_SPECIAL_PARAMS)
dom_string *src;
dom_exception err;
- if (box->style && css_computed_display(box->style,
+ if (box->style && ns_computed_display(box->style,
box_is_root(n)) == CSS_DISPLAY_NONE)
return true;
diff --git a/render/box_normalise.c b/render/box_normalise.c
index 5d36b99d7..9f78f75ac 100644
--- a/render/box_normalise.c
+++ b/render/box_normalise.c
@@ -111,7 +111,7 @@ bool box_normalise_block(struct box *block, html_content *c)
assert(block != NULL);
#ifdef BOX_NORMALISE_DEBUG
- LOG("block %p, block->type %u", block, block->type);
+ NSLOG(netsurf, INFO, "block %p, block->type %u", block, block->type);
#endif
assert(block->type == BOX_BLOCK || block->type == BOX_INLINE_BLOCK ||
@@ -119,7 +119,8 @@ bool box_normalise_block(struct box *block, html_content *c)
for (child = block->children; child != NULL; child = next_child) {
#ifdef BOX_NORMALISE_DEBUG
- LOG("child %p, child->type = %d", child, child->type);
+ NSLOG(netsurf, INFO, "child %p, child->type = %d", child,
+ child->type);
#endif
next_child = child->next; /* child may be destroyed */
@@ -223,7 +224,7 @@ bool box_normalise_table(struct box *table, html_content * c)
assert(table->type == BOX_TABLE);
#ifdef BOX_NORMALISE_DEBUG
- LOG("table %p", table);
+ NSLOG(netsurf, INFO, "table %p", table);
#endif
col_info.num_columns = 1;
@@ -337,7 +338,8 @@ bool box_normalise_table(struct box *table, html_content * c)
struct box *row;
#ifdef BOX_NORMALISE_DEBUG
- LOG("table->children == 0, creating implied row");
+ NSLOG(netsurf, INFO,
+ "table->children == 0, creating implied row");
#endif
assert(table->style != NULL);
@@ -399,7 +401,7 @@ bool box_normalise_table(struct box *table, html_content * c)
return false;
#ifdef BOX_NORMALISE_DEBUG
- LOG("table %p done", table);
+ NSLOG(netsurf, INFO, "table %p done", table);
#endif
return true;
@@ -585,7 +587,7 @@ bool box_normalise_table_row_group(struct box *row_group,
assert(row_group->type == BOX_TABLE_ROW_GROUP);
#ifdef BOX_NORMALISE_DEBUG
- LOG("row_group %p", row_group);
+ NSLOG(netsurf, INFO, "row_group %p", row_group);
#endif
for (child = row_group->children; child != NULL; child = next_child) {
@@ -677,7 +679,8 @@ bool box_normalise_table_row_group(struct box *row_group,
if (row_group->children == NULL) {
#ifdef BOX_NORMALISE_DEBUG
- LOG("row_group->children == 0, inserting implied row");
+ NSLOG(netsurf, INFO,
+ "row_group->children == 0, inserting implied row");
#endif
assert(row_group->style != NULL);
@@ -712,7 +715,7 @@ bool box_normalise_table_row_group(struct box *row_group,
row_group->rows = group_row_count;
#ifdef BOX_NORMALISE_DEBUG
- LOG("row_group %p done", row_group);
+ NSLOG(netsurf, INFO, "row_group %p done", row_group);
#endif
return true;
@@ -734,7 +737,7 @@ bool box_normalise_table_row(struct box *row,
assert(row->type == BOX_TABLE_ROW);
#ifdef BOX_NORMALISE_DEBUG
- LOG("row %p", row);
+ NSLOG(netsurf, INFO, "row %p", row);
#endif
for (child = row->children; child != NULL; child = next_child) {
@@ -843,7 +846,7 @@ bool box_normalise_table_row(struct box *row,
col_info->num_rows++;
#ifdef BOX_NORMALISE_DEBUG
- LOG("row %p done", row);
+ NSLOG(netsurf, INFO, "row %p done", row);
#endif
return true;
@@ -934,7 +937,7 @@ bool box_normalise_inline_container(struct box *cont, html_content * c)
assert(cont->type == BOX_INLINE_CONTAINER);
#ifdef BOX_NORMALISE_DEBUG
- LOG("cont %p", cont);
+ NSLOG(netsurf, INFO, "cont %p", cont);
#endif
for (child = cont->children; child != NULL; child = next_child) {
@@ -997,7 +1000,7 @@ bool box_normalise_inline_container(struct box *cont, html_content * c)
}
#ifdef BOX_NORMALISE_DEBUG
- LOG("cont %p done", cont);
+ NSLOG(netsurf, INFO, "cont %p done", cont);
#endif
return true;
diff --git a/render/box_textarea.c b/render/box_textarea.c
index 1586d71c4..3b1e7750c 100644
--- a/render/box_textarea.c
+++ b/render/box_textarea.c
@@ -149,7 +149,9 @@ static void box_textarea_callback(void *data, struct textarea_msg *msg)
break;
default:
- LOG("Drag type %d not handled.", msg->data.drag);
+ NSLOG(netsurf, INFO,
+ "Drag type %d not handled.",
+ msg->data.drag);
/* This is a logic faliure in the
* front end code so abort.
*/
diff --git a/render/form.c b/render/form.c
index a8b96fefb..904272d3a 100644
--- a/render/form.c
+++ b/render/form.c
@@ -218,7 +218,8 @@ void form_free_control(struct form_control *control)
struct form_control *c;
assert(control != NULL);
- LOG("Control:%p name:%p value:%p initial:%p", control, control->name, control->value, control->initial_value);
+ NSLOG(netsurf, INFO, "Control:%p name:%p value:%p initial:%p",
+ control, control->name, control->value, control->initial_value);
free(control->name);
free(control->value);
free(control->initial_value);
@@ -229,7 +230,9 @@ void form_free_control(struct form_control *control)
for (option = control->data.select.items; option;
option = next) {
next = option->next;
- LOG("select option:%p text:%p value:%p", option, option->text, option->value);
+ NSLOG(netsurf, INFO,
+ "select option:%p text:%p value:%p", option,
+ option->text, option->value);
free(option->text);
free(option->value);
free(option);
@@ -348,7 +351,7 @@ bool form_successful_controls_dom(struct form *_form,
/** \todo Replace this call with something DOMish */
charset = form_acceptable_charset(_form);
if (charset == NULL) {
- LOG("failed to find charset");
+ NSLOG(netsurf, INFO, "failed to find charset");
return false;
}
@@ -362,7 +365,7 @@ bool form_successful_controls_dom(struct form *_form,
err = dom_html_form_element_get_elements(form, &form_elements);
if (err != DOM_NO_ERR) {
- LOG("Could not get form elements");
+ NSLOG(netsurf, INFO, "Could not get form elements");
goto dom_no_memory;
}
@@ -370,7 +373,7 @@ bool form_successful_controls_dom(struct form *_form,
err = dom_html_collection_get_length(form_elements, &element_count);
if (err != DOM_NO_ERR) {
- LOG("Could not get form element count");
+ NSLOG(netsurf, INFO, "Could not get form element count");
goto dom_no_memory;
}
@@ -402,7 +405,8 @@ bool form_successful_controls_dom(struct form *_form,
err = dom_html_collection_item(form_elements,
index, &form_element);
if (err != DOM_NO_ERR) {
- LOG("Could not retrieve form element %d", index);
+ NSLOG(netsurf, INFO,
+ "Could not retrieve form element %d", index);
goto dom_no_memory;
}
@@ -414,7 +418,7 @@ bool form_successful_controls_dom(struct form *_form,
*/
err = dom_node_get_node_name(form_element, &nodename);
if (err != DOM_NO_ERR) {
- LOG("Could not get node name");
+ NSLOG(netsurf, INFO, "Could not get node name");
goto dom_no_memory;
}
@@ -423,14 +427,16 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_text_area_element *)form_element,
&element_disabled);
if (err != DOM_NO_ERR) {
- LOG("Could not get text area disabled property");
+ NSLOG(netsurf, INFO,
+ "Could not get text area disabled property");
goto dom_no_memory;
}
err = dom_html_text_area_element_get_name(
(dom_html_text_area_element *)form_element,
&inputname);
if (err != DOM_NO_ERR) {
- LOG("Could not get text area name property");
+ NSLOG(netsurf, INFO,
+ "Could not get text area name property");
goto dom_no_memory;
}
} else if (dom_string_isequal(nodename, corestring_dom_SELECT)) {
@@ -438,14 +444,16 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_select_element *)form_element,
&element_disabled);
if (err != DOM_NO_ERR) {
- LOG("Could not get select disabled property");
+ NSLOG(netsurf, INFO,
+ "Could not get select disabled property");
goto dom_no_memory;
}
err = dom_html_select_element_get_name(
(dom_html_select_element *)form_element,
&inputname);
if (err != DOM_NO_ERR) {
- LOG("Could not get select name property");
+ NSLOG(netsurf, INFO,
+ "Could not get select name property");
goto dom_no_memory;
}
} else if (dom_string_isequal(nodename, corestring_dom_INPUT)) {
@@ -453,14 +461,16 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *)form_element,
&element_disabled);
if (err != DOM_NO_ERR) {
- LOG("Could not get input disabled property");
+ NSLOG(netsurf, INFO,
+ "Could not get input disabled property");
goto dom_no_memory;
}
err = dom_html_input_element_get_name(
(dom_html_input_element *)form_element,
&inputname);
if (err != DOM_NO_ERR) {
- LOG("Could not get input name property");
+ NSLOG(netsurf, INFO,
+ "Could not get input name property");
goto dom_no_memory;
}
} else if (dom_string_isequal(nodename, corestring_dom_BUTTON)) {
@@ -468,21 +478,23 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_button_element *)form_element,
&element_disabled);
if (err != DOM_NO_ERR) {
- LOG("Could not get button disabled property");
+ NSLOG(netsurf, INFO,
+ "Could not get button disabled property");
goto dom_no_memory;
}
err = dom_html_button_element_get_name(
(dom_html_button_element *)form_element,
&inputname);
if (err != DOM_NO_ERR) {
- LOG("Could not get button name property");
+ NSLOG(netsurf, INFO,
+ "Could not get button name property");
goto dom_no_memory;
}
} else {
/* Unknown element type came through! */
- LOG("Unknown element type: %*s",
- (int)dom_string_byte_length(nodename),
- dom_string_data(nodename));
+ NSLOG(netsurf, INFO, "Unknown element type: %*s",
+ (int)dom_string_byte_length(nodename),
+ dom_string_data(nodename));
goto dom_no_memory;
}
if (element_disabled)
@@ -495,7 +507,8 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_text_area_element *)form_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG("Could not get text area content");
+ NSLOG(netsurf, INFO,
+ "Could not get text area content");
goto dom_no_memory;
}
} else if (dom_string_isequal(nodename, corestring_dom_SELECT)) {
@@ -504,13 +517,15 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_select_element *)form_element,
&options);
if (err != DOM_NO_ERR) {
- LOG("Could not get select options collection");
+ NSLOG(netsurf, INFO,
+ "Could not get select options collection");
goto dom_no_memory;
}
err = dom_html_options_collection_get_length(
options, &options_count);
if (err != DOM_NO_ERR) {
- LOG("Could not get select options collection length");
+ NSLOG(netsurf, INFO,
+ "Could not get select options collection length");
goto dom_no_memory;
}
for(option_index = 0; option_index < options_count;
@@ -527,14 +542,17 @@ bool form_successful_controls_dom(struct form *_form,
err = dom_html_options_collection_item(
options, option_index, &option_element);
if (err != DOM_NO_ERR) {
- LOG("Could not get options item %d", option_index);
+ NSLOG(netsurf, INFO,
+ "Could not get options item %d",
+ option_index);
goto dom_no_memory;
}
err = dom_html_option_element_get_selected(
(dom_html_option_element *)option_element,
&selected);
if (err != DOM_NO_ERR) {
- LOG("Could not get option selected property");
+ NSLOG(netsurf, INFO,
+ "Could not get option selected property");
goto dom_no_memory;
}
if (!selected)
@@ -543,13 +561,15 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_option_element *)option_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG("Could not get option value");
+ NSLOG(netsurf, INFO,
+ "Could not get option value");
goto dom_no_memory;
}
success_new = calloc(1, sizeof(*success_new));
if (success_new == NULL) {
- LOG("Could not allocate data for option");
+ NSLOG(netsurf, INFO,
+ "Could not allocate data for option");
goto dom_no_memory;
}
@@ -558,12 +578,14 @@ bool form_successful_controls_dom(struct form *_form,
success_new->name = ENCODE_ITEM(inputname);
if (success_new->name == NULL) {
- LOG("Could not encode name for option");
+ NSLOG(netsurf, INFO,
+ "Could not encode name for option");
goto dom_no_memory;
}
success_new->value = ENCODE_ITEM(inputvalue);
if (success_new->value == NULL) {
- LOG("Could not encode value for option");
+ NSLOG(netsurf, INFO,
+ "Could not encode value for option");
goto dom_no_memory;
}
}
@@ -573,7 +595,8 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_button_element *) form_element,
&inputtype);
if (err != DOM_NO_ERR) {
- LOG("Could not get button element type");
+ NSLOG(netsurf, INFO,
+ "Could not get button element type");
goto dom_no_memory;
}
if (dom_string_caseless_isequal(
@@ -593,7 +616,8 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_button_element *)form_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG("Could not get submit button value");
+ NSLOG(netsurf, INFO,
+ "Could not get submit button value");
goto dom_no_memory;
}
/* Drop through to report successful button */
@@ -610,7 +634,8 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *) form_element,
&inputtype);
if (err != DOM_NO_ERR) {
- LOG("Could not get input element type");
+ NSLOG(netsurf, INFO,
+ "Could not get input element type");
goto dom_no_memory;
}
if (dom_string_caseless_isequal(
@@ -630,7 +655,8 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *)form_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG("Could not get submit button value");
+ NSLOG(netsurf, INFO,
+ "Could not get submit button value");
goto dom_no_memory;
}
/* Drop through to report the successful button */
@@ -648,11 +674,13 @@ bool form_successful_controls_dom(struct form *_form,
corestring_dom___ns_key_image_coords_node_data,
&coords);
if (err != DOM_NO_ERR) {
- LOG("Could not get image XY data");
+ NSLOG(netsurf, INFO,
+ "Could not get image XY data");
goto dom_no_memory;
}
if (coords == NULL) {
- LOG("No XY data on the image input");
+ NSLOG(netsurf, INFO,
+ "No XY data on the image input");
goto dom_no_memory;
}
@@ -661,7 +689,8 @@ bool form_successful_controls_dom(struct form *_form,
success_new = calloc(1, sizeof(*success_new));
if (success_new == NULL) {
free(basename);
- LOG("Could not allocate data for image.x");
+ NSLOG(netsurf, INFO,
+ "Could not allocate data for image.x");
goto dom_no_memory;
}
@@ -671,13 +700,15 @@ bool form_successful_controls_dom(struct form *_form,
success_new->name = malloc(strlen(basename) + 3);
if (success_new->name == NULL) {
free(basename);
- LOG("Could not allocate name for image.x");
+ NSLOG(netsurf, INFO,
+ "Could not allocate name for image.x");
goto dom_no_memory;
}
success_new->value = malloc(20);
if (success_new->value == NULL) {
free(basename);
- LOG("Could not allocate value for image.x");
+ NSLOG(netsurf, INFO,
+ "Could not allocate value for image.x");
goto dom_no_memory;
}
sprintf(success_new->name, "%s.x", basename);
@@ -686,7 +717,8 @@ bool form_successful_controls_dom(struct form *_form,
success_new = calloc(1, sizeof(*success_new));
if (success_new == NULL) {
free(basename);
- LOG("Could not allocate data for image.y");
+ NSLOG(netsurf, INFO,
+ "Could not allocate data for image.y");
goto dom_no_memory;
}
@@ -696,13 +728,15 @@ bool form_successful_controls_dom(struct form *_form,
success_new->name = malloc(strlen(basename) + 3);
if (success_new->name == NULL) {
free(basename);
- LOG("Could not allocate name for image.y");
+ NSLOG(netsurf, INFO,
+ "Could not allocate name for image.y");
goto dom_no_memory;
}
success_new->value = malloc(20);
if (success_new->value == NULL) {
free(basename);
- LOG("Could not allocate value for image.y");
+ NSLOG(netsurf, INFO,
+ "Could not allocate value for image.y");
goto dom_no_memory;
}
sprintf(success_new->name, "%s.y", basename);
@@ -717,7 +751,8 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *)form_element,
&checked);
if (err != DOM_NO_ERR) {
- LOG("Could not get input element checked");
+ NSLOG(netsurf, INFO,
+ "Could not get input element checked");
goto dom_no_memory;
}
if (!checked)
@@ -726,7 +761,8 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *)form_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG("Could not get input element value");
+ NSLOG(netsurf, INFO,
+ "Could not get input element value");
goto dom_no_memory;
}
if (inputvalue == NULL) {
@@ -741,7 +777,8 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *)form_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG("Could not get file value");
+ NSLOG(netsurf, INFO,
+ "Could not get file value");
goto dom_no_memory;
}
err = dom_node_get_user_data(
@@ -749,14 +786,16 @@ bool form_successful_controls_dom(struct form *_form,
corestring_dom___ns_key_file_name_node_data,
&rawfile_temp);
if (err != DOM_NO_ERR) {
- LOG("Could not get file rawname");
+ NSLOG(netsurf, INFO,
+ "Could not get file rawname");
goto dom_no_memory;
}
rawfile_temp = strdup(rawfile_temp != NULL ?
rawfile_temp :
"");
if (rawfile_temp == NULL) {
- LOG("Could not copy file rawname");
+ NSLOG(netsurf, INFO,
+ "Could not copy file rawname");
goto dom_no_memory;
}
/* Fall out to the allocation */
@@ -765,7 +804,8 @@ bool form_successful_controls_dom(struct form *_form,
dom_string_caseless_isequal(
inputtype, corestring_dom_button)) {
/* Skip these */
- LOG("Skipping RESET and BUTTON");
+ NSLOG(netsurf, INFO,
+ "Skipping RESET and BUTTON");
continue;
} else {
/* Everything else is treated as text values */
@@ -773,7 +813,8 @@ bool form_successful_controls_dom(struct form *_form,
(dom_html_input_element *)form_element,
&inputvalue);
if (err != DOM_NO_ERR) {
- LOG("Could not get input value");
+ NSLOG(netsurf, INFO,
+ "Could not get input value");
goto dom_no_memory;
}
/* Fall out to the allocation */
@@ -782,7 +823,8 @@ bool form_successful_controls_dom(struct form *_form,
success_new = calloc(1, sizeof(*success_new));
if (success_new == NULL) {
- LOG("Could not allocate data for generic");
+ NSLOG(netsurf, INFO,
+ "Could not allocate data for generic");
goto dom_no_memory;
}
@@ -791,12 +833,14 @@ bool form_successful_controls_dom(struct form *_form,
success_new->name = ENCODE_ITEM(inputname);
if (success_new->name == NULL) {
- LOG("Could not encode name for generic");
+ NSLOG(netsurf, INFO,
+ "Could not encode name for generic");
goto dom_no_memory;
}
success_new->value = ENCODE_ITEM(inputvalue);
if (success_new->value == NULL) {
- LOG("Could not encode value for generic");
+ NSLOG(netsurf, INFO,
+ "Could not encode value for generic");
goto dom_no_memory;
}
if (rawfile_temp != NULL) {
diff --git a/render/html.c b/render/html.c
index a573ef5f5..3cfc5e236 100644
--- a/render/html.c
+++ b/render/html.c
@@ -89,8 +89,8 @@ bool fire_dom_event(dom_string *type, dom_node *target,
dom_event_unref(evt);
return false;
}
- LOG("Dispatching '%*s' against %p",
- dom_string_length(type), dom_string_data(type), target);
+ NSLOG(netsurf, INFO, "Dispatching '%*s' against %p",
+ dom_string_length(type), dom_string_data(type), target);
exc = dom_event_target_dispatch_event(target, evt, &result);
if (exc != DOM_NO_ERR) {
result = false;
@@ -111,7 +111,7 @@ static void html_box_convert_done(html_content *c, bool success)
dom_exception exc; /* returned by libdom functions */
dom_node *html;
- LOG("Done XML to box (%p)", c);
+ NSLOG(netsurf, INFO, "Done XML to box (%p)", c);
/* Clean up and report error if unsuccessful or aborted */
if ((success == false) || (c->aborted)) {
@@ -141,7 +141,7 @@ static void html_box_convert_done(html_content *c, bool success)
/** @todo should this call html_object_free_objects(c);
* like the other error paths
*/
- LOG("error retrieving html element from dom");
+ NSLOG(netsurf, INFO, "error retrieving html element from dom");
content_broadcast_errorcode(&c->base, NSERROR_DOM);
content_set_error(&c->base);
return;
@@ -150,7 +150,7 @@ static void html_box_convert_done(html_content *c, bool success)
/* extract image maps - can't do this sensibly in dom_to_box */
err = imagemap_extract(c);
if (err != NSERROR_OK) {
- LOG("imagemap extraction failed");
+ NSLOG(netsurf, INFO, "imagemap extraction failed");
html_object_free_objects(c);
content_broadcast_errorcode(&c->base, err);
content_set_error(&c->base);
@@ -443,7 +443,7 @@ static nserror html_meta_refresh_process_element(html_content *c, dom_node *n)
c->base.refresh = nsurl_ref(
content_get_url(&c->base));
- content_broadcast(&c->base, CONTENT_MSG_REFRESH, msg_data);
+ content_broadcast(&c->base, CONTENT_MSG_REFRESH, &msg_data);
return NSERROR_OK;
}
@@ -522,7 +522,8 @@ static nserror html_meta_refresh_process_element(html_content *c, dom_node *n)
c->base.refresh = nsurl;
- content_broadcast(&c->base, CONTENT_MSG_REFRESH, msg_data);
+ content_broadcast(&c->base, CONTENT_MSG_REFRESH,
+ &msg_data);
c->refresh = true;
}
@@ -600,14 +601,14 @@ void html_finish_conversion(html_content *htmlc)
}
/* convert dom tree to box tree */
- LOG("DOM to box (%p)", htmlc);
+ NSLOG(netsurf, INFO, "DOM to box (%p)", htmlc);
content_set_status(&htmlc->base, messages_get("Processing"));
msg_data.explicit_status_text = NULL;
- content_broadcast(&htmlc->base, CONTENT_MSG_STATUS, msg_data);
+ content_broadcast(&htmlc->base, CONTENT_MSG_STATUS, &msg_data);
exc = dom_document_get_document_element(htmlc->document, (void *) &html);
if ((exc != DOM_NO_ERR) || (html == NULL)) {
- LOG("error retrieving html element from dom");
+ NSLOG(netsurf, INFO, "error retrieving html element from dom");
content_broadcast_errorcode(&htmlc->base, NSERROR_DOM);
content_set_error(&htmlc->base);
return;
@@ -615,7 +616,7 @@ void html_finish_conversion(html_content *htmlc)
error = dom_to_box(html, htmlc, html_box_convert_done);
if (error != NSERROR_OK) {
- LOG("box conversion failed");
+ NSLOG(netsurf, INFO, "box conversion failed");
dom_node_unref(html);
html_object_free_objects(htmlc);
content_broadcast_errorcode(&htmlc->base, error);
@@ -685,10 +686,11 @@ dom_default_action_DOMNodeInserted_cb(struct dom_event *evt, void *pw)
msg_data.jscontext = &htmlc->jscontext;
content_broadcast(&htmlc->base,
CONTENT_MSG_GETCTX,
- msg_data);
- LOG("javascript context: %p (htmlc: %p)",
- htmlc->jscontext,
- htmlc);
+ &msg_data);
+ NSLOG(netsurf, INFO,
+ "javascript context: %p (htmlc: %p)",
+ htmlc->jscontext,
+ htmlc);
}
if (htmlc->jscontext != NULL) {
js_handle_new_element(htmlc->jscontext,
@@ -767,7 +769,7 @@ dom_event_fetcher(dom_string *type,
dom_default_action_phase phase,
void **pw)
{
- //LOG("type:%s", dom_string_data(type));
+ NSLOG(netsurf, DEEPDEBUG, "type:%s", dom_string_data(type));
if (phase == DOM_DEFAULT_ACTION_END) {
if (dom_string_isequal(type, corestring_dom_DOMNodeInserted)) {
@@ -794,22 +796,22 @@ html_document_user_data_handler(dom_node_operation operation,
switch (operation) {
case DOM_NODE_CLONED:
- LOG("Cloned");
+ NSLOG(netsurf, INFO, "Cloned");
break;
case DOM_NODE_RENAMED:
- LOG("Renamed");
+ NSLOG(netsurf, INFO, "Renamed");
break;
case DOM_NODE_IMPORTED:
- LOG("imported");
+ NSLOG(netsurf, INFO, "imported");
break;
case DOM_NODE_ADOPTED:
- LOG("Adopted");
+ NSLOG(netsurf, INFO, "Adopted");
break;
case DOM_NODE_DELETED:
/* This is the only path I expect */
break;
default:
- LOG("User data operation not handled.");
+ NSLOG(netsurf, INFO, "User data operation not handled.");
assert(0);
}
}
@@ -934,7 +936,7 @@ html_create_html_data(html_content *c, const http_parameter *params)
lwc_string_unref(c->universal);
c->universal = NULL;
- LOG("Unable to set user data.");
+ NSLOG(netsurf, INFO, "Unable to set user data.");
return NSERROR_DOM;
}
@@ -1141,11 +1143,11 @@ static bool html_convert(struct content *c)
exc = dom_document_get_quirks_mode(htmlc->document, &htmlc->quirks);
if (exc == DOM_NO_ERR) {
html_css_quirks_stylesheets(htmlc);
- LOG("quirks set to %d", htmlc->quirks);
+ NSLOG(netsurf, INFO, "quirks set to %d", htmlc->quirks);
}
htmlc->base.active--; /* the html fetch is no longer active */
- LOG("%d fetches active (%p)", htmlc->base.active, c);
+ NSLOG(netsurf, INFO, "%d fetches active (%p)", htmlc->base.active, c);
/* The parse cannot be completed here because it may be paused
* untill all the resources being fetched have completed.
@@ -1198,11 +1200,11 @@ html_begin_conversion(html_content *htmlc)
* complete to avoid repeating the completion pointlessly.
*/
if (htmlc->parse_completed == false) {
- LOG("Completing parse (%p)", htmlc);
+ NSLOG(netsurf, INFO, "Completing parse (%p)", htmlc);
/* complete parsing */
error = dom_hubbub_parser_completed(htmlc->parser);
if (error != DOM_HUBBUB_OK) {
- LOG("Parsing failed");
+ NSLOG(netsurf, INFO, "Parsing failed");
content_broadcast_errorcode(&htmlc->base,
libdom_hubbub_error_to_nserror(error));
@@ -1213,15 +1215,15 @@ html_begin_conversion(html_content *htmlc)
}
if (html_can_begin_conversion(htmlc) == false) {
- LOG("Can't begin conversion (%p)", htmlc);
+ NSLOG(netsurf, INFO, "Can't begin conversion (%p)", htmlc);
/* We can't proceed (see commentary above) */
return true;
}
/* Give up processing if we've been aborted */
if (htmlc->aborted) {
- LOG("Conversion aborted (%p) (active: %u)", htmlc,
- htmlc->base.active);
+ NSLOG(netsurf, INFO, "Conversion aborted (%p) (active: %u)",
+ htmlc, htmlc->base.active);
content_set_error(&htmlc->base);
content_broadcast_errorcode(&htmlc->base, NSERROR_STOPPED);
return false;
@@ -1257,7 +1259,7 @@ html_begin_conversion(html_content *htmlc)
/* locate root element and ensure it is html */
exc = dom_document_get_document_element(htmlc->document, (void *) &html);
if ((exc != DOM_NO_ERR) || (html == NULL)) {
- LOG("error retrieving html element from dom");
+ NSLOG(netsurf, INFO, "error retrieving html element from dom");
content_broadcast_errorcode(&htmlc->base, NSERROR_DOM);
return false;
}
@@ -1267,7 +1269,7 @@ html_begin_conversion(html_content *htmlc)
(node_name == NULL) ||
(!dom_string_caseless_lwc_isequal(node_name,
corestring_lwc_html))) {
- LOG("root element not html");
+ NSLOG(netsurf, INFO, "root element not html");
content_broadcast_errorcode(&htmlc->base, NSERROR_DOM);
dom_node_unref(html);
return false;
@@ -1373,7 +1375,8 @@ static void html_stop(struct content *c)
break;
default:
- LOG("Unexpected status %d (%p)", c->status, c);
+ NSLOG(netsurf, INFO, "Unexpected status %d (%p)", c->status,
+ c);
assert(0);
}
}
@@ -1530,7 +1533,7 @@ static void html_destroy(struct content *c)
html_content *html = (html_content *) c;
struct form *f, *g;
- LOG("content %p", c);
+ NSLOG(netsurf, INFO, "content %p", c);
/* Destroy forms */
for (f = html->forms; f != NULL; f = g) {
@@ -1919,7 +1922,7 @@ static void html__dom_user_data_handler(dom_node_operation operation,
free(data);
break;
default:
- LOG("User data operation not handled.");
+ NSLOG(netsurf, INFO, "User data operation not handled.");
assert(0);
}
}
@@ -1935,7 +1938,8 @@ static void html__set_file_gadget_filename(struct content *c,
ret = guit->utf8->local_to_utf8(fn, 0, &utf8_fn);
if (ret != NSERROR_OK) {
assert(ret != NSERROR_BAD_ENCODING);
- LOG("utf8 to local encoding conversion failed");
+ NSLOG(netsurf, INFO,
+ "utf8 to local encoding conversion failed");
/* Load was for us - just no memory */
return;
}
@@ -2087,7 +2091,7 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file)
if (ret != NSERROR_OK) {
/* bad encoding shouldn't happen */
assert(ret != NSERROR_BAD_ENCODING);
- LOG("local to utf8 encoding failed");
+ NSLOG(netsurf, INFO, "local to utf8 encoding failed");
free(buffer);
guit->misc->warning("NoMemory", NULL);
return true;
@@ -2153,19 +2157,19 @@ html_debug_dump(struct content *c, FILE *f, enum content_debug op)
ret = NSERROR_OK;
} else {
if (htmlc->document == NULL) {
- LOG("No document to dump");
+ NSLOG(netsurf, INFO, "No document to dump");
return NSERROR_DOM;
}
exc = dom_document_get_document_element(htmlc->document, (void *) &html);
if ((exc != DOM_NO_ERR) || (html == NULL)) {
- LOG("Unable to obtain root node");
+ NSLOG(netsurf, INFO, "Unable to obtain root node");
return NSERROR_DOM;
}
ret = libdom_dump_structure(html, f, 0);
- LOG("DOM structure dump returning %d", ret);
+ NSLOG(netsurf, INFO, "DOM structure dump returning %d", ret);
dom_node_unref(html);
}
diff --git a/render/html_css.c b/render/html_css.c
index 4d5469361..45bc16f56 100644
--- a/render/html_css.c
+++ b/render/html_css.c
@@ -103,17 +103,23 @@ html_convert_css_callback(hlcache_handle *css,
switch (event->type) {
case CONTENT_MSG_DONE:
- LOG("done stylesheet slot %d '%s'", i, nsurl_access(hlcache_handle_get_url(css)));
+ NSLOG(netsurf, INFO, "done stylesheet slot %d '%s'", i,
+ nsurl_access(hlcache_handle_get_url(css)));
parent->base.active--;
- LOG("%d fetches active", parent->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", parent->base.active);
break;
case CONTENT_MSG_ERROR:
- LOG("stylesheet %s failed: %s", nsurl_access(hlcache_handle_get_url(css)), event->data.error);
+ NSLOG(netsurf, INFO, "stylesheet %s failed: %s",
+ nsurl_access(hlcache_handle_get_url(css)),
+ event->data.error);
+ /* fall through */
+
+ case CONTENT_MSG_ERRORCODE:
hlcache_handle_release(css);
s->sheet = NULL;
parent->base.active--;
- LOG("%d fetches active", parent->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", parent->base.active);
content_add_error(&parent->base, "?", 0);
break;
@@ -150,7 +156,7 @@ html_stylesheet_from_domnode(html_content *c,
exc = dom_node_get_text_content(node, &style);
if ((exc != DOM_NO_ERR) || (style == NULL)) {
- LOG("No text content");
+ NSLOG(netsurf, INFO, "No text content");
return NSERROR_OK;
}
@@ -181,7 +187,7 @@ html_stylesheet_from_domnode(html_content *c,
nsurl_unref(url);
c->base.active++;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", c->base.active);
return NSERROR_OK;
}
@@ -253,13 +259,14 @@ static bool html_css_process_modified_style(html_content *c,
error = html_stylesheet_from_domnode(c, s->node, &sheet);
if (error != NSERROR_OK) {
- LOG("Failed to update sheet");
+ NSLOG(netsurf, INFO, "Failed to update sheet");
content_broadcast_errorcode(&c->base, error);
return false;
}
if (sheet != NULL) {
- LOG("Updating sheet %p with %p", s->sheet, sheet);
+ NSLOG(netsurf, INFO, "Updating sheet %p with %p", s->sheet,
+ sheet);
if (s->sheet != NULL) {
switch (content_get_status(s->sheet)) {
@@ -268,7 +275,8 @@ static bool html_css_process_modified_style(html_content *c,
default:
hlcache_handle_abort(s->sheet);
c->base.active--;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active",
+ c->base.active);
}
hlcache_handle_release(s->sheet);
}
@@ -313,7 +321,9 @@ bool html_css_update_style(html_content *c, dom_node *style)
s = html_create_style_element(c, style);
}
if (s == NULL) {
- LOG("Could not find or create inline stylesheet for %p", style);
+ NSLOG(netsurf, INFO,
+ "Could not find or create inline stylesheet for %p",
+ style);
return false;
}
@@ -417,7 +427,8 @@ bool html_css_process_link(html_content *htmlc, dom_node *node)
}
dom_string_unref(href);
- LOG("linked stylesheet %i '%s'", htmlc->stylesheet_count, nsurl_access(joined));
+ NSLOG(netsurf, INFO, "linked stylesheet %i '%s'",
+ htmlc->stylesheet_count, nsurl_access(joined));
/* extend stylesheets array to allow for new sheet */
stylesheets = realloc(htmlc->stylesheets,
@@ -452,7 +463,7 @@ bool html_css_process_link(html_content *htmlc, dom_node *node)
htmlc->stylesheet_count++;
htmlc->base.active++;
- LOG("%d fetches active", htmlc->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", htmlc->base.active);
return true;
@@ -517,7 +528,7 @@ nserror html_css_quirks_stylesheets(html_content *c)
}
c->base.active++;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", c->base.active);
}
return ns_error;
@@ -561,7 +572,7 @@ nserror html_css_new_stylesheets(html_content *c)
}
c->base.active++;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", c->base.active);
if (nsoption_bool(block_advertisements)) {
@@ -575,7 +586,7 @@ nserror html_css_new_stylesheets(html_content *c)
}
c->base.active++;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", c->base.active);
}
@@ -588,7 +599,7 @@ nserror html_css_new_stylesheets(html_content *c)
}
c->base.active++;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", c->base.active);
return ns_error;
}
diff --git a/render/html_css_fetcher.c b/render/html_css_fetcher.c
index 9eda6aeb7..0f8809a42 100644
--- a/render/html_css_fetcher.c
+++ b/render/html_css_fetcher.c
@@ -61,13 +61,15 @@ static html_css_fetcher_context *ring = NULL;
static bool html_css_fetcher_initialise(lwc_string *scheme)
{
- LOG("html_css_fetcher_initialise called for %s", lwc_string_data(scheme));
+ NSLOG(netsurf, INFO, "html_css_fetcher_initialise called for %s",
+ lwc_string_data(scheme));
return true;
}
static void html_css_fetcher_finalise(lwc_string *scheme)
{
- LOG("html_css_fetcher_finalise called for %s", lwc_string_data(scheme));
+ NSLOG(netsurf, INFO, "html_css_fetcher_finalise called for %s",
+ lwc_string_data(scheme));
}
static bool html_css_fetcher_can_fetch(const nsurl *url)
@@ -251,7 +253,8 @@ static void html_css_fetcher_poll(lwc_string *scheme)
html_css_fetcher_send_callback(&msg, c);
}
} else {
- LOG("Processing of %s failed!", nsurl_access(c->url));
+ NSLOG(netsurf, INFO, "Processing of %s failed!",
+ nsurl_access(c->url));
/* Ensure that we're unlocked here. If we aren't,
* then html_css_fetcher_process() is broken.
@@ -290,7 +293,7 @@ nserror html_css_fetcher_register(void)
if (lwc_intern_string("x-ns-css", SLEN("x-ns-css"),
&scheme) != lwc_error_ok) {
- LOG("could not intern \"x-ns-css\".");
+ NSLOG(netsurf, INFO, "could not intern \"x-ns-css\".");
return NSERROR_INIT_FAILED;
}
diff --git a/render/html_interaction.c b/render/html_interaction.c
index e727a9ffc..30adaa080 100644
--- a/render/html_interaction.c
+++ b/render/html_interaction.c
@@ -289,7 +289,7 @@ html__image_coords_dom_user_data_handler(dom_node_operation operation,
break;
default:
- LOG("User data operation not handled.");
+ NSLOG(netsurf, INFO, "User data operation not handled.");
assert(0);
}
}
@@ -368,7 +368,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
mouse, x - box_x, y - box_y);
if (status != NULL) {
msg_data.explicit_status_text = status;
- content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
+ content_broadcast(c, CONTENT_MSG_STATUS, &msg_data);
} else {
int width, height;
form_select_get_dimensions(html->visible_select_menu,
@@ -459,7 +459,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
}
msg_data.explicit_status_text = status;
- content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
+ content_broadcast(c, CONTENT_MSG_STATUS, &msg_data);
return;
}
@@ -678,7 +678,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
} else if (mouse & BROWSER_MOUSE_CLICK_1) {
msg_data.select_menu.gadget = gadget;
content_broadcast(c, CONTENT_MSG_SELECTMENU,
- msg_data);
+ &msg_data);
}
break;
case GADGET_CHECKBOX:
@@ -697,6 +697,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
form_radio_set(gadget);
break;
case GADGET_IMAGE:
+ /* This falls through to SUBMIT */
if (mouse & BROWSER_MOUSE_CLICK_1) {
struct image_input_coords *coords, *oldcoords;
/** \todo Find a way to not ignore errors */
@@ -714,7 +715,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
return;
free(oldcoords);
}
- /* drop through */
+ /* Fall through */
case GADGET_SUBMIT:
if (gadget->form) {
snprintf(status_buffer, sizeof status_buffer,
@@ -768,7 +769,8 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
status = messages_get("FormFile");
if (mouse & BROWSER_MOUSE_CLICK_1) {
msg_data.gadget_click.gadget = gadget;
- content_broadcast(c, CONTENT_MSG_GADGETCLICK, msg_data);
+ content_broadcast(c, CONTENT_MSG_GADGETCLICK,
+ &msg_data);
}
break;
case GADGET_BUTTON:
@@ -782,12 +784,12 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
if (mouse & BROWSER_MOUSE_DRAG_2) {
msg_data.dragsave.type = CONTENT_SAVE_NATIVE;
msg_data.dragsave.content = object;
- content_broadcast(c, CONTENT_MSG_DRAGSAVE, msg_data);
+ content_broadcast(c, CONTENT_MSG_DRAGSAVE, &msg_data);
} else if (mouse & BROWSER_MOUSE_DRAG_1) {
msg_data.dragsave.type = CONTENT_SAVE_ORIG;
msg_data.dragsave.content = object;
- content_broadcast(c, CONTENT_MSG_DRAGSAVE, msg_data);
+ content_broadcast(c, CONTENT_MSG_DRAGSAVE, &msg_data);
}
/* \todo should have a drag-saving object msg */
@@ -869,7 +871,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
mouse & BROWSER_MOUSE_MOD_1) {
msg_data.savelink.url = url;
msg_data.savelink.title = title;
- content_broadcast(c, CONTENT_MSG_SAVELINK, msg_data);
+ content_broadcast(c, CONTENT_MSG_SAVELINK, &msg_data);
} else if (mouse & (BROWSER_MOUSE_CLICK_1 |
BROWSER_MOUSE_CLICK_2))
@@ -968,7 +970,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
msg_data.dragsave.content = NULL;
content_broadcast(c,
CONTENT_MSG_DRAGSAVE,
- msg_data);
+ &msg_data);
} else {
if (drag_candidate == NULL) {
browser_window_page_drag_start(
@@ -988,7 +990,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
msg_data.dragsave.content = NULL;
content_broadcast(c,
CONTENT_MSG_DRAGSAVE,
- msg_data);
+ &msg_data);
} else {
if (drag_candidate == NULL) {
browser_window_page_drag_start(
@@ -1013,10 +1015,10 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
if (!iframe && !html_object_box) {
msg_data.explicit_status_text = status;
- content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
+ content_broadcast(c, CONTENT_MSG_STATUS, &msg_data);
msg_data.pointer = pointer;
- content_broadcast(c, CONTENT_MSG_POINTER, msg_data);
+ content_broadcast(c, CONTENT_MSG_POINTER, &msg_data);
}
/* fire dom click event */
@@ -1217,7 +1219,7 @@ void html_overflow_scroll_callback(void *client_data,
html_set_drag_type(html, drag_type, drag_owner, NULL);
msg_data.pointer = BROWSER_POINTER_AUTO;
- content_broadcast(data->c, CONTENT_MSG_POINTER, msg_data);
+ content_broadcast(data->c, CONTENT_MSG_POINTER, &msg_data);
break;
}
}
@@ -1292,7 +1294,7 @@ void html_set_drag_type(html_content *html, html_drag_type drag_type,
msg_data.drag.rect = rect;
/* Inform of the content's drag status change */
- content_broadcast((struct content *)html, CONTENT_MSG_DRAG, msg_data);
+ content_broadcast((struct content *)html, CONTENT_MSG_DRAG, &msg_data);
}
/* Documented in html_internal.h */
@@ -1350,7 +1352,7 @@ void html_set_focus(html_content *html, html_focus_type focus_type,
}
/* Inform of the content's drag status change */
- content_broadcast((struct content *)html, CONTENT_MSG_CARET, msg_data);
+ content_broadcast((struct content *)html, CONTENT_MSG_CARET, &msg_data);
}
/* Documented in html_internal.h */
@@ -1426,5 +1428,5 @@ void html_set_selection(html_content *html, html_selection_type selection_type,
/* Inform of the content's selection status change */
content_broadcast((struct content *)html, CONTENT_MSG_SELECTION,
- msg_data);
+ &msg_data);
}
diff --git a/render/html_object.c b/render/html_object.c
index e20cd6d63..e98bdba0b 100644
--- a/render/html_object.c
+++ b/render/html_object.c
@@ -125,7 +125,9 @@ html_object_callback(hlcache_handle *object,
struct box *box;
box = o->box;
- if (box == NULL && event->type != CONTENT_MSG_ERROR) {
+ if (box == NULL &&
+ event->type != CONTENT_MSG_ERROR &&
+ event->type != CONTENT_MSG_ERRORCODE) {
return NSERROR_OK;
}
@@ -158,7 +160,7 @@ html_object_callback(hlcache_handle *object,
case CONTENT_MSG_DONE:
c->base.active--;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", c->base.active);
html_object_done(box, object, o->background);
@@ -177,10 +179,11 @@ html_object_callback(hlcache_handle *object,
data.redraw.height = box->height;
data.redraw.full_redraw = true;
- content_broadcast(&c->base, CONTENT_MSG_REDRAW, data);
+ content_broadcast(&c->base, CONTENT_MSG_REDRAW, &data);
}
break;
+ case CONTENT_MSG_ERRORCODE:
case CONTENT_MSG_ERROR:
hlcache_handle_release(object);
@@ -188,7 +191,8 @@ html_object_callback(hlcache_handle *object,
if (box != NULL) {
c->base.active--;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active",
+ c->base.active);
content_add_error(&c->base, "?", 0);
html_object_failed(box, c, o->background);
@@ -276,7 +280,7 @@ html_object_callback(hlcache_handle *object,
data.redraw.object_y += y;
content_broadcast(&c->base,
- CONTENT_MSG_REDRAW, data);
+ CONTENT_MSG_REDRAW, &data);
break;
} else {
@@ -315,7 +319,7 @@ html_object_callback(hlcache_handle *object,
data.redraw.object_y += y + box->padding[TOP];
}
- content_broadcast(&c->base, CONTENT_MSG_REDRAW, data);
+ content_broadcast(&c->base, CONTENT_MSG_REDRAW, &data);
}
break;
@@ -354,7 +358,7 @@ html_object_callback(hlcache_handle *object,
msg_data.dragsave.content =
event->data.dragsave.content;
- content_broadcast(&c->base, CONTENT_MSG_DRAGSAVE, msg_data);
+ content_broadcast(&c->base, CONTENT_MSG_DRAGSAVE, &msg_data);
}
break;
@@ -364,7 +368,7 @@ html_object_callback(hlcache_handle *object,
case CONTENT_MSG_GADGETCLICK:
/* These messages are for browser window layer.
* we're not interested, so pass them on. */
- content_broadcast(&c->base, event->type, event->data);
+ content_broadcast(&c->base, event->type, &event->data);
break;
case CONTENT_MSG_CARET:
@@ -437,7 +441,8 @@ html_object_callback(hlcache_handle *object,
c->base.active == 0 &&
(event->type == CONTENT_MSG_LOADING ||
event->type == CONTENT_MSG_DONE ||
- event->type == CONTENT_MSG_ERROR)) {
+ event->type == CONTENT_MSG_ERROR ||
+ event->type == CONTENT_MSG_ERRORCODE)) {
/* all objects have arrived */
content__reformat(&c->base, false, c->base.available_width,
c->base.height);
@@ -499,7 +504,8 @@ static bool html_replace_object(struct content_html_object *object, nsurl *url)
/* remove existing object */
if (content_get_status(object->content) != CONTENT_STATUS_DONE) {
c->base.active--;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active",
+ c->base.active);
}
hlcache_handle_release(object->content);
@@ -520,7 +526,7 @@ static bool html_replace_object(struct content_html_object *object, nsurl *url)
for (page = c; page != NULL; page = page->page) {
page->base.active++;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", c->base.active);
page->base.status = CONTENT_STATUS_READY;
}
@@ -603,7 +609,8 @@ nserror html_object_abort_objects(html_content *htmlc)
object->content = NULL;
if (object->box != NULL) {
htmlc->base.active--;
- LOG("%d fetches active", htmlc->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active",
+ htmlc->base.active);
}
break;
@@ -641,7 +648,7 @@ nserror html_object_free_objects(html_content *html)
struct content_html_object *victim = html->object_list;
if (victim->content != NULL) {
- LOG("object %p", victim->content);
+ NSLOG(netsurf, INFO, "object %p", victim->content);
if (content_get_type(victim->content) == CONTENT_HTML) {
guit->misc->schedule(-1, html_object_refresh, victim);
@@ -703,7 +710,7 @@ bool html_fetch_object(html_content *c, nsurl *url, struct box *box,
c->num_objects++;
if (box != NULL) {
c->base.active++;
- LOG("%d fetches active", c->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", c->base.active);
}
return true;
diff --git a/render/html_script.c b/render/html_script.c
index 37b0564d7..c73a4806d 100644
--- a/render/html_script.c
+++ b/render/html_script.c
@@ -96,7 +96,7 @@ nserror html_script_exec(html_content *c)
s->already_started = true;
- }
+ }
}
}
@@ -105,8 +105,8 @@ nserror html_script_exec(html_content *c)
/* create new html script entry */
static struct html_script *
-html_process_new_script(html_content *c,
- dom_string *mimetype,
+html_process_new_script(html_content *c,
+ dom_string *mimetype,
enum html_script_type type)
{
struct html_script *nscript;
@@ -165,18 +165,24 @@ convert_script_async_cb(hlcache_handle *script,
break;
case CONTENT_MSG_DONE:
- LOG("script %d done '%s'", i, nsurl_access(hlcache_handle_get_url(script)));
+ NSLOG(netsurf, INFO, "script %d done '%s'", i,
+ nsurl_access(hlcache_handle_get_url(script)));
parent->base.active--;
- LOG("%d fetches active", parent->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", parent->base.active);
break;
case CONTENT_MSG_ERROR:
- LOG("script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), event->data.error);
+ NSLOG(netsurf, INFO, "script %s failed: %s",
+ nsurl_access(hlcache_handle_get_url(script)),
+ event->data.error);
+ /* fall through */
+
+ case CONTENT_MSG_ERRORCODE:
hlcache_handle_release(script);
s->data.handle = NULL;
parent->base.active--;
- LOG("%d fetches active", parent->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", parent->base.active);
content_add_error(&parent->base, "?", 0);
break;
@@ -218,18 +224,24 @@ convert_script_defer_cb(hlcache_handle *script,
switch (event->type) {
case CONTENT_MSG_DONE:
- LOG("script %d done '%s'", i, nsurl_access(hlcache_handle_get_url(script)));
+ NSLOG(netsurf, INFO, "script %d done '%s'", i,
+ nsurl_access(hlcache_handle_get_url(script)));
parent->base.active--;
- LOG("%d fetches active", parent->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", parent->base.active);
break;
case CONTENT_MSG_ERROR:
- LOG("script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), event->data.error);
+ NSLOG(netsurf, INFO, "script %s failed: %s",
+ nsurl_access(hlcache_handle_get_url(script)),
+ event->data.error);
+ /* fall through */
+
+ case CONTENT_MSG_ERRORCODE:
hlcache_handle_release(script);
s->data.handle = NULL;
parent->base.active--;
- LOG("%d fetches active", parent->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", parent->base.active);
content_add_error(&parent->base, "?", 0);
break;
@@ -272,9 +284,10 @@ convert_script_sync_cb(hlcache_handle *script,
switch (event->type) {
case CONTENT_MSG_DONE:
- LOG("script %d done '%s'", i, nsurl_access(hlcache_handle_get_url(script)));
+ NSLOG(netsurf, INFO, "script %d done '%s'", i,
+ nsurl_access(hlcache_handle_get_url(script)));
parent->base.active--;
- LOG("%d fetches active", parent->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", parent->base.active);
s->already_started = true;
@@ -291,19 +304,23 @@ convert_script_sync_cb(hlcache_handle *script,
/* continue parse */
err = dom_hubbub_parser_pause(parent->parser, false);
if (err != DOM_HUBBUB_OK) {
- LOG("unpause returned 0x%x", err);
- }
+ NSLOG(netsurf, INFO, "unpause returned 0x%x", err);
+ }
break;
case CONTENT_MSG_ERROR:
- LOG("script %s failed: %s", nsurl_access(hlcache_handle_get_url(script)), event->data.error);
+ NSLOG(netsurf, INFO, "script %s failed: %s",
+ nsurl_access(hlcache_handle_get_url(script)),
+ event->data.error);
+ /* fall through */
+ case CONTENT_MSG_ERRORCODE:
hlcache_handle_release(script);
s->data.handle = NULL;
parent->base.active--;
- LOG("%d fetches active", parent->base.active);
+ NSLOG(netsurf, INFO, "%d fetches active", parent->base.active);
content_add_error(&parent->base, "?", 0);
s->already_started = true;
@@ -311,8 +328,8 @@ convert_script_sync_cb(hlcache_handle *script,
/* continue parse */
err = dom_hubbub_parser_pause(parent->parser, false);
if (err != DOM_HUBBUB_OK) {
- LOG("unpause returned 0x%x", err);
- }
+ NSLOG(netsurf, INFO, "unpause returned 0x%x", err);
+ }
break;
@@ -343,7 +360,6 @@ exec_src_script(html_content *c,
nsurl *joined;
hlcache_child_context child;
struct html_script *nscript;
- union content_msg_data msg_data;
bool async;
bool defer;
enum html_script_type script_type;
@@ -354,21 +370,21 @@ exec_src_script(html_content *c,
/* src url */
ns_error = nsurl_join(c->base_url, dom_string_data(src), &joined);
if (ns_error != NSERROR_OK) {
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast_errorcode(&c->base, NSERROR_NOMEM);
return DOM_HUBBUB_NOMEM;
}
- LOG("script %i '%s'", c->scripts_count, nsurl_access(joined));
+ NSLOG(netsurf, INFO, "script %i '%s'", c->scripts_count,
+ nsurl_access(joined));
/* there are three ways to process the script tag at this point:
*
* Syncronously pause the parent parse and continue after
* the script has downloaded and executed. (default)
- * Async Start the script downloading and execute it when it
- * becomes available.
- * Defered Start the script downloading and execute it when
- * the page has completed parsing, may be set along
+ * Async Start the script downloading and execute it when it
+ * becomes available.
+ * Defered Start the script downloading and execute it when
+ * the page has completed parsing, may be set along
* with async where it is ignored.
*/
@@ -377,7 +393,7 @@ exec_src_script(html_content *c,
* value or the attribute name itself are valid. However
* various browsers interpret this in various ways the most
* compatible approach is to be liberal and accept any
- * value. Note setting the values to "false" still makes them true!
+ * value. Note setting the values to "false" still makes them true!
*/
exc = dom_element_has_attribute(node, corestring_dom_async, &async);
if (exc != DOM_NO_ERR) {
@@ -390,7 +406,7 @@ exec_src_script(html_content *c,
script_cb = convert_script_async_cb;
} else {
- exc = dom_element_has_attribute(node,
+ exc = dom_element_has_attribute(node,
corestring_dom_defer, &defer);
if (exc != DOM_NO_ERR) {
return DOM_HUBBUB_OK; /* dom error */
@@ -410,8 +426,7 @@ exec_src_script(html_content *c,
nscript = html_process_new_script(c, mimetype, script_type);
if (nscript == NULL) {
nsurl_unref(joined);
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast_errorcode(&c->base, NSERROR_NOMEM);
return DOM_HUBBUB_NOMEM;
}
@@ -434,15 +449,15 @@ exec_src_script(html_content *c,
if (ns_error != NSERROR_OK) {
/* @todo Deal with fetch error better. currently assume
- * fetch never became active
+ * fetch never became active
*/
/* mark duff script fetch as already started */
- nscript->already_started = true;
- LOG("Fetch failed with error %d", ns_error);
+ nscript->already_started = true;
+ NSLOG(netsurf, INFO, "Fetch failed with error %d", ns_error);
} else {
/* update base content active fetch count */
- c->base.active++;
- LOG("%d fetches active", c->base.active);
+ c->base.active++;
+ NSLOG(netsurf, INFO, "%d fetches active", c->base.active);
switch (script_type) {
case HTML_SCRIPT_SYNC:
@@ -465,7 +480,6 @@ exec_src_script(html_content *c,
static dom_hubbub_error
exec_inline_script(html_content *c, dom_node *node, dom_string *mimetype)
{
- union content_msg_data msg_data;
dom_string *script;
dom_exception exc; /* returned by libdom functions */
struct lwc_string_s *lwcmimetype;
@@ -482,8 +496,7 @@ exec_inline_script(html_content *c, dom_node *node, dom_string *mimetype)
if (nscript == NULL) {
dom_string_unref(script);
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast_errorcode(&c->base, NSERROR_NOMEM);
return DOM_HUBBUB_NOMEM;
}
@@ -526,15 +539,16 @@ html_process_script(void *ctx, dom_node *node)
union content_msg_data msg_data;
msg_data.jscontext = &c->jscontext;
- content_broadcast(&c->base, CONTENT_MSG_GETCTX, msg_data);
- LOG("javascript context %p ", c->jscontext);
+ content_broadcast(&c->base, CONTENT_MSG_GETCTX, &msg_data);
+ NSLOG(netsurf, INFO, "javascript context %p ", c->jscontext);
if (c->jscontext == NULL) {
/* no context and it could not be created, abort */
return DOM_HUBBUB_OK;
}
}
- LOG("content %p parser %p node %p", c, c->parser, node);
+ NSLOG(netsurf, INFO, "content %p parser %p node %p", c, c->parser,
+ node);
exc = dom_element_get_attribute(node, corestring_dom_type, &mimetype);
if (exc != DOM_NO_ERR || mimetype == NULL) {
diff --git a/render/imagemap.c b/render/imagemap.c
index 6e2504bdc..0d3b42a1b 100644
--- a/render/imagemap.c
+++ b/render/imagemap.c
@@ -241,21 +241,35 @@ void imagemap_dump(html_content *c)
map = c->imagemaps[i];
while (map != NULL) {
- LOG("Imagemap: %s", map->key);
+ NSLOG(netsurf, INFO, "Imagemap: %s", map->key);
for (entry = map->list; entry; entry = entry->next) {
switch (entry->type) {
case IMAGEMAP_DEFAULT:
- LOG("\tDefault: %s", nsurl_access(entry->url));
+ NSLOG(netsurf, INFO, "\tDefault: %s",
+ nsurl_access(entry->url));
break;
case IMAGEMAP_RECT:
- LOG("\tRectangle: %s: [(%d,%d),(%d,%d)]", nsurl_access(entry->url), entry->bounds.rect.x0, entry->bounds.rect.y0, entry->bounds.rect.x1, entry->bounds.rect.y1);
+ NSLOG(netsurf, INFO,
+ "\tRectangle: %s: [(%d,%d),(%d,%d)]",
+ nsurl_access(entry->url),
+ entry->bounds.rect.x0,
+ entry->bounds.rect.y0,
+ entry->bounds.rect.x1,
+ entry->bounds.rect.y1);
break;
case IMAGEMAP_CIRCLE:
- LOG("\tCircle: %s: [(%d,%d),%d]", nsurl_access(entry->url), entry->bounds.circle.x, entry->bounds.circle.y, entry->bounds.circle.r);
+ NSLOG(netsurf, INFO,
+ "\tCircle: %s: [(%d,%d),%d]",
+ nsurl_access(entry->url),
+ entry->bounds.circle.x,
+ entry->bounds.circle.y,
+ entry->bounds.circle.r);
break;
case IMAGEMAP_POLY:
- LOG("\tPolygon: %s:", nsurl_access(entry->url));
+ NSLOG(netsurf, INFO,
+ "\tPolygon: %s:",
+ nsurl_access(entry->url));
for (j = 0; j != entry->bounds.poly.num;
j++) {
fprintf(stderr, "(%d,%d) ",
diff --git a/render/layout.c b/render/layout.c
index 6782fdfc6..7ca688fab 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -47,6 +47,7 @@
#include "utils/talloc.h"
#include "utils/utils.h"
#include "utils/nsoption.h"
+#include "netsurf/inttypes.h"
#include "netsurf/content.h"
#include "netsurf/browser_window.h"
#include "netsurf/layout.h"
@@ -62,10 +63,6 @@
#include "render/layout.h"
#include "render/table.h"
-
-/* Define to enable layout debugging */
-#undef LAYOUT_DEBUG
-
#define AUTO INT_MIN
/* Fixed point percentage (a) of an integer (b), to an integer */
@@ -342,9 +339,7 @@ layout_minmax_line(struct box *first,
b->type == BOX_BR || b->type == BOX_TEXT ||
b->type == BOX_INLINE_END);
-#ifdef LAYOUT_DEBUG
- LOG("%p: min %i, max %i", b, min, max);
-#endif
+ NSLOG(layout, DEBUG, "%p: min %i, max %i", b, min, max);
if (b->type == BOX_BR) {
b = b->next;
@@ -624,9 +619,7 @@ layout_minmax_line(struct box *first,
*line_min = min;
*line_max = max;
-#ifdef LAYOUT_DEBUG
- LOG("line_min %i, line_max %i", min, max);
-#endif
+ NSLOG(layout, DEBUG, "line_min %i, line_max %i", min, max);
assert(b != first);
assert(0 <= *line_min);
@@ -1117,7 +1110,7 @@ layout_find_dimensions(int available_width,
css_fixed value = 0;
css_unit unit = CSS_UNIT_PX;
- type = css_computed_min_width(style, &value, &unit);
+ type = ns_computed_min_width(style, &value, &unit);
if (type == CSS_MIN_WIDTH_SET) {
if (unit == CSS_UNIT_PCT) {
@@ -1164,7 +1157,7 @@ layout_find_dimensions(int available_width,
css_fixed value = 0;
css_unit unit = CSS_UNIT_PX;
- type = css_computed_min_height(style, &value, &unit);
+ type = ns_computed_min_height(style, &value, &unit);
if (type == CSS_MIN_HEIGHT_SET) {
if (unit == CSS_UNIT_PCT) {
@@ -1469,9 +1462,7 @@ find_sides(struct box *fl,
{
int fy0, fy1, fx0, fx1;
-#ifdef LAYOUT_DEBUG
- LOG("y0 %i, y1 %i, x0 %i, x1 %i", y0, y1, *x0, *x1);
-#endif
+ NSLOG(layout, DEBUG, "y0 %i, y1 %i, x0 %i, x1 %i", y0, y1, *x0, *x1);
*left = *right = 0;
for (; fl; fl = fl->next_float) {
@@ -1500,9 +1491,8 @@ find_sides(struct box *fl,
}
}
-#ifdef LAYOUT_DEBUG
- LOG("x0 %i, x1 %i, left %p, right %p", *x0, *x1, *left, *right);
-#endif
+ NSLOG(layout, DEBUG, "x0 %i, x1 %i, left %p, right %p", *x0, *x1,
+ *left, *right);
}
@@ -1964,15 +1954,22 @@ static bool layout_table(struct box *table, int available_width,
/* calculate width required by cells */
for (i = 0; i != columns; i++) {
-#ifdef LAYOUT_DEBUG
- LOG("table %p, column %u: type %s, width %i, min %i, max %i", table, i, ((const char *[]){
- "UNKNOWN",
- "FIXED",
- "AUTO",
- "PERCENT",
- "RELATIVE"
- })[col[i].type], col[i].width, col[i].min, col[i].max);
-#endif
+
+ NSLOG(layout, DEBUG,
+ "table %p, column %u: type %s, width %i, min %i, max %i",
+ table,
+ i,
+ ((const char *[]){
+ "UNKNOWN",
+ "FIXED",
+ "AUTO",
+ "PERCENT",
+ "RELATIVE",
+ })[col[i].type],
+ col[i].width,
+ col[i].min,
+ col[i].max);
+
if (col[i].positioned) {
positioned_columns++;
@@ -1990,16 +1987,14 @@ static bool layout_table(struct box *table, int available_width,
} else
required_width += col[i].min;
-#ifdef LAYOUT_DEBUG
- LOG("required_width %i", required_width);
-#endif
+ NSLOG(layout, DEBUG, "required_width %i", required_width);
}
required_width += (columns + 1 - positioned_columns) *
border_spacing_h;
-#ifdef LAYOUT_DEBUG
- LOG("width %i, min %i, max %i, auto %i, required %i", table_width, table->min_width, table->max_width, auto_width, required_width);
-#endif
+ NSLOG(layout, DEBUG,
+ "width %i, min %i, max %i, auto %i, required %i", table_width,
+ table->min_width, table->max_width, auto_width, required_width);
if (auto_width < required_width) {
/* table narrower than required width for columns:
@@ -2400,7 +2395,7 @@ static bool layout_apply_minmax_height(struct box *box, struct box *container)
}
/* min-height */
- if (css_computed_min_height(box->style, &value, &unit) ==
+ if (ns_computed_min_height(box->style, &value, &unit) ==
CSS_MIN_HEIGHT_SET) {
if (unit == CSS_UNIT_PCT) {
if (containing_block &&
@@ -2448,9 +2443,8 @@ static bool layout_block_object(struct box *block)
block->type == BOX_TABLE_CELL);
assert(block->object);
-#ifdef LAYOUT_DEBUG
- LOG("block %p, object %s, width %i", block, hlcache_handle_get_url(block->object), block->width);
-#endif
+ NSLOG(layout, DEBUG, "block %p, object %p, width %i", block,
+ hlcache_handle_get_url(block->object), block->width);
if (content_get_type(block->object) == CONTENT_HTML) {
content_reformat(block->object, false, block->width, 1);
@@ -2746,9 +2740,7 @@ layout_block_context(struct box *block,
goto advance_to_next_box;
}
-#ifdef LAYOUT_DEBUG
- LOG("box %p, cx %i, cy %i", box, cx, cy);
-#endif
+ NSLOG(layout, DEBUG, "box %p, cx %i, cy %i", box, cx, cy);
/* Layout (except tables). */
if (box->object) {
@@ -3187,9 +3179,12 @@ layout_absolute(struct box *box,
box->float_container = NULL;
/* 10.3.7 */
-#ifdef LAYOUT_DEBUG
- LOG("%i + %i + %i + %i + %i + %i + %i + %i + %i = %i", left, margin[LEFT], border[LEFT].width, padding[LEFT], width, padding[RIGHT], border[RIGHT].width, margin[RIGHT], right, containing_block->width);
-#endif
+ NSLOG(layout, DEBUG,
+ "%i + %i + %i + %i + %i + %i + %i + %i + %i = %i",
+ left, margin[LEFT], border[LEFT].width, padding[LEFT], width,
+ padding[RIGHT], border[RIGHT].width, margin[RIGHT], right,
+ containing_block->width);
+
if (left == AUTO && width == AUTO && right == AUTO) {
if (margin[LEFT] == AUTO)
@@ -3352,9 +3347,11 @@ layout_absolute(struct box *box,
}
}
-#ifdef LAYOUT_DEBUG
- LOG("%i + %i + %i + %i + %i + %i + %i + %i + %i = %i", left, margin[LEFT], border[LEFT].width, padding[LEFT], width, padding[RIGHT], border[RIGHT].width, margin[RIGHT], right, containing_block->width);
-#endif
+ NSLOG(layout, DEBUG,
+ "%i + %i + %i + %i + %i + %i + %i + %i + %i = %i",
+ left, margin[LEFT], border[LEFT].width, padding[LEFT], width,
+ padding[RIGHT], border[RIGHT].width, margin[RIGHT], right,
+ containing_block->width);
box->x = left + margin[LEFT] + border[LEFT].width - cx;
if (containing_block->type == BOX_BLOCK ||
@@ -3386,9 +3383,11 @@ layout_absolute(struct box *box,
}
/* 10.6.4 */
-#ifdef LAYOUT_DEBUG
- LOG("%i + %i + %i + %i + %i + %i + %i + %i + %i = %i", top, margin[TOP], border[TOP].width, padding[TOP], height, padding[BOTTOM], border[BOTTOM].width, margin[BOTTOM], bottom, containing_block->height);
-#endif
+ NSLOG(layout, DEBUG,
+ "%i + %i + %i + %i + %i + %i + %i + %i + %i = %i",
+ top, margin[TOP], border[TOP].width, padding[TOP], height,
+ padding[BOTTOM], border[BOTTOM].width, margin[BOTTOM], bottom,
+ containing_block->height);
if (top == AUTO && height == AUTO && bottom == AUTO) {
top = static_top;
@@ -3474,9 +3473,11 @@ layout_absolute(struct box *box,
}
}
-#ifdef LAYOUT_DEBUG
- LOG("%i + %i + %i + %i + %i + %i + %i + %i + %i = %i", top, margin[TOP], border[TOP].width, padding[TOP], height, padding[BOTTOM], border[BOTTOM].width, margin[BOTTOM], bottom, containing_block->height);
-#endif
+ NSLOG(layout, DEBUG,
+ "%i + %i + %i + %i + %i + %i + %i + %i + %i = %i",
+ top, margin[TOP], border[TOP].width, padding[TOP], height,
+ padding[BOTTOM], border[BOTTOM].width, margin[BOTTOM], bottom,
+ containing_block->height);
box->y = top + margin[TOP] + border[TOP].width - cy;
if (containing_block->type == BOX_BLOCK ||
@@ -3624,9 +3625,8 @@ static void layout_compute_relative_offset(struct box *box, int *x, int *y)
bottom = -top;
}
-#ifdef LAYOUT_DEBUG
- LOG("left %i, right %i, top %i, bottom %i", left, right, top, bottom);
-#endif
+ NSLOG(layout, DEBUG, "left %i, right %i, top %i, bottom %i", left,
+ right, top, bottom);
*x = left;
*y = top;
@@ -3887,10 +3887,20 @@ layout_text_box_split(html_content *content,
c2->next->prev = c2;
else
c2->parent->last = c2;
-#ifdef LAYOUT_DEBUG
- LOG("split_box %p len: %u \"%.*s\"", split_box, split_box->length, split_box->length, split_box->text);
- LOG(" new_box %p len: %u \"%.*s\"", c2, c2->length, c2->length, c2->text);
-#endif
+
+ NSLOG(layout, DEBUG,
+ "split_box %p len: %" PRIsizet " \"%.*s\"",
+ split_box,
+ split_box->length,
+ (int)split_box->length,
+ split_box->text);
+ NSLOG(layout, DEBUG,
+ " new_box %p len: %" PRIsizet " \"%.*s\"",
+ c2,
+ c2->length,
+ (int)c2->length,
+ c2->text);
+
return true;
}
@@ -4079,9 +4089,9 @@ place_float_below(struct box *c, int width, int cx, int y, struct box *cont)
yy = y > cont->cached_place_below_level ?
y : cont->cached_place_below_level;
-#ifdef LAYOUT_DEBUG
- LOG("c %p, width %i, cx %i, y %i, cont %p", c, width, cx, y, cont);
-#endif
+ NSLOG(layout, DEBUG,
+ "c %p, width %i, cx %i, y %i, cont %p", c,
+ width, cx, y, cont);
do {
y = yy;
@@ -4158,9 +4168,15 @@ layout_line(struct box *first,
const struct gui_layout_table *font_func = content->font_func;
plot_font_style_t fstyle;
-#ifdef LAYOUT_DEBUG
- LOG("first %p, first->text '%.*s', width %i, y %i, cx %i, cy %i", first, (int)first->length, first->text, *width, *y, cx, cy);
-#endif
+ NSLOG(layout, DEBUG,
+ "first %p, first->text '%.*s', width %i, y %i, cx %i, cy %i",
+ first,
+ (int)first->length,
+ first->text,
+ *width,
+ *y,
+ cx,
+ cy);
/* find sides at top of line */
x0 += cx;
@@ -4189,9 +4205,9 @@ layout_line(struct box *first,
/* pass 1: find height of line assuming sides at top of line: loop
* body executed at least once
* keep in sync with the loop in layout_minmax_line() */
-#ifdef LAYOUT_DEBUG
- LOG("x0 %i, x1 %i, x1 - x0 %i", x0, x1, x1 - x0);
-#endif
+
+ NSLOG(layout, DEBUG, "x0 %i, x1 %i, x1 - x0 %i", x0, x1, x1 - x0);
+
for (x = 0, b = first; x <= x1 - x0 && b != 0; b = b->next) {
int min_width, max_width, min_height, max_height;
@@ -4202,9 +4218,9 @@ layout_line(struct box *first,
b->type == BOX_BR || b->type == BOX_TEXT ||
b->type == BOX_INLINE_END);
-#ifdef LAYOUT_DEBUG
- LOG("pass 1: b %p, x %i", b, x);
-#endif
+
+ NSLOG(layout, DEBUG, "pass 1: b %p, x %i", b, x);
+
if (b->type == BOX_BR)
break;
@@ -4413,14 +4429,12 @@ layout_line(struct box *first,
space_after = space_before = 0;
/* pass 2: place boxes in line: loop body executed at least once */
-#ifdef LAYOUT_DEBUG
- LOG("x0 %i, x1 %i, x1 - x0 %i", x0, x1, x1 - x0);
-#endif
+
+ NSLOG(layout, DEBUG, "x0 %i, x1 %i, x1 - x0 %i", x0, x1, x1 - x0);
for (x = x_previous = 0, b = first; x <= x1 - x0 && b; b = b->next) {
-#ifdef LAYOUT_DEBUG
- LOG("pass 2: b %p, x %i", b, x);
-#endif
+
+ NSLOG(layout, DEBUG, "pass 2: b %p, x %i", b, x);
if (b->type == BOX_INLINE_BLOCK &&
(css_computed_position(b->style) ==
@@ -4488,9 +4502,7 @@ layout_line(struct box *first,
} else {
/* float */
-#ifdef LAYOUT_DEBUG
- LOG("float %p", b);
-#endif
+ NSLOG(layout, DEBUG, "float %p", b);
d = b->children;
d->float_children = 0;
@@ -4500,9 +4512,11 @@ layout_line(struct box *first,
if (!layout_float(d, *width, content))
return false;
-#ifdef LAYOUT_DEBUG
- LOG("%p : %d %d", d, d->margin[TOP], d->border[TOP].width);
-#endif
+ NSLOG(layout, DEBUG,
+ "%p : %d %d",
+ d,
+ d->margin[TOP],
+ d->border[TOP].width);
d->x = d->margin[LEFT] + d->border[LEFT].width;
d->y = d->margin[TOP] + d->border[TOP].width;
@@ -4633,9 +4647,18 @@ layout_line(struct box *first,
if (split == 0)
w = split_box->width;
-#ifdef LAYOUT_DEBUG
- LOG("splitting: split_box %p \"%.*s\", spilt %zu, w %i, ""left %p, right %p, inline_count %u", split_box, (int)split_box->length, split_box->text, split, w, left, right, inline_count);
-#endif
+
+ NSLOG(layout, DEBUG,
+ "splitting: split_box %p \"%.*s\", spilt %zu, w %i, "
+ "left %p, right %p, inline_count %u",
+ split_box,
+ (int)split_box->length,
+ split_box->text,
+ split,
+ w,
+ left,
+ right,
+ inline_count);
if ((split == 0 || x1 - x0 <= x + space_before + w) &&
!left && !right && inline_count == 1) {
@@ -4653,9 +4676,9 @@ layout_line(struct box *first,
b = split_box->next;
}
x += space_before + w;
-#ifdef LAYOUT_DEBUG
- LOG("forcing");
-#endif
+
+ NSLOG(layout, DEBUG, "forcing");
+
} else if ((split == 0 || x1 - x0 <= x + space_before + w) &&
inline_count == 1) {
/* first word of first box doesn't fit, but a float is
@@ -4663,13 +4686,18 @@ layout_line(struct box *first,
assert(left || right);
used_height = 0;
if (left) {
-#ifdef LAYOUT_DEBUG
- LOG("cy %i, left->y %i, left->height %i", cy, left->y, left->height);
-#endif
+
+ NSLOG(layout, DEBUG,
+ "cy %i, left->y %i, left->height %i",
+ cy,
+ left->y,
+ left->height);
+
used_height = left->y + left->height - cy + 1;
-#ifdef LAYOUT_DEBUG
- LOG("used_height %i", used_height);
-#endif
+
+ NSLOG(layout, DEBUG, "used_height %i",
+ used_height);
+
}
if (right && used_height <
right->y + right->height - cy + 1)
@@ -4679,22 +4707,24 @@ layout_line(struct box *first,
used_height = 0;
b = split_box;
-#ifdef LAYOUT_DEBUG
- LOG("moving below float");
-#endif
+
+ NSLOG(layout, DEBUG, "moving below float");
+
} else if (split == 0 || x1 - x0 <= x + space_before + w) {
/* first word of box doesn't fit so leave box for next
* line */
b = split_box;
-#ifdef LAYOUT_DEBUG
- LOG("leaving for next line");
-#endif
+
+ NSLOG(layout, DEBUG, "leaving for next line");
+
} else {
/* fit as many words as possible */
assert(split != 0);
-#ifdef LAYOUT_DEBUG
- LOG("'%.*s' %i %zu %i", (int)split_box->length, split_box->text, x1 - x0, split, w);
-#endif
+
+ NSLOG(layout, DEBUG, "'%.*s' %i %zu %i",
+ (int)split_box->length, split_box->text,
+ x1 - x0, split, w);
+
if (split != split_box->length) {
if (!layout_text_box_split(content, &fstyle,
split_box, split, w))
@@ -4702,9 +4732,9 @@ layout_line(struct box *first,
b = split_box->next;
}
x += space_before + w;
-#ifdef LAYOUT_DEBUG
- LOG("fitting words");
-#endif
+
+ NSLOG(layout, DEBUG, "fitting words");
+
}
move_y = true;
}
@@ -4842,9 +4872,14 @@ bool layout_inline_container(struct box *inline_container, int width,
assert(inline_container->type == BOX_INLINE_CONTAINER);
-#ifdef LAYOUT_DEBUG
- LOG("inline_container %p, width %i, cont %p, cx %i, cy %i", inline_container, width, cont, cx, cy);
-#endif
+ NSLOG(layout, DEBUG,
+ "inline_container %p, width %i, cont %p, cx %i, cy %i",
+ inline_container,
+ width,
+ cont,
+ cx,
+ cy);
+
has_text_children = false;
for (c = inline_container->children; c; c = c->next) {
@@ -4872,9 +4907,9 @@ bool layout_inline_container(struct box *inline_container, int width,
* curwidth = width and have the multiword lines wrap to the min width)
*/
for (c = inline_container->children; c; ) {
-#ifdef LAYOUT_DEBUG
- LOG("c %p", c);
-#endif
+
+ NSLOG(layout, DEBUG, "c %p", c);
+
curwidth = inline_container->width;
if (!layout_line(c, &curwidth, &y, cx, cy + y, cont, first_line,
has_text_children, content, &next))
diff --git a/render/search.c b/render/search.c
index 4af6706a0..8f21d8758 100644
--- a/render/search.c
+++ b/render/search.c
@@ -538,7 +538,7 @@ static void search_text(const char *string, int string_len,
msg_data.scroll.y0 = bounds.y0;
msg_data.scroll.x1 = bounds.x1;
msg_data.scroll.y1 = bounds.y1;
- content_broadcast(context->c, CONTENT_MSG_SCROLL, msg_data);
+ content_broadcast(context->c, CONTENT_MSG_SCROLL, &msg_data);
}
@@ -571,7 +571,7 @@ void search_step(struct search_context *context, search_flags_t flags,
msg_data.scroll.area = false;
msg_data.scroll.x0 = 0;
msg_data.scroll.y0 = 0;
- content_broadcast(context->c, CONTENT_MSG_SCROLL, msg_data);
+ content_broadcast(context->c, CONTENT_MSG_SCROLL, &msg_data);
return;
}
search_text(string, string_len, context, flags);
diff --git a/render/table.c b/render/table.c
index acf00c70e..c41b9130e 100644
--- a/render/table.c
+++ b/render/table.c
@@ -219,13 +219,14 @@ bool table_calculate_column_types(struct box *table)
#ifdef TABLE_DEBUG
for (i = 0; i != table->columns; i++)
- LOG("table %p, column %u: type %s, width %i", table, i, ((const char *[]){
+ NSLOG(netsurf, INFO,
+ "table %p, column %u: type %s, width %i", table, i, ((const char *[]){
"UNKNOWN",
"FIXED",
"AUTO",
"PERCENT",
- "RELATIVE"
- })[col[i].type], col[i].width);
+ "RELATIVE",
+ })[col[i].type], col[i].width);
#endif
return true;
@@ -740,27 +741,27 @@ bool table_border_is_more_eyecatching(const struct border *a,
/* 3b -- sort by style */
switch (a->style) {
- case CSS_BORDER_STYLE_DOUBLE: impact++;
- case CSS_BORDER_STYLE_SOLID: impact++;
- case CSS_BORDER_STYLE_DASHED: impact++;
- case CSS_BORDER_STYLE_DOTTED: impact++;
- case CSS_BORDER_STYLE_RIDGE: impact++;
- case CSS_BORDER_STYLE_OUTSET: impact++;
- case CSS_BORDER_STYLE_GROOVE: impact++;
- case CSS_BORDER_STYLE_INSET: impact++;
+ case CSS_BORDER_STYLE_DOUBLE: impact++; /* Fall through */
+ case CSS_BORDER_STYLE_SOLID: impact++; /* Fall through */
+ case CSS_BORDER_STYLE_DASHED: impact++; /* Fall through */
+ case CSS_BORDER_STYLE_DOTTED: impact++; /* Fall through */
+ case CSS_BORDER_STYLE_RIDGE: impact++; /* Fall through */
+ case CSS_BORDER_STYLE_OUTSET: impact++; /* Fall through */
+ case CSS_BORDER_STYLE_GROOVE: impact++; /* Fall through */
+ case CSS_BORDER_STYLE_INSET: impact++; /* Fall through */
default:
break;
}
switch (b->style) {
- case CSS_BORDER_STYLE_DOUBLE: impact--;
- case CSS_BORDER_STYLE_SOLID: impact--;
- case CSS_BORDER_STYLE_DASHED: impact--;
- case CSS_BORDER_STYLE_DOTTED: impact--;
- case CSS_BORDER_STYLE_RIDGE: impact--;
- case CSS_BORDER_STYLE_OUTSET: impact--;
- case CSS_BORDER_STYLE_GROOVE: impact--;
- case CSS_BORDER_STYLE_INSET: impact--;
+ case CSS_BORDER_STYLE_DOUBLE: impact--; /* Fall through */
+ case CSS_BORDER_STYLE_SOLID: impact--; /* Fall through */
+ case CSS_BORDER_STYLE_DASHED: impact--; /* Fall through */
+ case CSS_BORDER_STYLE_DOTTED: impact--; /* Fall through */
+ case CSS_BORDER_STYLE_RIDGE: impact--; /* Fall through */
+ case CSS_BORDER_STYLE_OUTSET: impact--; /* Fall through */
+ case CSS_BORDER_STYLE_GROOVE: impact--; /* Fall through */
+ case CSS_BORDER_STYLE_INSET: impact--; /* Fall through */
default:
break;
}
@@ -773,22 +774,22 @@ bool table_border_is_more_eyecatching(const struct border *a,
/* 4a -- sort by origin */
impact = 0;
- switch (a_src) {
- case BOX_TABLE_CELL: impact++;
- case BOX_TABLE_ROW: impact++;
- case BOX_TABLE_ROW_GROUP: impact++;
/** \todo COL/COL_GROUP */
- case BOX_TABLE: impact++;
+ switch (a_src) {
+ case BOX_TABLE_CELL: impact++; /* Fall through */
+ case BOX_TABLE_ROW: impact++; /* Fall through */
+ case BOX_TABLE_ROW_GROUP: impact++; /* Fall through */
+ case BOX_TABLE: impact++; /* Fall through */
default:
break;
}
- switch (b_src) {
- case BOX_TABLE_CELL: impact--;
- case BOX_TABLE_ROW: impact--;
- case BOX_TABLE_ROW_GROUP: impact--;
/** \todo COL/COL_GROUP */
- case BOX_TABLE: impact--;
+ switch (b_src) {
+ case BOX_TABLE_CELL: impact--; /* Fall through */
+ case BOX_TABLE_ROW: impact--; /* Fall through */
+ case BOX_TABLE_ROW_GROUP: impact--; /* Fall through */
+ case BOX_TABLE: impact--; /* Fall through */
default:
break;
}
diff --git a/render/textplain.c b/render/textplain.c
index 5d28d9c54..ab2d55955 100644
--- a/render/textplain.c
+++ b/render/textplain.c
@@ -150,7 +150,6 @@ textplain_create_internal(textplain_content *c, lwc_string *encoding)
char *utf8_data;
parserutils_inputstream *stream;
parserutils_error error;
- union content_msg_data msg_data;
textplain_style.size = (nsoption_int(font_size) * FONT_SIZE_SCALE) / 10;
@@ -185,8 +184,7 @@ textplain_create_internal(textplain_content *c, lwc_string *encoding)
return NSERROR_OK;
no_memory:
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast_errorcode(&c->base, NSERROR_NOMEM);
return NSERROR_NOMEM;
}
@@ -347,7 +345,6 @@ textplain_process_data(struct content *c, const char *data, unsigned int size)
{
textplain_content *text = (textplain_content *) c;
parserutils_inputstream *stream = text->inputstream;
- union content_msg_data msg_data;
parserutils_error error;
error = parserutils_inputstream_append(stream,
@@ -362,8 +359,7 @@ textplain_process_data(struct content *c, const char *data, unsigned int size)
return true;
no_memory:
- msg_data.error = messages_get("NoMemory");
- content_broadcast(c, CONTENT_MSG_ERROR, msg_data);
+ content_broadcast_errorcode(c, NSERROR_NOMEM);
return false;
}
@@ -427,7 +423,7 @@ static void textplain_reformat(struct content *c, int width, int height)
size_t line_start;
nserror res;
- LOG("content %p w:%d h:%d", c, width, height);
+ NSLOG(netsurf, INFO, "content %p w:%d h:%d", c, width, height);
/* compute available columns (assuming monospaced font) - use 8
* characters for better accuracy
@@ -526,7 +522,7 @@ static void textplain_reformat(struct content *c, int width, int height)
return;
no_memory:
- LOG("out of memory (line_count %lu)", line_count);
+ NSLOG(netsurf, INFO, "out of memory (line_count %lu)", line_count);
return;
}
@@ -647,10 +643,10 @@ textplain_mouse_action(struct content *c,
}
msg_data.explicit_status_text = status;
- content_broadcast(c, CONTENT_MSG_STATUS, msg_data);
+ content_broadcast(c, CONTENT_MSG_STATUS, &msg_data);
msg_data.pointer = pointer;
- content_broadcast(c, CONTENT_MSG_POINTER, msg_data);
+ content_broadcast(c, CONTENT_MSG_POINTER, &msg_data);
}