Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/cbb0c05258e91fc3c3c6a421141df738fcfe7473
...commit
http://git.netsurf-browser.org/netsurf.git/commit/cbb0c05258e91fc3c3c6a421141df738fcfe7473
...tree
http://git.netsurf-browser.org/netsurf.git/tree/cbb0c05258e91fc3c3c6a421141df738fcfe7473
The branch, master has been updated
via cbb0c05258e91fc3c3c6a421141df738fcfe7473 (commit)
from 78aa34e5d761c2597f24ebba89c69ac6fda2f3a8 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=cbb0c05258e91fc3c3c6a421141df738fcfe7473
commit cbb0c05258e91fc3c3c6a421141df738fcfe7473
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>
remove unecessary user warning calls and improve error propogation in html
box
diff --git a/content/handlers/html/box.c b/content/handlers/html/box.c
index 30cb4e2..475e86b 100644
--- a/content/handlers/html/box.c
+++ b/content/handlers/html/box.c
@@ -1114,22 +1114,18 @@ void box_dump(FILE *stream, struct box *box, unsigned
int depth, bool style)
}
}
-/**
- * Applies the given scroll setup to a box. This includes scroll
- * creation/deletion as well as scroll dimension updates.
- *
- * \param c content in which the box is located
- * \param box the box to handle the scrolls for
- * \param bottom whether the horizontal scrollbar should be present
- * \param right whether the vertical scrollbar should be present
- * \return true on success false otherwise
- */
-bool box_handle_scrollbars(struct content *c, struct box *box,
- bool bottom, bool right)
+
+/* exported interface documented in html/box.h */
+nserror
+box_handle_scrollbars(struct content *c,
+ struct box *box,
+ bool bottom,
+ bool right)
{
struct html_scrollbar_data *data;
int visible_width, visible_height;
int full_width, full_height;
+ nserror res;
if (!bottom && box->scroll_x != NULL) {
data = scrollbar_get_data(box->scroll_x);
@@ -1145,8 +1141,9 @@ bool box_handle_scrollbars(struct content *c, struct box
*box,
box->scroll_y = NULL;
}
- if (!bottom && !right)
- return true;
+ if (!bottom && !right) {
+ return NSERROR_OK;
+ }
visible_width = box->width + box->padding[RIGHT] + box->padding[LEFT];
visible_height = box->height + box->padding[TOP] + box->padding[BOTTOM];
@@ -1164,40 +1161,44 @@ 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) {
- NSLOG(netsurf, INFO, "malloc failed");
- guit->misc->warning("NoMemory", 0);
- return false;
+ return NSERROR_NOMEM;
}
data->c = c;
data->box = box;
- if (scrollbar_create(false, visible_height,
- full_height, visible_height,
- data, html_overflow_scroll_callback,
- &(box->scroll_y)) != NSERROR_OK) {
- return false;
+ res = scrollbar_create(false,
+ visible_height,
+ full_height,
+ visible_height,
+ data,
+ html_overflow_scroll_callback,
+ &(box->scroll_y));
+ if (res != NSERROR_OK) {
+ return res;
}
} else {
- scrollbar_set_extents(box->scroll_y, visible_height,
- visible_height, full_height);
+ scrollbar_set_extents(box->scroll_y,
+ visible_height,
+ visible_height,
+ full_height);
}
}
if (bottom) {
if (box->scroll_x == NULL) {
data = malloc(sizeof(struct html_scrollbar_data));
if (data == NULL) {
- NSLOG(netsurf, INFO, "malloc failed");
- guit->misc->warning("NoMemory", 0);
- return false;
+ return NSERROR_OK;
}
data->c = c;
data->box = box;
- if (scrollbar_create(true,
- visible_width -
- (right ? SCROLLBAR_WIDTH : 0),
- full_width, visible_width,
- data, html_overflow_scroll_callback,
- &box->scroll_x) != NSERROR_OK) {
- return false;
+ res = scrollbar_create(true,
+ visible_width - (right ?
SCROLLBAR_WIDTH : 0),
+ full_width,
+ visible_width,
+ data,
+ html_overflow_scroll_callback,
+ &box->scroll_x);
+ if (res != NSERROR_OK) {
+ return res;
}
} else {
scrollbar_set_extents(box->scroll_x,
@@ -1207,10 +1208,11 @@ bool box_handle_scrollbars(struct content *c, struct
box *box,
}
}
- if (right && bottom)
+ if (right && bottom) {
scrollbar_make_pair(box->scroll_x, box->scroll_y);
+ }
- return true;
+ return NSERROR_OK;
}
/**
diff --git a/content/handlers/html/box.h b/content/handlers/html/box.h
index 089c664..8ab2875 100644
--- a/content/handlers/html/box.h
+++ b/content/handlers/html/box.h
@@ -353,8 +353,19 @@ void box_dump(FILE *stream, struct box *box, unsigned int
depth, bool style);
*/
bool box_extract_link(const struct html_content *content, const struct
dom_string *dsrel, struct nsurl *base, struct nsurl **result);
-bool box_handle_scrollbars(struct content *c, struct box *box,
+/**
+ * Applies the given scroll setup to a box. This includes scroll
+ * creation/deletion as well as scroll dimension updates.
+ *
+ * \param c content in which the box is located
+ * \param box the box to handle the scrolls for
+ * \param bottom whether the horizontal scrollbar should be present
+ * \param right whether the vertical scrollbar should be present
+ * \return true on success false otherwise
+ */
+nserror box_handle_scrollbars(struct content *c, struct box *box,
bool bottom, bool right);
+
bool box_vscrollbar_present(const struct box *box);
bool box_hscrollbar_present(const struct box *box);
diff --git a/content/handlers/html/html_redraw.c
b/content/handlers/html/html_redraw.c
index 6216d60..268bd62 100644
--- a/content/handlers/html/html_redraw.c
+++ b/content/handlers/html/html_redraw.c
@@ -1841,20 +1841,24 @@ bool html_redraw_box(const html_content *html, struct
box *box,
/* scrollbars */
if (((box->style && box->type != BOX_BR &&
- box->type != BOX_TABLE && box->type != BOX_INLINE &&
- (overflow_x == CSS_OVERFLOW_SCROLL ||
- overflow_x == CSS_OVERFLOW_AUTO ||
- overflow_y == CSS_OVERFLOW_SCROLL ||
- overflow_y == CSS_OVERFLOW_AUTO)) ||
- (box->object && content_get_type(box->object) ==
- CONTENT_HTML)) && box->parent != NULL) {
+ box->type != BOX_TABLE && box->type != BOX_INLINE &&
+ (overflow_x == CSS_OVERFLOW_SCROLL ||
+ overflow_x == CSS_OVERFLOW_AUTO ||
+ overflow_y == CSS_OVERFLOW_SCROLL ||
+ overflow_y == CSS_OVERFLOW_AUTO)) ||
+ (box->object && content_get_type(box->object) ==
+ CONTENT_HTML)) && box->parent != NULL) {
+ nserror res;
has_x_scroll = box_hscrollbar_present(box);
has_y_scroll = box_vscrollbar_present(box);
- if (!box_handle_scrollbars((struct content *)html,
- box, has_x_scroll, has_y_scroll))
+ res = box_handle_scrollbars((struct content *)html,
+ box, has_x_scroll, has_y_scroll);
+ if (res != NSERROR_OK) {
+ NSLOG(netsurf, INFO, "%s", messages_get_errorcode(res));
return false;
+ }
if (box->scroll_x != NULL)
scrollbar_redraw(box->scroll_x,
diff --git a/desktop/browser_window.c b/desktop/browser_window.c
index 807393e..1e776c1 100644
--- a/desktop/browser_window.c
+++ b/desktop/browser_window.c
@@ -3486,8 +3486,6 @@ navigate_internal_real(struct browser_window *bw,
default: /* report error to user */
browser_window_set_status(bw, messages_get_errorcode(res));
- /** @todo should the caller report the error? */
- guit->misc->warning(messages_get_errorcode(res), NULL);
break;
}
@@ -4445,8 +4443,6 @@ browser_window_find_target(struct browser_window *bw,
* that begin with an underscore. */
if (target[0] != '_') {
bw_target->name = strdup(target);
- if (!bw_target->name)
- guit->misc->warning("NoMemory", NULL);
}
return bw_target;
}
-----------------------------------------------------------------------
Summary of changes:
content/handlers/html/box.c | 74 ++++++++++++++++++-----------------
content/handlers/html/box.h | 13 +++++-
content/handlers/html/html_redraw.c | 22 ++++++-----
desktop/browser_window.c | 4 --
4 files changed, 63 insertions(+), 50 deletions(-)
diff --git a/content/handlers/html/box.c b/content/handlers/html/box.c
index 30cb4e2..475e86b 100644
--- a/content/handlers/html/box.c
+++ b/content/handlers/html/box.c
@@ -1114,22 +1114,18 @@ void box_dump(FILE *stream, struct box *box, unsigned
int depth, bool style)
}
}
-/**
- * Applies the given scroll setup to a box. This includes scroll
- * creation/deletion as well as scroll dimension updates.
- *
- * \param c content in which the box is located
- * \param box the box to handle the scrolls for
- * \param bottom whether the horizontal scrollbar should be present
- * \param right whether the vertical scrollbar should be present
- * \return true on success false otherwise
- */
-bool box_handle_scrollbars(struct content *c, struct box *box,
- bool bottom, bool right)
+
+/* exported interface documented in html/box.h */
+nserror
+box_handle_scrollbars(struct content *c,
+ struct box *box,
+ bool bottom,
+ bool right)
{
struct html_scrollbar_data *data;
int visible_width, visible_height;
int full_width, full_height;
+ nserror res;
if (!bottom && box->scroll_x != NULL) {
data = scrollbar_get_data(box->scroll_x);
@@ -1145,8 +1141,9 @@ bool box_handle_scrollbars(struct content *c, struct box
*box,
box->scroll_y = NULL;
}
- if (!bottom && !right)
- return true;
+ if (!bottom && !right) {
+ return NSERROR_OK;
+ }
visible_width = box->width + box->padding[RIGHT] + box->padding[LEFT];
visible_height = box->height + box->padding[TOP] + box->padding[BOTTOM];
@@ -1164,40 +1161,44 @@ 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) {
- NSLOG(netsurf, INFO, "malloc failed");
- guit->misc->warning("NoMemory", 0);
- return false;
+ return NSERROR_NOMEM;
}
data->c = c;
data->box = box;
- if (scrollbar_create(false, visible_height,
- full_height, visible_height,
- data, html_overflow_scroll_callback,
- &(box->scroll_y)) != NSERROR_OK) {
- return false;
+ res = scrollbar_create(false,
+ visible_height,
+ full_height,
+ visible_height,
+ data,
+ html_overflow_scroll_callback,
+ &(box->scroll_y));
+ if (res != NSERROR_OK) {
+ return res;
}
} else {
- scrollbar_set_extents(box->scroll_y, visible_height,
- visible_height, full_height);
+ scrollbar_set_extents(box->scroll_y,
+ visible_height,
+ visible_height,
+ full_height);
}
}
if (bottom) {
if (box->scroll_x == NULL) {
data = malloc(sizeof(struct html_scrollbar_data));
if (data == NULL) {
- NSLOG(netsurf, INFO, "malloc failed");
- guit->misc->warning("NoMemory", 0);
- return false;
+ return NSERROR_OK;
}
data->c = c;
data->box = box;
- if (scrollbar_create(true,
- visible_width -
- (right ? SCROLLBAR_WIDTH : 0),
- full_width, visible_width,
- data, html_overflow_scroll_callback,
- &box->scroll_x) != NSERROR_OK) {
- return false;
+ res = scrollbar_create(true,
+ visible_width - (right ?
SCROLLBAR_WIDTH : 0),
+ full_width,
+ visible_width,
+ data,
+ html_overflow_scroll_callback,
+ &box->scroll_x);
+ if (res != NSERROR_OK) {
+ return res;
}
} else {
scrollbar_set_extents(box->scroll_x,
@@ -1207,10 +1208,11 @@ bool box_handle_scrollbars(struct content *c, struct
box *box,
}
}
- if (right && bottom)
+ if (right && bottom) {
scrollbar_make_pair(box->scroll_x, box->scroll_y);
+ }
- return true;
+ return NSERROR_OK;
}
/**
diff --git a/content/handlers/html/box.h b/content/handlers/html/box.h
index 089c664..8ab2875 100644
--- a/content/handlers/html/box.h
+++ b/content/handlers/html/box.h
@@ -353,8 +353,19 @@ void box_dump(FILE *stream, struct box *box, unsigned int
depth, bool style);
*/
bool box_extract_link(const struct html_content *content, const struct
dom_string *dsrel, struct nsurl *base, struct nsurl **result);
-bool box_handle_scrollbars(struct content *c, struct box *box,
+/**
+ * Applies the given scroll setup to a box. This includes scroll
+ * creation/deletion as well as scroll dimension updates.
+ *
+ * \param c content in which the box is located
+ * \param box the box to handle the scrolls for
+ * \param bottom whether the horizontal scrollbar should be present
+ * \param right whether the vertical scrollbar should be present
+ * \return true on success false otherwise
+ */
+nserror box_handle_scrollbars(struct content *c, struct box *box,
bool bottom, bool right);
+
bool box_vscrollbar_present(const struct box *box);
bool box_hscrollbar_present(const struct box *box);
diff --git a/content/handlers/html/html_redraw.c
b/content/handlers/html/html_redraw.c
index 6216d60..268bd62 100644
--- a/content/handlers/html/html_redraw.c
+++ b/content/handlers/html/html_redraw.c
@@ -1841,20 +1841,24 @@ bool html_redraw_box(const html_content *html, struct
box *box,
/* scrollbars */
if (((box->style && box->type != BOX_BR &&
- box->type != BOX_TABLE && box->type != BOX_INLINE &&
- (overflow_x == CSS_OVERFLOW_SCROLL ||
- overflow_x == CSS_OVERFLOW_AUTO ||
- overflow_y == CSS_OVERFLOW_SCROLL ||
- overflow_y == CSS_OVERFLOW_AUTO)) ||
- (box->object && content_get_type(box->object) ==
- CONTENT_HTML)) && box->parent != NULL) {
+ box->type != BOX_TABLE && box->type != BOX_INLINE &&
+ (overflow_x == CSS_OVERFLOW_SCROLL ||
+ overflow_x == CSS_OVERFLOW_AUTO ||
+ overflow_y == CSS_OVERFLOW_SCROLL ||
+ overflow_y == CSS_OVERFLOW_AUTO)) ||
+ (box->object && content_get_type(box->object) ==
+ CONTENT_HTML)) && box->parent != NULL) {
+ nserror res;
has_x_scroll = box_hscrollbar_present(box);
has_y_scroll = box_vscrollbar_present(box);
- if (!box_handle_scrollbars((struct content *)html,
- box, has_x_scroll, has_y_scroll))
+ res = box_handle_scrollbars((struct content *)html,
+ box, has_x_scroll, has_y_scroll);
+ if (res != NSERROR_OK) {
+ NSLOG(netsurf, INFO, "%s", messages_get_errorcode(res));
return false;
+ }
if (box->scroll_x != NULL)
scrollbar_redraw(box->scroll_x,
diff --git a/desktop/browser_window.c b/desktop/browser_window.c
index 807393e..1e776c1 100644
--- a/desktop/browser_window.c
+++ b/desktop/browser_window.c
@@ -3486,8 +3486,6 @@ navigate_internal_real(struct browser_window *bw,
default: /* report error to user */
browser_window_set_status(bw, messages_get_errorcode(res));
- /** @todo should the caller report the error? */
- guit->misc->warning(messages_get_errorcode(res), NULL);
break;
}
@@ -4445,8 +4443,6 @@ browser_window_find_target(struct browser_window *bw,
* that begin with an underscore. */
if (target[0] != '_') {
bw_target->name = strdup(target);
- if (!bw_target->name)
- guit->misc->warning("NoMemory", NULL);
}
return bw_target;
}
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org