summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/frames.c14
-rw-r--r--desktop/scrollbar.c10
-rw-r--r--desktop/textarea.c12
-rw-r--r--render/box.c10
-rw-r--r--render/form.c4
5 files changed, 27 insertions, 23 deletions
diff --git a/desktop/frames.c b/desktop/frames.c
index 394deb2ad..7be75ce77 100644
--- a/desktop/frames.c
+++ b/desktop/frames.c
@@ -147,10 +147,11 @@ void browser_window_handle_scrollbars(struct browser_window *bw)
if (bw->scroll_y == NULL) {
/* create vertical scrollbar */
- if (!scrollbar_create(false, length, c_height, visible,
- bw, browser_window_scroll_callback,
- &(bw->scroll_y)))
+ if (scrollbar_create(false, length, c_height, visible,
+ bw, browser_window_scroll_callback,
+ &(bw->scroll_y)) != NSERROR_OK) {
return;
+ }
} else {
/* update vertical scrollbar */
scrollbar_set_extents(bw->scroll_y, length,
@@ -164,10 +165,11 @@ void browser_window_handle_scrollbars(struct browser_window *bw)
if (bw->scroll_x == NULL) {
/* create horizontal scrollbar */
- if (!scrollbar_create(true, length, c_width, visible,
- bw, browser_window_scroll_callback,
- &(bw->scroll_x)))
+ if (scrollbar_create(true, length, c_width, visible,
+ bw, browser_window_scroll_callback,
+ &(bw->scroll_x)) != NSERROR_OK) {
return;
+ }
} else {
/* update horizontal scrollbar */
scrollbar_set_extents(bw->scroll_x, length,
diff --git a/desktop/scrollbar.c b/desktop/scrollbar.c
index caed13fbc..82fcac1c9 100644
--- a/desktop/scrollbar.c
+++ b/desktop/scrollbar.c
@@ -70,9 +70,9 @@ struct scrollbar {
/*
- * Exported function. Documented in scrollbar.h
+ * Exported function. Documented in desktop/scrollbar.h
*/
-bool scrollbar_create(bool horizontal, int length, int full_size,
+nserror scrollbar_create(bool horizontal, int length, int full_size,
int visible_size, void *client_data,
scrollbar_client_callback client_callback,
struct scrollbar **s)
@@ -82,10 +82,8 @@ bool scrollbar_create(bool horizontal, int length, int full_size,
scrollbar = malloc(sizeof(struct scrollbar));
if (scrollbar == NULL) {
- LOG("malloc failed");
- warn_user("NoMemory", 0);
*s = NULL;
- return false;
+ return NSERROR_NOMEM;
}
scrollbar->horizontal = horizontal;
@@ -109,7 +107,7 @@ bool scrollbar_create(bool horizontal, int length, int full_size,
*s = scrollbar;
- return true;
+ return NSERROR_OK;
}
diff --git a/desktop/textarea.c b/desktop/textarea.c
index 4a7e008bc..467965d39 100644
--- a/desktop/textarea.c
+++ b/desktop/textarea.c
@@ -1029,10 +1029,11 @@ static bool textarea_reflow_multiline(struct textarea *ta,
if (x > avail_width && ta->bar_x == NULL) {
/* We need to insert a horizontal scrollbar */
int w = ta->vis_width - 2 * ta->border_width;
- if (!scrollbar_create(true, w, w, w,
+ if (scrollbar_create(true, w, w, w,
ta, textarea_scrollbar_callback,
- &(ta->bar_x)))
+ &(ta->bar_x)) != NSERROR_OK) {
return false;
+ }
if (ta->bar_y != NULL)
scrollbar_make_pair(ta->bar_x,
ta->bar_y);
@@ -1120,10 +1121,11 @@ static bool textarea_reflow_multiline(struct textarea *ta,
if (line > scroll_lines && ta->bar_y == NULL) {
/* Add vertical scrollbar */
int h = ta->vis_height - 2 * ta->border_width;
- if (!scrollbar_create(false, h, h, h,
- ta, textarea_scrollbar_callback,
- &(ta->bar_y)))
+ if (scrollbar_create(false, h, h, h,
+ ta, textarea_scrollbar_callback,
+ &(ta->bar_y)) != NSERROR_OK) {
return false;
+ }
if (ta->bar_x != NULL)
scrollbar_make_pair(ta->bar_x,
ta->bar_y);
diff --git a/render/box.c b/render/box.c
index 7111f1a6e..5a0735e24 100644
--- a/render/box.c
+++ b/render/box.c
@@ -1151,11 +1151,12 @@ bool box_handle_scrollbars(struct content *c, struct box *box,
}
data->c = c;
data->box = box;
- if (!scrollbar_create(false, visible_height,
+ if (scrollbar_create(false, visible_height,
full_height, visible_height,
data, html_overflow_scroll_callback,
- &(box->scroll_y)))
+ &(box->scroll_y)) != NSERROR_OK) {
return false;
+ }
} else {
scrollbar_set_extents(box->scroll_y, visible_height,
visible_height, full_height);
@@ -1171,13 +1172,14 @@ bool box_handle_scrollbars(struct content *c, struct box *box,
}
data->c = c;
data->box = box;
- if (!scrollbar_create(true,
+ if (scrollbar_create(true,
visible_width -
(right ? SCROLLBAR_WIDTH : 0),
full_width, visible_width,
data, html_overflow_scroll_callback,
- &box->scroll_x))
+ &box->scroll_x) != NSERROR_OK) {
return false;
+ }
} else {
scrollbar_set_extents(box->scroll_x,
visible_width -
diff --git a/render/form.c b/render/form.c
index 1adce23d8..f53e9dece 100644
--- a/render/form.c
+++ b/render/form.c
@@ -1131,13 +1131,13 @@ bool form_open_select_menu(void *client_data,
}
menu->client_data = client_data;
menu->callback = callback;
- if (!scrollbar_create(false,
+ if (scrollbar_create(false,
menu->height,
total_height,
menu->height,
control,
form_select_menu_scroll_callback,
- &(menu->scrollbar))) {
+ &(menu->scrollbar)) != NSERROR_OK) {
free(menu);
return false;
}