From 9bd355e30c1f6aa57d42fe4f2fa6e9f521f002a4 Mon Sep 17 00:00:00 2001
From: Chris Young
Date: Thu, 2 Jan 2014 18:50:59 +0000
Subject: [PATCH 001/773] Convert download filename to local charset
---
amiga/Makefile.target | 2 +-
amiga/download.c | 8 +++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/amiga/Makefile.target b/amiga/Makefile.target
index da9b252c9..484c57dcb 100644
--- a/amiga/Makefile.target
+++ b/amiga/Makefile.target
@@ -109,7 +109,7 @@ AMIGA_LIBRARIES := parserutils.library nsgif.library nsbmp.library iconv.library
AMIGA_LIBS := $(addprefix /Libs/,$(AMIGA_LIBRARIES))
AMIGA_SHARED_OBJS := libjpeg.so.12 libcurl.so.7 librtmp.so.0 libsvgtiny.so.0 \
libssl.so.1.0.0 libcrypto.so.1.0.0 libcss.so.0 libwapcaplet.so.0 libpng12.so \
- libdom.so.0 libhubbub.so.0 libtre.so.5 libintl.so
+ libdom.so.0 libhubbub.so.0 libtre.so.5 libintl.so libparserutils.so.0
AMIGA_SOBJS := $(addprefix /SObjs/,$(AMIGA_SHARED_OBJS))
AMIGA_DISTRIBUTION_FILES := amiga/dist/*
AMIGA_INSTALL_TARGET_DIR := NetSurf_Amiga
diff --git a/amiga/download.c b/amiga/download.c
index 52baedb24..d33b723d1 100644
--- a/amiga/download.c
+++ b/amiga/download.c
@@ -92,6 +92,7 @@ struct gui_download_window *gui_download_window_create(download_context *ctx,
const char *mime_type = download_context_get_mime_type(ctx);
unsigned long total_size = download_context_get_total_length(ctx);
struct gui_download_window *dw;
+ char *dl_filename = ami_utf8_easy(download_context_get_filename(ctx));
APTR va[3];
dw = AllocVecTags(sizeof(struct gui_download_window), AVT_ClearWithValue, 0, TAG_DONE);
@@ -107,9 +108,9 @@ struct gui_download_window *gui_download_window_create(download_context *ctx,
if(AslRequestTags(savereq,
ASLFR_Window, gui->shared->win,
ASLFR_SleepWindow, TRUE,
- ASLFR_TitleText,messages_get("NetSurf"),
- ASLFR_Screen,scrn,
- ASLFR_InitialFile, download_context_get_filename(ctx),
+ ASLFR_TitleText, messages_get("NetSurf"),
+ ASLFR_Screen, scrn,
+ ASLFR_InitialFile, dl_filename,
TAG_DONE))
{
strlcpy(dw->fname, savereq->fr_Drawer, 1024);
@@ -127,6 +128,7 @@ struct gui_download_window *gui_download_window_create(download_context *ctx,
}
}
+ if(dl_filename) ami_utf8_free(dl_filename);
dw->size = total_size;
dw->downloaded = 0;
if(gui) dw->bw = gui->shared->bw;
From 286ee3834c7a20d3963b9cf288a6d091d3fb50f2 Mon Sep 17 00:00:00 2001
From: Steve Fryatt
Date: Thu, 2 Jan 2014 22:22:18 +0000
Subject: [PATCH 002/773] In framesets, F8 views source for frame under pointer
if applicable.
---
riscos/window.c | 64 +++++++++++++++++++++++++++----------------------
1 file changed, 36 insertions(+), 28 deletions(-)
diff --git a/riscos/window.c b/riscos/window.c
index f6b274a20..208f50c7b 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -1800,7 +1800,6 @@ bool ro_gui_window_keypress(wimp_key *key)
struct gui_window *g;
hlcache_handle *h;
os_error *error;
- wimp_pointer pointer;
uint32_t c = (uint32_t) key->c;
g = (struct gui_window *) ro_gui_wimp_event_get_user_data(key->w);
@@ -1809,14 +1808,6 @@ bool ro_gui_window_keypress(wimp_key *key)
h = g->bw->current_content;
- error = xwimp_get_pointer_info(&pointer);
- if (error) {
- LOG(("xwimp_get_pointer_info: 0x%x: %s\n",
- error->errnum, error->errmess));
- warn_user("WimpError", error->errmess);
- return false;
- }
-
/* First send the key to the browser window, eg. form fields. */
if ((unsigned)c < 0x20 || (0x7f <= c && c <= 0x9f) ||
@@ -1893,7 +1884,7 @@ bool ro_gui_window_keypress(wimp_key *key)
bool ro_gui_window_toolbar_keypress(void *data, wimp_key *key)
{
- struct gui_window *g = (struct gui_window *) data;
+ struct gui_window *g = (struct gui_window *) data;
if (g != NULL)
return ro_gui_window_handle_local_keypress(g, key, true);
@@ -1917,20 +1908,38 @@ bool ro_gui_window_toolbar_keypress(void *data, wimp_key *key)
bool ro_gui_window_handle_local_keypress(struct gui_window *g, wimp_key *key,
bool is_toolbar)
{
- hlcache_handle *h;
- const char *toolbar_url;
- float scale;
- uint32_t c = (uint32_t) key->c;
- wimp_scroll_direction xscroll = wimp_SCROLL_NONE;
- wimp_scroll_direction yscroll = wimp_SCROLL_NONE;
- nsurl *url;
- nserror error;
+ hlcache_handle *h;
+ struct contextual_content cont;
+ os_error *ro_error;
+ wimp_pointer pointer;
+ os_coord pos;
+ const char *toolbar_url;
+ float scale;
+ uint32_t c = (uint32_t) key->c;
+ wimp_scroll_direction xscroll = wimp_SCROLL_NONE;
+ wimp_scroll_direction yscroll = wimp_SCROLL_NONE;
+ nsurl *url;
+ nserror error;
if (g == NULL)
return false;
+ ro_error = xwimp_get_pointer_info(&pointer);
+ if (ro_error) {
+ LOG(("xwimp_get_pointer_info: 0x%x: %s\n",
+ ro_error->errnum, ro_error->errmess));
+ warn_user("WimpError", ro_error->errmess);
+ return false;
+ }
+
+ if (!ro_gui_window_to_window_pos(g, pointer.pos.x, pointer.pos.y, &pos))
+ return false;
+
+
h = g->bw->current_content;
+ browser_window_get_contextual_content(g->bw, pos.x, pos.y, &cont);
+
switch (c) {
case IS_WIMP_KEY + wimp_KEY_F1: /* Help. */
{
@@ -2015,7 +2024,7 @@ bool ro_gui_window_handle_local_keypress(struct gui_window *g, wimp_key *key,
return true;
case IS_WIMP_KEY + wimp_KEY_F8: /* View source */
- ro_gui_view_source(h);
+ ro_gui_view_source((cont.main != NULL) ? cont.main : h);
return true;
case IS_WIMP_KEY + wimp_KEY_F9:
@@ -2848,10 +2857,10 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
error = nsurl_create(current_menu_url, &url);
if (error == NSERROR_OK) {
error = browser_window_navigate(bw,
- url,
- hlcache_handle_get_url(h),
- BROWSER_WINDOW_DOWNLOAD |
- BROWSER_WINDOW_VERIFIABLE,
+ url,
+ hlcache_handle_get_url(h),
+ BROWSER_WINDOW_DOWNLOAD |
+ BROWSER_WINDOW_VERIFIABLE,
NULL,
NULL,
NULL);
@@ -3035,12 +3044,12 @@ bool ro_gui_window_menu_select(wimp_w w, wimp_i i, wimp_menu *menu,
}
break;
case BROWSER_WINDOW_STAGGER:
- nsoption_set_bool(window_stagger,
+ nsoption_set_bool(window_stagger,
!nsoption_bool(window_stagger));
ro_gui_save_options();
break;
case BROWSER_WINDOW_COPY:
- nsoption_set_bool(window_size_clone,
+ nsoption_set_bool(window_size_clone,
!nsoption_bool(window_size_clone));
ro_gui_save_options();
break;
@@ -3637,7 +3646,7 @@ void ro_gui_window_toolbar_click(void *data,
case TOOLBAR_URL_ADJUST_HOTLIST:
ro_gui_window_action_remove_bookmark(g);
break;
-
+
default:
break;
}
@@ -3749,7 +3758,7 @@ void ro_gui_window_toolbar_click(void *data,
warn_user(messages_get_errorcode(error), 0);
} else {
/* do it without loading the content
- * into the new window
+ * into the new window
*/
ro_gui_window_navigate_up(new_bw->window,
nsurl_access(hlcache_handle_get_url(h)));
@@ -5255,4 +5264,3 @@ bool ro_gui_alt_pressed(void)
xosbyte1(osbyte_SCAN_KEYBOARD, 2 ^ 0x80, 0, &alt);
return (alt == 0xff);
}
-
From bf8c88dbec9d66dadaa584d80702c1653fda1c08 Mon Sep 17 00:00:00 2001
From: Steve Fryatt
Date: Thu, 2 Jan 2014 22:25:23 +0000
Subject: [PATCH 003/773] Update copyright header dates for recent commits.
---
riscos/gui/url_bar.c | 9 ++++-----
riscos/hotlist.c | 5 ++---
riscos/hotlist.h | 3 +--
riscos/window.c | 2 +-
4 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/riscos/gui/url_bar.c b/riscos/gui/url_bar.c
index 845f8b3e8..62956a9ab 100644
--- a/riscos/gui/url_bar.c
+++ b/riscos/gui/url_bar.c
@@ -1,6 +1,6 @@
/*
* Copyright 2004, 2005 Richard Wilson
- * Copyright 2011 Stephen Fryatt
+ * Copyright 2011-2013 Stephen Fryatt
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -1013,9 +1013,9 @@ static void ro_gui_url_bar_set_hotlist(struct url_bar *url_bar, bool set)
{
if (url_bar == NULL || set == url_bar->hotlist.set)
return;
-
+
url_bar->hotlist.set = set;
-
+
if (!url_bar->hidden) {
xwimp_force_redraw(url_bar->window,
url_bar->hotlist.extent.x0,
@@ -1097,7 +1097,7 @@ bool ro_gui_url_bar_test_for_text_field_keypress(struct url_bar *url_bar,
return false;
/* Update hotlist indicator */
-
+
url = (const char *) url_bar->text_buffer;
if (url != NULL && nsurl_create(url, &n) == NSERROR_OK) {
ro_gui_url_bar_set_hotlist(url_bar, ro_gui_hotlist_has_page(n));
@@ -1278,4 +1278,3 @@ void ro_gui_url_bar_fini(void)
hlcache_handle_release(url_bar_res[i].c);
}
}
-
diff --git a/riscos/hotlist.c b/riscos/hotlist.c
index f47d05e9c..eeaddd00f 100644
--- a/riscos/hotlist.c
+++ b/riscos/hotlist.c
@@ -1,6 +1,6 @@
/*
* Copyright 2004, 2005 Richard Wilson
- * Copyright 2010 Stephen Fryatt
+ * Copyright 2010, 2013 Stephen Fryatt
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -220,7 +220,7 @@ void ro_gui_hotlist_open(void)
os_error *error;
char command[2048];
- if (nsoption_bool(external_hotlists) &&
+ if (nsoption_bool(external_hotlists) &&
nsoption_charp(external_hotlist_app) != NULL &&
*nsoption_charp(external_hotlist_app) != '\0') {
snprintf(command, sizeof(command), "Filer_Run %s",
@@ -732,4 +732,3 @@ void ro_gui_hotlist_url_drop(wimp_message *message, const char *url)
nsurl_unref(nsurl);
}
#endif
-
diff --git a/riscos/hotlist.h b/riscos/hotlist.h
index 4cb5a1ff3..70cb183c9 100644
--- a/riscos/hotlist.h
+++ b/riscos/hotlist.h
@@ -1,6 +1,6 @@
/*
* Copyright 2006 Richard Wilson
- * Copyright 2010 Stephen Fryatt
+ * Copyright 2010, 2013 Stephen Fryatt
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -51,4 +51,3 @@ void ro_gui_hotlist_remove_page(nsurl *url);
bool ro_gui_hotlist_has_page(nsurl *url);
#endif
-
diff --git a/riscos/window.c b/riscos/window.c
index 208f50c7b..c314c748b 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -5,7 +5,7 @@
* Copyright 2004 Andrew Timmins
* Copyright 2005 Richard Wilson
* Copyright 2005 Adrian Lees
- * Copyright 2010, 2011 Stephen Fryatt
+ * Copyright 2010-2014 Stephen Fryatt
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
From 8d82cd9963942cd9e78081c27639f69557ca4f08 Mon Sep 17 00:00:00 2001
From: Chris Young
Date: Fri, 3 Jan 2014 00:26:45 +0000
Subject: [PATCH 004/773] Attempt fix/workaround of bug #2034
---
amiga/menu.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/amiga/menu.c b/amiga/menu.c
index a9185e823..59d244112 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -61,6 +61,7 @@
#include "desktop/hotlist.h"
#include "desktop/browser_private.h"
#include "desktop/gui.h"
+#include "desktop/local_history.h"
#include "desktop/textinput.h"
#include "utils/messages.h"
#include "utils/schedule.h"
@@ -715,6 +716,7 @@ static void ami_menu_item_project_newtab(struct Hook *hook, APTR window, struct
struct gui_window_2 *gwin;
nsurl *url;
nserror error;
+ struct browser_window *bw = NULL;
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
@@ -726,12 +728,16 @@ static void ami_menu_item_project_newtab(struct Hook *hook, APTR window, struct
url,
NULL,
gwin->bw,
- NULL);
+ &bw);
nsurl_unref(url);
}
if (error != NSERROR_OK) {
warn_user(messages_get_errorcode(error), 0);
+ return;
}
+
+ history_destroy(bw->history);
+ bw->history = history_create();
}
static void ami_menu_item_project_open(struct Hook *hook, APTR window, struct IntuiMessage *msg)
From c25728b01179b8e53f8022d14363b8a81a8c25d5 Mon Sep 17 00:00:00 2001
From: Chris Young
Date: Fri, 3 Jan 2014 18:17:25 +0000
Subject: [PATCH 005/773] Move new blank tab into own function
---
amiga/gui.c | 30 +++++++++++++++++++++++++++++-
amiga/gui.h | 3 ++-
amiga/menu.c | 24 ++----------------------
3 files changed, 33 insertions(+), 24 deletions(-)
diff --git a/amiga/gui.c b/amiga/gui.c
index c28ea583f..22d5b428d 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008-2013 Chris Young
+ * Copyright 2008-2014 Chris Young
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -3139,6 +3139,34 @@ void ami_gui_tabs_toggle_all(void)
} while(node = nnode);
}
+nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin)
+{
+ nsurl *url;
+ nserror error;
+ struct browser_window *bw = NULL;
+
+ error = nsurl_create(nsoption_charp(homepage_url), &url);
+ if (error == NSERROR_OK) {
+ error = browser_window_create(BROWSER_WINDOW_VERIFIABLE |
+ BROWSER_WINDOW_HISTORY |
+ BROWSER_WINDOW_TAB,
+ url,
+ NULL,
+ gwin->bw,
+ &bw);
+ nsurl_unref(url);
+ }
+ if (error != NSERROR_OK) {
+ warn_user(messages_get_errorcode(error), 0);
+ return error;
+ }
+
+ history_destroy(bw->history);
+ bw->history = history_create();
+
+ return NSERROR_OK;
+}
+
struct gui_window *gui_create_browser_window(struct browser_window *bw,
struct browser_window *clone, bool new_tab)
{
diff --git a/amiga/gui.h b/amiga/gui.h
index 85e5854ea..4ec329eb8 100755
--- a/amiga/gui.h
+++ b/amiga/gui.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008-2012 Chris Young
+ * Copyright 2008-2014 Chris Young
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -164,6 +164,7 @@ void ami_gui_hotlist_toolbar_update_all(void);
void ami_gui_tabs_toggle_all(void);
bool ami_locate_resource(char *fullpath, const char *file);
void ami_gui_update_hotlist_button(struct gui_window_2 *gwin);
+nserror ami_gui_new_blank_tab(struct gui_window_2 *gwin);
struct TextFont *origrpfont;
struct MinList *window_list;
diff --git a/amiga/menu.c b/amiga/menu.c
index 59d244112..26f5c2b81 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -714,30 +714,10 @@ static void ami_menu_item_project_newwin(struct Hook *hook, APTR window, struct
static void ami_menu_item_project_newtab(struct Hook *hook, APTR window, struct IntuiMessage *msg)
{
struct gui_window_2 *gwin;
- nsurl *url;
nserror error;
- struct browser_window *bw = NULL;
+
GetAttr(WINDOW_UserData, (Object *)window, (ULONG *)&gwin);
-
-
- error = nsurl_create(nsoption_charp(homepage_url), &url);
- if (error == NSERROR_OK) {
- error = browser_window_create(BROWSER_WINDOW_VERIFIABLE |
- BROWSER_WINDOW_HISTORY |
- BROWSER_WINDOW_TAB,
- url,
- NULL,
- gwin->bw,
- &bw);
- nsurl_unref(url);
- }
- if (error != NSERROR_OK) {
- warn_user(messages_get_errorcode(error), 0);
- return;
- }
-
- history_destroy(bw->history);
- bw->history = history_create();
+ error = ami_gui_new_blank_tab(gwin);
}
static void ami_menu_item_project_open(struct Hook *hook, APTR window, struct IntuiMessage *msg)
From 845923adfc21dae8b434a4abc8efa34d81257ea8 Mon Sep 17 00:00:00 2001
From: Chris Young
Date: Fri, 3 Jan 2014 18:20:47 +0000
Subject: [PATCH 006/773] Make the new tab button also use the new blank tab
function. This fixes bug 2034
---
amiga/gui.c | 19 +------------------
1 file changed, 1 insertion(+), 18 deletions(-)
diff --git a/amiga/gui.c b/amiga/gui.c
index 22d5b428d..103d3a1e8 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -1780,24 +1780,7 @@ void ami_handle_msg(void)
break;
case GID_ADDTAB:
- {
- nserror error;
-
- error = nsurl_create(nsoption_charp(homepage_url), &url);
- if (error == NSERROR_OK) {
- error = browser_window_create(BROWSER_WINDOW_VERIFIABLE |
- BROWSER_WINDOW_HISTORY |
- BROWSER_WINDOW_TAB,
- url,
- NULL,
- gwin->bw,
- NULL);
- nsurl_unref(url);
- }
- if (error != NSERROR_OK) {
- warn_user(messages_get_errorcode(error), 0);
- }
- }
+ ami_gui_new_blank_tab(gwin);
break;
case GID_URL:
From 8b253a215134c104f853165b4a674ffc24be8cbe Mon Sep 17 00:00:00 2001
From: Michael Drake
Date: Sat, 4 Jan 2014 14:00:16 +0000
Subject: [PATCH 007/773] Improve min/max-height handling on replaced elements.
---
render/layout.c | 119 ++++++++++++++++++++++++++++++++++++++----------
1 file changed, 96 insertions(+), 23 deletions(-)
diff --git a/render/layout.c b/render/layout.c
index 9bd1156ab..7de049080 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -75,7 +75,8 @@ static struct box* layout_next_margin_block(struct box *box, struct box *block,
int viewport_height, int *max_pos_margin, int *max_neg_margin);
static bool layout_block_object(struct box *block);
static void layout_get_object_dimensions(struct box *box,
- int *width, int *height, int min_width, int max_width);
+ int *width, int *height, int min_width, int max_width,
+ int min_height, int max_height);
static void layout_block_find_dimensions(int available_width,
int viewport_height, int lm, int rm,
struct box *box);
@@ -88,7 +89,8 @@ static void layout_float_find_dimensions(int available_width,
static void layout_find_dimensions(int available_width, int viewport_height,
struct box *box, const css_computed_style *style,
int *width, int *height, int *max_width, int *min_width,
- int margin[4], int padding[4], struct box_border border[4]);
+ int *max_height, int *min_height, int margin[4], int padding[4],
+ struct box_border border[4]);
static void layout_tweak_form_dimensions(struct box *box, bool percentage,
int available_width, bool setwidth, int *dimension);
static int layout_clear(struct box *fl, enum css_clear_e clear);
@@ -229,7 +231,8 @@ bool layout_block_context(struct box *block, int viewport_height,
if (!layout_block_object(block))
return false;
layout_get_object_dimensions(block, &temp_width,
- &block->height, INT_MIN, INT_MAX);
+ &block->height, INT_MIN, INT_MAX,
+ INT_MIN, INT_MAX);
return true;
} else if (block->flags & REPLACE_DIM) {
return true;
@@ -903,8 +906,8 @@ struct box* layout_next_margin_block(struct box *box, struct box *block,
viewport_height, box,
box->style,
NULL, NULL, NULL, NULL,
- box->margin, box->padding,
- box->border);
+ NULL, NULL, box->margin,
+ box->padding, box->border);
/* Apply top margin */
if (*max_pos_margin < box->margin[TOP])
@@ -977,8 +980,8 @@ struct box* layout_next_margin_block(struct box *box, struct box *block,
viewport_height, box,
box->style,
NULL, NULL, NULL, NULL,
- box->margin, box->padding,
- box->border);
+ NULL, NULL, box->margin,
+ box->padding, box->border);
}
}
}
@@ -1029,12 +1032,14 @@ bool layout_block_object(struct box *block)
* \param height Height value in px or AUTO. If AUTO, updated to value in px.
* \param min_width Box's min width, as given by layout_find_dimensions.
* \param max_width Box's max width, as given by layout_find_dimensions.
+ * \param min_height Box's min height, as given by layout_find_dimensions.
+ * \param max_height Box's max height, as given by layout_find_dimensions.
*
* See CSS 2.1 sections 10.3 and 10.6.
*/
void layout_get_object_dimensions(struct box *box, int *width, int *height,
- int min_width, int max_width)
+ int min_width, int max_width, int min_height, int max_height)
{
assert(box->object != NULL);
assert(width != NULL && height != NULL);
@@ -1050,6 +1055,7 @@ void layout_get_object_dimensions(struct box *box, int *width, int *height,
*width = intrinsic_width;
*height = intrinsic_height;
+ /* Deal with min/max-width first */
if (min_width > 0 && min_width > *width) {
*width = min_width;
scaled = true;
@@ -1060,10 +1066,28 @@ void layout_get_object_dimensions(struct box *box, int *width, int *height,
}
if (scaled && (intrinsic_width != 0)) {
+ /* Update height */
*height = (*width * intrinsic_height) /
intrinsic_width;
}
+ scaled = false;
+ /* Deal with min/max-height */
+ if (min_height > 0 && min_height > *height) {
+ *height = min_height;
+ scaled = true;
+ }
+ if (max_height >= 0 && max_height < *height) {
+ *height = max_height;
+ scaled = true;
+ }
+
+ if (scaled && (intrinsic_height != 0)) {
+ /* Update width */
+ *width = (*height * intrinsic_width) /
+ intrinsic_height;
+ }
+
} else if (*width == AUTO) {
/* Have given height; width is calculated from the given height
* and ratio of intrinsic dimensions */
@@ -1116,7 +1140,7 @@ void layout_block_find_dimensions(int available_width, int viewport_height,
int lm, int rm, struct box *box)
{
int width, max_width, min_width;
- int height;
+ int height, max_height, min_height;
int *margin = box->margin;
int *padding = box->padding;
struct box_border *border = box->border;
@@ -1124,13 +1148,13 @@ void layout_block_find_dimensions(int available_width, int viewport_height,
layout_find_dimensions(available_width, viewport_height, box, style,
&width, &height, &max_width, &min_width,
- margin, padding, border);
+ &max_height, &min_height, margin, padding, border);
if (box->object && !(box->flags & REPLACE_DIM) &&
content_get_type(box->object) != CONTENT_HTML) {
/* block-level replaced element, see 10.3.4 and 10.6.2 */
layout_get_object_dimensions(box, &width, &height,
- min_width, max_width);
+ min_width, max_width, min_height, max_height);
}
box->width = layout_solve_width(box, available_width, width, lm, rm,
@@ -1430,7 +1454,7 @@ int layout_solve_width(struct box *box, int available_width, int width,
void layout_float_find_dimensions(int available_width,
const css_computed_style *style, struct box *box)
{
- int width, height, max_width, min_width;
+ int width, height, max_width, min_width, max_height, min_height;
int *margin = box->margin;
int *padding = box->padding;
struct box_border *border = box->border;
@@ -1440,7 +1464,8 @@ void layout_float_find_dimensions(int available_width,
SCROLLBAR_WIDTH : 0;
layout_find_dimensions(available_width, -1, box, style, &width, &height,
- &max_width, &min_width, margin, padding, border);
+ &max_width, &min_width, &max_height, &min_height,
+ margin, padding, border);
if (margin[LEFT] == AUTO)
margin[LEFT] = 0;
@@ -1457,7 +1482,7 @@ void layout_float_find_dimensions(int available_width,
/* Floating replaced element, with intrinsic width or height.
* See 10.3.6 and 10.6.2 */
layout_get_object_dimensions(box, &width, &height,
- min_width, max_width);
+ min_width, max_width, min_height, max_height);
} else if (box->gadget && (box->gadget->type == GADGET_TEXTBOX ||
box->gadget->type == GADGET_PASSWORD ||
box->gadget->type == GADGET_FILE ||
@@ -1555,6 +1580,8 @@ void layout_float_find_dimensions(int available_width,
* \param height updated to height, may be NULL
* \param max_width updated to max-width, may be NULL
* \param min_width updated to min-width, may be NULL
+ * \param max_height updated to max-height, may be NULL
+ * \param min_height updated to min-height, may be NULL
* \param margin[4] filled with margins, may be NULL
* \param padding[4] filled with paddings, may be NULL
* \param border[4] filled with border widths, may be NULL
@@ -1563,7 +1590,8 @@ void layout_float_find_dimensions(int available_width,
void layout_find_dimensions(int available_width, int viewport_height,
struct box *box, const css_computed_style *style,
int *width, int *height, int *max_width, int *min_width,
- int margin[4], int padding[4], struct box_border border[4])
+ int *max_height, int *min_height, int margin[4], int padding[4],
+ struct box_border border[4])
{
struct box *containing_block = NULL;
unsigned int i;
@@ -1750,6 +1778,48 @@ void layout_find_dimensions(int available_width, int viewport_height,
}
}
+ if (max_height) {
+ enum css_max_height_e type;
+ css_fixed value = 0;
+ css_unit unit = CSS_UNIT_PX;
+
+ type = css_computed_max_height(style, &value, &unit);
+
+ if (type == CSS_MAX_HEIGHT_SET) {
+ if (unit == CSS_UNIT_PCT) {
+ /* TODO: handle percentage */
+ *max_height = -1;
+ } else {
+ *max_height = FIXTOINT(nscss_len2px(value, unit,
+ style));
+ }
+ } else {
+ /* Inadmissible */
+ *max_height = -1;
+ }
+ }
+
+ if (min_height) {
+ enum css_min_height_e type;
+ css_fixed value = 0;
+ css_unit unit = CSS_UNIT_PX;
+
+ type = css_computed_min_height(style, &value, &unit);
+
+ if (type == CSS_MIN_HEIGHT_SET) {
+ if (unit == CSS_UNIT_PCT) {
+ /* TODO: handle percentage */
+ *min_height = 0;
+ } else {
+ *min_height = FIXTOINT(nscss_len2px(value, unit,
+ style));
+ }
+ } else {
+ /* Inadmissible */
+ *min_height = 0;
+ }
+ }
+
for (i = 0; i != 4; i++) {
if (margin) {
enum css_margin_e type = CSS_MARGIN_AUTO;
@@ -2297,7 +2367,7 @@ bool layout_line(struct box *first, int *width, int *y,
#endif
for (x = 0, b = first; x <= x1 - x0 && b != 0; b = b->next) {
- int min_width, max_width;
+ int min_width, max_width, min_height, max_height;
assert(b->type == BOX_INLINE || b->type == BOX_INLINE_BLOCK ||
b->type == BOX_FLOAT_LEFT ||
@@ -2347,7 +2417,8 @@ bool layout_line(struct box *first, int *width, int *y,
if (b->type == BOX_INLINE) {
/* calculate borders, margins, and padding */
layout_find_dimensions(*width, -1, b, b->style, 0, 0,
- 0, 0, b->margin, b->padding, b->border);
+ 0, 0, 0, 0, b->margin, b->padding,
+ b->border);
for (i = 0; i != 4; i++)
if (b->margin[i] == AUTO)
b->margin[i] = 0;
@@ -2454,11 +2525,12 @@ bool layout_line(struct box *first, int *width, int *y,
layout_find_dimensions(*width, -1, b, b->style,
&b->width, &b->height, &max_width, &min_width,
- NULL, NULL, NULL);
+ &max_height, &min_height, NULL, NULL, NULL);
if (b->object && !(b->flags & REPLACE_DIM)) {
layout_get_object_dimensions(b, &b->width, &b->height,
- min_width, max_width);
+ min_width, max_width,
+ min_height, max_height);
} else if (b->flags & IFRAME) {
/* TODO: should we look at the content dimensions? */
if (b->width == AUTO)
@@ -3185,6 +3257,7 @@ struct box *layout_minmax_line(struct box *first,
int temp_height = height;
layout_get_object_dimensions(b,
&width, &temp_height,
+ INT_MIN, INT_MAX,
INT_MIN, INT_MAX);
}
@@ -3412,7 +3485,7 @@ bool layout_table(struct box *table, int available_width,
/* find margins, paddings, and borders for table and cells */
layout_find_dimensions(available_width, -1, table, style, 0, 0, 0, 0,
- table->margin, table->padding, table->border);
+ 0, 0, table->margin, table->padding, table->border);
for (row_group = table->children; row_group;
row_group = row_group->next) {
for (row = row_group->children; row; row = row->next) {
@@ -3420,8 +3493,8 @@ bool layout_table(struct box *table, int available_width,
assert(c->style);
table_used_border_for_cell(c);
layout_find_dimensions(available_width, -1,
- c, c->style, 0, 0, 0, 0, 0,
- c->padding, c->border);
+ c, c->style, 0, 0, 0, 0, 0, 0,
+ 0, c->padding, c->border);
if (css_computed_overflow(c->style) ==
CSS_OVERFLOW_SCROLL ||
css_computed_overflow(c->style) ==
@@ -4518,7 +4591,7 @@ bool layout_absolute(struct box *box, struct box *containing_block,
box->float_container = containing_block;
layout_find_dimensions(available_width, -1, box, box->style,
&width, &height, &max_width, &min_width,
- margin, padding, border);
+ 0, 0, margin, padding, border);
box->float_container = NULL;
/* 10.3.7 */
From 838359194e423fb5c568fca75f9ab6e00600be6c Mon Sep 17 00:00:00 2001
From: Michael Drake
Date: Sat, 4 Jan 2014 14:48:58 +0000
Subject: [PATCH 008/773] Return message to client when textarea is modified.
---
desktop/textarea.c | 9 +++++++++
desktop/textarea.h | 7 ++++++-
render/box_textarea.c | 4 ++++
3 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/desktop/textarea.c b/desktop/textarea.c
index bfa07ad4f..f9712ac84 100644
--- a/desktop/textarea.c
+++ b/desktop/textarea.c
@@ -160,6 +160,7 @@ static void textarea_normalise_text(struct textarea *ta,
unsigned int b_start, unsigned int b_len)
{
bool multi = (ta->flags & TEXTAREA_MULTILINE) ? true : false;
+ struct textarea_msg msg;
unsigned int index;
/* Remove CR characters. If it's a CRLF pair delete the CR, or replace
@@ -187,6 +188,14 @@ static void textarea_normalise_text(struct textarea *ta,
ta->text.data[b_start + index] = ' ';
}
+ /* Build text modified message */
+ msg.ta = ta;
+ msg.type = TEXTAREA_MSG_TEXT_MODIFIED;
+ msg.data.modified.text = ta->text.data;
+ msg.data.modified.len = ta->text.len;
+
+ /* Pass message to client */
+ ta->callback(ta->data, &msg);
}
diff --git a/desktop/textarea.h b/desktop/textarea.h
index 016f15a10..1c24dd1cc 100644
--- a/desktop/textarea.h
+++ b/desktop/textarea.h
@@ -51,7 +51,8 @@ typedef enum {
TEXTAREA_MSG_DRAG_REPORT, /**< Textarea drag start/end report */
TEXTAREA_MSG_SELECTION_REPORT, /**< Textarea text selection presence */
TEXTAREA_MSG_REDRAW_REQUEST, /**< Textarea redraw request */
- TEXTAREA_MSG_CARET_UPDATE /**< Textarea caret */
+ TEXTAREA_MSG_CARET_UPDATE, /**< Textarea caret */
+ TEXTAREA_MSG_TEXT_MODIFIED /**< Textarea text modified */
} textarea_msg_type;
struct textarea_msg {
@@ -77,6 +78,10 @@ struct textarea_msg {
struct rect *clip; /**< Carret clip rect */
} pos; /**< With _CARET_SET_POS */
} caret; /**< With _CARET_UPDATE */
+ struct {
+ const char *text; /**< UTF8 text */
+ unsigned int len; /**< Byte length of text */
+ } modified; /**< With _TEXT_MODIFIED */
} data; /**< Depends on msg type */
};
diff --git a/render/box_textarea.c b/render/box_textarea.c
index 546a39e04..d34c4c4a4 100644
--- a/render/box_textarea.c
+++ b/render/box_textarea.c
@@ -204,6 +204,10 @@ static void box_textarea_callback(void *data, struct textarea_msg *msg)
msg->data.caret.pos.clip);
}
break;
+
+ case TEXTAREA_MSG_TEXT_MODIFIED:
+ /* TODO */
+ break;
}
}
From c239a98dd9b93f32418bd8636dd1051cb8a02c36 Mon Sep 17 00:00:00 2001
From: Michael Drake
Date: Sat, 4 Jan 2014 16:00:07 +0000
Subject: [PATCH 009/773] Native RO builds have been unsupported for a year,
and the doc is out of date.
---
Docs/BUILDING-RISC_OS | 121 ------------------------------------------
1 file changed, 121 deletions(-)
delete mode 100644 Docs/BUILDING-RISC_OS
diff --git a/Docs/BUILDING-RISC_OS b/Docs/BUILDING-RISC_OS
deleted file mode 100644
index 7e61bd22f..000000000
--- a/Docs/BUILDING-RISC_OS
+++ /dev/null
@@ -1,121 +0,0 @@
---------------------------------------------------------------------------------
- Build Instructions for RISC OS NetSurf 16 July 2012
---------------------------------------------------------------------------------
-
- This document provides instructions for building the RISC OS NetSurf
- natively on a RISC OS computer and provides guidance on obtaining NetSurf's
- build dependencies.
-
- RISC OS NetSurf should work on RISC OS 4.02 and above.
-
- | Note: This guide assumes that you have the RISC OS SVN client installed,
- | and that you have used it to fetch the NetSurf source. It also
- | assumes that you have the following requirements installed:
- |
- | + OSLib 6.80 or later
- | + Perl 5.8.8 or later
- | + GCC 3.4.6 release 3 or later
- | + The latest NSTools
-
- If you want to cross-compile NetSurf for RISC OS, use the BUILDING-ROCross
- document.
-
-
- Building and executing NetSurf
-================================
-
- | Note: The version of make supplied with RISC OS GCC 3 is old and has a bug
- | that prevents NetSurf from building. Either ensure that NSTools is
- | seen before GCC, or replace the make inside "!GCC.bin" with the make
- | from "!NSTools.bin".
- | The minimum version of make that works is v3.81. You can check what
- | version you have by running, '*make --version'.
-
- | Note: The pre-built libraries currently supplied in NSTools are AOF format,
- | and will not work with GCC4, which requires them to be in ELF format.
- | If you want to build NetSurf with GCC4, you will need to build the
- | libraries yourself. See "Obtaining NetSurf's dependencies" below for
- | details.
-
- You can examine the contents of Makefile.defaults and enable and disable
- features as you see fit by creating a Makefile.config file. The default
- settings will work fine.
-
- You should then obtain NetSurf's dependencies, keeping in mind which options
- you have enabled in the configuration file. See the next section for
- specifics.
-
- Once done, to build RISC OS NetSurf on a RISC OS system, set the CSD to the
- directory containing the NetSurf sources, set the next slot to at least
- 6000K, and in a TaskWindow, simply run:
-
- *make
-
- If that produces errors, you probably don't have some of NetSurf's build
- dependencies installed, or your libraries may be out of date.
-
- See "Obtaining NetSurf's dependencies" below. Or turn off the complaining
- features in a Makefile.config file. You may need to "make clean" before
- attempting to build after installing the dependencies.
-
- Once NetSurf is compiled, the !RunImage is put into the !NetSurf
- application directory, so you can simply double click it as normal.
-
- To confirm that you're running your own development NetSurf build, view the
- Info window from the NetSurf iconbar menu. The Version string should read
-
- #.0 (Development)
-
- where # is the next major release version number.
-
-
- Obtaining NetSurf's build dependencies
-========================================
-
- NSTools contains all of the tools needed to build NetSurf, such as make,
- uname and ccres. It also contains pre-built libraries.
-
- Currently NSTools contains libraries which are in a format that are in a
- format which is compatible with RISC OS GCC3 but not RISC OS GCC4. Until
- NSTools is updated with GCC4 compatible libraries, it is recommended that
- you use GCC3 for native builds.
-
- The NSTools on the web site is not auto-built, so it may not always have
- the latest versions of the NetSurf project's own libraries. In this case
- you will need to build the libraries yourself and update your copy of
- NSTools.
-
- Fetching the sources
-----------------------
-
- Use SVN to obtain the latest versions of each of the libraries. To do this,
- set the CSD to a directory where you want to keep your copies of the library
- sources, and run the appropriate commands from the Docs/LIBRARIES file.
-
- The above will create a directory for each of the libraries containing their
- sources.
-
- | Note: We advise enabling iconv() support in libparserutils, which vastly
- | increases the number of supported character sets. To do this,
- | create a file called Makefile.config.override in the libparserutils
- | directory, containing the following line:
- |
- | CFLAGS += -DWITH_ICONV_FILTER
- |
- | For more information, consult the libparserutils README file.
-
- Updating NSTools' copies of the libraries
--------------------------------------------
-
- Set the CSD to the directory of the library you want to build, set your next
- slot to at least 6000K and in a TaskWindow, run
-
- *svn update
-
- This updates your local copy of the source to the latest version. To build
- and install the library into NSTools, run:
-
- *make install
-
- | Note: If you are using GCC3, you may get a warning from AR when you run
- | make. This can be ignored.
From 5a408069c95674bc6e591d0f3a65d3d810746a0f Mon Sep 17 00:00:00 2001
From: Vincent Sanders
Date: Sun, 22 Dec 2013 14:10:55 +0000
Subject: [PATCH 010/773] remove lcms dependancy as NetSurf does not directaly
use it.
The dependancy probbaly comes from our historical use of libmng,
even then the libmng pkg-config should bring it in.
---
Docs/BUILDING-GTK | 4 ++--
Docs/env.sh | 2 +-
gtk/Makefile.target | 1 -
monkey/Makefile.target | 2 +-
4 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/Docs/BUILDING-GTK b/Docs/BUILDING-GTK
index 16b15a4af..35fcd02db 100644
--- a/Docs/BUILDING-GTK
+++ b/Docs/BUILDING-GTK
@@ -67,7 +67,7 @@
Debian-like OS:
$ apt-get install libgtk2.0-dev libcurl3-dev libmng-dev
- $ apt-get install librsvg2-dev liblcms1-dev libjpeg-dev
+ $ apt-get install librsvg2-dev libjpeg-dev
If you want to build with gtk 3 replace libgtk2.0-dev with libgtk-3-dev
@@ -85,7 +85,7 @@
Fedora:
$ yum install curl-devel libmng-devel
- $ yum install librsvg2-devel lcms-devel expat-devel
+ $ yum install librsvg2-devel expat-devel
Other:
diff --git a/Docs/env.sh b/Docs/env.sh
index db2729c0c..8946e46e2 100644
--- a/Docs/env.sh
+++ b/Docs/env.sh
@@ -53,7 +53,7 @@ NS_BROWSER="netsurf"
# deb packages
NS_DEV_DEB="build-essential pkg-config git gperf"
NS_TOOL_DEB="flex bison"
-NS_GTK_DEB="libgtk2.0-dev libcurl3-dev libmng-dev librsvg2-dev liblcms1-dev libjpeg-dev libmozjs-dev"
+NS_GTK_DEB="libgtk2.0-dev libcurl3-dev libmng-dev librsvg2-dev libjpeg-dev libmozjs-dev"
#add target specific libraries
if [ "x${TARGET_ABI}" = "xriscos" ]; then
diff --git a/gtk/Makefile.target b/gtk/Makefile.target
index ae67fd7f4..426c4affd 100644
--- a/gtk/Makefile.target
+++ b/gtk/Makefile.target
@@ -62,7 +62,6 @@ $(eval $(call pkg_config_find_and_add,libcurl,Curl ))
$(eval $(call pkg_config_find_and_add,gtk+-$(NETSURF_GTK_MAJOR).0,GTK-$(NETSURF_GTK_MAJOR)))
$(eval $(call pkg_config_find_and_add,gthread-2.0,GThread2))
$(eval $(call pkg_config_find_and_add,gmodule-2.0,GModule2))
-$(eval $(call pkg_config_find_and_add,lcms,lcms))
CFLAGS += $(GTKCFLAGS)
diff --git a/monkey/Makefile.target b/monkey/Makefile.target
index 6c60ca1c5..6bea07d46 100644
--- a/monkey/Makefile.target
+++ b/monkey/Makefile.target
@@ -47,7 +47,7 @@ MONKEYCFLAGS := -std=c99 -Dmonkey -Dnsmonkey \
$(shell $(PKG_CONFIG) --cflags openssl) \
$(shell xml2-config --cflags)
-MONKEYLDFLAGS := -lm $(shell $(PKG_CONFIG) --cflags --libs glib-2.0 lcms)
+MONKEYLDFLAGS := -lm
CFLAGS += $(MONKEYCFLAGS)
From c43c456d0505c2b9ee117bf1f5f40fb9be36f1a1 Mon Sep 17 00:00:00 2001
From: Michael Drake
Date: Sat, 4 Jan 2014 16:26:02 +0000
Subject: [PATCH 011/773] Use dom_string_isequal, not lwc_string_isequal, for
dom strings.
---
css/select.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/css/select.c b/css/select.c
index ee0e7dacd..0202737b8 100644
--- a/css/select.c
+++ b/css/select.c
@@ -219,11 +219,9 @@ static void nscss_dom_user_data_handler(dom_node_operation operation,
struct dom_node *dst)
{
css_error error;
- bool match;
- if (lwc_string_isequal(corestring_dom___ns_key_libcss_node_data,
- key, &match) != lwc_error_ok || match == false ||
- data == NULL) {
+ if (dom_string_isequal(corestring_dom___ns_key_libcss_node_data,
+ key) == false || data == NULL) {
return;
}
From f7916866e3e4a81a2ba69d75b04ee6c45673429e Mon Sep 17 00:00:00 2001
From: Vincent Sanders
Date: Sat, 4 Jan 2014 17:07:11 +0000
Subject: [PATCH 012/773] remove all references to using libMNG
---
!NetSurf/Resources/en/licence.html,faf | 34 -
!NetSurf/Resources/it/licence.html,faf | 37 +-
Docs/BUILDING-AmigaCross | 4 -
Docs/BUILDING-AmigaOS | 6 +-
Docs/BUILDING-BeOS | 4 +-
Docs/BUILDING-Framebuffer | 10 +-
Docs/BUILDING-GTK | 10 +-
Docs/BUILDING-ROCross | 2 -
Docs/env.sh | 2 +-
Makefile | 1 -
Makefile.config.example | 7 +-
Makefile.defaults | 10 +-
amiga/Makefile.defaults | 4 -
amiga/Makefile.target | 1 -
atari/Makefile.defaults | 2 -
atari/Makefile.target | 1 -
beos/Makefile.target | 2 -
cocoa/Makefile.defaults | 1 -
framebuffer/Makefile.target | 2 -
image/Makefile | 1 -
image/image.c | 12 -
image/mng.c | 832 -------------------------
image/mng.h | 29 -
riscos/Makefile.target | 1 -
windows/Makefile.defaults | 3 -
windows/Makefile.target | 1 -
26 files changed, 18 insertions(+), 1001 deletions(-)
delete mode 100644 image/mng.c
delete mode 100644 image/mng.h
diff --git a/!NetSurf/Resources/en/licence.html,faf b/!NetSurf/Resources/en/licence.html,faf
index 6375c56da..7b3aef628 100644
--- a/!NetSurf/Resources/en/licence.html,faf
+++ b/!NetSurf/Resources/en/licence.html,faf
@@ -158,12 +158,6 @@ version.
MIT
-libmng
-
-© 2000–2007 Gerard Juyn, Glenn Randers-Pehrson
-MNG
-
-
OSLib
© 1994–1998 Jonathan Coxhead and contributors
@@ -642,34 +636,6 @@ ltmain.sh). Another support script, install-sh, is copyright by X Consortium
but is also freely distributable.
-
-MNG Licence
-The MNG Library is supplied "AS IS". The Contributing Authors
-disclaim all warranties, expressed or implied, including, without
-limitation, the warranties of merchantability and of fitness for any
-purpose. The Contributing Authors assume no liability for direct,
-indirect, incidental, special, exemplary, or consequential damages,
-which may result from the use of the MNG Library, even if advised of
-the possibility of such damage.
-
-Permission is hereby granted to use, copy, modify, and distribute this
-source code, or portions hereof, for any purpose, without fee, subject
-to the following restrictions:
-
-1. The origin of this source code must not be misrepresented;
- you must not claim that you wrote the original software.
-
-2. Altered versions must be plainly marked as such and must not be
- misrepresented as being the original source.
-
-3. This Copyright notice may not be removed or altered from any source
- or altered source distribution.
-
-The Contributing Authors specifically permit, without fee, and
-encourage the use of this source code as a component to supporting
-the MNG and JNG file format in commercial products. If you use this
-source code in a product, acknowledgment would be highly appreciated.
-
OSLib Licence
diff --git a/!NetSurf/Resources/it/licence.html,faf b/!NetSurf/Resources/it/licence.html,faf
index 1fa93b39e..b0a6c8ae3 100644
--- a/!NetSurf/Resources/it/licence.html,faf
+++ b/!NetSurf/Resources/it/licence.html,faf
@@ -150,13 +150,7 @@ dl.components > dd > span + span {
MIT
-libmng
-
-© 2000–2007 Gerard Juyn, Glenn Randers-Pehrson
-MNG
-
-
-OSLib
+qOSLib
© 1994–1998 Jonathan Coxhead and contributors
OSLib
@@ -631,35 +625,6 @@ ltmain.sh). Another support script, install-sh, is copyright by X Consortium
but is also freely distributable.
-
-Licenza MNG
-The MNG Library is supplied "AS IS". The Contributing Authors
-disclaim all warranties, expressed or implied, including, without
-limitation, the warranties of merchantability and of fitness for any
-purpose. The Contributing Authors assume no liability for direct,
-indirect, incidental, special, exemplary, or consequential damages,
-which may result from the use of the MNG Library, even if advised of
-the possibility of such damage.
-
-Permission is hereby granted to use, copy, modify, and distribute this
-source code, or portions hereof, for any purpose, without fee, subject
-to the following restrictions:
-
-1. The origin of this source code must not be misrepresented;
- you must not claim that you wrote the original software.
-
-2. Altered versions must be plainly marked as such and must not be
- misrepresented as being the original source.
-
-3. This Copyright notice may not be removed or altered from any source
- or altered source distribution.
-
-The Contributing Authors specifically permit, without fee, and
-encourage the use of this source code as a component to supporting
-the MNG and JNG file format in commercial products. If you use this
-source code in a product, acknowledgment would be highly appreciated.
-
-
Licenza OSLib
The copyright holder has granted a small relaxation of the
diff --git a/Docs/BUILDING-AmigaCross b/Docs/BUILDING-AmigaCross
index da2e2adf0..32762cd5b 100644
--- a/Docs/BUILDING-AmigaCross
+++ b/Docs/BUILDING-AmigaCross
@@ -70,10 +70,6 @@ openssl
libpng
-libmng
-http://www.aminet.net/dev/lib/libmng_so.lha
-http://www.aminet.net/dev/lib/libmng.lha
-
liblcms
http://www.aminet.net/dev/lib/liblcms_so.lha
http://www.aminet.net/dev/lib/liblcms_so.lha
diff --git a/Docs/BUILDING-AmigaOS b/Docs/BUILDING-AmigaOS
index 4dabf4f11..c15db573f 100644
--- a/Docs/BUILDING-AmigaOS
+++ b/Docs/BUILDING-AmigaOS
@@ -91,13 +91,13 @@
1> makelink sdk:local/newlib/lib/libcurl.so sobjs:libcurl-7.16.so soft
- libmng
+ libpng
--------
- NetSurf uses libMNG to display MNG and PNG files.
+ NetSurf uses libPNG to display PNG files.
It builds without any problems on OS4, or available from Aminet:
- http://www.aminet.net/package/dev/lib/libmng_so
+ http://www.aminet.net/package/dev/lib/libpng_so
OpenSSL
diff --git a/Docs/BUILDING-BeOS b/Docs/BUILDING-BeOS
index 83ced0e93..8d33a6808 100644
--- a/Docs/BUILDING-BeOS
+++ b/Docs/BUILDING-BeOS
@@ -89,10 +89,10 @@
TODO
- libmng
+ libpng
--------
- NetSurf uses libMNG to display MNG and PNG files.
+ NetSurf uses libPNG to display PNG files.
It should build just fine on BeOS.
diff --git a/Docs/BUILDING-Framebuffer b/Docs/BUILDING-Framebuffer
index 63ef02dd6..9cbd66065 100644
--- a/Docs/BUILDING-Framebuffer
+++ b/Docs/BUILDING-Framebuffer
@@ -218,7 +218,7 @@ Index: framebuffer/font_freetype.c
Debian-like OS:
- $ apt-get install libcurl3-dev libmng-dev
+ $ apt-get install libcurl3-dev libpng-dev
Recent OS versions might need libcurl4-dev instead of libcurl3-dev but
note that when it has not been built with OpenSSL, the SSL_CTX is not
@@ -228,15 +228,11 @@ Index: framebuffer/font_freetype.c
Fedora:
- $ yum install curl-devel libmng-devel lcms-devel
+ $ yum install curl-devel libpng-devel lcms-devel
Other:
- You'll need to install the development resources for libcurl3 and libmng.
-
- Note that if you don't require MNG or JNG image support, NetSurf can be
- configured to use libpng instead of libmng. If you wish to do this, install
- the libpng development package instead.
+ You'll need to install the development resources for libcurl3 and libpng.
The NetSurf project's libraries
---------------------------------
diff --git a/Docs/BUILDING-GTK b/Docs/BUILDING-GTK
index 35fcd02db..4641924f8 100644
--- a/Docs/BUILDING-GTK
+++ b/Docs/BUILDING-GTK
@@ -66,7 +66,7 @@
Debian-like OS:
- $ apt-get install libgtk2.0-dev libcurl3-dev libmng-dev
+ $ apt-get install libgtk2.0-dev libcurl3-dev libpng-dev
$ apt-get install librsvg2-dev libjpeg-dev
If you want to build with gtk 3 replace libgtk2.0-dev with libgtk-3-dev
@@ -84,17 +84,13 @@
Fedora:
- $ yum install curl-devel libmng-devel
+ $ yum install curl-devel libpng-devel
$ yum install librsvg2-devel expat-devel
Other:
You'll need to install the development resources for libglade2, libcurl3,
- libmng and librsvg.
-
- Note that if you don't require MNG or JNG image support, NetSurf can be
- configured to use libpng instead of libmng. If you wish to do this, install
- the libpng development package instead.
+ libpng and librsvg.
The NetSurf project's libraries
---------------------------------
diff --git a/Docs/BUILDING-ROCross b/Docs/BUILDING-ROCross
index f82ff2ad7..e28847f8d 100644
--- a/Docs/BUILDING-ROCross
+++ b/Docs/BUILDING-ROCross
@@ -56,8 +56,6 @@
$ ../autobuilder/build libpng12-0
- $ ../autobuilder/build libmng1
-
$ ../autobuilder/build oslib
B. NetSurf libraries
diff --git a/Docs/env.sh b/Docs/env.sh
index 8946e46e2..27ae2e92d 100644
--- a/Docs/env.sh
+++ b/Docs/env.sh
@@ -53,7 +53,7 @@ NS_BROWSER="netsurf"
# deb packages
NS_DEV_DEB="build-essential pkg-config git gperf"
NS_TOOL_DEB="flex bison"
-NS_GTK_DEB="libgtk2.0-dev libcurl3-dev libmng-dev librsvg2-dev libjpeg-dev libmozjs-dev"
+NS_GTK_DEB="libgtk2.0-dev libcurl3-dev libpng-dev librsvg2-dev libjpeg-dev libmozjs-dev"
#add target specific libraries
if [ "x${TARGET_ABI}" = "xriscos" ]; then
diff --git a/Makefile b/Makefile
index 32b1afd07..1638f3228 100644
--- a/Makefile
+++ b/Makefile
@@ -432,7 +432,6 @@ endif
include Makefile.defaults
$(eval $(call feature_enabled,JPEG,-DWITH_JPEG,-ljpeg,JPEG (libjpeg)))
-$(eval $(call feature_enabled,MNG,-DWITH_MNG,-lmng,JNG/MNG/PNG (libmng)))
$(eval $(call feature_enabled,HARU_PDF,-DWITH_PDF_EXPORT,-lhpdf -lpng,PDF export (haru)))
$(eval $(call feature_enabled,LIBICONV_PLUG,-DLIBICONV_PLUG,,glibc internal iconv))
diff --git a/Makefile.config.example b/Makefile.config.example
index a142d4610..8737e5372 100644
--- a/Makefile.config.example
+++ b/Makefile.config.example
@@ -8,10 +8,9 @@
# To see the available config options, look at Makefile.defaults, but make any
# alterations in your Makefile.config
-
-### To enable/disable MNG support, uncomment the appropriate line below.
-# override NETSURF_USE_MNG := YES
-# override NETSURF_USE_MNG := NO
+### To enable/disable PNG support, uncomment the appropriate line below.
+# override NETSURF_USE_PNG := YES
+# override NETSURF_USE_PNG := NO
### To enable/disable SVGTiny support, uncomment the appropriate line below.
# override NETSURF_USE_NSSVG := YES
diff --git a/Makefile.defaults b/Makefile.defaults
index 515f4a042..e11fa1fb6 100644
--- a/Makefile.defaults
+++ b/Makefile.defaults
@@ -43,16 +43,10 @@ NETSURF_USE_GIF := YES
# Valid options: YES, NO (highly recommended)
NETSURF_USE_JPEG := YES
-# Enable NetSurf's use of libpng for displaying PNGs. If MNG and PNG
-# are both enabled then NetSurf will choose libpng for PNGs, leaving
-# MNGs and JNGs to libmng.
-# Valid options: YES, NO (at least one of PNG/MNG highly recommended)
+# Enable NetSurf's use of libpng for displaying PNGs.
+# Valid options: YES, NO (highly recommended)
NETSURF_USE_PNG := YES
-# Enable NetSurf's use of libmng for displaying MNGs, JNGs and PNGs
-# Valid options: YES, NO (at least one of PNG/MNG highly recommended)
-NETSURF_USE_MNG := YES
-
# Enable NetSurf's use of libwebp for displaying WebPs
# Valid options: YES, NO
NETSURF_USE_WEBP := NO
diff --git a/amiga/Makefile.defaults b/amiga/Makefile.defaults
index 5ff1b69c3..35c35ae76 100644
--- a/amiga/Makefile.defaults
+++ b/amiga/Makefile.defaults
@@ -10,10 +10,6 @@
# Valid options: YES, NO, AUTO
NETSURF_USE_ROSPRITE := NO
- # Enable NetSurf's use of libmng for displaying MNGs, JNGs and PNGs
- # Valid options: YES, NO (at least one of PNG/MNG/DT highly recommended)
- NETSURF_USE_MNG := NO
-
# Enable NetSurf's use of libwebp for displaying WebPs
# Valid options: YES, NO
NETSURF_USE_WEBP := NO
diff --git a/amiga/Makefile.target b/amiga/Makefile.target
index 484c57dcb..b3220a142 100644
--- a/amiga/Makefile.target
+++ b/amiga/Makefile.target
@@ -23,7 +23,6 @@ ifeq ($(HOST),amiga)
$(eval $(call feature_enabled,GIF,-DWITH_GIF,-lnsgif,GIF (libnsgif)))
$(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng) ))
$(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny,SVG (libsvgtiny)))
- $(eval $(call feature_enabled,MNG,,-llcms -ljpeg,PNG/JNG/MNG (libmng)))
$(eval $(call feature_enabled,WEBP,-DWITH_WEBP,-lwebp,WebP (libwebp)))
$(eval $(call feature_enabled,VIDEO,-DWITH_VIDEO -I /SDK/local/newlib/include/glib-2.0,-lgstreamer-0.10 -lglib-2.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lintl -lffi,Video (libgstreamer)))
$(eval $(call feature_enabled,JS,-DXP_UNIX -DWITH_JS -DJS_VERSION=185,-lstdc++ -lmozjs185,JavaScript))
diff --git a/atari/Makefile.defaults b/atari/Makefile.defaults
index ccc9b49ce..d4ef0232b 100644
--- a/atari/Makefile.defaults
+++ b/atari/Makefile.defaults
@@ -22,8 +22,6 @@
# Valid options: YES, NO, AUTO
NETSURF_USE_NSSVG := AUTO
- NETSURF_USE_MNG := NO
-
# Enable Spidermonkey JavaScript engine
# Valid options: YES, NO
NETSURF_USE_MOZJS := NO
diff --git a/atari/Makefile.target b/atari/Makefile.target
index 283361355..bc79b0625 100644
--- a/atari/Makefile.target
+++ b/atari/Makefile.target
@@ -35,7 +35,6 @@ endif
FREETYPE_FONT_CFLAGS := $(shell freetype-config --cflags) -DWITH_FREETYPE_FONT_DRIVER
SPIDERMONKEY_CFLAGS := -DWITH_MOZJS -DXP_UNIX -DJS_HAS_FILE_OBJECT=0 -DJSOPTION_JIT=0 -DPOSIX_SOURCE -D_BSD_SOURCE
-$(eval $(call feature_enabled,MNG,-DWITH_MNG,-lmng,PNG/MNG/JNG (libmng)))
$(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng)))
$(eval $(call feature_enabled,MOZJS,$(SPIDERMONKEY_CFLAGS),-ljs,JavaScript (Spidermonkey)))
$(eval $(call feature_enabled,ATARI_FREETYPE_FONT,$(FREETYPE_FONT_CFLAGS),-lfreetype,(Freetype)))
diff --git a/beos/Makefile.target b/beos/Makefile.target
index 499ec16e9..81e2a951e 100644
--- a/beos/Makefile.target
+++ b/beos/Makefile.target
@@ -32,7 +32,6 @@ RSRC_BEOS = $(addprefix $(OBJROOT)/,$(subst /,_,$(patsubst %.rdef,%.rsrc,$(RDEF_
RESOURCES = $(RSRC_BEOS)
ifeq ($(HOST),beos)
CFLAGS += -I/boot/home/config/include \
- -I/boot/home/config/include/libmng \
-I/boot/home/config/include/hubbub \
-I/boot/home/config/include/libcss \
-I/boot/home/config/include/parserutils
@@ -42,7 +41,6 @@ ifeq ($(HOST),beos)
ifneq ($(wildcard /boot/develop/lib/*/libnetwork.so),)
# Haiku
CFLAGS += -I/boot/common/include \
- -I/boot/common/include/libmng \
-I/boot/common/include/hubbub \
-I/boot/common/include/libcss \
-I/boot/common/include/parserutils
diff --git a/cocoa/Makefile.defaults b/cocoa/Makefile.defaults
index b2f64ec56..24517490c 100644
--- a/cocoa/Makefile.defaults
+++ b/cocoa/Makefile.defaults
@@ -22,7 +22,6 @@
# Valid options: YES, NO, AUTO
NETSURF_USE_NSSVG := AUTO
- NETSURF_USE_MNG := NO
NETSURF_USE_BMP := NO
NETSURF_USE_GIF := NO
NETSURF_USE_PNG := NO
diff --git a/framebuffer/Makefile.target b/framebuffer/Makefile.target
index d423e298f..5c658925e 100644
--- a/framebuffer/Makefile.target
+++ b/framebuffer/Makefile.target
@@ -2,8 +2,6 @@
# Framebuffer target setup
# ----------------------------------------------------------------------------
-
-$(eval $(call feature_enabled,MNG,-DWITH_MNG,-lmng,PNG/MNG/JNG (libmng)))
$(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng) ))
ifeq ($(NETSURF_FB_FONTLIB),freetype)
diff --git a/image/Makefile b/image/Makefile
index becd944cd..9992c5443 100644
--- a/image/Makefile
+++ b/image/Makefile
@@ -6,7 +6,6 @@ S_IMAGE_NO :=
S_IMAGE_$(NETSURF_USE_BMP) += bmp.c ico.c
S_IMAGE_$(NETSURF_USE_GIF) += gif.c
S_IMAGE_$(NETSURF_USE_JPEG) += jpeg.c
-S_IMAGE_$(NETSURF_USE_MNG) += mng.c
S_IMAGE_$(NETSURF_USE_ROSPRITE) += nssprite.c
S_IMAGE_$(NETSURF_USE_PNG) += png.c
S_IMAGE_$(NETSURF_USE_NSSVG) += svg.c
diff --git a/image/image.c b/image/image.c
index becf221b9..97ab2c0a3 100644
--- a/image/image.c
+++ b/image/image.c
@@ -31,7 +31,6 @@
#include "image/gif.h"
#include "image/ico.h"
#include "image/jpeg.h"
-#include "image/mng.h"
#include "image/nssprite.h"
#include "image/png.h"
#include "image/rsvg.h"
@@ -73,18 +72,7 @@ nserror image_init(void)
return error;
#endif
-#ifdef WITH_MNG
- error = nsmng_init();
- if (error != NSERROR_OK)
- return error;
-
- error = nsjpng_init();
- if (error != NSERROR_OK)
- return error;
-#endif
-
#ifdef WITH_PNG
- /* Prefer libpng over libmng for pngs by registering later */
error = nspng_init();
if (error != NSERROR_OK)
return error;
diff --git a/image/mng.c b/image/mng.c
deleted file mode 100644
index 325d1d192..000000000
--- a/image/mng.c
+++ /dev/null
@@ -1,832 +0,0 @@
-/*
- * Copyright 2005 Richard Wilson
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-/** \file
- * Content for image/mng, image/png, and image/jng (implementation).
- */
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include "content/content_protected.h"
-#include "utils/nsoption.h"
-#include "desktop/plotters.h"
-#include "image/bitmap.h"
-#include "image/mng.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/schedule.h"
-#include "utils/utils.h"
-
-/* This implementation does not currently support dynamic MNGs or any
- * form of colour/gamma correction,
- */
-
-typedef struct nsmng_content
-{
- struct content base;
-
- bool opaque_test_pending;
- bool read_start;
- bool read_resume;
- int read_size;
- bool waiting;
- bool displayed;
- void *handle;
-
- struct bitmap *bitmap; /**< Created NetSurf bitmap */
-} nsmng_content;
-
-
-#ifndef MNG_INTERNAL_MEMMNGMT
-
-/**
- * Memory allocation callback for libmng.
- */
-
-static mng_ptr nsmng_alloc(mng_size_t n)
-{
- return calloc(1, n);
-}
-
-
-/**
- * Memory free callback for libmng.
- */
-
-static void nsmng_free(mng_ptr p, mng_size_t n)
-{
- free(p);
-}
-
-#endif
-
-/**
- * Broadcasts an error message and returns false
- *
- * \param c the content to broadcast for
- * \return Appropriate error
- */
-static nserror nsmng_broadcast_error(nsmng_content *c, mng_retcode code)
-{
- union content_msg_data msg_data;
- char error[100];
-
- assert(c != NULL);
-
- if (code == MNG_OUTOFMEMORY) {
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data);
- return NSERROR_NOMEM;
- }
-
- snprintf(error, sizeof error, messages_get("MNGError"), code);
- msg_data.error = error;
- content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data);
- return NSERROR_MNG_ERROR;
-}
-
-/* CALLBACKS REQUIRED FOR libmng READING */
-
-static mng_bool nsmng_openstream(mng_handle mng)
-{
- assert(mng != NULL);
- return MNG_TRUE;
-}
-
-static mng_bool nsmng_readdata(mng_handle mng, mng_ptr buffer, mng_uint32 size,
- mng_uint32 *bytesread)
-{
- nsmng_content *c;
- const char *data;
- unsigned long data_size;
-
- assert(mng != NULL);
- assert(buffer != NULL);
- assert(bytesread != NULL);
-
- /* Get our content back
- */
- c = (nsmng_content *) mng_get_userdata(mng);
- assert(c != NULL);
-
- /* Copy any data we have (maximum of 'size')
- */
- data = content__get_source_data(&c->base, &data_size);
-
- *bytesread = ((data_size - c->read_size) < size) ?
- (data_size - c->read_size) : size;
-
- if ((*bytesread) > 0) {
- memcpy(buffer, data + c->read_size, *bytesread);
- c->read_size += *bytesread;
- }
-
- /* Return success
- */
- return MNG_TRUE;
-}
-
-static mng_bool nsmng_closestream(mng_handle mng)
-{
- assert(mng != NULL);
- return MNG_TRUE;
-}
-
-static mng_bool nsmng_processheader(mng_handle mng, mng_uint32 width,
- mng_uint32 height)
-{
- nsmng_content *c;
- union content_msg_data msg_data;
- uint8_t *buffer;
-
- assert(mng != NULL);
-
- /* This function is called when the header has been read and we
- know the dimensions of the canvas.
- */
- c = (nsmng_content *) mng_get_userdata(mng);
- assert(c != NULL);
-
- c->bitmap = bitmap_create(width, height, BITMAP_NEW);
- if (c->bitmap == NULL) {
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data);
- LOG(("Insufficient memory to create canvas."));
- return MNG_FALSE;
- }
-
- /* Get the buffer to ensure that it is allocated and the calls in
- * nsmng_getcanvasline() succeed. */
- buffer = bitmap_get_buffer(c->bitmap);
- if (buffer == NULL) {
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data);
- LOG(("Insufficient memory to create canvas."));
- return MNG_FALSE;
- }
-
- /* Initialise the content size
- */
- c->base.width = width;
- c->base.height = height;
-
- /* Set the canvas style
- */
- if (mng_set_canvasstyle(mng, MNG_CANVAS_RGBA8) != MNG_NOERROR) {
- LOG(("Error setting canvas style."));
- }
-
- /* Return success
- */
- return MNG_TRUE;
-}
-
-
-/* END OF CALLBACKS REQUIRED FOR READING
-*/
-
-
-static bool nsmng_process_data(struct content *c, const char *data, unsigned int size)
-{
- nsmng_content *mng = (nsmng_content *) c;
- mng_retcode status;
-
- assert(c != NULL);
- assert(data != NULL);
-
- /* We only need to do any processing if we're starting/resuming reading.
- */
- if ((!mng->read_resume) && (!mng->read_start))
- return true;
-
- /* Try to start processing, or process some more data
- */
- if (mng->read_start) {
- status = mng_read(mng->handle);
- mng->read_start = false;
- } else {
- status = mng_read_resume(mng->handle);
- }
- mng->read_resume = (status == MNG_NEEDMOREDATA);
- if ((status != MNG_NOERROR) && (status != MNG_NEEDMOREDATA)) {
- LOG(("Failed to start/continue reading (%i).", status));
- return nsmng_broadcast_error(mng, status) == NSERROR_OK;
- }
-
- /* Continue onwards
- */
- return true;
-}
-
-/* START OF CALLBACKS REQUIRED FOR DISPLAYING
-*/
-
-
-static mng_ptr nsmng_getcanvasline(mng_handle mng, mng_uint32 line)
-{
- nsmng_content *c;
-
- assert(mng != NULL);
-
- /* Get our content back
- */
- c = (nsmng_content *) mng_get_userdata(mng);
- assert(c != NULL);
-
- /* Calculate the address
- */
- return bitmap_get_buffer(c->bitmap) +
- bitmap_get_rowstride(c->bitmap) * line;
-}
-
-static mng_bool nsmng_refresh(mng_handle mng, mng_uint32 x, mng_uint32 y,
- mng_uint32 w, mng_uint32 h)
-{
- union content_msg_data data;
- nsmng_content *c;
-
- assert(mng != NULL);
-
- /* Get our content back
- */
- c = (nsmng_content *) mng_get_userdata(mng);
- assert(c != NULL);
-
- /* Set the minimum redraw area
- */
- data.redraw.x = x;
- data.redraw.y = y;
- data.redraw.width = w;
- data.redraw.height = h;
-
- /* Set the redraw area to the whole canvas to ensure that if
- we can redraw something to trigger animation later then we do
- */
-/* data.redraw.x = 0;
- data.redraw.y = 0;
- data.redraw.width = c->width;
- data.redraw.height = c->height;
-*/
- /* Always redraw everything
- */
- data.redraw.full_redraw = true;
-
- /* Set the object characteristics
- */
- data.redraw.object = &c->base;
- data.redraw.object_x = 0;
- data.redraw.object_y = 0;
- data.redraw.object_width = c->base.width;
- data.redraw.object_height = c->base.height;
-
- /* Only attempt to force the redraw if we've been requested to
- * display the image in the first place (i.e. nsmng_redraw has
- * been called). This avoids the situation of forcibly redrawing
- * an image that shouldn't be shown (e.g. if the image is a fallback
- * for an object that can't be rendered)
- */
- if (c->displayed)
- content_broadcast(&c->base, CONTENT_MSG_REDRAW, data);
-
- return MNG_TRUE;
-}
-
-/**
- * Animates to the next frame
- */
-static void nsmng_animate(void *p)
-{
- nsmng_content *c;
-
- assert(p != NULL);
-
- c = (nsmng_content *) p;
-
- /* If we used the last animation we advance, if not we try again later
- */
- if (c->base.user_list->next == NULL) {
- c->waiting = true;
- } else {
- c->waiting = false;
- mng_display_resume(c->handle);
- c->opaque_test_pending = true;
- if (c->bitmap)
- bitmap_modified(c->bitmap);
- }
-}
-
-static mng_bool nsmng_settimer(mng_handle mng, mng_uint32 msecs)
-{
- nsmng_content *c;
-
- assert(mng != NULL);
-
- /* Get our content back
- */
- c = (nsmng_content *) mng_get_userdata(mng);
- assert(c != NULL);
-
- /* Perform the scheduling
- */
- schedule(msecs / 10, nsmng_animate, c);
- return MNG_TRUE;
-}
-
-/**
- * Get the wall-clock time in milliseconds since some fixed time.
- */
-
-static mng_uint32 nsmng_gettickcount(mng_handle mng)
-{
- static bool start = true;
- static time_t t0;
- struct timeval tv;
-#if defined(__SVR4) && defined(__sun) || defined(__NetBSD__) || \
- defined(__APPLE__)
- /* Solaris, NetBSD, and OS X don't have this structure, and ignore the
- * second parameter to gettimeofday()
- */
- int tz;
-#else
- struct timezone tz;
-#endif
- assert(mng != NULL);
-
- gettimeofday(&tv, &tz);
- if (start) {
- t0 = tv.tv_sec;
- start = false;
- }
-
- return (tv.tv_sec - t0) * 1000 + tv.tv_usec / 1000;
-}
-
-/* END OF CALLBACKS REQUIRED FOR DISPLAYING
-*/
-
-static mng_bool nsmng_errorproc(mng_handle mng, mng_int32 code,
- mng_int8 severity, mng_chunkid chunktype, mng_uint32 chunkseq,
- mng_int32 extra1, mng_int32 extra2, mng_pchar text)
-{
- nsmng_content *c;
- char chunk[5];
-
- assert(mng != NULL);
-
- c = (nsmng_content *) mng_get_userdata(mng);
- assert(c != NULL);
-
- chunk[0] = (char)((chunktype >> 24) & 0xFF);
- chunk[1] = (char)((chunktype >> 16) & 0xFF);
- chunk[2] = (char)((chunktype >> 8) & 0xFF);
- chunk[3] = (char)((chunktype ) & 0xFF);
- chunk[4] = '\0';
-
- LOG(("error playing '%s' chunk %s (%d):",
- content_get_url(&c->base), chunk, chunkseq));
- LOG(("code %d severity %d extra1 %d extra2 %d text:'%s'", code,
- severity, extra1, extra2, text));
-
- return (0);
-}
-
-static nserror nsmng_create_mng_data(nsmng_content *c)
-{
- mng_retcode code;
- union content_msg_data msg_data;
-
- assert(c != NULL);
-
- /* Initialise the library
- */
-#ifdef MNG_INTERNAL_MEMMNGMT
- c->handle = mng_initialize(c, MNG_NULL, MNG_NULL, MNG_NULL);
-#else
- c->handle = mng_initialize(c, nsmng_alloc, nsmng_free, MNG_NULL);
-#endif
- if (c->handle == MNG_NULL) {
- LOG(("Unable to initialise MNG library."));
- msg_data.error = messages_get("NoMemory");
- content_broadcast(&c->base, CONTENT_MSG_ERROR, msg_data);
- return NSERROR_NOMEM;
- }
-
- /* We need to decode in suspension mode
- */
- code = mng_set_suspensionmode(c->handle, MNG_TRUE);
- if (code) {
- LOG(("Unable to set suspension mode."));
- return nsmng_broadcast_error(c, code);
- }
-
- /* We need to register our callbacks
- */
- code = mng_setcb_openstream(c->handle, nsmng_openstream);
- if (code) {
- LOG(("Unable to set openstream callback."));
- return nsmng_broadcast_error(c, code);
- }
- code = mng_setcb_readdata(c->handle, nsmng_readdata);
- if (code) {
- LOG(("Unable to set readdata callback."));
- return nsmng_broadcast_error(c, code);
- }
- code = mng_setcb_closestream(c->handle, nsmng_closestream);
- if (code) {
- LOG(("Unable to set closestream callback."));
- return nsmng_broadcast_error(c, code);
- }
- code = mng_setcb_processheader(c->handle, nsmng_processheader);
- if (code) {
- LOG(("Unable to set processheader callback."));
- return nsmng_broadcast_error(c, code);
- }
-
- /* Register our callbacks for displaying
- */
- code = mng_setcb_getcanvasline(c->handle, nsmng_getcanvasline);
- if (code) {
- LOG(("Unable to set getcanvasline callback."));
- return nsmng_broadcast_error(c, code);
- }
- code = mng_setcb_refresh(c->handle, nsmng_refresh);
- if (code) {
- LOG(("Unable to set refresh callback."));
- return nsmng_broadcast_error(c, code);
- }
- code = mng_setcb_gettickcount(c->handle, nsmng_gettickcount);
- if (code) {
- LOG(("Unable to set gettickcount callback."));
- return nsmng_broadcast_error(c, code);
- }
- code = mng_setcb_settimer(c->handle, nsmng_settimer);
- if (code) {
- LOG(("Unable to set settimer callback."));
- return nsmng_broadcast_error(c, code);
- }
-
- /* register error handling function */
- code = mng_setcb_errorproc(c->handle, nsmng_errorproc);
- if (code) {
- LOG(("Unable to set errorproc"));
- return nsmng_broadcast_error(c, code);
- }
-
- /* Initialise the reading
- */
- c->read_start = true;
- c->read_resume = false;
- c->read_size = 0;
- c->waiting = false;
-
- c->displayed = false;
-
- return NSERROR_OK;
-}
-
-static nserror nsmng_create(const content_handler *handler,
- lwc_string *imime_type, const struct http_parameter *params,
- llcache_handle *llcache, const char *fallback_charset,
- bool quirks, struct content **c)
-{
- nsmng_content *mng;
- nserror error;
-
- mng = calloc(1, sizeof(nsmng_content));
- if (mng == NULL)
- return NSERROR_NOMEM;
-
- error = content__init(&mng->base, handler, imime_type, params,
- llcache, fallback_charset, quirks);
- if (error != NSERROR_OK) {
- free(mng);
- return error;
- }
-
- error = nsmng_create_mng_data(mng);
- if (error != NSERROR_OK) {
- free(mng);
- return error;
- }
-
- *c = (struct content *) mng;
-
- return NSERROR_OK;
-}
-
-
-
-static bool nsmng_convert(struct content *c)
-{
- nsmng_content *mng = (nsmng_content *) c;
- mng_retcode status;
- unsigned long size;
- char *title;
-
- assert(c != NULL);
-
- content__get_source_data(c, &size);
-
- /* by this point, the png should have been parsed
- * and the bitmap created, so ensure that's the case
- */
- if (mng->bitmap == NULL) {
- return nsmng_broadcast_error(mng, -1) == NSERROR_OK;
- }
-
-
- /* set title text */
- title = messages_get_buff("MNGTitle",
- nsurl_access_leaf(llcache_handle_get_url(c->llcache)),
- c->width, c->height);
- if (title != NULL) {
- content__set_title(c, title);
- free(title);
- }
-
- c->size += c->width * c->height * 4;
- content_set_ready(c);
- content_set_done(c);
- /* Done: update status bar */
- content_set_status(c, "");
-
- /* jmb: I'm really not sure that this should be here.
- * The *_convert functions are for converting a content into a
- * displayable format. They should not, however, do anything which
- * could cause the content to be displayed; the content may have
- * hidden visibility or be a fallback for an object; this
- * information is not available here (nor is there any need for it
- * to be).
- * The specific issue here is that mng_display calls the display
- * callbacks, which include nsmng_refresh. nsmng_refresh forces
- * a content to be redrawn regardless of whether it should be
- * displayed or not.
- */
- /* Start displaying
- */
- status = mng_display(mng->handle);
- if ((status != MNG_NOERROR) && (status != MNG_NEEDTIMERWAIT)) {
- LOG(("Unable to start display (%i)", status));
- return nsmng_broadcast_error(mng, status) == NSERROR_OK;
- }
- bitmap_modified(mng->bitmap);
-
- /* Optimise the plotting of MNG */
- mng->opaque_test_pending = false;
-
- return true;
-}
-
-static bool nsjpng_convert(struct content *c)
-{
- nsmng_content *mng = (nsmng_content *) c;
- mng_retcode status;
- unsigned long size;
- char *title;
- mng_handle handle;
-
- assert(c != NULL);
-
- content__get_source_data(c, &size);
-
- /* by this point, the png should have been parsed
- * and the bitmap created, so ensure that's the case
- */
- if (mng->bitmap == NULL) {
- return nsmng_broadcast_error(mng, -1) == NSERROR_OK;
- }
-
- /* set title text */
- title = messages_get_buff("PNGTitle",
- nsurl_access_leaf(llcache_handle_get_url(c->llcache)),
- c->width, c->height);
- if (title != NULL) {
- content__set_title(c, title);
- free(title);
- }
-
- c->size += c->width * c->height * 4;
- content_set_ready(c);
- content_set_done(c);
- /* Done: update status bar */
- content_set_status(c, "");
-
- /* jmb: I'm really not sure that this should be here.
- * The *_convert functions are for converting a content into a
- * displayable format. They should not, however, do anything which
- * could cause the content to be displayed; the content may have
- * hidden visibility or be a fallback for an object; this
- * information is not available here (nor is there any need for it
- * to be).
- * The specific issue here is that mng_display calls the display
- * callbacks, which include nsmng_refresh. nsmng_refresh forces
- * a content to be redrawn regardless of whether it should be
- * displayed or not.
- */
- /* Start displaying
- */
- status = mng_display(mng->handle);
- if ((status != MNG_NOERROR) && (status != MNG_NEEDTIMERWAIT)) {
- LOG(("Unable to start display (%i)", status));
- return nsmng_broadcast_error(mng, status) == NSERROR_OK;
- }
- bitmap_modified(mng->bitmap);
-
- /* Optimise the plotting of JNG/PNGs
- */
- mng->opaque_test_pending = true;
- bitmap_set_opaque(mng->bitmap, false);
-
- /* free associated memory */
-
- handle = mng->handle;
-
- mng_cleanup(&handle);
-
- mng->handle = NULL;
-
- return true;
-}
-
-static void nsmng_destroy(struct content *c)
-{
- nsmng_content *mng = (nsmng_content *) c;
-
- assert (c != NULL);
-
- /* Cleanup the MNG structure and release the canvas memory
- */
- schedule_remove(nsmng_animate, c);
-
- if (mng->handle != NULL) {
- mng_handle handle = mng->handle;
-
- mng_cleanup(&handle);
-
- mng->handle = NULL;
- }
-
- if (mng->bitmap) {
- bitmap_destroy(mng->bitmap);
- }
-}
-
-
-static bool nsmng_redraw(struct content *c, struct content_redraw_data *data,
- const struct rect *clip, const struct redraw_context *ctx)
-{
- nsmng_content *mng = (nsmng_content *) c;
- bool ret;
- bitmap_flags_t flags = BITMAPF_NONE;
-
- /* mark image as having been requested to display */
- mng->displayed = true;
-
- if ((mng->bitmap) &&
- (mng->opaque_test_pending)) {
- bitmap_set_opaque(mng->bitmap, bitmap_test_opaque(mng->bitmap));
- mng->opaque_test_pending = false;
- }
-
- if (data->repeat_x)
- flags |= BITMAPF_REPEAT_X;
- if (data->repeat_y)
- flags |= BITMAPF_REPEAT_Y;
-
- ret = ctx->plot->bitmap(data->x, data->y, data->width, data->height,
- mng->bitmap, data->background_colour, flags);
-
- /* Check if we need to restart the animation */
- if ((mng->waiting) &&
- (nsoption_bool(animate_images))) {
- nsmng_animate(c);
- }
-
- return ret;
-}
-
-
-static nserror nsmng_clone(const struct content *old, struct content **newc)
-{
- nsmng_content *mng;
- nserror error;
- const char *data;
- unsigned long size;
-
- mng = calloc(1, sizeof(nsmng_content));
- if (mng == NULL)
- return NSERROR_NOMEM;
-
- error = content__clone(old, &mng->base);
- if (error != NSERROR_OK) {
- content_destroy(&mng->base);
- return error;
- }
-
- /* Simply replay create/process/convert */
- error = nsmng_create_mng_data(mng);
- if (error != NSERROR_OK) {
- content_destroy(&mng->base);
- return error;
- }
-
- data = content__get_source_data(&mng->base, &size);
- if (size > 0) {
- if (nsmng_process_data(&mng->base, data, size) == false) {
- content_destroy(&mng->base);
- return NSERROR_CLONE_FAILED;
- }
- }
-
- if (old->status == CONTENT_STATUS_READY ||
- old->status == CONTENT_STATUS_DONE) {
- if (nsmng_convert(&mng->base) == false) {
- content_destroy(&mng->base);
- return NSERROR_CLONE_FAILED;
- }
- }
-
- *newc = (struct content *) mng;
-
- return NSERROR_OK;
-}
-
-static void *nsmng_get_internal(const struct content *c, void *context)
-{
- nsmng_content *mng = (nsmng_content *)c;
-
- return mng->bitmap;
-}
-
-static content_type nsmng_content_type(void)
-{
- return CONTENT_IMAGE;
-}
-
-/* register handler for mng types */
-static const content_handler nsmng_content_handler = {
- .create = nsmng_create,
- .process_data = nsmng_process_data,
- .data_complete = nsmng_convert,
- .destroy = nsmng_destroy,
- .redraw = nsmng_redraw,
- .clone = nsmng_clone,
- .get_internal = nsmng_get_internal,
- .type = nsmng_content_type,
- .no_share = false,
-};
-
-static const char *nsmng_types[] = {
- /* MNG types*/
- "image/mng",
- "image/x-mng",
- "video/mng",
- "video/x-mng",
-};
-
-CONTENT_FACTORY_REGISTER_TYPES(nsmng, nsmng_types, nsmng_content_handler);
-
-/* register handler for jng and png types */
-static const content_handler nsjpng_content_handler = {
- .create = nsmng_create,
- .process_data = nsmng_process_data,
- .data_complete = nsjpng_convert,
- .destroy = nsmng_destroy,
- .redraw = nsmng_redraw,
- .clone = nsmng_clone,
- .get_internal = nsmng_get_internal,
- .type = nsmng_content_type,
- .no_share = false,
-};
-
-
-static const char *nsjpng_types[] = {
- /* JNG types*/
- "image/jng",
- "image/x-jng",
- /* PNG types*/
- "image/png",
- "image/x-png"
-};
-
-CONTENT_FACTORY_REGISTER_TYPES(nsjpng, nsjpng_types, nsjpng_content_handler);
diff --git a/image/mng.h b/image/mng.h
deleted file mode 100644
index 7ad779904..000000000
--- a/image/mng.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright 2004 Richard Wilson
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
-
-/** \file
- * Content for image/mng, image/png, and image/jng (interface).
- */
-
-#ifndef _NETSURF_IMAGE_MNG_H_
-#define _NETSURF_IMAGE_MNG_H_
-
-nserror nsmng_init(void);
-nserror nsjpng_init(void);
-
-#endif
diff --git a/riscos/Makefile.target b/riscos/Makefile.target
index 3d64e24f9..05e66c829 100644
--- a/riscos/Makefile.target
+++ b/riscos/Makefile.target
@@ -45,7 +45,6 @@ RESOURCES = $(TPD_RISCOS) split-messages
CFLAGS += $(WARNFLAGS) -Driscos -std=c99 -D_BSD_SOURCE -D_POSIX_C_SOURCE \
-mpoke-function-name -fno-strict-aliasing
-CFLAGS += -I$(GCCSDK_INSTALL_ENV)/include -I$(GCCSDK_INSTALL_ENV)/include/libmng
ifeq ($(HOST),riscos)
CFLAGS += -I -mthrowback
endif
diff --git a/windows/Makefile.defaults b/windows/Makefile.defaults
index 68fb7af66..10c9abbf7 100644
--- a/windows/Makefile.defaults
+++ b/windows/Makefile.defaults
@@ -14,9 +14,6 @@
# Valid options: YES, NO
NETSURF_USE_LIBICONV_PLUG := NO
- # mng support does not currently build on windows
- NETSURF_USE_MNG := NO
-
# no pdf support
NETSURF_USE_HARU_PDF := NO
diff --git a/windows/Makefile.target b/windows/Makefile.target
index 1cdb4a61a..cad28b575 100644
--- a/windows/Makefile.target
+++ b/windows/Makefile.target
@@ -16,7 +16,6 @@ $(eval $(call feature_enabled,BMP,-DWITH_BMP,-lnsbmp,BMP (libnsbmp)))
$(eval $(call feature_enabled,GIF,-DWITH_GIF,-lnsgif,GIF (libnsgif)))
$(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG (libpng) ))
$(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny,SVG (libsvgtiny)))
-$(eval $(call feature_enabled,MNG,,-llcms -ljpeg,PNG/JNG/MNG (libmng)))
ifneq ($(PKG_CONFIG),)
$(eval $(call pkg_config_find_and_add,zlib,ZLib))
From 0aa488288caa69738032a7f68d3b75ab1e776c61 Mon Sep 17 00:00:00 2001
From: Michael Drake
Date: Sat, 4 Jan 2014 17:54:43 +0000
Subject: [PATCH 013/773] Fix longstanding bug where floating root element
caused assertion. Bug #394.
---
render/box_construct.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/render/box_construct.c b/render/box_construct.c
index a72f918f8..b259e6a1f 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -1013,12 +1013,13 @@ bool box_construct_element(struct box_construct_ctx *ctx,
box->type == BOX_BR ||
box->type == BOX_INLINE_BLOCK ||
css_computed_float(box->style) == CSS_FLOAT_LEFT ||
- css_computed_float(box->style) == CSS_FLOAT_RIGHT)) {
+ css_computed_float(box->style) == CSS_FLOAT_RIGHT) &&
+ props.node_is_root == false) {
/* Found an inline child of a block without a current container
* (i.e. this box is the first child of its parent, or was
* preceded by block-level siblings) */
assert(props.containing_block != NULL &&
- "Root box must not be inline or floated");
+ "Box must have containing block.");
props.inline_container = box_create(NULL, NULL, false, NULL,
NULL, NULL, NULL, ctx->bctx);
@@ -1073,9 +1074,11 @@ bool box_construct_element(struct box_construct_ctx *ctx,
return false;
}
- if (css_computed_float(box->style) == CSS_FLOAT_LEFT ||
+ if (props.node_is_root == false &&
+ (css_computed_float(box->style) ==
+ CSS_FLOAT_LEFT ||
css_computed_float(box->style) ==
- CSS_FLOAT_RIGHT) {
+ CSS_FLOAT_RIGHT)) {
/* Float: insert a float between the parent and box. */
struct box *flt = box_create(NULL, NULL, false,
props.href, props.target, props.title,
From 068b07494bc5491705da6b5056bd442efc3b797f Mon Sep 17 00:00:00 2001
From: Daniel Silverstone
Date: Sat, 4 Jan 2014 15:37:51 +0000
Subject: [PATCH 014/773] Retrieve text area content from the textarea api
---
render/box_textarea.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/render/box_textarea.c b/render/box_textarea.c
index d34c4c4a4..3c312a85f 100644
--- a/render/box_textarea.c
+++ b/render/box_textarea.c
@@ -241,7 +241,7 @@ bool box_textarea_create_textarea(html_content *html,
return false;
/* Get the textarea's initial content */
- err = dom_node_get_text_content(node, &dom_text);
+ err = dom_html_text_area_element_get_value(textarea, &dom_text);
if (err != DOM_NO_ERR)
return false;
From 533cfa27dadb05c30f641d274bde91c7d5f3b457 Mon Sep 17 00:00:00 2001
From: Daniel Silverstone
Date: Sat, 4 Jan 2014 16:30:09 +0000
Subject: [PATCH 015/773] Ensure textual input boxes re-update the DOM with new
values
---
render/box_textarea.c | 4 +++-
render/form.c | 37 +++++++++++++++++++++++++++++++++++++
render/form.h | 3 +++
3 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/render/box_textarea.c b/render/box_textarea.c
index 3c312a85f..099dcc8e0 100644
--- a/render/box_textarea.c
+++ b/render/box_textarea.c
@@ -206,7 +206,9 @@ static void box_textarea_callback(void *data, struct textarea_msg *msg)
break;
case TEXTAREA_MSG_TEXT_MODIFIED:
- /* TODO */
+ form_gadget_update_value(d->html, gadget,
+ strndup(msg->data.modified.text,
+ msg->data.modified.len));
break;
}
}
diff --git a/render/form.c b/render/form.c
index ebe9b6f28..254d2cffb 100644
--- a/render/form.c
+++ b/render/form.c
@@ -1539,3 +1539,40 @@ void form_submit(nsurl *page_url, struct browser_window *target,
fetch_multipart_data_destroy(success);
free(data);
}
+
+void form_gadget_update_value(struct html_content *html,
+ struct form_control *control, char *value)
+{
+ switch (control->type) {
+ case GADGET_HIDDEN:
+ case GADGET_TEXTBOX:
+ case GADGET_TEXTAREA:
+ case GADGET_PASSWORD:
+ case GADGET_FILE:
+ if (control->value != NULL) {
+ free(control->value);
+ }
+ control->value = value;
+ if (control->node != NULL) {
+ dom_exception err;
+ dom_string *str;
+ err = dom_string_create((uint8_t *)value,
+ strlen(value), &str);
+ if (err == DOM_NO_ERR) {
+ if (control->type == GADGET_TEXTAREA)
+ err = dom_html_text_area_element_set_value(
+ (dom_html_text_area_element *)(control->node),
+ str);
+ else
+ err = dom_html_input_element_set_value(
+ (dom_html_input_element *)(control->node),
+ str);
+ dom_string_unref(str);
+ }
+ }
+ break;
+ default:
+ /* Do nothing */
+ break;
+ }
+}
diff --git a/render/form.h b/render/form.h
index 9088ca293..c03ea8e99 100644
--- a/render/form.h
+++ b/render/form.h
@@ -183,4 +183,7 @@ void form_submit(nsurl *page_url, struct browser_window *target,
struct form *form, struct form_control *submit_button);
void form_radio_set(struct html_content *html, struct form_control *radio);
+void form_gadget_update_value(struct html_content *html,
+ struct form_control *control, char *value);
+
#endif
From a5bb596eb3444a314cc32ff3062889d814df951d Mon Sep 17 00:00:00 2001
From: Daniel Silverstone
Date: Sat, 4 Jan 2014 16:30:52 +0000
Subject: [PATCH 016/773] Ensure that file inputs update the dom node and
annotate with the unencoded filename
---
render/html.c | 55 ++++++++++++++++++++++++++++++++++++++++++---
utils/corestrings.c | 4 +++-
utils/corestrings.h | 1 +
3 files changed, 56 insertions(+), 4 deletions(-)
diff --git a/render/html.c b/render/html.c
index 1e7350cf1..49bb019dd 100644
--- a/render/html.c
+++ b/render/html.c
@@ -1685,6 +1685,47 @@ html_scroll_at_point(struct content *c, int x, int y, int scrx, int scry)
return false;
}
+/** Helper for file gadgets to store their filename unencoded on the
+ * dom node associated with the gadget.
+ *
+ * \todo Get rid of this crap eventually
+ */
+static void html__dom_user_data_handler(dom_node_operation operation,
+ dom_string *key, void *_data, struct dom_node *src,
+ struct dom_node *dst)
+{
+ char *oldfile;
+ char *data = (char *)_data;
+
+ if (!dom_string_isequal(corestring_dom___ns_key_libcss_node_data,
+ key) || data == NULL) {
+ return;
+ }
+
+ switch (operation) {
+ case DOM_NODE_CLONED:
+ if (dom_node_set_user_data(dst,
+ corestring_dom___ns_key_file_name_node_data,
+ strdup(data), html__dom_user_data_handler,
+ &oldfile) == DOM_NO_ERR) {
+ if (oldfile != NULL)
+ free(oldfile);
+ }
+ break;
+
+ case DOM_NODE_RENAMED:
+ case DOM_NODE_IMPORTED:
+ case DOM_NODE_ADOPTED:
+ break;
+
+ case DOM_NODE_DELETED:
+ free(data);
+ break;
+ default:
+ LOG(("User data operation not handled."));
+ assert(0);
+ }
+}
/**
* Drop a file onto a content at a particular point, or determine if a file
@@ -1752,7 +1793,7 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file)
if (file_box) {
/* File dropped on file input */
utf8_convert_ret ret;
- char *utf8_fn;
+ char *utf8_fn, *oldfile = NULL;
ret = utf8_from_local_encoding(file, 0,
&utf8_fn);
@@ -1765,8 +1806,16 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file)
}
/* Found: update form input */
- free(file_box->gadget->value);
- file_box->gadget->value = utf8_fn;
+ form_gadget_update_value(html, file_box->gadget, utf8_fn);
+
+ /* corestring_dom___ns_key_file_name_node_data */
+ if (dom_node_set_user_data((dom_node *)file_box->gadget->node,
+ corestring_dom___ns_key_file_name_node_data,
+ strdup(file), html__dom_user_data_handler,
+ &oldfile) == DOM_NO_ERR) {
+ if (oldfile != NULL)
+ free(oldfile);
+ }
/* Redraw box. */
html__redraw_a_box(html, file_box);
diff --git a/utils/corestrings.c b/utils/corestrings.c
index efdd0e07f..8623d127b 100644
--- a/utils/corestrings.c
+++ b/utils/corestrings.c
@@ -233,7 +233,7 @@ dom_string *corestring_dom_vspace;
dom_string *corestring_dom_waiting;
dom_string *corestring_dom_width;
dom_string *corestring_dom___ns_key_libcss_node_data;
-
+dom_string *corestring_dom___ns_key_file_name_node_data;
/*
* Free the core strings
@@ -464,6 +464,7 @@ void corestrings_fini(void)
CSS_DOM_STRING_UNREF(waiting);
CSS_DOM_STRING_UNREF(width);
CSS_DOM_STRING_UNREF(__ns_key_libcss_node_data);
+ CSS_DOM_STRING_UNREF(__ns_key_file_name_node_data);
#undef CSS_DOM_STRING_UNREF
}
@@ -725,6 +726,7 @@ nserror corestrings_init(void)
CSS_DOM_STRING_INTERN(waiting);
CSS_DOM_STRING_INTERN(width);
CSS_DOM_STRING_INTERN(__ns_key_libcss_node_data);
+ CSS_DOM_STRING_INTERN(__ns_key_file_name_node_data);
#undef CSS_DOM_STRING_INTERN
exc = dom_string_create_interned((const uint8_t *) "text/javascript",
diff --git a/utils/corestrings.h b/utils/corestrings.h
index c50cc3113..a8c345946 100644
--- a/utils/corestrings.h
+++ b/utils/corestrings.h
@@ -239,6 +239,7 @@ extern struct dom_string *corestring_dom_vspace;
extern struct dom_string *corestring_dom_waiting;
extern struct dom_string *corestring_dom_width;
extern struct dom_string *corestring_dom___ns_key_libcss_node_data;
+extern struct dom_string *corestring_dom___ns_key_file_name_node_data;
#endif
From 0516e4c069db9e0edf601a5f17e702237e3cb9d5 Mon Sep 17 00:00:00 2001
From: Daniel Silverstone
Date: Sat, 4 Jan 2014 16:33:30 +0000
Subject: [PATCH 017/773] Reflect toggling of 'selected' in the DOM
---
render/html_interaction.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/render/html_interaction.c b/render/html_interaction.c
index 6f4d9bd51..f18daebd4 100644
--- a/render/html_interaction.c
+++ b/render/html_interaction.c
@@ -617,6 +617,9 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
status = messages_get("FormCheckbox");
if (mouse & BROWSER_MOUSE_CLICK_1) {
gadget->selected = !gadget->selected;
+ dom_html_input_element_set_checked(
+ (dom_html_input_element *)(gadget->node),
+ gadget->selected);
html__redraw_a_box(html, gadget_box);
}
break;
From 9b8988dd23e2adc14b8f5ee7a3e47bbe4982dc73 Mon Sep 17 00:00:00 2001
From: Daniel Silverstone
Date: Sat, 4 Jan 2014 17:06:10 +0000
Subject: [PATCH 018/773] Reflect changes to select boxes into the DOM
---
render/box_construct.c | 2 +-
render/form.c | 10 +++++++++-
render/form.h | 3 ++-
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/render/box_construct.c b/render/box_construct.c
index b259e6a1f..4d9796932 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -2853,7 +2853,7 @@ bool box_select_add_option(struct form_control *control, dom_node *n)
if (text_nowrap == NULL)
goto no_memory;
- if (form_add_option(control, value, text_nowrap, selected) == false)
+ if (form_add_option(control, value, text_nowrap, selected, n) == false)
goto no_memory;
free(text);
diff --git a/render/form.c b/render/form.c
index 254d2cffb..aa6661cfa 100644
--- a/render/form.c
+++ b/render/form.c
@@ -278,10 +278,11 @@ void form_free_control(struct form_control *control)
* \param value value of option, used directly (not copied)
* \param text text for option, used directly (not copied)
* \param selected this option is selected
+ * \param node the DOM node this option is associated with
* \return true on success, false on memory exhaustion
*/
bool form_add_option(struct form_control *control, char *value, char *text,
- bool selected)
+ bool selected, void *node)
{
struct form_option *option;
@@ -312,6 +313,8 @@ bool form_add_option(struct form_control *control, char *value, char *text,
control->data.select.num_items++;
+ option->node = node;
+
return true;
}
@@ -1140,12 +1143,15 @@ static void form__select_process_selection(html_content *html,
if (control->data.select.multiple) {
if (o->selected) {
o->selected = false;
+ dom_html_option_element_set_selected(o->node, false);
control->data.select.num_selected--;
} else {
o->selected = true;
+ dom_html_option_element_set_selected(o->node, true);
control->data.select.num_selected++;
}
} else {
+ dom_html_option_element_set_selected(o->node, true);
o->selected = true;
}
}
@@ -1434,11 +1440,13 @@ void form_radio_set(html_content *html,
if (control->selected) {
control->selected = false;
+ dom_html_input_element_set_checked(control->node, false);
html__redraw_a_box(html, control->box);
}
}
radio->selected = true;
+ dom_html_input_element_set_checked(radio->node, true);
html__redraw_a_box(html, radio->box);
}
diff --git a/render/form.h b/render/form.h
index c03ea8e99..b538c3b33 100644
--- a/render/form.h
+++ b/render/form.h
@@ -126,6 +126,7 @@ struct form_control {
/** Option in a select. */
struct form_option {
+ void *node; /**< Corresponding DOM node */
bool selected;
bool initial_selected;
char *value;
@@ -154,7 +155,7 @@ struct form_control *form_new_control(void *node, form_control_type type);
void form_add_control(struct form *form, struct form_control *control);
void form_free_control(struct form_control *control);
bool form_add_option(struct form_control *control, char *value, char *text,
- bool selected);
+ bool selected, void *node);
bool form_successful_controls(struct form *form,
struct form_control *submit_button,
struct fetch_multipart_data **successful_controls);
From a1725caf865bef1e5d26fbba21836116ad117dbb Mon Sep 17 00:00:00 2001
From: Vincent Sanders
Date: Sat, 4 Jan 2014 18:06:34 +0000
Subject: [PATCH 019/773] fix mngectony makefiles
---
monkey/Makefile.target | 2 +-
riscos/Makefile.target | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/monkey/Makefile.target b/monkey/Makefile.target
index 6bea07d46..52407542d 100644
--- a/monkey/Makefile.target
+++ b/monkey/Makefile.target
@@ -47,7 +47,7 @@ MONKEYCFLAGS := -std=c99 -Dmonkey -Dnsmonkey \
$(shell $(PKG_CONFIG) --cflags openssl) \
$(shell xml2-config --cflags)
-MONKEYLDFLAGS := -lm
+MONKEYLDFLAGS := -lm $(shell $(PKG_CONFIG) --cflags --libs glib-2.0)
CFLAGS += $(MONKEYCFLAGS)
diff --git a/riscos/Makefile.target b/riscos/Makefile.target
index 05e66c829..2f5bbb150 100644
--- a/riscos/Makefile.target
+++ b/riscos/Makefile.target
@@ -45,6 +45,7 @@ RESOURCES = $(TPD_RISCOS) split-messages
CFLAGS += $(WARNFLAGS) -Driscos -std=c99 -D_BSD_SOURCE -D_POSIX_C_SOURCE \
-mpoke-function-name -fno-strict-aliasing
+CFLAGS += -I$(GCCSDK_INSTALL_ENV)/include
ifeq ($(HOST),riscos)
CFLAGS += -I -mthrowback
endif
From 748b13c8bad9f7c900284396286b6f60e053f683 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?=
Date: Mon, 30 Dec 2013 15:32:50 +0100
Subject: [PATCH 020/773] beos: Fix permission on temp directories creation
TODO: use filename_initialize() instead when it's fixed.
---
beos/gui.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/beos/gui.cpp b/beos/gui.cpp
index 04a52bbd7..537c3a5a2 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -620,7 +620,7 @@ void gui_init(int argc, char** argv)
check_homedir();
// make sure the cache dir exists
- create_directory(TEMP_FILENAME_PREFIX, 0600);
+ create_directory(TEMP_FILENAME_PREFIX, 0700);
//nsbeos_completion_init();
From d69997c8a323bb593f642830b28ed0c4d7de476c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?=
Date: Mon, 30 Dec 2013 15:40:12 +0100
Subject: [PATCH 021/773] beos: Add missing call to lwc_string_unref()
---
beos/gui.cpp | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/beos/gui.cpp b/beos/gui.cpp
index 537c3a5a2..131173c64 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -918,10 +918,11 @@ void nsbeos_gui_view_source(struct hlcache_handle *content)
return;
}
lwc_string *mime = content_get_mime_type(content);
- const char *mime_string = lwc_string_data(mime);
- if (mime)
+ if (mime) {
file.WriteAttr("BEOS:TYPE", B_MIME_STRING_TYPE, 0LL,
- mime_string, lwc_string_length(mime) + 1);
+ lwc_string_data(mime), lwc_string_length(mime) + 1);
+ lwc_string_unref(mime);
+ }
}
From 6f4e293311faa6bf485d40eb15f684b6559241a1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?=
Date: Mon, 30 Dec 2013 16:18:53 +0100
Subject: [PATCH 022/773] beos: Load Messages files for current language
For now we just check for LC_MESSAGES in the environment, which
should even work in BeOS. Someday we should probably use Haiku's
BLocale API instead.
---
beos/gui.cpp | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/beos/gui.cpp b/beos/gui.cpp
index 131173c64..7c8418215 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -512,6 +512,20 @@ static bool nslog_stream_configure(FILE *fptr)
return true;
}
+static BPath get_messages_path()
+{
+ BPath p("/boot/apps/netsurf/res");
+ // TODO: use Haiku's BLocale stuff
+ BString lang(getenv("LC_MESSAGES"));
+ lang.Truncate(2);
+ BDirectory d(p.Path());
+ if (!d.Contains(lang.String(), B_DIRECTORY_NODE))
+ lang = "en";
+ p.Append(lang.String());
+ p.Append("Messages");
+ return p;
+}
+
/** Normal entry point from OS */
int main(int argc, char** argv)
{
@@ -527,8 +541,6 @@ int main(int argc, char** argv)
new NSBrowserApplication;
}
- const char* messages = "/boot/apps/netsurf/res/en/Messages";
-
/* initialise logging. Not fatal if it fails but not much we
* can do about it either.
*/
@@ -543,7 +555,8 @@ int main(int argc, char** argv)
nsoption_commandline(&argc, argv, NULL);
/* common initialisation */
- ret = netsurf_init(messages);
+ BPath messages = get_messages_path();
+ ret = netsurf_init(messages.Path());
if (ret != NSERROR_OK) {
die("NetSurf failed to initialise");
}
@@ -567,8 +580,6 @@ int gui_init_replicant(int argc, char** argv)
options.Append("x-vnd.NetSurf");
}
- const char* messages = "/boot/apps/netsurf/res/en/Messages";
-
/* initialise logging. Not fatal if it fails but not much we
* can do about it either.
*/
@@ -585,7 +596,8 @@ int gui_init_replicant(int argc, char** argv)
nsoption_commandline(&argc, argv, NULL);
/* common initialisation */
- ret = netsurf_init(messages);
+ BPath messages = get_messages_path();
+ ret = netsurf_init(messages.Path());
if (ret != NSERROR_OK) {
// FIXME: must not die when in replicant!
die("NetSurf failed to initialise");
From f3455a755662794d6aebaf642d00eb35398ac3f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?=
Date: Tue, 31 Dec 2013 13:40:51 +0100
Subject: [PATCH 023/773] beos: Remove unused Tracker button bitmaps
We never used them, and we now have better looking HVIF ones anyway.
---
beos/res.h | 12 ----
beos/res.rdef | 196 --------------------------------------------------
2 files changed, 208 deletions(-)
diff --git a/beos/res.h b/beos/res.h
index 4e6497815..278ffb545 100644
--- a/beos/res.h
+++ b/beos/res.h
@@ -16,15 +16,3 @@
* along with this program. If not, see .
*/
-enum {
- R_ResizeHandle = 1000,
- R_ResBackNavActive = 1042,
- R_ResBackNavInactive = 1043,
- R_ResForwNavActive = 1044,
- R_ResForwNavInactive = 1045,
- R_ResUpNavActive = 1046,
- R_ResUpNavInactive = 1047,
- R_ResBackNavActiveSel = 1048,
- R_ResForwNavActiveSel = 1049,
- R_ResUpNavActiveSel = 1050
-};
diff --git a/beos/res.rdef b/beos/res.rdef
index 862d6d0f1..1cf31f287 100644
--- a/beos/res.rdef
+++ b/beos/res.rdef
@@ -106,202 +106,6 @@ resource(1, "BEOS:FILE_TYPES") message {
"types" = "application/x-vnd.Be.URL.https"
};
-resource(R_ResizeHandle) archive(, 0x00000000) BBitmap {
- "_frame" = rect { 0.0, 0.0, 13.0, 13.0 },
- "_cspace" = 4,
- "_bmflags" = 1,
- "_rowbytes" = 16,
- "_data" = array {
- $"1B1B1B1B1B1B1B1B1B1B1B1B133F3F3F1B1B1B1B1B1B1B1B1B1B1B1B133F3F3F"
- $"1B1B1B1B1B1B1B1B1B1B1B1B133F3F3F1B1B1B1B1B1B1B1B1B0C1B1B133F3F3F"
- $"1B1B1B1B1B1B1B1B1B1B3F1B133F3F3F1B1B1B1B1B1B1B1B1B1B1B1B133F3F3F"
- $"1B1B1B1B1B1B0C1B1B0D1B1B133F3F3F1B1B1B1B1B1B1B3F1B1B3F1B133F3F3F"
- $"1B1B1B1B1B1B1B1B1B1B1B1B133F3F3F1B1B1B0C1B1B0D1B1B0C1B1B133F3F3F"
- $"1B1B1B1B3F1B1B3F1B1B3F1B133F3F3F1B1B1B1B1B1B1B1B1B1B1B1B133F3F3F"
- $"131313131313131313131313133F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F3F"
- }
-};
-
-resource(R_ResBackNavActive) archive(, 0x00000000) BBitmap {
- "_frame" = rect { 0.0, 0.0, 18.0, 16.0 },
- "_cspace" = 4,
- "_bmflags" = 1,
- "_rowbytes" = 20,
- "_data" = array {
- $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3FFFFFFFFFFFFFFF3B3B18FFFF"
- $"FFFFFFFFFFFFFF3FFFFFFFFFFFFF3B353B1418FFFFFFFFFFFFFFFF3FFFFFFFFF"
- $"FF3B35353B1418FFFFFFFFFFFFFFFF3FFFFFFFFF3B3435353B3B3B3B3B3B3B3B"
- $"18FFFF3FFFFFFF3B34343535363637373737373B1418FF3FFFFF3B3434343535"
- $"363637373737373B1418FF3FFF3B343434353536363637373737373B1418FF3F"
- $"FF183B3535353536363637373737373B1418FF3FFFFF183B3536363636373737"
- $"3737373B1418FF3FFFFFFF183B3636373B3B3B3B3B3B3B3B1418FF3FFFFFFFFF"
- $"183B37373B141414141414141418FF3FFFFFFFFFFF183B373B14181818181818"
- $"18FFFF3FFFFFFFFFFFFF183B3B1418FFFFFFFFFFFFFFFF3FFFFFFFFFFFFFFF18"
- $"141418FFFFFFFFFFFFFFFF3FFFFFFFFFFFFFFFFF1818FFFFFFFFFFFFFFFFFF3F"
- $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
- }
-};
-
-resource(R_ResBackNavInactive) archive(, 0x00000000) BBitmap {
- "_frame" = rect { 0.0, 0.0, 18.0, 16.0 },
- "_cspace" = 4,
- "_bmflags" = 1,
- "_rowbytes" = 20,
- "_data" = array {
- $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3FFFFFFFFFFFFFFF0000FFFFFF"
- $"FFFFFFFFFFFFFF3FFFFFFFFFFFFF001800FFFFFFFFFFFFFFFFFFFF3FFFFFFFFF"
- $"FF00181800FFFFFFFFFFFFFFFFFFFF3FFFFFFFFF001C18180000000000000000"
- $"FFFFFF3FFFFFFF001C1C18181515111111111100FFFFFF3FFFFF001C1C1C1818"
- $"1515111111111100FFFFFF3FFF001C1C1C1818151515111111111100FFFFFF3F"
- $"FFFF0018181818151515111111111100FFFFFF3FFFFFFF001815151515111111"
- $"11111100FFFFFF3FFFFFFFFF001515110000000000000000FFFFFF3FFFFFFFFF"
- $"FF00111100FFFFFFFFFFFFFFFFFFFF3FFFFFFFFFFFFF001100FFFFFFFFFFFFFF"
- $"FFFFFF3FFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFFFF3FFFFFFFFFFFFFFFFF"
- $"FFFFFFFFFFFFFFFFFFFFFF3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
- $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
- }
-};
-
-resource(R_ResForwNavActive) archive(, 0x00000000) BBitmap {
- "_frame" = rect { 0.0, 0.0, 18.0, 16.0 },
- "_cspace" = 4,
- "_bmflags" = 1,
- "_rowbytes" = 20,
- "_data" = array {
- $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3FFFFFFFFFFFFFFFFF3B3B18FF"
- $"FFFFFFFFFFFFFF3FFFFFFFFFFFFFFFFF3B353B18FFFFFFFFFFFFFF3FFFFFFFFF"
- $"FFFFFFFF3B35363B18FFFFFFFFFFFF3FFF3B3B3B3B3B3B3B3B3536363B18FFFF"
- $"FFFFFF3FFF3B34343434353535363636373B18FFFFFFFF3FFF3B343434353535"
- $"3536363637373B18FFFFFF3FFF3B343435353535363636373737373B18FFFF3F"
- $"FF3B3535353535363636373737373B141418FF3FFF3B35353536363636373737"
- $"373B141418FFFF3FFF3B3B3B3B3B3B3B3B3737373B141418FFFFFF3FFF181414"
- $"141414143B37373B141418FFFFFFFF3FFFFF1818181818183B373B141418FFFF"
- $"FFFFFF3FFFFFFFFFFFFFFFFF3B3B141418FFFFFFFFFFFF3FFFFFFFFFFFFFFFFF"
- $"18141418FFFFFFFFFFFFFF3FFFFFFFFFFFFFFFFFFF1818FFFFFFFFFFFFFFFF3F"
- $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
- }
-};
-
-resource(R_ResForwNavInactive) archive(, 0x00000000) BBitmap {
- "_frame" = rect { 0.0, 0.0, 18.0, 16.0 },
- "_cspace" = 4,
- "_bmflags" = 1,
- "_rowbytes" = 20,
- "_data" = array {
- $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3FFFFFFFFFFFFFFFFF0000FFFF"
- $"FFFFFFFFFFFFFF3FFFFFFFFFFFFFFFFF001800FFFFFFFFFFFFFFFF3FFFFFFFFF"
- $"FFFFFFFF00181500FFFFFFFFFFFFFF3FFF000000000000000018151500FFFFFF"
- $"FFFFFF3FFF001C1C1C1C1818181515151100FFFFFFFFFF3FFF001C1C1C181818"
- $"18151515111100FFFFFFFF3FFF001C1C181818181515151111111100FFFFFF3F"
- $"FF0018181818181515151111111100FFFFFFFF3FFF0018181815151515111111"
- $"1100FFFFFFFFFF3FFF000000000000000011111100FFFFFFFFFFFF3FFFFFFFFF"
- $"FFFFFFFF00111100FFFFFFFFFFFFFF3FFFFFFFFFFFFFFFFF001100FFFFFFFFFF"
- $"FFFFFF3FFFFFFFFFFFFFFFFF0000FFFFFFFFFFFFFFFFFF3FFFFFFFFFFFFFFFFF"
- $"FFFFFFFFFFFFFFFFFFFFFF3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
- $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
- }
-};
-
-resource(R_ResUpNavActive) archive(, 0x00000000) BBitmap {
- "_frame" = rect { 0.0, 0.0, 17.0, 16.0 },
- "_cspace" = 4,
- "_bmflags" = 1,
- "_rowbytes" = 20,
- "_data" = array {
- $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F3FFFFFFFFFFFFFFFFF00FFFFFF"
- $"FFFFFFFFFFFF3F3FFFFFFFFFFFFFFF00E50018FFFFFFFFFFFFFF3F3FFFFFFFFF"
- $"FFFF00E5BDBD0018FFFFFFFFFFFF3F3FFFFFFFFFFF00E5BDBDBDBD0018FFFFFF"
- $"FFFF3F3FFFFFFFFF00E5BDBDBDBDBDBD0018FFFFFFFF3F3FFFFFFF00E5BDBDBD"
- $"BDBDBDBDBD0018FFFFFF3F3FFFFF00E5E5E5BDBDBDBDBD9898980018FFFF3F3F"
- $"FF00000000E5BDBDBDBDBD980000000018FF3F3FFFFF141400E5BDBDBDBDBD98"
- $"00141418FFFF3F3FFFFFFF1800E5BDBDBDBDBD98001418FFFFFF3F3FFFFFFFFF"
- $"00E5BDBDBDBDBD98001418FFFFFF3F3FFFFFFFFF00E5989898989898001418FF"
- $"FFFF3F3FFFFFFFFF0000000000000000001418FFFFFF3F3FFFFFFFFF18141414"
- $"141414141418FFFFFFFF3F3FFFFFFFFFFF181818181818181818FFFFFFFF3F3F"
- $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F3F"
- }
-};
-
-resource(R_ResUpNavInactive) archive(, 0x00000000) BBitmap {
- "_frame" = rect { 0.0, 0.0, 17.0, 16.0 },
- "_cspace" = 4,
- "_bmflags" = 1,
- "_rowbytes" = 20,
- "_data" = array {
- $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F3FFFFFFFFFFFFFFFFF00FFFFFF"
- $"FFFFFFFFFFFF3F3FFFFFFFFFFFFFFF001C00FFFFFFFFFFFFFFFF3F3FFFFFFFFF"
- $"FFFF001C171700FFFFFFFFFFFFFF3F3FFFFFFFFFFF001C1717171700FFFFFFFF"
- $"FFFF3F3FFFFFFFFF001C17171717171700FFFFFFFFFF3F3FFFFFFF001C171717"
- $"171717171700FFFFFFFF3F3FFFFF001C1C1C171717171712121200FFFFFF3F3F"
- $"FF000000001C17171717171200000000FFFF3F3FFFFFFFFF001C171717171712"
- $"00FFFFFFFFFF3F3FFFFFFFFF001C17171717171200FFFFFFFFFF3F3FFFFFFFFF"
- $"001C17171717171200FFFFFFFFFF3F3FFFFFFFFF001C12121212121200FFFFFF"
- $"FFFF3F3FFFFFFFFF000000000000000000FFFFFFFFFF3F3FFFFFFFFFFFFFFFFF"
- $"FFFFFFFFFFFFFFFFFFFF3F3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F3F"
- $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F3F"
- }
-};
-
-resource(R_ResBackNavActiveSel) archive(, 0x00000000) BBitmap {
- "_frame" = rect { 0.0, 0.0, 18.0, 16.0 },
- "_cspace" = 4,
- "_bmflags" = 1,
- "_rowbytes" = 20,
- "_data" = array {
- $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3FFFFFFFFFFFFFFF3B3BFFFFFF"
- $"FFFFFFFFFFFFFF3FFFFFFFFFFFFF3B353BFFFFFFFFFFFFFFFFFFFF3FFFFFFFFF"
- $"FF3B35353BFFFFFFFFFFFFFFFFFFFF3FFFFFFFFF3B3435353B3B3B3B3B3B3B3B"
- $"FFFFFF3FFFFFFF3B34343535363637373737373BFFFFFF3FFFFF3B3434343535"
- $"363637373737373BFFFFFF3FFF3B343434353536363637373737373BFFFFFF3F"
- $"FFFF3B3535353536363637373737373BFFFFFF3FFFFFFF3B3536363636373737"
- $"3737373BFFFFFF3FFFFFFFFF3B3636373B3B3B3B3B3B3B3BFFFFFF3FFFFFFFFF"
- $"FF3B37373BFFFFFFFFFFFFFFFFFFFF3FFFFFFFFFFFFF3B373BFFFFFFFFFFFFFF"
- $"FFFFFF3FFFFFFFFFFFFFFF3B3BFFFFFFFFFFFFFFFFFFFF3FFFFFFFFFFFFFFFFF"
- $"FFFFFFFFFFFFFFFFFFFFFF3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
- $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
- }
-};
-
-resource(R_ResForwNavActiveSel) archive(, 0x00000000) BBitmap {
- "_frame" = rect { 0.0, 0.0, 18.0, 16.0 },
- "_cspace" = 4,
- "_bmflags" = 1,
- "_rowbytes" = 20,
- "_data" = array {
- $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3FFFFFFFFFFFFFFFFF3B3BFFFF"
- $"FFFFFFFFFFFFFF3FFFFFFFFFFFFFFFFF3B353BFFFFFFFFFFFFFFFF3FFFFFFFFF"
- $"FFFFFFFF3B35363BFFFFFFFFFFFFFF3FFF3B3B3B3B3B3B3B3B3536363BFFFFFF"
- $"FFFFFF3FFF3B34343434353535363636373BFFFFFFFFFF3FFF3B343434353535"
- $"3536363637373BFFFFFFFF3FFF3B343435353535363636373737373BFFFFFF3F"
- $"FF3B3535353535363636373737373BFFFFFFFF3FFF3B35353536363636373737"
- $"373BFFFFFFFFFF3FFF3B3B3B3B3B3B3B3B3737373BFFFFFFFFFFFF3FFFFFFFFF"
- $"FFFFFFFF3B37373BFFFFFFFFFFFFFF3FFFFFFFFFFFFFFFFF3B373BFFFFFFFFFF"
- $"FFFFFF3FFFFFFFFFFFFFFFFF3B3BFFFFFFFFFFFFFFFFFF3FFFFFFFFFFFFFFFFF"
- $"FFFFFFFFFFFFFFFFFFFFFF3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
- $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F"
- }
-};
-
-resource(R_ResUpNavActiveSel) archive(, 0x00000000) BBitmap {
- "_frame" = rect { 0.0, 0.0, 17.0, 16.0 },
- "_cspace" = 4,
- "_bmflags" = 1,
- "_rowbytes" = 20,
- "_data" = array {
- $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F3FFFFFFFFFFFFFFFFF00FFFFFF"
- $"FFFFFFFFFFFF3F3FFFFFFFFFFFFFFF00E500FFFFFFFFFFFFFFFF3F3FFFFFFFFF"
- $"FFFF00E5BDBD00FFFFFFFFFFFFFF3F3FFFFFFFFFFF00E5BDBDBDBD00FFFFFFFF"
- $"FFFF3F3FFFFFFFFF00E5BDBDBDBDBDBD00FFFFFFFFFF3F3FFFFFFF00E5BDBDBD"
- $"BDBDBDBDBD00FFFFFFFF3F3FFFFF00E5E5E5BDBDBDBDBD98989800FFFFFF3F3F"
- $"FF00000000E5BDBDBDBDBD9800000000FFFF3F3FFFFFFFFF00E5BDBDBDBDBD98"
- $"00FFFFFFFFFF3F3FFFFFFFFF00E5BDBDBDBDBD9800FFFFFFFFFF3F3FFFFFFFFF"
- $"00E5BDBDBDBDBD9800FFFFFFFFFF3F3FFFFFFFFF00E598989898989800FFFFFF"
- $"FFFF3F3FFFFFFFFF000000000000000000FFFFFFFFFF3F3FFFFFFFFFFFFFFFFF"
- $"FFFFFFFFFFFFFFFFFFFF3F3FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F3F"
- $"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF3F3F"
- }
-};
-
resource(101, "BEOS:ICON") #'VICN' array {
$"6E6369660A02010203AE259A400198BFFA65AE20E548AF9547F2037F30A0FFFF"
$"00E8F1FDFFF131A0FFFB02000602B83B85BC57333C5733B83B8549EAE1481199"
From 053897d07db6b5824864adeefee382d3199d328f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?=
Date: Tue, 31 Dec 2013 14:01:20 +0100
Subject: [PATCH 024/773] beos: Move some resources around
Move app signature and supported filetypes before icons for more visibility.
---
beos/res.rdef | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/beos/res.rdef b/beos/res.rdef
index 1cf31f287..efa2991f0 100644
--- a/beos/res.rdef
+++ b/beos/res.rdef
@@ -37,6 +37,21 @@ resource(502, "welcome.html") #'data' import "res/en/welcome.html,faf";
resource(1, "BEOS:APP_FLAGS") (#'APPF') $"01000000";
+resource(1, "BEOS:APP_SIG") (#'MIMS') "application/x-vnd.NetSurf";
+
+resource(1, "BEOS:FILE_TYPES") message {
+ "types" = "text/html",
+ "types" = "image/gif",
+ "types" = "image/jpeg",
+ "types" = "application/x-vnd.Be-bookmark",
+ "types" = "text",
+ "types" = "application/x-vnd.Be-doc_bookmark",
+ "types" = "application/x-vnd.Be.URL.file",
+ "types" = "application/x-vnd.Be.URL.ftp",
+ "types" = "application/x-vnd.Be.URL.http",
+ "types" = "application/x-vnd.Be.URL.https"
+};
+
resource(101, "BEOS:L:STD_ICON") #'ICON' array {
$"FFFFFFFFFFFFFFFFFFFFFF0E0A00D600D6000AAF0EFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFF0E0A000001DED5D5D5DE020000090EFFFFFFFFFFFFFFFFFF"
@@ -91,21 +106,6 @@ resource(101, "BEOS:M:STD_ICON") #'MICN' array {
$"FFFFFFFF0E0B000500000A0EFFFFFFFF"
};
-resource(1, "BEOS:APP_SIG") (#'MIMS') "application/x-vnd.NetSurf";
-
-resource(1, "BEOS:FILE_TYPES") message {
- "types" = "text/html",
- "types" = "image/gif",
- "types" = "image/jpeg",
- "types" = "application/x-vnd.Be-bookmark",
- "types" = "text",
- "types" = "application/x-vnd.Be-doc_bookmark",
- "types" = "application/x-vnd.Be.URL.file",
- "types" = "application/x-vnd.Be.URL.ftp",
- "types" = "application/x-vnd.Be.URL.http",
- "types" = "application/x-vnd.Be.URL.https"
-};
-
resource(101, "BEOS:ICON") #'VICN' array {
$"6E6369660A02010203AE259A400198BFFA65AE20E548AF9547F2037F30A0FFFF"
$"00E8F1FDFFF131A0FFFB02000602B83B85BC57333C5733B83B8549EAE1481199"
From da504bbbb86b01fa6aad60ad7bf5d5925856b0ee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?=
Date: Tue, 31 Dec 2013 14:09:54 +0100
Subject: [PATCH 025/773] beos: Add comments to resources definition file
---
beos/res.rdef | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/beos/res.rdef b/beos/res.rdef
index efa2991f0..daad9dee3 100644
--- a/beos/res.rdef
+++ b/beos/res.rdef
@@ -29,16 +29,18 @@ resource(406, "throbber6.png") #'data' import "res/throbber/throbber6.png";
resource(407, "throbber7.png") #'data' import "res/throbber/throbber7.png";
resource(408, "throbber8.png") #'data' import "res/throbber/throbber8.png";
-/* */
+/* files exported as resource:// via rsrc:// mapping */
resource(500, "credits.html") #'data' import "res/en/credits.html,faf";
resource(501, "licence.html") #'data' import "res/en/licence.html,faf";
resource(502, "welcome.html") #'data' import "res/en/welcome.html,faf";
-
+/* application flags (multiple launch) */
resource(1, "BEOS:APP_FLAGS") (#'APPF') $"01000000";
+/* application MIME signature */
resource(1, "BEOS:APP_SIG") (#'MIMS') "application/x-vnd.NetSurf";
+/* list of supported MIME types */
resource(1, "BEOS:FILE_TYPES") message {
"types" = "text/html",
"types" = "image/gif",
@@ -52,6 +54,7 @@ resource(1, "BEOS:FILE_TYPES") message {
"types" = "application/x-vnd.Be.URL.https"
};
+/* BeOS large (32x32) icon */
resource(101, "BEOS:L:STD_ICON") #'ICON' array {
$"FFFFFFFFFFFFFFFFFFFFFF0E0A00D600D6000AAF0EFFFFFFFFFFFFFFFFFFFFFF"
$"FFFFFFFFFFFFFFFF0E0A000001DED5D5D5DE020000090EFFFFFFFFFFFFFFFFFF"
@@ -87,6 +90,7 @@ resource(101, "BEOS:L:STD_ICON") #'ICON' array {
$"FFFFFFFFFFFFFFFFFFFFFFFF0E0B000A0A0A0D0EFFFFFFFFFFFFFFFFFFFFFFFF"
};
+/* BeOS small (16x16) icon */
resource(101, "BEOS:M:STD_ICON") #'MICN' array {
$"FFFFFFFF0E0900020205000DFFFFFFFF"
$"FFFFFF09038E66666C6C93DD000EFFFF"
@@ -106,6 +110,7 @@ resource(101, "BEOS:M:STD_ICON") #'MICN' array {
$"FFFFFFFF0E0B000500000A0EFFFFFFFF"
};
+/* Haiku vector icon */
resource(101, "BEOS:ICON") #'VICN' array {
$"6E6369660A02010203AE259A400198BFFA65AE20E548AF9547F2037F30A0FFFF"
$"00E8F1FDFFF131A0FFFB02000602B83B85BC57333C5733B83B8549EAE1481199"
@@ -167,8 +172,10 @@ resource(101, "BEOS:ICON") #'VICN' array {
$"00000000000040012FBD3E023BCFC400190117850004"
};
+/* ZETA SVG icon descriptor */
resource(101, "BEOS:D:STD_ICON") (#'iICO') $"4944585A055300";
+/* ZETA SVG compressed icon */
resource(101, "BEOS:V:STD_ICON") #'zICO' array {
$"7A10000078DAED57DD6EDB3618BDEF5310CA4D03C40C7F3E8A6466B7C002AC37"
$"2C066CCD03B8B1EC6853A44052B3644FBFF351769C7601D68B41BB5814C03AA2"
From 917f8ca804bbbacc631cce414608cb989866f6ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?=
Date: Tue, 31 Dec 2013 14:28:09 +0100
Subject: [PATCH 026/773] beos: Drop duplicate throbber PNG resources
They are also added with another path by the makefile.
---
beos/gui.cpp | 2 +-
beos/res.rdef | 11 -----------
2 files changed, 1 insertion(+), 12 deletions(-)
diff --git a/beos/gui.cpp b/beos/gui.cpp
index 7c8418215..4b60d7c36 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -643,7 +643,7 @@ void gui_init(int argc, char** argv)
{
#define STROF(n) #n
#define FIND_THROB(n) filenames[(n)] = \
- "throbber" STROF(n) ".png";
+ "throbber/throbber" STROF(n) ".png";
char *filenames[9];
FIND_THROB(0);
FIND_THROB(1);
diff --git a/beos/res.rdef b/beos/res.rdef
index daad9dee3..97dc59dd7 100644
--- a/beos/res.rdef
+++ b/beos/res.rdef
@@ -18,17 +18,6 @@
#include "res.h"
-/* throbber */
-resource(400, "throbber0.png") #'data' import "res/throbber/throbber0.png";
-resource(401, "throbber1.png") #'data' import "res/throbber/throbber1.png";
-resource(402, "throbber2.png") #'data' import "res/throbber/throbber2.png";
-resource(403, "throbber3.png") #'data' import "res/throbber/throbber3.png";
-resource(404, "throbber4.png") #'data' import "res/throbber/throbber4.png";
-resource(405, "throbber5.png") #'data' import "res/throbber/throbber5.png";
-resource(406, "throbber6.png") #'data' import "res/throbber/throbber6.png";
-resource(407, "throbber7.png") #'data' import "res/throbber/throbber7.png";
-resource(408, "throbber8.png") #'data' import "res/throbber/throbber8.png";
-
/* files exported as resource:// via rsrc:// mapping */
resource(500, "credits.html") #'data' import "res/en/credits.html,faf";
resource(501, "licence.html") #'data' import "res/en/licence.html,faf";
From e1e1b5c45b0f0e443fb7d64db5d5056c92426822 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?=
Date: Tue, 31 Dec 2013 14:44:12 +0100
Subject: [PATCH 027/773] beos: Export icons/ resources with a lowercase i
That's what GTK does, and it fixes the dirlist icons too.
---
beos/Makefile.target | 2 +-
beos/res/{Icons => icons} | 0
2 files changed, 1 insertion(+), 1 deletion(-)
rename beos/res/{Icons => icons} (100%)
diff --git a/beos/Makefile.target b/beos/Makefile.target
index 81e2a951e..847850bb9 100644
--- a/beos/Makefile.target
+++ b/beos/Makefile.target
@@ -101,7 +101,7 @@ RDEP_BEOS := \
adblock.css beosdefault.css default.css internal.css quirks.css \
netsurf.png ca-bundle.txt
RDEP_BEOS := $(addprefix beos/res/,$(RDEP_BEOS)) \
- $(wildcard beos/res/Icons/*.png) \
+ $(wildcard beos/res/icons/*.png) \
$(wildcard beos/res/throbber/throbber*.png)
diff --git a/beos/res/Icons b/beos/res/icons
similarity index 100%
rename from beos/res/Icons
rename to beos/res/icons
From 3c5317cf54aebe40e8aaa2a6e107579c33184449 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?=
Date: Tue, 31 Dec 2013 15:13:36 +0100
Subject: [PATCH 028/773] beos: Fix embedded files in resources
- drop the remaining hardcoded files in rdef file
- add favicon.png
- remove en/ symlink
- add real folders with symlinks for translated files like GTK
Note the Messages files are also included although the current code
is not able to load them from the resources.
- add symlinks for html files to the en/ version
(TODO: try to remap automatically)
---
beos/Makefile.target | 6 ++++--
beos/res.rdef | 5 +----
beos/res/credits.html | 1 +
beos/res/de/Messages | 1 +
beos/res/de/welcome.html | 1 +
beos/res/en | 1 -
beos/res/en/Messages | 1 +
beos/res/en/credits.html | 1 +
beos/res/en/licence.html | 1 +
beos/res/en/welcome.html | 1 +
beos/res/favicon.png | 1 +
beos/res/fr/Messages | 1 +
beos/res/it/Messages | 1 +
beos/res/it/credits.html | 1 +
beos/res/it/licence.html | 1 +
beos/res/it/welcome.html | 1 +
beos/res/ja/welcome.html | 1 +
beos/res/licence.html | 1 +
beos/res/nl/Messages | 1 +
beos/res/welcome.html | 1 +
20 files changed, 22 insertions(+), 7 deletions(-)
create mode 120000 beos/res/credits.html
create mode 120000 beos/res/de/Messages
create mode 120000 beos/res/de/welcome.html
delete mode 120000 beos/res/en
create mode 120000 beos/res/en/Messages
create mode 120000 beos/res/en/credits.html
create mode 120000 beos/res/en/licence.html
create mode 120000 beos/res/en/welcome.html
create mode 120000 beos/res/favicon.png
create mode 120000 beos/res/fr/Messages
create mode 120000 beos/res/it/Messages
create mode 120000 beos/res/it/credits.html
create mode 120000 beos/res/it/licence.html
create mode 120000 beos/res/it/welcome.html
create mode 120000 beos/res/ja/welcome.html
create mode 120000 beos/res/licence.html
create mode 120000 beos/res/nl/Messages
create mode 120000 beos/res/welcome.html
diff --git a/beos/Makefile.target b/beos/Makefile.target
index 847850bb9..ed7532dc2 100644
--- a/beos/Makefile.target
+++ b/beos/Makefile.target
@@ -99,9 +99,11 @@ RDEF_IMP_BEOS := $(addprefix $(OBJROOT)/,$(subst /,_,$(RDEF_IMP_BEOS)))
RDEP_BEOS := \
adblock.css beosdefault.css default.css internal.css quirks.css \
- netsurf.png ca-bundle.txt
+ netsurf.png favicon.png ca-bundle.txt \
+ credits.html licence.html welcome.html
RDEP_BEOS := $(addprefix beos/res/,$(RDEP_BEOS)) \
- $(wildcard beos/res/icons/*.png) \
+ $(wildcard beos/res/icons/*.png) \
+ $(wildcard beos/res/??/*) \
$(wildcard beos/res/throbber/throbber*.png)
diff --git a/beos/res.rdef b/beos/res.rdef
index 97dc59dd7..07012356c 100644
--- a/beos/res.rdef
+++ b/beos/res.rdef
@@ -18,10 +18,7 @@
#include "res.h"
-/* files exported as resource:// via rsrc:// mapping */
-resource(500, "credits.html") #'data' import "res/en/credits.html,faf";
-resource(501, "licence.html") #'data' import "res/en/licence.html,faf";
-resource(502, "welcome.html") #'data' import "res/en/welcome.html,faf";
+/* files exported as resource: via rsrc:// mapping are added by the makefile */
/* application flags (multiple launch) */
resource(1, "BEOS:APP_FLAGS") (#'APPF') $"01000000";
diff --git a/beos/res/credits.html b/beos/res/credits.html
new file mode 120000
index 000000000..ca85d3d27
--- /dev/null
+++ b/beos/res/credits.html
@@ -0,0 +1 @@
+en/credits.html
\ No newline at end of file
diff --git a/beos/res/de/Messages b/beos/res/de/Messages
new file mode 120000
index 000000000..2f1fc39c3
--- /dev/null
+++ b/beos/res/de/Messages
@@ -0,0 +1 @@
+../../../!NetSurf/Resources/de/Messages
\ No newline at end of file
diff --git a/beos/res/de/welcome.html b/beos/res/de/welcome.html
new file mode 120000
index 000000000..b2ddfc796
--- /dev/null
+++ b/beos/res/de/welcome.html
@@ -0,0 +1 @@
+../../../!NetSurf/Resources/de/welcome.html,faf
\ No newline at end of file
diff --git a/beos/res/en b/beos/res/en
deleted file mode 120000
index d1dfaa9d2..000000000
--- a/beos/res/en
+++ /dev/null
@@ -1 +0,0 @@
-../../!NetSurf/Resources/en
\ No newline at end of file
diff --git a/beos/res/en/Messages b/beos/res/en/Messages
new file mode 120000
index 000000000..72c9eff90
--- /dev/null
+++ b/beos/res/en/Messages
@@ -0,0 +1 @@
+../../../!NetSurf/Resources/en/Messages
\ No newline at end of file
diff --git a/beos/res/en/credits.html b/beos/res/en/credits.html
new file mode 120000
index 000000000..1ba17392b
--- /dev/null
+++ b/beos/res/en/credits.html
@@ -0,0 +1 @@
+../../../!NetSurf/Resources/en/credits.html,faf
\ No newline at end of file
diff --git a/beos/res/en/licence.html b/beos/res/en/licence.html
new file mode 120000
index 000000000..147dd6db2
--- /dev/null
+++ b/beos/res/en/licence.html
@@ -0,0 +1 @@
+../../../!NetSurf/Resources/en/licence.html,faf
\ No newline at end of file
diff --git a/beos/res/en/welcome.html b/beos/res/en/welcome.html
new file mode 120000
index 000000000..28362130a
--- /dev/null
+++ b/beos/res/en/welcome.html
@@ -0,0 +1 @@
+../../../!NetSurf/Resources/en/welcome.html,faf
\ No newline at end of file
diff --git a/beos/res/favicon.png b/beos/res/favicon.png
new file mode 120000
index 000000000..d968c3827
--- /dev/null
+++ b/beos/res/favicon.png
@@ -0,0 +1 @@
+../../gtk/res/favicon.png
\ No newline at end of file
diff --git a/beos/res/fr/Messages b/beos/res/fr/Messages
new file mode 120000
index 000000000..a42cf08f4
--- /dev/null
+++ b/beos/res/fr/Messages
@@ -0,0 +1 @@
+../../../!NetSurf/Resources/fr/Messages
\ No newline at end of file
diff --git a/beos/res/it/Messages b/beos/res/it/Messages
new file mode 120000
index 000000000..d4c5c2956
--- /dev/null
+++ b/beos/res/it/Messages
@@ -0,0 +1 @@
+../../../!NetSurf/Resources/it/Messages
\ No newline at end of file
diff --git a/beos/res/it/credits.html b/beos/res/it/credits.html
new file mode 120000
index 000000000..6e1e15ed5
--- /dev/null
+++ b/beos/res/it/credits.html
@@ -0,0 +1 @@
+../../../!NetSurf/Resources/it/credits.html,faf
\ No newline at end of file
diff --git a/beos/res/it/licence.html b/beos/res/it/licence.html
new file mode 120000
index 000000000..3a7c056b6
--- /dev/null
+++ b/beos/res/it/licence.html
@@ -0,0 +1 @@
+../../../!NetSurf/Resources/it/licence.html,faf
\ No newline at end of file
diff --git a/beos/res/it/welcome.html b/beos/res/it/welcome.html
new file mode 120000
index 000000000..dea1e839c
--- /dev/null
+++ b/beos/res/it/welcome.html
@@ -0,0 +1 @@
+../../../!NetSurf/Resources/it/welcome.html,faf
\ No newline at end of file
diff --git a/beos/res/ja/welcome.html b/beos/res/ja/welcome.html
new file mode 120000
index 000000000..827796f02
--- /dev/null
+++ b/beos/res/ja/welcome.html
@@ -0,0 +1 @@
+../../../!NetSurf/Resources/ja/welcome.html,faf
\ No newline at end of file
diff --git a/beos/res/licence.html b/beos/res/licence.html
new file mode 120000
index 000000000..86f8c54bf
--- /dev/null
+++ b/beos/res/licence.html
@@ -0,0 +1 @@
+en/licence.html
\ No newline at end of file
diff --git a/beos/res/nl/Messages b/beos/res/nl/Messages
new file mode 120000
index 000000000..d484ebd29
--- /dev/null
+++ b/beos/res/nl/Messages
@@ -0,0 +1 @@
+../../../!NetSurf/Resources/nl/Messages
\ No newline at end of file
diff --git a/beos/res/welcome.html b/beos/res/welcome.html
new file mode 120000
index 000000000..1abdc5e8a
--- /dev/null
+++ b/beos/res/welcome.html
@@ -0,0 +1 @@
+en/welcome.html
\ No newline at end of file
From f8517f2e51ccd3852edfcc813e9fe5ac7f7a2319 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?=
Date: Tue, 31 Dec 2013 16:05:15 +0100
Subject: [PATCH 029/773] beos: remap resource:favicon.ico to favicon.png
We don't use it yet though.
---
beos/gui.cpp | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/beos/gui.cpp b/beos/gui.cpp
index 4b60d7c36..204c11caf 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -352,10 +352,16 @@ nsurl *gui_get_resource_url(const char *path)
{
nsurl *url = NULL;
BString u("rsrc:///");
+
+ /* default.css -> beosdefault.css */
if (strcmp(path, "default.css") == 0)
- u << "beosdefault.css";
- else
- u << path;
+ path = "beosdefault.css";
+
+ /* favicon.ico -> favicon.png */
+ if (strcmp(path, "favicon.ico") == 0)
+ path = "favicon.png";
+
+ u << path;
LOG(("(%s) -> '%s'\n", path, u.String()));
nsurl_create(u.String(), &url);
return url;
From fc782f55ba6ddc4e325a97e941aa1a2f21b78fb5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?=
Date: Tue, 31 Dec 2013 17:37:21 +0100
Subject: [PATCH 030/773] beos: Add a resize knob to replicants
The view resizes the base view by the relative mouse movement.
TODO: Add a bitmap to draw, for now it's ugly green.
---
beos/scaffolding.cpp | 90 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 90 insertions(+)
diff --git a/beos/scaffolding.cpp b/beos/scaffolding.cpp
index 252a816dc..3718f9492 100644
--- a/beos/scaffolding.cpp
+++ b/beos/scaffolding.cpp
@@ -154,6 +154,86 @@ extern int main(int argc, char** argv);
// in fetch_rsrc.cpp
extern BResources *gAppResources;
+// #pragma mark - class NSResizeKnob
+
+class NSResizeKnob : public BView {
+public:
+ NSResizeKnob(BRect frame, BView *target);
+virtual ~NSResizeKnob();
+
+virtual void MouseDown(BPoint where);
+virtual void MouseUp(BPoint where);
+virtual void MouseMoved(BPoint where, uint32 code,
+ const BMessage* dragMessage);
+
+virtual void Draw(BRect updateRect);
+
+void SetBitmap(const BBitmap *bitmap);
+
+private:
+ const BBitmap *fBitmap;
+ BView *fTarget;
+ BPoint fOffset;
+};
+
+NSResizeKnob::NSResizeKnob(BRect frame, BView *target)
+ : BView(frame, "NSResizeKnob", B_FOLLOW_BOTTOM | B_FOLLOW_RIGHT, B_WILL_DRAW),
+ fBitmap(NULL),
+ fTarget(target),
+ fOffset(-1, -1)
+{
+ SetViewColor(0, 255, 0);
+}
+
+
+NSResizeKnob::~NSResizeKnob()
+{
+}
+
+
+void
+NSResizeKnob::MouseDown(BPoint where)
+{
+ SetMouseEventMask(B_POINTER_EVENTS,
+ B_NO_POINTER_HISTORY | B_LOCK_WINDOW_FOCUS);
+ fOffset = where;
+}
+
+
+void
+NSResizeKnob::MouseUp(BPoint where)
+{
+ fOffset.Set(-1, -1);
+}
+
+
+void
+NSResizeKnob::MouseMoved(BPoint where, uint32 code,
+ const BMessage* dragMessage)
+{
+ if (fOffset.x >= 0) {
+ fTarget->ResizeBy(where.x - fOffset.x, where.y - fOffset.y);
+ }
+}
+
+
+void
+NSResizeKnob::Draw(BRect updateRect)
+{
+ if (!fBitmap)
+ return;
+ DrawBitmap(fBitmap);
+}
+
+
+void
+NSResizeKnob::SetBitmap(const BBitmap *bitmap)
+{
+ fBitmap = bitmap;
+ Invalidate();
+}
+
+
// #pragma mark - class NSThrobber
class NSThrobber : public BView {
@@ -1128,6 +1208,16 @@ void nsbeos_attach_toplevel_view(nsbeos_scaffolding *g, BView *view)
g->top_view->AddChild(g->scroll_view);
+ // for replicants, add a NSResizeKnob to allow resizing
+ if (!g->window) {
+ BRect frame = g->scroll_view->Bounds();
+ frame.left = frame.right - B_V_SCROLL_BAR_WIDTH;
+ frame.top = frame.bottom - B_H_SCROLL_BAR_HEIGHT;
+ NSResizeKnob *knob = new NSResizeKnob(frame, g->top_view);
+ //TODO: set bitmap
+ g->scroll_view->AddChild(knob);
+ }
+
view->MakeFocus();
// resize the horiz scrollbar to make room for the status bar and add it.
From 92afacbe6fde01cdbf8cc02076e0a40d8581682e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?=
Date: Wed, 1 Jan 2014 17:07:02 +0100
Subject: [PATCH 031/773] beos: Add icon in url bar
A bit hackish, flickers on resize, but it works.
---
beos/scaffolding.cpp | 107 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 104 insertions(+), 3 deletions(-)
diff --git a/beos/scaffolding.cpp b/beos/scaffolding.cpp
index 3718f9492..36ba9ea63 100644
--- a/beos/scaffolding.cpp
+++ b/beos/scaffolding.cpp
@@ -24,6 +24,7 @@
#include
#include
+#include
#include
#include
#include
@@ -65,6 +66,7 @@ extern "C" {
#include "utils/utils.h"
#include "utils/log.h"
}
+#include "beos/bitmap.h"
#include "beos/gui.h"
#include "beos/plotters.h"
#include "beos/scaffolding.h"
@@ -154,6 +156,85 @@ extern int main(int argc, char** argv);
// in fetch_rsrc.cpp
extern BResources *gAppResources;
+// #pragma mark - class NSIconTextControl
+
+class NSIconTextControl : public BTextControl {
+public:
+ NSIconTextControl(BRect frame, const char* name,
+ const char* label, const char* initialText,
+ BMessage* message,
+ uint32 resizeMode
+ = B_FOLLOW_LEFT | B_FOLLOW_TOP,
+ uint32 flags = B_WILL_DRAW | B_NAVIGABLE);
+virtual ~NSIconTextControl();
+
+virtual void FrameResized(float newWidth, float newHeight);
+
+void SetBitmap(const BBitmap *bitmap);
+void FixupTextRect();
+
+private:
+ const BBitmap *fBitmap;
+ BView *fBitmapView;
+};
+
+NSIconTextControl::NSIconTextControl(BRect frame, const char* name,
+ const char* label, const char* initialText,
+ BMessage* message,
+ uint32 resizeMode,
+ uint32 flags)
+ : BTextControl(frame, name, label, initialText, message, resizeMode, flags),
+ fBitmap(NULL),
+ fBitmapView(NULL)
+{
+ BRect r(TextView()->TextRect());
+ BRect frame = r;
+ frame.right = frame.left + 15;
+ frame.bottom = frame.top + 15;
+ frame.OffsetBy(-2, (r.IntegerHeight() - 16) / 2);
+ fBitmapView = new BView(frame, "iconview", B_FOLLOW_NONE, 0);
+ FixupTextRect();
+
+ TextView()->AddChild(fBitmapView);
+}
+
+
+NSIconTextControl::~NSIconTextControl()
+{
+}
+
+
+void
+NSIconTextControl::FrameResized(float newWidth, float newHeight)
+{
+ BTextControl::FrameResized(newWidth, newHeight);
+ FixupTextRect();
+ Invalidate();
+}
+
+
+void
+NSIconTextControl::SetBitmap(const BBitmap *bitmap)
+{
+ fBitmapView->SetViewBitmap(bitmap);
+ fBitmapView->Invalidate();
+}
+
+
+void
+NSIconTextControl::FixupTextRect()
+{
+ // FIXME: this flickers on resize, quite ugly
+ BRect r(TextView()->TextRect());
+
+ // in case this ever gets fixed...
+ if (r.left > 10)
+ return;
+ r.left += r.bottom - r.top;
+ TextView()->SetTextRect(r);
+}
+
+
// #pragma mark - class NSResizeKnob
class NSResizeKnob : public BView {
@@ -1890,9 +1971,12 @@ nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel)
rect.InsetBySelf(5, 5);
message = new BMessage('urle');
message->AddPointer("scaffolding", g);
- g->url_bar = new BTextControl(rect, "url_bar", "url", "", message,
+ g->url_bar = new NSIconTextControl(rect, "url_bar", "", "", message,
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
- g->url_bar->SetDivider(g->url_bar->StringWidth("url "));
+ g->url_bar->SetDivider(0);
+ rect = g->url_bar->TextView()->TextRect();
+ rect.left += 16;
+ g->url_bar->TextView()->SetTextRect(rect);
g->tool_bar->AddChild(g->url_bar);
@@ -2026,8 +2110,25 @@ void gui_window_stop_throbber(struct gui_window* _g)
/**
* add retrieved favicon to the gui
*/
-void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon)
+void gui_window_set_icon(struct gui_window *_g, hlcache_handle *icon)
{
+ BBitmap *bitmap = NULL;
+ struct bitmap *bmp_icon;
+
+ bmp_icon = (icon != NULL) ? content_get_bitmap(icon) : NULL;
+
+ if (bmp_icon) {
+ bitmap = nsbeos_bitmap_get_primary(bmp_icon);
+ }
+
+ struct beos_scaffolding *g = nsbeos_get_scaffold(_g);
+
+ if (!g->top_view->LockLooper())
+ return;
+
+ dynamic_cast(g->url_bar)->SetBitmap(bitmap);
+
+ g->top_view->UnlockLooper();
}
/**
From bd89e5a0883b4c5444ec41ff7c70bb9053ef2442 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?=
Date: Wed, 1 Jan 2014 17:41:23 +0100
Subject: [PATCH 032/773] beos: Fix background color for control on replicants
Still some redundancy there but it works.
---
beos/scaffolding.cpp | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/beos/scaffolding.cpp b/beos/scaffolding.cpp
index 36ba9ea63..26ca2e952 100644
--- a/beos/scaffolding.cpp
+++ b/beos/scaffolding.cpp
@@ -606,13 +606,23 @@ NSBaseView::AllAttached()
g->url_bar->SetTarget(this);
- SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+ rgb_color c = ui_color(B_PANEL_BACKGROUND_COLOR);
+ SetViewColor(c);
- g->tool_bar->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
- g->dragger->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
+ g->tool_bar->SetViewColor(c);
+ g->back_button->SetViewColor(c);
+ g->forward_button->SetViewColor(c);
+ g->stop_button->SetViewColor(c);
+ g->reload_button->SetViewColor(c);
+ g->home_button->SetViewColor(c);
+ g->url_bar->SetViewColor(c);
+ g->throbber->SetViewColor(c);
+ g->scroll_view->SetViewColor(c);
- g->status_bar->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
- g->status_bar->SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)) ;
+ g->dragger->SetViewColor(c);
+
+ g->status_bar->SetViewColor(c);
+ g->status_bar->SetLowColor(c);
#if defined(__HAIKU__) || defined(B_DANO_VERSION)
g->status_bar->SetHighColor(ui_color(B_PANEL_TEXT_COLOR));
#endif
@@ -1344,6 +1354,8 @@ void nsbeos_attach_toplevel_view(nsbeos_scaffolding *g, BView *view)
g->url_bar->SetTarget(view);
+ nsbeos_scaffolding_update_colors(g);
+
if (g->window) {
recursively_set_menu_items_target(g->menu_bar, view);
From 967d930477bc8080295e197c44ebd052bbd1963d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?=
Date: Wed, 1 Jan 2014 18:08:13 +0100
Subject: [PATCH 033/773] beos: Fix opening about from replicant popup
---
beos/scaffolding.cpp | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/beos/scaffolding.cpp b/beos/scaffolding.cpp
index 26ca2e952..1790cf06b 100644
--- a/beos/scaffolding.cpp
+++ b/beos/scaffolding.cpp
@@ -66,6 +66,7 @@ extern "C" {
#include "utils/utils.h"
#include "utils/log.h"
}
+#include "beos/about.h"
#include "beos/bitmap.h"
#include "beos/gui.h"
#include "beos/plotters.h"
@@ -402,6 +403,7 @@ NSBaseView::MessageReceived(BMessage *message)
{
switch (message->what) {
case B_SIMPLE_DATA:
+ case B_ABOUT_REQUESTED:
case B_ARGV_RECEIVED:
case B_REFS_RECEIVED:
case B_COPY:
@@ -777,6 +779,15 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m
case B_QUIT_REQUESTED:
nsbeos_scaffolding_destroy(scaffold);
break;
+ case B_ABOUT_REQUESTED:
+ {
+ nsbeos_about(NULL);
+ /* XXX: doesn't work yet! bug in rsrc:/
+ BString url("rsrc:/about.en.html,text/html");
+ browser_window_create(url.String(), NULL, NULL, true, false);
+ */
+ break;
+ }
case B_NETPOSITIVE_DOWN:
//XXX WRITEME
break;
From 0dc8cd66256e9a9235f2976fcfed2797cc50c865 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?=
Date: Wed, 1 Jan 2014 18:19:55 +0100
Subject: [PATCH 034/773] beos: Fix about box
---
beos/about.cpp | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/beos/about.cpp b/beos/about.cpp
index bfe836e62..f8447fa2a 100644
--- a/beos/about.cpp
+++ b/beos/about.cpp
@@ -114,7 +114,14 @@ void nsbeos_about(struct gui_window *gui)
alert->AddToSubset(w);
}
}
+
+ // make space for controls
+ alert->ResizeBy(200, 640);
+ alert->MoveTo(alert->AlertPosition(alert->Frame().Width() + 1,
+ alert->Frame().Height() + 1));
+
tv->SetStylable(true);
+ tv->ResizeBy(200, 640);
add_section(tv, name, description);
add_section(tv, NULL, copyright);
add_section(tv, "authors", authors);
@@ -123,10 +130,5 @@ void nsbeos_about(struct gui_window *gui)
add_section(tv, "documenters", documenters);
add_section(tv, url_label, url);
- // make space for controls
- alert->ResizeBy(200, 500);
- alert->MoveTo(alert->AlertPosition(alert->Frame().Width() + 1,
- alert->Frame().Height() + 1));
-
alert->Go(NULL);
}
From 1025a49cb6c0eee0b66ac74eb5f639001643fe90 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?=
Date: Wed, 1 Jan 2014 19:21:59 +0100
Subject: [PATCH 035/773] beos: if no gui window, pass the first one to
nsbeos_about()
---
beos/window.cpp | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/beos/window.cpp b/beos/window.cpp
index 5c5df96b3..b743ec0c2 100644
--- a/beos/window.cpp
+++ b/beos/window.cpp
@@ -463,11 +463,9 @@ void nsbeos_dispatch_event(BMessage *message)
break;
case B_ABOUT_REQUESTED:
{
+ if (gui == NULL)
+ gui = window_list;
nsbeos_about(gui);
- /* XXX: doesn't work yet! bug in rsrc:/
- BString url("rsrc:/about.en.html,text/html");
- browser_window_create(url.String(), NULL, NULL, true, false);
- */
break;
}
case _UPDATE_:
From f713cdd90b1b13d790f5e062a28c729aa98f6933 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?=
Date: Wed, 1 Jan 2014 19:23:28 +0100
Subject: [PATCH 036/773] beos: Add credits and licence buttons to about box
We'll simplify it to just mention version infos like on atari.
---
beos/about.cpp | 21 +++++++++++++++----
beos/scaffolding.cpp | 49 +++++++++++++++++++++++++++++++++++++++-----
beos/scaffolding.h | 3 +++
3 files changed, 64 insertions(+), 9 deletions(-)
diff --git a/beos/about.cpp b/beos/about.cpp
index f8447fa2a..3f7adf7fc 100644
--- a/beos/about.cpp
+++ b/beos/about.cpp
@@ -28,6 +28,8 @@ extern "C" {
#include "beos/window.h"
#include
+#include
+#include
#include
#include
#include
@@ -102,18 +104,29 @@ static void add_section(BTextView *textview, const char *header,
void nsbeos_about(struct gui_window *gui)
{
BAlert *alert;
- alert = new BAlert("about", "", /*"HomePage",*/ "Ok");
+ alert = new BAlert("about", "", "Credits", "Licence", "Ok");
//XXX: i18n-ize
BTextView *tv = alert->TextView();
+ BHandler *target = be_app;
+ BMessage *message = new BMessage(ABOUT_BUTTON);
+ BInvoker *invoker = NULL;
if (gui) {
- alert->SetFeel(B_MODAL_SUBSET_WINDOW_FEEL);
nsbeos_scaffolding *s = nsbeos_get_scaffold(gui);
if (s) {
NSBrowserWindow *w = nsbeos_get_bwindow_for_scaffolding(s);
- if (w)
+ if (w) {
+ alert->SetFeel(B_MODAL_SUBSET_WINDOW_FEEL);
alert->AddToSubset(w);
+ }
+ NSBaseView *v = nsbeos_get_baseview_for_scaffolding(s);
+ if (v) {
+ if (w)
+ message->AddPointer("Window", w);
+ target = v;
+ }
}
}
+ invoker = new BInvoker(message, target);
// make space for controls
alert->ResizeBy(200, 640);
@@ -130,5 +143,5 @@ void nsbeos_about(struct gui_window *gui)
add_section(tv, "documenters", documenters);
add_section(tv, url_label, url);
- alert->Go(NULL);
+ alert->Go(invoker);
}
diff --git a/beos/scaffolding.cpp b/beos/scaffolding.cpp
index 1790cf06b..a67ab50f8 100644
--- a/beos/scaffolding.cpp
+++ b/beos/scaffolding.cpp
@@ -502,6 +502,7 @@ NSBaseView::MessageReceived(BMessage *message)
case TOOLBAR_THROBBER:
case TOOLBAR_EDIT:
case CHOICES_SHOW:
+ case ABOUT_BUTTON:
case APPLICATION_QUIT:
if (Window())
Window()->DetachCurrentMessage();
@@ -781,11 +782,7 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m
break;
case B_ABOUT_REQUESTED:
{
- nsbeos_about(NULL);
- /* XXX: doesn't work yet! bug in rsrc:/
- BString url("rsrc:/about.en.html,text/html");
- browser_window_create(url.String(), NULL, NULL, true, false);
- */
+ nsbeos_about(scaffold->top_level);
break;
}
case B_NETPOSITIVE_DOWN:
@@ -1198,6 +1195,43 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m
break;
case CHOICES_SHOW:
break;
+ case ABOUT_BUTTON:
+ /* XXX: doesn't work yet! bug in rsrc:/
+ BString url("rsrc:/about.en.html,text/html");
+ browser_window_create(url.String(), NULL, NULL, true, false);
+ */
+ {
+ int32 button;
+ if (message->FindInt32("which", &button) == B_OK) {
+ const char *goto_url = NULL;
+ nserror nserr;
+ nsurl *url;
+ switch (button) {
+ case 0:
+ goto_url = "about:credits";
+ break;
+ case 1:
+ goto_url = "about:licence";
+ break;
+ default:
+ break;
+ }
+ if (goto_url == NULL)
+ break;
+ nserr = nsurl_create(goto_url, &url);
+ if (nserr == NSERROR_OK) {
+ nserr = browser_window_navigate(bw,
+ url, NULL,
+ (browser_window_nav_flags)(BROWSER_WINDOW_HISTORY | BROWSER_WINDOW_VERIFIABLE),
+ NULL, NULL, NULL);
+ nsurl_unref(url);
+ }
+ if (nserr != NSERROR_OK) {
+ warn_user(messages_get_errorcode(nserr), 0);
+ }
+ }
+ }
+ break;
case APPLICATION_QUIT:
netsurf_quit = true;
break;
@@ -1276,6 +1310,11 @@ NSBrowserWindow *nsbeos_get_bwindow_for_scaffolding(nsbeos_scaffolding *scaffold
return scaffold->window;
}
+NSBaseView *nsbeos_get_baseview_for_scaffolding(nsbeos_scaffolding *scaffold)
+{
+ return scaffold->top_view;
+}
+
static void recursively_set_menu_items_target(BMenu *menu, BHandler *handler)
{
menu->SetTargetForItems(handler);
diff --git a/beos/scaffolding.h b/beos/scaffolding.h
index 7b7080322..1b78d54a8 100644
--- a/beos/scaffolding.h
+++ b/beos/scaffolding.h
@@ -173,6 +173,7 @@ typedef enum {
/* misc actions */
CHOICES_SHOW,
+ ABOUT_BUTTON,
APPLICATION_QUIT,
} menu_action;
@@ -181,6 +182,8 @@ NSBrowserWindow *nsbeos_find_last_window(void);
NSBrowserWindow *nsbeos_get_bwindow_for_scaffolding(nsbeos_scaffolding *scaffold);
+NSBaseView *nsbeos_get_baseview_for_scaffolding(nsbeos_scaffolding *scaffold);
+
nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel);
bool nsbeos_scaffolding_is_busy(nsbeos_scaffolding *scaffold);
From a7ef9dc4abb57e0d0675de6befc8c639ea9c3a3b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?=
Date: Wed, 1 Jan 2014 19:35:21 +0100
Subject: [PATCH 037/773] beos: Simplify about box
Just print some version infos, the buttons are there for credits
and licence.
---
beos/about.cpp | 96 +++++++-------------------------------------------
1 file changed, 13 insertions(+), 83 deletions(-)
diff --git a/beos/about.cpp b/beos/about.cpp
index 3f7adf7fc..1c43c4606 100644
--- a/beos/about.cpp
+++ b/beos/about.cpp
@@ -22,6 +22,9 @@
#include
extern "C" {
#include "utils/log.h"
+#include "utils/testament.h"
+#include "utils/useragent.h"
+#include "curl/curlver.h"
}
#include "beos/about.h"
#include "beos/scaffolding.h"
@@ -30,83 +33,23 @@ extern "C" {
#include
#include
#include
-#include
#include
-#include
-static const char *authors[] = {
- "John-Mark Bell", "James Bursa", "Michael Drake",
- "Rob Kendrick", "Adrian Lees", "Vincent Sanders",
- "Daniel Silverstone", "Richard Wilson",
- "\nContributors:", "Kevin Bagust", "Stefaan Claes",
- "Matthew Hambley", "Rob Jackson", "Jeffrey Lee", "Phil Mellor",
- "Philip Pemberton", "Darren Salt", "Andrew Timmins",
- "John Tytgat", "Chris Williams",
- "\nGoogle Summer of Code Contributors:", "Adam Blokus",
- "Sean Fox", "Michael Lester", "Andrew Sidwell", NULL
-};
-
-static const char *translators[] = { "Sebastian Barthel", "Bruno D'Arcangeli",
- "Gerard van Katwijk", "Jérôme Mathevet", "Simon Voortman.", NULL
-};
-static const char *artists[] = {
- "Michael Drake", "\nContributors:", "Andrew Duffell",
- "John Duffell", "Richard Hallas", "Phil Mellor", NULL
-};
-
-static const char *documenters[] = {
- "John-Mark Bell", "James Bursa", "Michael Drake",
- "Richard Wilson", "\nContributors:", "James Shaw", NULL
-};
-
-static const char *name = "NetSurf";
-static const char *description =
- "Small as a mouse, fast as a cheetah, and available for free.\n"
- "NetSurf is a web browser for RISC OS and UNIX-like platforms.";
-static const char *url = "http://www.netsurf-browser.org/";
-static const char *url_label = "NetSurf Website";
-static const char *copyright =
- "Copyright © 2003 - 2008 The NetSurf Developers";
-
-static void add_section(BTextView *textview, const char *header,
- const char *text)
-{
- BFont titleFont;
- titleFont.SetSize(titleFont.Size() + 10);
- BFont textFont;
- text_run_array titleRuns = { 1, { 0, titleFont, { 0, 0, 0, 255 } } };
- text_run_array textRuns = { 1, { 0, textFont, { 0, 0, 0, 255 } } };
- BString h(header);
- BString t(text);
- h << "\n";
- t << "\n\n";
- if (header)
- textview->Insert(h.String(), &titleRuns);
- if (text)
- textview->Insert(t.String(), &textRuns);
-}
-
-static void add_section(BTextView *textview, const char *header,
- const char **texts)
-{
- BString t;
- while (*texts) {
- t << *texts;
- t << ", ";
- texts++;
- }
- add_section(textview, header, t.String());
-}
/**
* Creates the about alert
*/
void nsbeos_about(struct gui_window *gui)
{
- BAlert *alert;
- alert = new BAlert("about", "", "Credits", "Licence", "Ok");
- //XXX: i18n-ize
- BTextView *tv = alert->TextView();
+ BString text;
+ text << "Netsurf : " << user_agent_string() << "\n";
+ text << "Version : " << netsurf_version << "\n";
+ text << "Build ID : " << WT_REVID << "\n";
+ text << "Date : " << WT_COMPILEDATE << "\n";
+ text << "cURL : " << LIBCURL_VERSION << "\n";
+
+ BAlert *alert = new BAlert("about", text.String(), "Credits", "Licence", "Ok");
+
BHandler *target = be_app;
BMessage *message = new BMessage(ABOUT_BUTTON);
BInvoker *invoker = NULL;
@@ -128,20 +71,7 @@ void nsbeos_about(struct gui_window *gui)
}
invoker = new BInvoker(message, target);
- // make space for controls
- alert->ResizeBy(200, 640);
- alert->MoveTo(alert->AlertPosition(alert->Frame().Width() + 1,
- alert->Frame().Height() + 1));
-
- tv->SetStylable(true);
- tv->ResizeBy(200, 640);
- add_section(tv, name, description);
- add_section(tv, NULL, copyright);
- add_section(tv, "authors", authors);
- add_section(tv, "translators", translators);
- add_section(tv, "artists", artists);
- add_section(tv, "documenters", documenters);
- add_section(tv, url_label, url);
+ //TODO: i18n-ize
alert->Go(invoker);
}
From 3a1bf5c20fe9e30117dabadbfc9277a6ec3eb295 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?=
Date: Wed, 1 Jan 2014 19:53:42 +0100
Subject: [PATCH 038/773] beos: Also set LowColor on toolbar buttons when
attached
---
beos/scaffolding.cpp | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/beos/scaffolding.cpp b/beos/scaffolding.cpp
index a67ab50f8..06184f24e 100644
--- a/beos/scaffolding.cpp
+++ b/beos/scaffolding.cpp
@@ -614,10 +614,15 @@ NSBaseView::AllAttached()
g->tool_bar->SetViewColor(c);
g->back_button->SetViewColor(c);
+ g->back_button->SetLowColor(c);
g->forward_button->SetViewColor(c);
+ g->forward_button->SetLowColor(c);
g->stop_button->SetViewColor(c);
+ g->stop_button->SetLowColor(c);
g->reload_button->SetViewColor(c);
+ g->reload_button->SetLowColor(c);
g->home_button->SetViewColor(c);
+ g->home_button->SetLowColor(c);
g->url_bar->SetViewColor(c);
g->throbber->SetViewColor(c);
g->scroll_view->SetViewColor(c);
From 6c63adb1c1b7ecdc6666d6b84ec3b354ce8c37ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?=
Date: Sat, 4 Jan 2014 20:22:26 +0100
Subject: [PATCH 039/773] beos: Remove Messages symlinks in res/*/
It seems the messages files aren't generated early enough
anymore, so building the resources fails.
We can't load them from the resource yet anyway.
---
beos/res/de/Messages | 1 -
beos/res/en/Messages | 1 -
beos/res/fr/Messages | 1 -
beos/res/it/Messages | 1 -
beos/res/nl/Messages | 1 -
5 files changed, 5 deletions(-)
delete mode 120000 beos/res/de/Messages
delete mode 120000 beos/res/en/Messages
delete mode 120000 beos/res/fr/Messages
delete mode 120000 beos/res/it/Messages
delete mode 120000 beos/res/nl/Messages
diff --git a/beos/res/de/Messages b/beos/res/de/Messages
deleted file mode 120000
index 2f1fc39c3..000000000
--- a/beos/res/de/Messages
+++ /dev/null
@@ -1 +0,0 @@
-../../../!NetSurf/Resources/de/Messages
\ No newline at end of file
diff --git a/beos/res/en/Messages b/beos/res/en/Messages
deleted file mode 120000
index 72c9eff90..000000000
--- a/beos/res/en/Messages
+++ /dev/null
@@ -1 +0,0 @@
-../../../!NetSurf/Resources/en/Messages
\ No newline at end of file
diff --git a/beos/res/fr/Messages b/beos/res/fr/Messages
deleted file mode 120000
index a42cf08f4..000000000
--- a/beos/res/fr/Messages
+++ /dev/null
@@ -1 +0,0 @@
-../../../!NetSurf/Resources/fr/Messages
\ No newline at end of file
diff --git a/beos/res/it/Messages b/beos/res/it/Messages
deleted file mode 120000
index d4c5c2956..000000000
--- a/beos/res/it/Messages
+++ /dev/null
@@ -1 +0,0 @@
-../../../!NetSurf/Resources/it/Messages
\ No newline at end of file
diff --git a/beos/res/nl/Messages b/beos/res/nl/Messages
deleted file mode 120000
index d484ebd29..000000000
--- a/beos/res/nl/Messages
+++ /dev/null
@@ -1 +0,0 @@
-../../../!NetSurf/Resources/nl/Messages
\ No newline at end of file
From 581d87757601286fbb8250abc8d2bd185dddecb7 Mon Sep 17 00:00:00 2001
From: Daniel Silverstone
Date: Sat, 4 Jan 2014 19:34:04 +0000
Subject: [PATCH 040/773] In theory, store raw filenames and pass them through
for file upload. Untested due to no file-upload in GTK frontend just yet
---
content/fetch.c | 2 ++
content/fetch.h | 1 +
content/fetchers/curl.c | 2 +-
render/form.c | 25 ++++++++++++++++++++++++-
4 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/content/fetch.c b/content/fetch.c
index 1ff925ae3..ffc907891 100644
--- a/content/fetch.c
+++ b/content/fetch.c
@@ -665,6 +665,8 @@ void fetch_multipart_data_destroy(struct fetch_multipart_data *list)
next = list->next;
free(list->name);
free(list->value);
+ if (list->file)
+ free(list->rawfile);
free(list);
}
}
diff --git a/content/fetch.h b/content/fetch.h
index d23b3cd4b..a173f7f30 100644
--- a/content/fetch.h
+++ b/content/fetch.h
@@ -79,6 +79,7 @@ struct fetch_multipart_data {
bool file; /**< Item is a file */
char *name; /**< Name of item */
char *value; /**< Item value */
+ char *rawfile; /**< Raw filename if file is true */
struct fetch_multipart_data *next; /**< Next in linked list */
};
diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c
index 1dfc44631..7578ad4cb 100644
--- a/content/fetchers/curl.c
+++ b/content/fetchers/curl.c
@@ -1301,7 +1301,7 @@ fetch_curl_post_convert(const struct fetch_multipart_data *control)
char *mimetype = fetch_mimetype(control->value);
code = curl_formadd(&post, &last,
CURLFORM_COPYNAME, control->name,
- CURLFORM_FILE, control->value,
+ CURLFORM_FILE, control->rawfile,
CURLFORM_FILENAME, leafname,
CURLFORM_CONTENTTYPE,
(mimetype != 0 ? mimetype : "text/plain"),
diff --git a/render/form.c b/render/form.c
index aa6661cfa..a4b882a64 100644
--- a/render/form.c
+++ b/render/form.c
@@ -50,6 +50,7 @@
#include "render/html.h"
#include "render/html_internal.h"
#include "render/layout.h"
+#include "utils/corestrings.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/talloc.h"
@@ -346,7 +347,7 @@ bool form_successful_controls(struct form *form,
struct fetch_multipart_data sentinel, *last_success, *success_new;
char *value = NULL;
bool had_submit = false;
- char *charset;
+ char *charset, *rawfile_temp;
last_success = &sentinel;
sentinel.next = NULL;
@@ -598,6 +599,28 @@ bool form_successful_controls(struct form *form,
goto no_memory;
}
+ /* Retrieve the filename from the DOM annotation */
+ if (dom_node_get_user_data(
+ control->node,
+ corestring_dom___ns_key_file_name_node_data,
+ &rawfile_temp) != DOM_NO_ERR) {
+ LOG(("unable to get rawfile"));
+ goto no_memory;
+ }
+
+ if (rawfile_temp == NULL) {
+ /* No annotation means the file was not
+ */
+ success_new->rawfile = strdup("");
+ } else {
+ success_new->rawfile = strdup(rawfile_temp);
+ }
+
+ if (success_new->rawfile == NULL) {
+ LOG(("strdup failed"));
+ goto no_memory;
+ }
+
continue;
break;
From 2a18cef82b84037b14f5e470c70ab70e433add5e Mon Sep 17 00:00:00 2001
From: Daniel Silverstone
Date: Sat, 4 Jan 2014 20:53:43 +0000
Subject: [PATCH 041/773] Shunt around the file multipart stuff a bit to try
and fix the segfault
---
render/form.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/render/form.c b/render/form.c
index a4b882a64..9ac52392e 100644
--- a/render/form.c
+++ b/render/form.c
@@ -590,15 +590,7 @@ bool form_successful_controls(struct form *form,
success_new->value =
ENCODE_ITEM(control->value ?
control->value : "");
- success_new->next = 0;
- last_success->next = success_new;
- last_success = success_new;
- if (!success_new->name ||
- !success_new->value) {
- LOG(("strdup failed"));
- goto no_memory;
- }
-
+ success_new->rawfile = NULL;
/* Retrieve the filename from the DOM annotation */
if (dom_node_get_user_data(
control->node,
@@ -621,6 +613,15 @@ bool form_successful_controls(struct form *form,
goto no_memory;
}
+ success_new->next = 0;
+ last_success->next = success_new;
+ last_success = success_new;
+ if (!success_new->name ||
+ !success_new->value) {
+ LOG(("strdup failed"));
+ goto no_memory;
+ }
+
continue;
break;
From de42f8880e49bc32825d13a4ba0c7ed6e4295b81 Mon Sep 17 00:00:00 2001
From: Daniel Silverstone
Date: Sat, 4 Jan 2014 21:15:52 +0000
Subject: [PATCH 042/773] Add a bunch of logging to try and help track down the
issue with rawfile handling, sorry guys
---
content/fetch.c | 4 +++-
content/fetchers/curl.c | 1 +
render/form.c | 5 +++--
render/html.c | 4 ++++
4 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/content/fetch.c b/content/fetch.c
index ffc907891..5b9aba1b0 100644
--- a/content/fetch.c
+++ b/content/fetch.c
@@ -665,8 +665,10 @@ void fetch_multipart_data_destroy(struct fetch_multipart_data *list)
next = list->next;
free(list->name);
free(list->value);
- if (list->file)
+ if (list->file) {
+ LOG(("Freeing rawfile: %s", list->rawfile));
free(list->rawfile);
+ }
free(list);
}
}
diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c
index 7578ad4cb..1fada9d0a 100644
--- a/content/fetchers/curl.c
+++ b/content/fetchers/curl.c
@@ -1299,6 +1299,7 @@ fetch_curl_post_convert(const struct fetch_multipart_data *control)
code, control->name));
} else {
char *mimetype = fetch_mimetype(control->value);
+ LOG(("XYZZY: Using rawfile of %s", control->rawfile));
code = curl_formadd(&post, &last,
CURLFORM_COPYNAME, control->name,
CURLFORM_FILE, control->rawfile,
diff --git a/render/form.c b/render/form.c
index 9ac52392e..fe18e4336 100644
--- a/render/form.c
+++ b/render/form.c
@@ -592,14 +592,15 @@ bool form_successful_controls(struct form *form,
control->value : "");
success_new->rawfile = NULL;
/* Retrieve the filename from the DOM annotation */
+ LOG(("XYZZY: Attempting to retrieve data"));
if (dom_node_get_user_data(
control->node,
corestring_dom___ns_key_file_name_node_data,
&rawfile_temp) != DOM_NO_ERR) {
- LOG(("unable to get rawfile"));
+ LOG(("XYZZY: unable to get rawfile"));
goto no_memory;
}
-
+ LOG(("XYZZY: Got raw filename: %s", rawfile_temp));
if (rawfile_temp == NULL) {
/* No annotation means the file was not
*/
diff --git a/render/html.c b/render/html.c
index 49bb019dd..c1e831571 100644
--- a/render/html.c
+++ b/render/html.c
@@ -1704,6 +1704,7 @@ static void html__dom_user_data_handler(dom_node_operation operation,
switch (operation) {
case DOM_NODE_CLONED:
+ LOG(("XYZZY: Cloned, so copying to the new location"));
if (dom_node_set_user_data(dst,
corestring_dom___ns_key_file_name_node_data,
strdup(data), html__dom_user_data_handler,
@@ -1719,6 +1720,7 @@ static void html__dom_user_data_handler(dom_node_operation operation,
break;
case DOM_NODE_DELETED:
+ LOG(("XYZZY: Freeing data due to node deletion"));
free(data);
break;
default:
@@ -1809,10 +1811,12 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file)
form_gadget_update_value(html, file_box->gadget, utf8_fn);
/* corestring_dom___ns_key_file_name_node_data */
+ LOG(("XYZZY: Setting userdata to %s", file));
if (dom_node_set_user_data((dom_node *)file_box->gadget->node,
corestring_dom___ns_key_file_name_node_data,
strdup(file), html__dom_user_data_handler,
&oldfile) == DOM_NO_ERR) {
+ LOG(("XYZZY: Userdata used to be %s", oldfile));
if (oldfile != NULL)
free(oldfile);
}
From 33f94c265e34c6ec2a9c0603f814deda47f77849 Mon Sep 17 00:00:00 2001
From: Daniel Silverstone
Date: Sat, 4 Jan 2014 21:49:03 +0000
Subject: [PATCH 043/773] Support cloning rawfile data
---
content/fetch.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/content/fetch.c b/content/fetch.c
index 5b9aba1b0..a9a9049f2 100644
--- a/content/fetch.c
+++ b/content/fetch.c
@@ -639,6 +639,21 @@ struct fetch_multipart_data *fetch_multipart_data_clone(
return NULL;
}
+ if (clone->file) {
+ clone->rawfile = strdup(list->rawfile);
+ if (clone->rawfile == NULL) {
+ free(clone->value);
+ free(clone->name);
+ free(clone);
+ if (result != NULL)
+ fetch_multipart_data_destroy(result);
+
+ return NULL;
+ }
+ } else {
+ clone->rawfile = NULL;
+ }
+
clone->next = NULL;
if (result == NULL)
From b4f986084885a366220d86d91be84be5dad7a0bc Mon Sep 17 00:00:00 2001
From: Daniel Silverstone
Date: Sat, 4 Jan 2014 22:05:23 +0000
Subject: [PATCH 044/773] Remove logging now that file upload *seems* to work
---
content/fetchers/curl.c | 1 -
render/form.c | 5 ++---
render/html.c | 4 ----
3 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c
index 1fada9d0a..7578ad4cb 100644
--- a/content/fetchers/curl.c
+++ b/content/fetchers/curl.c
@@ -1299,7 +1299,6 @@ fetch_curl_post_convert(const struct fetch_multipart_data *control)
code, control->name));
} else {
char *mimetype = fetch_mimetype(control->value);
- LOG(("XYZZY: Using rawfile of %s", control->rawfile));
code = curl_formadd(&post, &last,
CURLFORM_COPYNAME, control->name,
CURLFORM_FILE, control->rawfile,
diff --git a/render/form.c b/render/form.c
index fe18e4336..9ac52392e 100644
--- a/render/form.c
+++ b/render/form.c
@@ -592,15 +592,14 @@ bool form_successful_controls(struct form *form,
control->value : "");
success_new->rawfile = NULL;
/* Retrieve the filename from the DOM annotation */
- LOG(("XYZZY: Attempting to retrieve data"));
if (dom_node_get_user_data(
control->node,
corestring_dom___ns_key_file_name_node_data,
&rawfile_temp) != DOM_NO_ERR) {
- LOG(("XYZZY: unable to get rawfile"));
+ LOG(("unable to get rawfile"));
goto no_memory;
}
- LOG(("XYZZY: Got raw filename: %s", rawfile_temp));
+
if (rawfile_temp == NULL) {
/* No annotation means the file was not
*/
diff --git a/render/html.c b/render/html.c
index c1e831571..49bb019dd 100644
--- a/render/html.c
+++ b/render/html.c
@@ -1704,7 +1704,6 @@ static void html__dom_user_data_handler(dom_node_operation operation,
switch (operation) {
case DOM_NODE_CLONED:
- LOG(("XYZZY: Cloned, so copying to the new location"));
if (dom_node_set_user_data(dst,
corestring_dom___ns_key_file_name_node_data,
strdup(data), html__dom_user_data_handler,
@@ -1720,7 +1719,6 @@ static void html__dom_user_data_handler(dom_node_operation operation,
break;
case DOM_NODE_DELETED:
- LOG(("XYZZY: Freeing data due to node deletion"));
free(data);
break;
default:
@@ -1811,12 +1809,10 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file)
form_gadget_update_value(html, file_box->gadget, utf8_fn);
/* corestring_dom___ns_key_file_name_node_data */
- LOG(("XYZZY: Setting userdata to %s", file));
if (dom_node_set_user_data((dom_node *)file_box->gadget->node,
corestring_dom___ns_key_file_name_node_data,
strdup(file), html__dom_user_data_handler,
&oldfile) == DOM_NO_ERR) {
- LOG(("XYZZY: Userdata used to be %s", oldfile));
if (oldfile != NULL)
free(oldfile);
}
From 40387901e4b353c1b12e5e8a54214f43ac46c168 Mon Sep 17 00:00:00 2001
From: John-Mark Bell
Date: Sun, 5 Jan 2014 10:37:37 +0000
Subject: [PATCH 045/773] Env: we need libmozjs185. Install it explicitly.
---
Docs/env.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Docs/env.sh b/Docs/env.sh
index 27ae2e92d..57334febd 100644
--- a/Docs/env.sh
+++ b/Docs/env.sh
@@ -53,7 +53,7 @@ NS_BROWSER="netsurf"
# deb packages
NS_DEV_DEB="build-essential pkg-config git gperf"
NS_TOOL_DEB="flex bison"
-NS_GTK_DEB="libgtk2.0-dev libcurl3-dev libpng-dev librsvg2-dev libjpeg-dev libmozjs-dev"
+NS_GTK_DEB="libgtk2.0-dev libcurl3-dev libpng-dev librsvg2-dev libjpeg-dev libmozjs185-dev"
#add target specific libraries
if [ "x${TARGET_ABI}" = "xriscos" ]; then
From 88278faa20aec727e2c0e355bcc4601c396b8fdd Mon Sep 17 00:00:00 2001
From: John-Mark Bell
Date: Sun, 5 Jan 2014 10:48:43 +0000
Subject: [PATCH 046/773] Env: also install libhtml-parser-perl
---
Docs/env.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Docs/env.sh b/Docs/env.sh
index 57334febd..7b5aedd1d 100644
--- a/Docs/env.sh
+++ b/Docs/env.sh
@@ -52,7 +52,7 @@ NS_BROWSER="netsurf"
# deb packages
NS_DEV_DEB="build-essential pkg-config git gperf"
-NS_TOOL_DEB="flex bison"
+NS_TOOL_DEB="flex bison libhtml-parser-perl"
NS_GTK_DEB="libgtk2.0-dev libcurl3-dev libpng-dev librsvg2-dev libjpeg-dev libmozjs185-dev"
#add target specific libraries
From b80da8bf0b6662062881214bc19bbe8cbe1ec2f4 Mon Sep 17 00:00:00 2001
From: Chris Young
Date: Sun, 5 Jan 2014 12:07:53 +0000
Subject: [PATCH 047/773] Add Javascript build ability to cross-compiled target
---
amiga/Makefile.target | 1 +
1 file changed, 1 insertion(+)
diff --git a/amiga/Makefile.target b/amiga/Makefile.target
index b3220a142..7b04f3763 100644
--- a/amiga/Makefile.target
+++ b/amiga/Makefile.target
@@ -46,6 +46,7 @@ else
$(eval $(call pkg_config_find_and_add_enabled,PNG,libpng,PNG))
$(eval $(call pkg_config_find_and_add_enabled,NSSVG,libsvgtiny,NSSVG))
$(eval $(call pkg_config_find_and_add_enabled,AMIGA_CAIRO,cairo,Cairo))
+ $(eval $(call feature_enabled,MOZJS,-DXP_AMIGA -DWITH_MOZJS -DJS_VERSION=170 -DJSVERSION_LATEST=170 -DJSOPTION_JIT=0 -DJSCLASS_GLOBAL_FLAGS=0,-ljs,JavaScript))
$(eval $(call feature_enabled,AMIGA_ICON,-DWITH_AMIGA_ICON,,Amiga icon))
$(eval $(call feature_enabled,AMIGA_DATATYPES,-DWITH_AMIGA_DATATYPES,,DataTypes))
From 32468516e31ee16f6d63923aeb2af8714dfe1a1a Mon Sep 17 00:00:00 2001
From: John-Mark Bell
Date: Sun, 5 Jan 2014 14:34:04 +0000
Subject: [PATCH 048/773] Speculatively start image fetches as we parse the
document.
---
desktop/save_complete.c | 2 +-
render/html.c | 35 +++++++++++++++++++++++++++++++++++
render/html_object.c | 26 +++++++++++++++++---------
3 files changed, 53 insertions(+), 10 deletions(-)
diff --git a/desktop/save_complete.c b/desktop/save_complete.c
index 0c67654a6..efe223747 100644
--- a/desktop/save_complete.c
+++ b/desktop/save_complete.c
@@ -435,7 +435,7 @@ static bool save_complete_save_html_objects(save_complete_ctx *ctx,
object = html_get_objects(c, &count);
for (; object != NULL; object = object->next) {
- if (object->content != NULL) {
+ if (object->content != NULL || object->box != NULL) {
if (save_complete_save_html_object(ctx,
object->content) == false)
return false;
diff --git a/render/html.c b/render/html.c
index 49bb019dd..04b2fda18 100644
--- a/render/html.c
+++ b/render/html.c
@@ -507,6 +507,37 @@ static nserror html_meta_refresh_process_element(html_content *c, dom_node *n)
return error;
}
+static bool html_process_img(html_content *c, dom_node *node)
+{
+ dom_string *src;
+ nsurl *url;
+ nserror err;
+ dom_exception exc;
+ bool success;
+
+ /* Do nothing if foreground images are disabled */
+ if (nsoption_bool(foreground_images) == false) {
+ return true;
+ }
+
+ exc = dom_element_get_attribute(node, corestring_dom_src, &src);
+ if (exc != DOM_NO_ERR || src == NULL) {
+ return true;
+ }
+
+ err = nsurl_join(c->base_url, dom_string_data(src), &url);
+ if (err != NSERROR_OK) {
+ dom_string_unref(src);
+ return false;
+ }
+ dom_string_unref(src);
+
+ /* Speculatively fetch the image */
+ success = html_fetch_object(c, url, NULL, CONTENT_IMAGE, 0, 0, false);
+ nsurl_unref(url);
+
+ return success;
+}
/**
* Complete conversion of an HTML document
@@ -608,6 +639,10 @@ dom_default_action_DOMNodeInserted_cb(struct dom_event *evt, void *pw)
name, corestring_lwc_title) &&
htmlc->title == NULL) {
htmlc->title = dom_node_ref(node);
+ } else if (dom_string_caseless_lwc_isequal(
+ name, corestring_lwc_img)) {
+ html_process_img(htmlc,
+ (dom_node *) node);
}
dom_string_unref(name);
diff --git a/render/html_object.c b/render/html_object.c
index f4975e9ba..6cd08c1ef 100644
--- a/render/html_object.c
+++ b/render/html_object.c
@@ -123,6 +123,9 @@ html_object_callback(hlcache_handle *object,
assert(c->base.status != CONTENT_STATUS_ERROR);
box = o->box;
+ if (box == NULL && event->type != CONTENT_MSG_ERROR) {
+ return NSERROR_OK;
+ }
switch (event->type) {
case CONTENT_MSG_LOADING:
@@ -181,11 +184,13 @@ html_object_callback(hlcache_handle *object,
o->content = NULL;
- c->base.active--;
- LOG(("%d fetches active", c->base.active));
+ if (box != NULL) {
+ c->base.active--;
+ LOG(("%d fetches active", c->base.active));
- content_add_error(&c->base, "?", 0);
- html_object_failed(box, c, o->background);
+ content_add_error(&c->base, "?", 0);
+ html_object_failed(box, c, o->background);
+ }
break;
case CONTENT_MSG_STATUS:
@@ -464,7 +469,7 @@ html_object_callback(hlcache_handle *object,
* then reformat the page to display newly fetched objects */
else if (nsoption_bool(incremental_reflow) &&
event->type == CONTENT_MSG_DONE &&
- !(box->flags & REPLACE_DIM) &&
+ box != NULL && !(box->flags & REPLACE_DIM) &&
(c->base.status == CONTENT_STATUS_READY ||
c->base.status == CONTENT_STATUS_DONE) &&
(wallclock() > c->base.reformat_time)) {
@@ -491,6 +496,7 @@ static bool html_replace_object(struct content_html_object *object, nsurl *url)
nserror error;
assert(object != NULL);
+ assert(object->box != NULL);
c = (html_content *) object->parent;
@@ -562,7 +568,7 @@ nserror html_object_open_objects(html_content *html, struct browser_window *bw)
for (object = html->object_list; object != NULL; object = next) {
next = object->next;
- if (object->content == NULL)
+ if (object->content == NULL || object->box == NULL)
continue;
if (content_get_type(object->content) == CONTENT_NONE)
@@ -621,7 +627,7 @@ nserror html_object_close_objects(html_content *html)
for (object = html->object_list; object != NULL; object = next) {
next = object->next;
- if (object->content == NULL)
+ if (object->content == NULL || object->box == NULL)
continue;
if (content_get_type(object->content) == CONTENT_NONE)
@@ -701,8 +707,10 @@ bool html_fetch_object(html_content *c, nsurl *url, struct box *box,
c->object_list = object;
c->num_objects++;
- c->base.active++;
- LOG(("%d fetches active", c->base.active));
+ if (box != NULL) {
+ c->base.active++;
+ LOG(("%d fetches active", c->base.active));
+ }
return true;
}
From 1bd4a34a271e4f839298f56d8e45f02dfa9d378b Mon Sep 17 00:00:00 2001
From: Rob Kendrick
Date: Sun, 5 Jan 2014 14:39:08 +0000
Subject: [PATCH 049/773] Remove asserts for default cases from all content
message handlers; this is laborious and is no longer useful for catching
bugs.
---
css/css.c | 13 +------------
desktop/browser.c | 2 +-
desktop/searchweb.c | 8 +-------
gtk/theme.c | 14 ++------------
render/html_css.c | 10 +---------
render/html_object.c | 6 +-----
render/html_script.c | 30 +++---------------------------
riscos/theme_install.c | 6 ------
8 files changed, 10 insertions(+), 79 deletions(-)
diff --git a/css/css.c b/css/css.c
index f8aa71a03..803906692 100644
--- a/css/css.c
+++ b/css/css.c
@@ -655,19 +655,8 @@ nserror nscss_import(hlcache_handle *handle,
/* Already released handle */
break;
- case CONTENT_MSG_LOADING:
- case CONTENT_MSG_READY:
- case CONTENT_MSG_STATUS:
- case CONTENT_MSG_REDIRECT:
- /* messages content handler will legitamately recive
- * but does not need to handle
- */
- break;
-
default:
- /* all other messages are unexpected and fatal */
- LOG(("Unhandled message type %d", event->type));
- assert(0);
+ break;
}
/* Preserve out-of-memory. Anything else is OK */
diff --git a/desktop/browser.c b/desktop/browser.c
index d159a5599..83b06bac5 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -1556,7 +1556,7 @@ static nserror browser_window_callback(hlcache_handle *c,
break;
default:
- assert(0);
+ break;
}
return NSERROR_OK;
diff --git a/desktop/searchweb.c b/desktop/searchweb.c
index 87e3e21f1..4c050d97a 100644
--- a/desktop/searchweb.c
+++ b/desktop/searchweb.c
@@ -304,9 +304,6 @@ nserror search_web_ico_callback(hlcache_handle *ico,
const hlcache_event *event, void *pw)
{
switch (event->type) {
- case CONTENT_MSG_LOADING:
- case CONTENT_MSG_READY:
- break;
case CONTENT_MSG_DONE:
LOG(("got favicon '%s'", nsurl_access(hlcache_handle_get_url(ico))));
@@ -322,11 +319,8 @@ nserror search_web_ico_callback(hlcache_handle *ico,
search_web_retrieve_ico(true);
break;
- case CONTENT_MSG_STATUS:
- break;
-
default:
- assert(0);
+ break;
}
return NSERROR_OK;
diff --git a/gtk/theme.c b/gtk/theme.c
index 9d50c5931..ff0144cc8 100644
--- a/gtk/theme.c
+++ b/gtk/theme.c
@@ -793,11 +793,8 @@ theme_install_callback(hlcache_handle *c,
const hlcache_event *event, void *pw)
{
switch (event->type) {
- case CONTENT_MSG_READY:
- break;
- case CONTENT_MSG_DONE:
- {
+ case CONTENT_MSG_DONE: {
const char *source_data;
unsigned long source_size;
@@ -807,21 +804,14 @@ theme_install_callback(hlcache_handle *c,
warn_user("ThemeInvalid", 0);
hlcache_handle_release(c);
+ break;
}
- break;
case CONTENT_MSG_ERROR:
warn_user(event->data.error, 0);
break;
- case CONTENT_MSG_STATUS:
- break;
-
- case CONTENT_MSG_LOADING:
- case CONTENT_MSG_REFORMAT:
- case CONTENT_MSG_REDRAW:
default:
- assert(0);
break;
}
diff --git a/render/html_css.c b/render/html_css.c
index 88c67697d..ad24804a9 100644
--- a/render/html_css.c
+++ b/render/html_css.c
@@ -97,14 +97,6 @@ html_convert_css_callback(hlcache_handle *css,
assert(i != parent->stylesheet_count);
switch (event->type) {
- case CONTENT_MSG_LOADING:
- break;
-
- case CONTENT_MSG_READY:
- break;
-
- case CONTENT_MSG_REDIRECT:
- break;
case CONTENT_MSG_DONE:
LOG(("done stylesheet slot %d '%s'", i,
@@ -143,7 +135,7 @@ html_convert_css_callback(hlcache_handle *css,
return NSERROR_OK;
default:
- assert(0);
+ break;
}
if (html_can_begin_conversion(parent)) {
diff --git a/render/html_object.c b/render/html_object.c
index f4975e9ba..7b34c4a7e 100644
--- a/render/html_object.c
+++ b/render/html_object.c
@@ -203,10 +203,6 @@ html_object_callback(hlcache_handle *object,
}
break;
- case CONTENT_MSG_REFORMAT:
- case CONTENT_MSG_REDIRECT:
- break;
-
case CONTENT_MSG_REDRAW:
if (c->base.status != CONTENT_STATUS_LOADING) {
union content_msg_data data = event->data;
@@ -440,7 +436,7 @@ html_object_callback(hlcache_handle *object,
break;
default:
- assert(0);
+ break;
}
if (c->base.status == CONTENT_STATUS_READY && c->base.active == 0 &&
diff --git a/render/html_script.c b/render/html_script.c
index 4aa8aff11..4a82bcd70 100644
--- a/render/html_script.c
+++ b/render/html_script.c
@@ -172,8 +172,6 @@ convert_script_async_cb(hlcache_handle *script,
parent->base.active--;
LOG(("%d fetches active", parent->base.active));
-
-
break;
case CONTENT_MSG_ERROR:
@@ -188,11 +186,8 @@ convert_script_async_cb(hlcache_handle *script,
break;
- case CONTENT_MSG_STATUS:
- break;
-
default:
- assert(0);
+ break;
}
return NSERROR_OK;
@@ -219,11 +214,6 @@ convert_script_defer_cb(hlcache_handle *script,
assert(i != parent->scripts_count);
switch (event->type) {
- case CONTENT_MSG_LOADING:
- break;
-
- case CONTENT_MSG_READY:
- break;
case CONTENT_MSG_DONE:
LOG(("script %d done '%s'", i,
@@ -245,11 +235,8 @@ convert_script_defer_cb(hlcache_handle *script,
break;
- case CONTENT_MSG_STATUS:
- break;
-
default:
- assert(0);
+ break;
}
/* if there are no active fetches remaining begin post parse
@@ -333,19 +320,8 @@ convert_script_sync_cb(hlcache_handle *script,
break;
- case CONTENT_MSG_LOADING:
- case CONTENT_MSG_READY:
- case CONTENT_MSG_STATUS:
- case CONTENT_MSG_REDIRECT:
- /* messages content handler will legitamately recive
- * but does not need to handle
- */
- break;
-
default:
- /* all other messages are unexpected and fatal */
- LOG(("Unhandled message type %d", event->type));
- assert(0);
+ break;
}
/* if there are no active fetches remaining begin post parse
diff --git a/riscos/theme_install.c b/riscos/theme_install.c
index 0d436dce8..82377facf 100644
--- a/riscos/theme_install.c
+++ b/riscos/theme_install.c
@@ -89,8 +89,6 @@ nserror theme_install_callback(hlcache_handle *handle,
int author_indent = 0;
switch (event->type) {
- case CONTENT_MSG_READY:
- break;
case CONTENT_MSG_DONE:
{
@@ -129,11 +127,7 @@ nserror theme_install_callback(hlcache_handle *handle,
warn_user(event->data.error, 0);
break;
- case CONTENT_MSG_STATUS:
- break;
-
default:
- assert(0);
break;
}
From b1e6c63a2f00a84c1774d7a5165a7518d8bd7b4d Mon Sep 17 00:00:00 2001
From: Daniel Silverstone
Date: Sun, 5 Jan 2014 15:50:23 +0000
Subject: [PATCH 050/773] Rewrite form_successful_controls() to use the DOM.
This stops image inputs from working temporarily, but makes
inputs inside display:none work correctly. As such, this is
a net-win.
---
render/form.c | 514 +++++++++++++++++++++++++++++++++++++++++++-
render/form.h | 3 +
utils/corestrings.c | 36 ++++
utils/corestrings.h | 15 ++
4 files changed, 563 insertions(+), 5 deletions(-)
diff --git a/render/form.c b/render/form.c
index 9ac52392e..48648b103 100644
--- a/render/form.c
+++ b/render/form.c
@@ -88,7 +88,7 @@ static plot_font_style_t plot_fstyle_entry = {
};
static char *form_acceptable_charset(struct form *form);
-static char *form_encode_item(const char *item, const char *charset,
+static char *form_encode_item(const char *item, uint32_t len, const char *charset,
const char *fallback);
static void form_select_menu_clicked(struct form_control *control,
int x, int y);
@@ -320,6 +320,509 @@ bool form_add_option(struct form_control *control, char *value, char *text,
}
+/**
+ * Identify 'successful' controls via the DOM.
+ *
+ * All text strings in the successful controls list will be in the charset most
+ * appropriate for submission. Therefore, no utf8_to_* processing should be
+ * performed upon them.
+ *
+ * \todo The chosen charset needs to be made available such that it can be
+ * included in the submission request (e.g. in the fetch's Content-Type header)
+ *
+ * \param form form to search for successful controls
+ * \param submit_button control used to submit the form, if any
+ * \param successful_controls updated to point to linked list of
+ * fetch_multipart_data, 0 if no controls
+ * \return true on success, false on memory exhaustion
+ *
+ * See HTML 4.01 section 17.13.2.
+ */
+bool form_successful_controls_dom(struct form *_form,
+ struct form_control *_submit_button,
+ struct fetch_multipart_data **successful_controls)
+{
+ dom_html_form_element *form = _form->node;
+ dom_html_element *submit_button = (_submit_button != NULL) ? _submit_button->node : NULL;
+ dom_html_collection *form_elements = NULL;
+ dom_html_options_collection *options = NULL;
+ dom_node *form_element = NULL, *option_element = NULL;
+ dom_exception err;
+ dom_string *nodename = NULL, *inputname = NULL, *inputvalue = NULL, *inputtype = NULL;
+ struct fetch_multipart_data sentinel, *last_success, *success_new;
+ bool had_submit = false, element_disabled;
+ char *charset, *rawfile_temp = NULL, *basename;
+ uint32_t index, element_count;
+
+ last_success = &sentinel;
+ sentinel.next = NULL;
+
+ LOG(("XYZZY: Yay, let's look for a form"));
+
+ /** \todo Replace this call with something DOMish */
+ charset = form_acceptable_charset(_form);
+ if (charset == NULL) {
+ LOG(("failed to find charset"));
+ return false;
+ }
+
+#define ENCODE_ITEM(i) (((i) == NULL) ? ( \
+ form_encode_item("", 0, charset, _form->document_charset) \
+ ):( \
+ form_encode_item(dom_string_data(i), dom_string_byte_length(i), \
+ charset, _form->document_charset) \
+ ))
+
+ err = dom_html_form_element_get_elements(form, &form_elements);
+
+ if (err != DOM_NO_ERR) {
+ LOG(("Could not get form elements"));
+ goto dom_no_memory;
+ }
+
+ LOG(("Reffed %p", form_elements));
+
+ err = dom_html_collection_get_length(form_elements, &element_count);
+
+ if (err != DOM_NO_ERR) {
+ LOG(("Could not get form element count"));
+ goto dom_no_memory;
+ }
+
+ for (index = 0; index < element_count; index++) {
+ if (form_element != NULL) {
+ LOG(("Unreffed %p", form_element));
+ dom_node_unref(form_element);
+ form_element = NULL;
+ }
+ if (nodename != NULL) {
+ dom_string_unref(nodename);
+ nodename = NULL;
+ }
+ if (inputname != NULL) {
+ dom_string_unref(inputname);
+ inputname = NULL;
+ }
+ if (inputvalue != NULL) {
+ dom_string_unref(inputvalue);
+ inputvalue = NULL;
+ }
+ if (inputtype != NULL) {
+ dom_string_unref(inputtype);
+ inputtype = NULL;
+ }
+ if (options != NULL) {
+ dom_html_options_collection_unref(options);
+ options = NULL;
+ }
+ err = dom_html_collection_item(form_elements,
+ index, &form_element);
+ if (err != DOM_NO_ERR) {
+ LOG(("Could not retrieve form element %d", index));
+ goto dom_no_memory;
+ }
+ LOG(("Reffed %p", form_element));
+ /* Form elements are one of:
+ * HTMLInputElement
+ * HTMLTextAreaElement
+ * HTMLSelectElement
+ */
+ err = dom_node_get_node_name(form_element, &nodename);
+ if (err != DOM_NO_ERR) {
+ LOG(("Could not get node name"));
+ goto dom_no_memory;
+ }
+ LOG(("Found a node(%p): `%*s`", nodename,
+ dom_string_byte_length(nodename),
+ dom_string_data(nodename)));
+ if (dom_string_isequal(nodename, corestring_dom_TEXTAREA)) {
+ err = dom_html_text_area_element_get_disabled(
+ (dom_html_text_area_element *)form_element,
+ &element_disabled);
+ if (err != DOM_NO_ERR) {
+ LOG(("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"));
+ goto dom_no_memory;
+ }
+ } else if (dom_string_isequal(nodename, corestring_dom_SELECT)) {
+ err = dom_html_select_element_get_disabled(
+ (dom_html_select_element *)form_element,
+ &element_disabled);
+ if (err != DOM_NO_ERR) {
+ LOG(("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"));
+ goto dom_no_memory;
+ }
+ } else if (dom_string_isequal(nodename, corestring_dom_INPUT)) {
+ err = dom_html_input_element_get_disabled(
+ (dom_html_input_element *)form_element,
+ &element_disabled);
+ if (err != DOM_NO_ERR) {
+ LOG(("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"));
+ goto dom_no_memory;
+ }
+ } else if (dom_string_isequal(nodename, corestring_dom_BUTTON)) {
+ /* It was a button, no fair */
+ continue;
+ } else {
+ /* Unknown element type came through! */
+ LOG(("Unknown element type: %*s",
+ dom_string_byte_length(nodename),
+ dom_string_data(nodename)));
+ goto dom_no_memory;
+ }
+ if (element_disabled)
+ continue;
+ if (inputname == NULL)
+ continue;
+
+ if (dom_string_isequal(nodename, corestring_dom_TEXTAREA)) {
+ err = dom_html_text_area_element_get_value(
+ (dom_html_text_area_element *)form_element,
+ &inputvalue);
+ if (err != DOM_NO_ERR) {
+ LOG(("Could not get text area content"));
+ goto dom_no_memory;
+ }
+ } else if (dom_string_isequal(nodename, corestring_dom_SELECT)) {
+ uint32_t options_count, option_index;
+ err = dom_html_select_element_get_options(
+ (dom_html_select_element *)form_element,
+ &options);
+ if (err != DOM_NO_ERR) {
+ LOG(("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"));
+ goto dom_no_memory;
+ }
+ for(option_index = 0; option_index < options_count;
+ ++option_index) {
+ bool selected;
+ if (option_element != NULL) {
+ dom_node_unref(option_element);
+ option_element = NULL;
+ }
+ if (inputvalue != NULL) {
+ dom_string_unref(inputvalue);
+ inputvalue = NULL;
+ }
+ 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));
+ 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"));
+ goto dom_no_memory;
+ }
+ if (!selected)
+ continue;
+ err = dom_html_option_element_get_value(
+ (dom_html_option_element *)option_element,
+ &inputvalue);
+ if (err != DOM_NO_ERR) {
+ LOG(("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"));
+ goto dom_no_memory;
+ }
+
+ last_success->next = success_new;
+ last_success = success_new;
+
+ success_new->name = ENCODE_ITEM(inputname);
+ if (success_new->name == NULL) {
+ LOG(("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"));
+ goto dom_no_memory;
+ }
+ }
+ continue;
+ } else if (dom_string_isequal(nodename, corestring_dom_INPUT)) {
+ /* Things to consider here */
+ /* Buttons -- only if the successful control */
+ /* radio and checkbox -- only if selected */
+ /* file -- also get the rawfile */
+ /* everything else -- just value */
+ err = dom_html_input_element_get_type(
+ (dom_html_input_element *) form_element,
+ &inputtype);
+ if (err != DOM_NO_ERR) {
+ LOG(("Could not get input element type"));
+ goto dom_no_memory;
+ }
+ if (dom_string_caseless_isequal(
+ inputtype, corestring_dom_submit)) {
+ LOG(("Examining submit button"));
+ if (submit_button == NULL && !had_submit)
+ /* no button used, and first submit
+ * node found, so use it
+ */
+ had_submit = true;
+ else if ((dom_node *)submit_button !=
+ (dom_node *)form_element)
+ continue;
+ err = dom_html_input_element_get_value(
+ (dom_html_input_element *)form_element,
+ &inputvalue);
+ if (err != DOM_NO_ERR) {
+ LOG(("Could not get submit button value"));
+ goto dom_no_memory;
+ }
+ /* Drop through to report the successful button */
+ } else if (dom_string_caseless_isequal(
+ inputtype, corestring_dom_image)) {
+ /* We *ONLY* use an image input if it was the
+ * thing which activated us
+ */
+ LOG(("Examining image button"));
+ if ((dom_node *)submit_button !=
+ (dom_node *)form_element)
+ continue;
+
+ basename = ENCODE_ITEM(inputname);
+
+ success_new = calloc(1, sizeof(*success_new));
+ if (success_new == NULL) {
+ free(basename);
+ LOG(("Could not allocate data for image.x"));
+ goto dom_no_memory;
+ }
+
+ last_success->next = success_new;
+ last_success = success_new;
+
+ success_new->name = malloc(strlen(basename) + 3);
+ if (success_new->name == NULL) {
+ free(basename);
+ LOG(("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"));
+ goto dom_no_memory;
+ }
+ sprintf(success_new->name, "%s.x", basename);
+ /** \todo Store this on the node and
+ * retrieve it here
+ */
+ sprintf(success_new->value, "%d", 0);
+
+ success_new = calloc(1, sizeof(*success_new));
+ if (success_new == NULL) {
+ free(basename);
+ LOG(("Could not allocate data for image.y"));
+ goto dom_no_memory;
+ }
+
+ last_success->next = success_new;
+ last_success = success_new;
+
+ success_new->name = malloc(strlen(basename) + 3);
+ if (success_new->name == NULL) {
+ free(basename);
+ LOG(("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"));
+ goto dom_no_memory;
+ }
+ sprintf(success_new->name, "%s.y", basename);
+ /** \todo Store this on the node and
+ * retrieve it here
+ */
+ sprintf(success_new->value, "%d", 0);
+ free(basename);
+ continue;
+ } else if (dom_string_caseless_isequal(
+ inputtype, corestring_dom_radio) ||
+ dom_string_caseless_isequal(
+ inputtype, corestring_dom_checkbox)) {
+ LOG(("Examining radio or checkbox"));
+ err = dom_html_input_element_get_value(
+ (dom_html_input_element *)form_element,
+ &inputvalue);
+ if (err != DOM_NO_ERR) {
+ LOG(("Could not get input element value"));
+ goto dom_no_memory;
+ }
+ if (inputvalue == NULL)
+ inputvalue = dom_string_ref(
+ corestring_dom_on);
+ /* Fall through to simple allocation */
+ } else if (dom_string_caseless_isequal(
+ inputtype, corestring_dom_file)) {
+ LOG(("Examining file input"));
+ err = dom_html_input_element_get_value(
+ (dom_html_input_element *)form_element,
+ &inputvalue);
+ if (err != DOM_NO_ERR) {
+ LOG(("Could not get file value"));
+ goto dom_no_memory;
+ }
+ err = dom_node_get_user_data(
+ form_element,
+ corestring_dom___ns_key_file_name_node_data,
+ &rawfile_temp);
+ if (err != DOM_NO_ERR) {
+ LOG(("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"));
+ goto dom_no_memory;
+ }
+ /* Fall out to the allocation */
+ } else if (dom_string_caseless_isequal(
+ inputtype, corestring_dom_reset) ||
+ dom_string_caseless_isequal(
+ inputtype, corestring_dom_button)) {
+ /* Skip these */
+ LOG(("Skipping RESET and BUTTON"));
+ continue;
+ } else {
+ /* Everything else is treated as text values */
+ LOG(("Retrieving generic input text"));
+ err = dom_html_input_element_get_value(
+ (dom_html_input_element *)form_element,
+ &inputvalue);
+ if (err != DOM_NO_ERR) {
+ LOG(("Could not get input value"));
+ goto dom_no_memory;
+ }
+ /* Fall out to the allocation */
+ }
+ }
+
+ success_new = calloc(1, sizeof(*success_new));
+ if (success_new == NULL) {
+ LOG(("Could not allocate data for generic"));
+ goto dom_no_memory;
+ }
+
+ last_success->next = success_new;
+ last_success = success_new;
+
+ success_new->name = ENCODE_ITEM(inputname);
+ if (success_new->name == NULL) {
+ LOG(("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"));
+ goto dom_no_memory;
+ }
+ if (rawfile_temp != NULL) {
+ success_new->file = true;
+ success_new->rawfile = rawfile_temp;
+ rawfile_temp = NULL;
+ }
+ }
+
+ free(charset);
+ if (form_element != NULL) {
+ LOG(("Unreffed %p", form_element));
+ dom_node_unref(form_element);
+ }
+ if (form_elements != NULL) {
+ LOG(("Unreffed %p", form_elements));
+ dom_html_collection_unref(form_elements);
+ }
+ if (nodename != NULL)
+ dom_string_unref(nodename);
+ if (inputname != NULL)
+ dom_string_unref(inputname);
+ if (inputvalue != NULL)
+ dom_string_unref(inputvalue);
+ if (options != NULL)
+ dom_html_options_collection_unref(options);
+ if (option_element != NULL)
+ dom_node_unref(option_element);
+ if (inputtype != NULL)
+ dom_string_unref(inputtype);
+ if (rawfile_temp != NULL)
+ free(rawfile_temp);
+ *successful_controls = sentinel.next;
+
+ for (success_new = *successful_controls; success_new != NULL;
+ success_new = success_new->next) {
+ LOG(("%p -> %s=%s", success_new, success_new->name, success_new->value));
+ LOG(("%p -> file=%s rawfile=%s", success_new,
+ success_new->file ? "yes" : "no", success_new->rawfile));
+ }
+ return true;
+
+dom_no_memory:
+ free(charset);
+ fetch_multipart_data_destroy(sentinel.next);
+
+ if (form_elements != NULL)
+ dom_html_collection_unref(form_elements);
+ if (form_element != NULL)
+ dom_node_unref(form_element);
+ if (nodename != NULL)
+ dom_string_unref(nodename);
+ if (inputname != NULL)
+ dom_string_unref(inputname);
+ if (inputvalue != NULL)
+ dom_string_unref(inputvalue);
+ if (options != NULL)
+ dom_html_options_collection_unref(options);
+ if (option_element != NULL)
+ dom_node_unref(option_element);
+ if (inputtype != NULL)
+ dom_string_unref(inputtype);
+ if (rawfile_temp != NULL)
+ free(rawfile_temp);
+
+ return false;
+}
+#undef ENCODE_ITEM
+
/**
* Identify 'successful' controls.
*
@@ -356,7 +859,7 @@ bool form_successful_controls(struct form *form,
if (charset == NULL)
return false;
-#define ENCODE_ITEM(i) form_encode_item((i), charset, form->document_charset)
+#define ENCODE_ITEM(i) form_encode_item((i), 0, charset, form->document_charset)
for (control = form->controls; control; control = control->next) {
/* ignore disabled controls */
@@ -812,12 +1315,13 @@ char *form_acceptable_charset(struct form *form)
* \todo Return charset used?
*
* \param item String to convert
+ * \param len Length of string to convert
* \param charset Destination charset
* \param fallback Fallback charset (may be NULL),
* used iff converting to charset fails
* \return Pointer to converted string (on heap, caller frees), or NULL
*/
-char *form_encode_item(const char *item, const char *charset,
+char *form_encode_item(const char *item, uint32_t len, const char *charset,
const char *fallback)
{
utf8_convert_ret err;
@@ -833,7 +1337,7 @@ char *form_encode_item(const char *item, const char *charset,
if (err == UTF8_CONVERT_BADENC) {
/* charset not understood, try without transliteration */
snprintf(cset, sizeof cset, "%s", charset);
- err = utf8_to_enc(item, cset, 0, &ret);
+ err = utf8_to_enc(item, cset, len, &ret);
if (err == UTF8_CONVERT_BADENC) {
/* nope, try fallback charset (if any) */
@@ -1490,7 +1994,7 @@ void form_submit(nsurl *page_url, struct browser_window *target,
assert(form != NULL);
- if (form_successful_controls(form, submit_button, &success) == false) {
+ if (form_successful_controls_dom(form, submit_button, &success) == false) {
warn_user("NoMemory", 0);
return;
}
diff --git a/render/form.h b/render/form.h
index b538c3b33..e65206d33 100644
--- a/render/form.h
+++ b/render/form.h
@@ -159,6 +159,9 @@ bool form_add_option(struct form_control *control, char *value, char *text,
bool form_successful_controls(struct form *form,
struct form_control *submit_button,
struct fetch_multipart_data **successful_controls);
+bool form_successful_controls_dom(struct form *form,
+ struct form_control *submit_button,
+ struct fetch_multipart_data **successful_controls);
bool form_open_select_menu(void *client_data,
struct form_control *control,
diff --git a/utils/corestrings.c b/utils/corestrings.c
index 8623d127b..9050ffe48 100644
--- a/utils/corestrings.c
+++ b/utils/corestrings.c
@@ -232,6 +232,16 @@ dom_string *corestring_dom_volumechange;
dom_string *corestring_dom_vspace;
dom_string *corestring_dom_waiting;
dom_string *corestring_dom_width;
+dom_string *corestring_dom_BUTTON;
+dom_string *corestring_dom_INPUT;
+dom_string *corestring_dom_SELECT;
+dom_string *corestring_dom_TEXTAREA;
+dom_string *corestring_dom_button;
+dom_string *corestring_dom_image;
+dom_string *corestring_dom_radio;
+dom_string *corestring_dom_checkbox;
+dom_string *corestring_dom_file;
+dom_string *corestring_dom_on;
dom_string *corestring_dom___ns_key_libcss_node_data;
dom_string *corestring_dom___ns_key_file_name_node_data;
@@ -463,6 +473,19 @@ void corestrings_fini(void)
CSS_DOM_STRING_UNREF(vspace);
CSS_DOM_STRING_UNREF(waiting);
CSS_DOM_STRING_UNREF(width);
+ /* DOM node names, not really CSS */
+ CSS_DOM_STRING_UNREF(BUTTON);
+ CSS_DOM_STRING_UNREF(INPUT);
+ CSS_DOM_STRING_UNREF(SELECT);
+ CSS_DOM_STRING_UNREF(TEXTAREA);
+ /* DOM input types, not really CSS */
+ CSS_DOM_STRING_UNREF(button);
+ CSS_DOM_STRING_UNREF(image);
+ CSS_DOM_STRING_UNREF(radio);
+ CSS_DOM_STRING_UNREF(checkbox);
+ CSS_DOM_STRING_UNREF(file);
+ CSS_DOM_STRING_UNREF(on);
+ /* DOM userdata keys, not really CSS */
CSS_DOM_STRING_UNREF(__ns_key_libcss_node_data);
CSS_DOM_STRING_UNREF(__ns_key_file_name_node_data);
#undef CSS_DOM_STRING_UNREF
@@ -725,6 +748,19 @@ nserror corestrings_init(void)
CSS_DOM_STRING_INTERN(vspace);
CSS_DOM_STRING_INTERN(waiting);
CSS_DOM_STRING_INTERN(width);
+ /* DOM node names, not really CSS */
+ CSS_DOM_STRING_INTERN(BUTTON);
+ CSS_DOM_STRING_INTERN(INPUT);
+ CSS_DOM_STRING_INTERN(SELECT);
+ CSS_DOM_STRING_INTERN(TEXTAREA);
+ /* DOM input types, not really CSS */
+ CSS_DOM_STRING_INTERN(button);
+ CSS_DOM_STRING_INTERN(image);
+ CSS_DOM_STRING_INTERN(radio);
+ CSS_DOM_STRING_INTERN(checkbox);
+ CSS_DOM_STRING_INTERN(file);
+ CSS_DOM_STRING_INTERN(on);
+ /* DOM userdata keys, not really CSS */
CSS_DOM_STRING_INTERN(__ns_key_libcss_node_data);
CSS_DOM_STRING_INTERN(__ns_key_file_name_node_data);
#undef CSS_DOM_STRING_INTERN
diff --git a/utils/corestrings.h b/utils/corestrings.h
index a8c345946..839d86522 100644
--- a/utils/corestrings.h
+++ b/utils/corestrings.h
@@ -238,6 +238,21 @@ extern struct dom_string *corestring_dom_volumechange;
extern struct dom_string *corestring_dom_vspace;
extern struct dom_string *corestring_dom_waiting;
extern struct dom_string *corestring_dom_width;
+/* DOM node types */
+extern struct dom_string *corestring_dom_BUTTON;
+extern struct dom_string *corestring_dom_INPUT;
+extern struct dom_string *corestring_dom_SELECT;
+extern struct dom_string *corestring_dom_TEXTAREA;
+/* DOM input node types */
+extern struct dom_string *corestring_dom_button;
+/* extern struct dom_string *corestring_dom_submit; */
+/* extern struct dom_string *corestring_dom_reset; */
+extern struct dom_string *corestring_dom_image;
+extern struct dom_string *corestring_dom_radio;
+extern struct dom_string *corestring_dom_checkbox;
+extern struct dom_string *corestring_dom_file;
+extern struct dom_string *corestring_dom_on;
+/* DOM userdata keys */
extern struct dom_string *corestring_dom___ns_key_libcss_node_data;
extern struct dom_string *corestring_dom___ns_key_file_name_node_data;
From d8ad3b8e7893630d3866bc56c90f6f7556ab1740 Mon Sep 17 00:00:00 2001
From: Rob Kendrick
Date: Sun, 5 Jan 2014 16:01:03 +0000
Subject: [PATCH 051/773] Add new gui entry point for file open dialogue
requests
---
amiga/gui.c | 12 ++++++++++--
atari/gui.c | 7 +++++++
beos/gui.cpp | 8 ++++++++
cocoa/gui.m | 7 +++++++
desktop/gui.h | 3 ++-
gtk/gui.c | 9 ++++++---
monkey/browser.c | 7 +++++++
riscos/gui.c | 8 ++++++++
8 files changed, 55 insertions(+), 6 deletions(-)
diff --git a/amiga/gui.c b/amiga/gui.c
index 103d3a1e8..76185e949 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -4232,8 +4232,8 @@ static void ami_gui_window_update_box_deferred(struct gui_window *g, bool draw)
static bool ami_gui_window_update_box_deferred_check(struct MinList *deferred_rects,
const struct rect *new_rect)
{
- struct nsObject *node;
- struct nsObject *nnode;
+struct nsObject *node;
+struct nsObject *nnode;
struct rect *rect;
if(IsMinListEmpty(deferred_rects)) return true;
@@ -5137,3 +5137,11 @@ void ami_gui_splash_close(Object *win_obj)
{
if(win_obj) DisposeObject(win_obj);
}
+
+void gui_file_gadget_open(struct browser_window *bw, hlcache_handle *hl,
+ struct form_control *gadget)
+{
+ LOG(("File open dialog rquest for %p/%p", bw, gadget));
+ /* browser_window_set_gadget_filename(bw, gadget, "filename"); */
+}
+
diff --git a/atari/gui.c b/atari/gui.c
index e52a6589c..badb4206c 100644
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -1098,6 +1098,13 @@ static void gui_init2(int argc, char** argv)
toolbar_init();
}
+void gui_file_gadget_open(struct browser_window *bw, hlcache_handle *hl,
+ struct form_control *gadget)
+{
+ LOG(("File open dialog rquest for %p/%p", bw, gadget));
+ /* browser_window_set_gadget_filename(bw, gadget, "filename"); */
+}
+
/* #define WITH_DBG_LOGFILE 1 */
/** Entry point from OS.
*
diff --git a/beos/gui.cpp b/beos/gui.cpp
index 204c11caf..6c9d1ed12 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -1164,3 +1164,11 @@ bool path_add_part(char *path, int length, const char *newpart)
return true;
}
+
+void gui_file_gadget_open(struct browser_window *bw, hlcache_handle *hl,
+ struct form_control *gadget)
+{
+ LOG(("File open dialog rquest for %p/%p", bw, gadget));
+ /* browser_window_set_gadget_filename(bw, gadget, "filename"); */
+}
+
diff --git a/cocoa/gui.m b/cocoa/gui.m
index b2ff01dc0..3804ad249 100644
--- a/cocoa/gui.m
+++ b/cocoa/gui.m
@@ -324,3 +324,10 @@ void gui_401login_open(nsurl *url, const char *realm,
cb( false, cbpw );
}
+void gui_file_gadget_open(struct browser_window *bw, hlcache_handle *hl,
+ struct form_control *gadget)
+{
+ LOG(("File open dialog rquest for %p/%p", bw, gadget));
+ /* browser_window_set_gadget_filename(bw, gadget, "filename"); */
+}
+
diff --git a/desktop/gui.h b/desktop/gui.h
index 9d35e1727..4bbf08718 100644
--- a/desktop/gui.h
+++ b/desktop/gui.h
@@ -116,7 +116,8 @@ void gui_drag_save_selection(struct gui_window *g, const char *selection);
void gui_start_selection(struct gui_window *g);
void gui_clear_selection(struct gui_window *g);
-
+void gui_file_gadget_open(struct browser_window *bw, hlcache_handle *hl,
+ struct form_control *gadget);
/**
* Core asks front end for clipboard contents.
diff --git a/gtk/gui.c b/gtk/gui.c
index 649c4a239..0f815a7a2 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -681,9 +681,12 @@ void gui_quit(void)
gtk_fetch_filetype_fin();
}
-
-
-
+void gui_file_gadget_open(struct browser_window *bw, hlcache_handle *hl,
+ struct form_control *gadget)
+{
+ LOG(("File open dialog rquest for %p/%p", bw, gadget));
+ /* browser_window_set_gadget_filename(bw, gadget, "plinth"); */
+}
static void nsgtk_select_menu_clicked(GtkCheckMenuItem *checkmenuitem,
gpointer user_data)
diff --git a/monkey/browser.c b/monkey/browser.c
index 09ecf4b11..47fb07bc1 100644
--- a/monkey/browser.c
+++ b/monkey/browser.c
@@ -390,6 +390,13 @@ gui_window_save_link(struct gui_window *g, const char *url,
g->win_num, url, title);
}
+void gui_file_gadget_open(struct browser_window *bw, hlcache_handle *hl,
+ struct form_control *gadget)
+{
+ LOG(("File open dialog rquest for %p/%p", bw, gadget));
+ /* browser_window_set_gadget_filename(bw, gadget, "filename"); */
+}
+
/**** Handlers ****/
diff --git a/riscos/gui.c b/riscos/gui.c
index bb1a318de..0c8ebecc7 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -2423,3 +2423,11 @@ bool path_add_part(char *path, int length, const char *newpart)
return true;
}
+
+void gui_file_gadget_open(struct browser_window *bw, hlcache_handle *hl,
+ struct form_control *gadget)
+{
+ LOG(("File open dialog rquest for %p/%p", bw, gadget));
+ /* browser_window_set_gadget_filename(bw, gadget, "filename"); */
+}
+
From 0d7f1cfc93008add9a082c2c54de8427ac0f1786 Mon Sep 17 00:00:00 2001
From: Rob Kendrick
Date: Sun, 5 Jan 2014 16:04:35 +0000
Subject: [PATCH 052/773] Add infrastructure for calling front ends to set file
gadget filenames via clicking in addition to drag-and-drop
---
content/content.h | 7 ++++-
desktop/browser.c | 17 ++++++++++-
desktop/browser.h | 3 ++
render/html.c | 70 ++++++++++++++++++++++++++------------------
render/html.h | 2 ++
render/html_object.c | 1 +
6 files changed, 69 insertions(+), 31 deletions(-)
diff --git a/content/content.h b/content/content.h
index 467fa6055..91a6ae9df 100644
--- a/content/content.h
+++ b/content/content.h
@@ -83,7 +83,8 @@ typedef enum {
CONTENT_MSG_POINTER, /**< Wants a specific mouse pointer set */
CONTENT_MSG_SELECTION, /**< A selection made or cleared */
CONTENT_MSG_CARET, /**< Caret movement / hiding */
- CONTENT_MSG_DRAG /**< A drag started or ended */
+ CONTENT_MSG_DRAG, /**< A drag started or ended */
+ CONTENT_MSG_GADGETCLICK/**< A gadget has been clicked on (mainly for file) */
} content_msg;
/** RFC5988 metadata link */
@@ -190,6 +191,10 @@ union content_msg_data {
} type;
const struct rect *rect;
} drag;
+ /** CONTENT_MSG_GADGETCLICK - User clicked on a form gadget */
+ struct {
+ struct form_control *gadget;
+ } gadget_click;
};
/** parameters to content redraw */
diff --git a/desktop/browser.c b/desktop/browser.c
index 83b06bac5..3d279f727 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -661,6 +661,13 @@ bool browser_window_drop_file_at_point(struct browser_window *bw,
return false;
}
+void browser_window_set_gadget_filename(struct browser_window *bw,
+ struct form_control *gadget, const char *fn)
+{
+ html_set_file_gadget_filename(bw->current_content,
+ gadget, fn);
+}
+
/* exported interface, documented in browser.h */
void browser_window_debug_dump(struct browser_window *bw, FILE *f)
{
@@ -1162,7 +1169,7 @@ static void browser_window_convert_to_download(struct browser_window *bw,
/**
- * Callback for fetchcache() for browser window fetches.
+ * Callback handler for content event messages.
*/
static nserror browser_window_callback(hlcache_handle *c,
@@ -1555,6 +1562,14 @@ static nserror browser_window_callback(hlcache_handle *c,
event->data.selection.read_only);
break;
+ case CONTENT_MSG_GADGETCLICK:
+ if (event->data.gadget_click.gadget->type == GADGET_FILE) {
+ gui_file_gadget_open(bw, c,
+ event->data.gadget_click.gadget);
+ }
+
+ break;
+
default:
break;
}
diff --git a/desktop/browser.h b/desktop/browser.h
index ee55e72c4..0ca2e009b 100644
--- a/desktop/browser.h
+++ b/desktop/browser.h
@@ -173,6 +173,9 @@ bool browser_window_scroll_at_point(struct browser_window *bw,
bool browser_window_drop_file_at_point(struct browser_window *bw,
int x, int y, char *file);
+void browser_window_set_gadget_filename(struct browser_window *bw,
+ struct form_control *gadget, const char *fn);
+
void browser_window_refresh_url_bar(struct browser_window *bw, nsurl *url,
lwc_string *frag);
diff --git a/render/html.c b/render/html.c
index c1e831571..103dec14f 100644
--- a/render/html.c
+++ b/render/html.c
@@ -1729,6 +1729,46 @@ static void html__dom_user_data_handler(dom_node_operation operation,
}
}
+static void html__set_file_gadget_filename(struct content *c,
+ struct form_control *gadget, const char *fn)
+{
+ utf8_convert_ret ret;
+ char *utf8_fn, *oldfile = NULL;
+ html_content *html = (html_content *)c;
+ struct box *file_box = gadget->box;
+
+ ret = utf8_from_local_encoding(fn,0, &utf8_fn);
+ if (ret != UTF8_CONVERT_OK) {
+ assert(ret != UTF8_CONVERT_BADENC);
+ LOG(("utf8_from_local_encoding failed"));
+ /* Load was for us - just no memory */
+ return;
+ }
+
+ form_gadget_update_value(html, gadget, utf8_fn);
+
+ /* corestring_dom___ns_key_file_name_node_data */
+ LOG(("XYZZY: Setting userdata to %s", fn));
+ if (dom_node_set_user_data((dom_node *)file_box->gadget->node,
+ corestring_dom___ns_key_file_name_node_data,
+ strdup(fn), html__dom_user_data_handler,
+ &oldfile) == DOM_NO_ERR) {
+ LOG(("XYZZY: Userdata used to be %s", oldfile));
+ if (oldfile != NULL)
+ free(oldfile);
+ }
+
+ /* Redraw box. */
+ html__redraw_a_box(html, file_box);
+}
+
+void html_set_file_gadget_filename(struct hlcache_handle *hl,
+ struct form_control *gadget, const char *fn)
+{
+ return html__set_file_gadget_filename(hlcache_handle_get_content(hl),
+ gadget, fn);
+}
+
/**
* Drop a file onto a content at a particular point, or determine if a file
* may be dropped onto the content at given point.
@@ -1794,35 +1834,7 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file)
/* Handle the drop */
if (file_box) {
/* File dropped on file input */
- utf8_convert_ret ret;
- char *utf8_fn, *oldfile = NULL;
-
- ret = utf8_from_local_encoding(file, 0,
- &utf8_fn);
- if (ret != UTF8_CONVERT_OK) {
- /* A bad encoding should never happen */
- assert(ret != UTF8_CONVERT_BADENC);
- LOG(("utf8_from_local_encoding failed"));
- /* Load was for us - just no memory */
- return true;
- }
-
- /* Found: update form input */
- form_gadget_update_value(html, file_box->gadget, utf8_fn);
-
- /* corestring_dom___ns_key_file_name_node_data */
- LOG(("XYZZY: Setting userdata to %s", file));
- if (dom_node_set_user_data((dom_node *)file_box->gadget->node,
- corestring_dom___ns_key_file_name_node_data,
- strdup(file), html__dom_user_data_handler,
- &oldfile) == DOM_NO_ERR) {
- LOG(("XYZZY: Userdata used to be %s", oldfile));
- if (oldfile != NULL)
- free(oldfile);
- }
-
- /* Redraw box. */
- html__redraw_a_box(html, file_box);
+ html__set_file_gadget_filename(c, box->gadget, file);
} else {
/* File dropped on text input */
diff --git a/render/html.h b/render/html.h
index 162541d72..7ca75e713 100644
--- a/render/html.h
+++ b/render/html.h
@@ -178,6 +178,8 @@ struct content_html_frames *html_get_frameset(struct hlcache_handle *h);
struct content_html_iframe *html_get_iframe(struct hlcache_handle *h);
nsurl *html_get_base_url(struct hlcache_handle *h);
const char *html_get_base_target(struct hlcache_handle *h);
+void html_set_file_gadget_filename(struct hlcache_handle *hl,
+ struct form_control *gadget, const char *fn);
/**
* Retrieve stylesheets used by HTML document
diff --git a/render/html_object.c b/render/html_object.c
index 7b34c4a7e..15ca7ed3b 100644
--- a/render/html_object.c
+++ b/render/html_object.c
@@ -368,6 +368,7 @@ html_object_callback(hlcache_handle *object,
case CONTENT_MSG_SAVELINK:
case CONTENT_MSG_POINTER:
+ 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);
From 6bf609a1a4b313d49e5a657b2cf421c092aa1414 Mon Sep 17 00:00:00 2001
From: Daniel Silverstone
Date: Sun, 5 Jan 2014 16:14:17 +0000
Subject: [PATCH 053/773] Support image inputs
---
render/form.c | 24 ++++++++++------
render/form.h | 5 ++++
render/html.c | 2 +-
render/html_interaction.c | 60 +++++++++++++++++++++++++++++++++++++--
utils/corestrings.c | 3 ++
utils/corestrings.h | 1 +
6 files changed, 84 insertions(+), 11 deletions(-)
diff --git a/render/form.c b/render/form.c
index 48648b103..b55ec171c 100644
--- a/render/form.c
+++ b/render/form.c
@@ -353,6 +353,7 @@ bool form_successful_controls_dom(struct form *_form,
bool had_submit = false, element_disabled;
char *charset, *rawfile_temp = NULL, *basename;
uint32_t index, element_count;
+ struct image_input_coords *coords;
last_success = &sentinel;
sentinel.next = NULL;
@@ -615,6 +616,19 @@ bool form_successful_controls_dom(struct form *_form,
(dom_node *)form_element)
continue;
+ err = dom_node_get_user_data(
+ form_element,
+ corestring_dom___ns_key_image_coords_node_data,
+ &coords);
+ if (err != DOM_NO_ERR) {
+ LOG(("Could not get image XY data"));
+ goto dom_no_memory;
+ }
+ if (coords == NULL) {
+ LOG(("No XY data on the image input"));
+ goto dom_no_memory;
+ }
+
basename = ENCODE_ITEM(inputname);
success_new = calloc(1, sizeof(*success_new));
@@ -640,10 +654,7 @@ bool form_successful_controls_dom(struct form *_form,
goto dom_no_memory;
}
sprintf(success_new->name, "%s.x", basename);
- /** \todo Store this on the node and
- * retrieve it here
- */
- sprintf(success_new->value, "%d", 0);
+ sprintf(success_new->value, "%d", coords->x);
success_new = calloc(1, sizeof(*success_new));
if (success_new == NULL) {
@@ -668,10 +679,7 @@ bool form_successful_controls_dom(struct form *_form,
goto dom_no_memory;
}
sprintf(success_new->name, "%s.y", basename);
- /** \todo Store this on the node and
- * retrieve it here
- */
- sprintf(success_new->value, "%d", 0);
+ sprintf(success_new->value, "%d", coords->y);
free(basename);
continue;
} else if (dom_string_caseless_isequal(
diff --git a/render/form.h b/render/form.h
index e65206d33..78211ee19 100644
--- a/render/form.h
+++ b/render/form.h
@@ -134,6 +134,11 @@ struct form_option {
struct form_option* next;
};
+struct image_input_coords {
+ int x;
+ int y;
+};
+
/**
* Called by the select menu when it wants an area to be redrawn. The
* coordinates are menu origin relative.
diff --git a/render/html.c b/render/html.c
index 04b2fda18..25147a0a0 100644
--- a/render/html.c
+++ b/render/html.c
@@ -1732,7 +1732,7 @@ static void html__dom_user_data_handler(dom_node_operation operation,
char *oldfile;
char *data = (char *)_data;
- if (!dom_string_isequal(corestring_dom___ns_key_libcss_node_data,
+ if (!dom_string_isequal(corestring_dom___ns_key_file_name_node_data,
key) || data == NULL) {
return;
}
diff --git a/render/html_interaction.c b/render/html_interaction.c
index f18daebd4..5d69c987f 100644
--- a/render/html_interaction.c
+++ b/render/html_interaction.c
@@ -45,8 +45,10 @@
#include "render/imagemap.h"
#include "render/search.h"
#include "javascript/js.h"
+#include "utils/corestrings.h"
#include "utils/messages.h"
#include "utils/utils.h"
+#include "utils/log.h"
/**
@@ -228,6 +230,47 @@ void html_mouse_track(struct content *c, struct browser_window *bw,
html_mouse_action(c, bw, mouse, x, y);
}
+/** Helper for file gadgets to store their filename unencoded on the
+ * dom node associated with the gadget.
+ *
+ * \todo Get rid of this crap eventually
+ */
+static void html__image_coords_dom_user_data_handler(dom_node_operation operation,
+ dom_string *key, void *_data, struct dom_node *src,
+ struct dom_node *dst)
+{
+ struct image_input_coords *oldcoords, *coords = _data, *newcoords;
+
+ if (!dom_string_isequal(corestring_dom___ns_key_image_coords_node_data,
+ key) || coords == NULL) {
+ return;
+ }
+
+ switch (operation) {
+ case DOM_NODE_CLONED:
+ newcoords = calloc(1, sizeof(*newcoords));
+ *newcoords = *coords;
+ if (dom_node_set_user_data(dst,
+ corestring_dom___ns_key_image_coords_node_data,
+ newcoords, html__image_coords_dom_user_data_handler,
+ &oldcoords) == DOM_NO_ERR) {
+ free(oldcoords);
+ }
+ break;
+
+ case DOM_NODE_RENAMED:
+ case DOM_NODE_IMPORTED:
+ case DOM_NODE_ADOPTED:
+ break;
+
+ case DOM_NODE_DELETED:
+ free(coords);
+ break;
+ default:
+ LOG(("User data operation not handled."));
+ assert(0);
+ }
+}
/**
* Handle mouse clicks and movements in an HTML content window.
@@ -630,8 +673,21 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
break;
case GADGET_IMAGE:
if (mouse & BROWSER_MOUSE_CLICK_1) {
- gadget->data.image.mx = x - gadget_box_x;
- gadget->data.image.my = y - gadget_box_y;
+ struct image_input_coords *coords, *oldcoords;
+ /** \todo Find a way to not ignore errors */
+ coords = calloc(1, sizeof(*coords));
+ if (coords == NULL) {
+ return;
+ }
+ coords->x = x - gadget_box_x;
+ coords->y = y - gadget_box_y;
+ if (dom_node_set_user_data(
+ gadget->node,
+ corestring_dom___ns_key_image_coords_node_data,
+ coords, html__image_coords_dom_user_data_handler,
+ &oldcoords) != DOM_NO_ERR)
+ return;
+ free(oldcoords);
}
/* drop through */
case GADGET_SUBMIT:
diff --git a/utils/corestrings.c b/utils/corestrings.c
index 9050ffe48..e60a75bdc 100644
--- a/utils/corestrings.c
+++ b/utils/corestrings.c
@@ -244,6 +244,7 @@ dom_string *corestring_dom_file;
dom_string *corestring_dom_on;
dom_string *corestring_dom___ns_key_libcss_node_data;
dom_string *corestring_dom___ns_key_file_name_node_data;
+dom_string *corestring_dom___ns_key_image_coords_node_data;
/*
* Free the core strings
@@ -488,6 +489,7 @@ void corestrings_fini(void)
/* DOM userdata keys, not really CSS */
CSS_DOM_STRING_UNREF(__ns_key_libcss_node_data);
CSS_DOM_STRING_UNREF(__ns_key_file_name_node_data);
+ CSS_DOM_STRING_UNREF(__ns_key_image_coords_node_data);
#undef CSS_DOM_STRING_UNREF
}
@@ -763,6 +765,7 @@ nserror corestrings_init(void)
/* DOM userdata keys, not really CSS */
CSS_DOM_STRING_INTERN(__ns_key_libcss_node_data);
CSS_DOM_STRING_INTERN(__ns_key_file_name_node_data);
+ CSS_DOM_STRING_INTERN(__ns_key_image_coords_node_data);
#undef CSS_DOM_STRING_INTERN
exc = dom_string_create_interned((const uint8_t *) "text/javascript",
diff --git a/utils/corestrings.h b/utils/corestrings.h
index 839d86522..90fef5aaa 100644
--- a/utils/corestrings.h
+++ b/utils/corestrings.h
@@ -255,6 +255,7 @@ extern struct dom_string *corestring_dom_on;
/* DOM userdata keys */
extern struct dom_string *corestring_dom___ns_key_libcss_node_data;
extern struct dom_string *corestring_dom___ns_key_file_name_node_data;
+extern struct dom_string *corestring_dom___ns_key_image_coords_node_data;
#endif
From 0d5960a68cc031758dd17edf7e83c342c13ea144 Mon Sep 17 00:00:00 2001
From: Daniel Silverstone
Date: Sun, 5 Jan 2014 16:14:45 +0000
Subject: [PATCH 054/773] Remove old form_successful_controls
---
render/form.c | 349 --------------------------------------------------
1 file changed, 349 deletions(-)
diff --git a/render/form.c b/render/form.c
index b55ec171c..761fc4c69 100644
--- a/render/form.c
+++ b/render/form.c
@@ -831,355 +831,6 @@ dom_no_memory:
}
#undef ENCODE_ITEM
-/**
- * Identify 'successful' controls.
- *
- * All text strings in the successful controls list will be in the charset most
- * appropriate for submission. Therefore, no utf8_to_* processing should be
- * performed upon them.
- *
- * \todo The chosen charset needs to be made available such that it can be
- * included in the submission request (e.g. in the fetch's Content-Type header)
- *
- * \param form form to search for successful controls
- * \param submit_button control used to submit the form, if any
- * \param successful_controls updated to point to linked list of
- * fetch_multipart_data, 0 if no controls
- * \return true on success, false on memory exhaustion
- *
- * See HTML 4.01 section 17.13.2.
- */
-bool form_successful_controls(struct form *form,
- struct form_control *submit_button,
- struct fetch_multipart_data **successful_controls)
-{
- struct form_control *control;
- struct form_option *option;
- struct fetch_multipart_data sentinel, *last_success, *success_new;
- char *value = NULL;
- bool had_submit = false;
- char *charset, *rawfile_temp;
-
- last_success = &sentinel;
- sentinel.next = NULL;
-
- charset = form_acceptable_charset(form);
- if (charset == NULL)
- return false;
-
-#define ENCODE_ITEM(i) form_encode_item((i), 0, charset, form->document_charset)
-
- for (control = form->controls; control; control = control->next) {
- /* ignore disabled controls */
- if (control->disabled)
- continue;
-
- /* ignore controls with no name */
- if (!control->name)
- continue;
-
- switch (control->type) {
- case GADGET_HIDDEN:
- if (control->value)
- value = ENCODE_ITEM(control->value);
- else
- value = ENCODE_ITEM("");
- if (!value) {
- LOG(("failed to duplicate value"
- "'%s' for control %s",
- control->value,
- control->name));
- goto no_memory;
- }
- break;
-
- case GADGET_RADIO:
- case GADGET_CHECKBOX:
- /* ignore checkboxes and radio buttons which
- * aren't selected */
- if (!control->selected)
- continue;
- if (control->value)
- value = ENCODE_ITEM(control->value);
- else
- value = ENCODE_ITEM("on");
- if (!value) {
- LOG(("failed to duplicate"
- "value '%s' for"
- "control %s",
- control->value,
- control->name));
- goto no_memory;
- }
- break;
-
- case GADGET_SELECT:
- /* select */
- for (option = control->data.select.items;
- option != NULL;
- option = option->next) {
- if (!option->selected)
- continue;
- success_new =
- malloc(sizeof(*success_new));
- if (!success_new) {
- LOG(("malloc failed"));
- goto no_memory;
- }
- success_new->file = false;
- success_new->name =
- ENCODE_ITEM(control->name);
- success_new->value =
- ENCODE_ITEM(option->value);
- success_new->next = NULL;
- last_success->next = success_new;
- last_success = success_new;
- if (!success_new->name ||
- !success_new->value) {
- LOG(("strdup failed"));
- goto no_memory;
- }
- }
-
- continue;
- break;
-
- case GADGET_TEXTBOX:
- case GADGET_PASSWORD:
- case GADGET_TEXTAREA:
- {
- char *v2;
- int ta_len = textarea_get_text(
- control->data.text.ta,
- NULL, 0);
-
- value = malloc(ta_len);
- if (!value) {
- LOG(("failed handling textarea"));
- goto no_memory;
- }
- textarea_get_text(control->data.text.ta,
- value, ta_len);
-
- if (control->type == GADGET_TEXTAREA &&
- value[0] == '\0') {
- /* Textarea not submitted if empty */
- free(value);
- continue;
- }
-
- v2 = ENCODE_ITEM(value);
- if (!v2) {
- LOG(("failed handling textarea"));
- free(value);
- goto no_memory;
- }
-
- free(value);
- value = v2;
- }
- break;
-
- case GADGET_IMAGE: {
- /* image */
- size_t len;
- char *name;
-
- if (control != submit_button)
- /* only the activated submit button
- * is successful */
- continue;
-
- name = ENCODE_ITEM(control->name);
- if (name == NULL)
- goto no_memory;
-
- len = strlen(name) + 3;
-
- /* x */
- success_new = malloc(sizeof(*success_new));
- if (!success_new) {
- free(name);
- LOG(("malloc failed"));
- goto no_memory;
- }
- success_new->file = false;
- success_new->name = malloc(len);
- success_new->value = malloc(20);
- if (!success_new->name ||
- !success_new->value) {
- free(success_new->name);
- free(success_new->value);
- free(success_new);
- free(name);
- LOG(("malloc failed"));
- goto no_memory;
- }
- sprintf(success_new->name, "%s.x", name);
- sprintf(success_new->value, "%i",
- control->data.image.mx);
- success_new->next = 0;
- last_success->next = success_new;
- last_success = success_new;
-
- /* y */
- success_new = malloc(sizeof(*success_new));
- if (!success_new) {
- free(name);
- LOG(("malloc failed"));
- goto no_memory;
- }
- success_new->file = false;
- success_new->name = malloc(len);
- success_new->value = malloc(20);
- if (!success_new->name ||
- !success_new->value) {
- free(success_new->name);
- free(success_new->value);
- free(success_new);
- free(name);
- LOG(("malloc failed"));
- goto no_memory;
- }
- sprintf(success_new->name, "%s.y", name);
- sprintf(success_new->value, "%i",
- control->data.image.my);
- success_new->next = 0;
- last_success->next = success_new;
- last_success = success_new;
-
- free(name);
-
- continue;
- break;
- }
-
- case GADGET_SUBMIT:
- if (!submit_button && !had_submit)
- /* no submit button specified, so
- * use first declared in form */
- had_submit = true;
- else if (control != submit_button)
- /* only the activated submit button
- * is successful */
- continue;
- if (control->value)
- value = ENCODE_ITEM(control->value);
- else
- value = ENCODE_ITEM("");
- if (!value) {
- LOG(("failed to duplicate value"
- "'%s' for control %s",
- control->value,
- control->name));
- goto no_memory;
- }
- break;
-
- case GADGET_RESET:
- /* ignore reset */
- continue;
- break;
-
- case GADGET_FILE:
- /* file */
- /* Handling of blank file entries is
- * implementation defined - we're perfectly
- * within our rights to treat it as an
- * unsuccessful control. Unfortunately, every
- * other browser submits the field with
- * a blank filename and no content. So,
- * that's what we have to do, too.
- */
- success_new = malloc(sizeof(*success_new));
- if (!success_new) {
- LOG(("malloc failed"));
- goto no_memory;
- }
- success_new->file = true;
- success_new->name = ENCODE_ITEM(control->name);
- success_new->value =
- ENCODE_ITEM(control->value ?
- control->value : "");
- success_new->rawfile = NULL;
- /* Retrieve the filename from the DOM annotation */
- if (dom_node_get_user_data(
- control->node,
- corestring_dom___ns_key_file_name_node_data,
- &rawfile_temp) != DOM_NO_ERR) {
- LOG(("unable to get rawfile"));
- goto no_memory;
- }
-
- if (rawfile_temp == NULL) {
- /* No annotation means the file was not
- */
- success_new->rawfile = strdup("");
- } else {
- success_new->rawfile = strdup(rawfile_temp);
- }
-
- if (success_new->rawfile == NULL) {
- LOG(("strdup failed"));
- goto no_memory;
- }
-
- success_new->next = 0;
- last_success->next = success_new;
- last_success = success_new;
- if (!success_new->name ||
- !success_new->value) {
- LOG(("strdup failed"));
- goto no_memory;
- }
-
- continue;
- break;
-
- case GADGET_BUTTON:
- /* Ignore it */
- continue;
- break;
-
- default:
- assert(0);
- break;
- }
-
- success_new = malloc(sizeof(*success_new));
- if (!success_new) {
- LOG(("malloc failed"));
- free(value);
- goto no_memory;
- }
- success_new->file = false;
- success_new->name = ENCODE_ITEM(control->name);
- success_new->value = value;
- success_new->next = NULL;
- last_success->next = success_new;
- last_success = success_new;
- if (!success_new->name) {
- LOG(("failed to duplicate name '%s'",
- control->name));
- goto no_memory;
- }
- }
-
- free(charset);
-
- *successful_controls = sentinel.next;
- return true;
-
-no_memory:
- warn_user("NoMemory", 0);
- free(charset);
- fetch_multipart_data_destroy(sentinel.next);
- return false;
-
-#undef ENCODE_ITEM
-}
-
-
/**
* Encode controls using application/x-www-form-urlencoded.
*
From 550c8cd73c06f0984ce22b844d5a216d332cee43 Mon Sep 17 00:00:00 2001
From: Rob Kendrick
Date: Sun, 5 Jan 2014 16:45:32 +0000
Subject: [PATCH 055/773] Change gui_file_gadget_interface to pass gui_window
not browser_window, add GTK implementation that of course does not work.
---
amiga/gui.c | 2 +-
atari/gui.c | 2 +-
beos/gui.cpp | 2 +-
cocoa/gui.m | 2 +-
desktop/browser.c | 2 +-
desktop/gui.h | 2 +-
gtk/gui.c | 7 -------
gtk/window.c | 32 ++++++++++++++++++++++++++++++++
monkey/browser.c | 2 +-
riscos/gui.c | 2 +-
10 files changed, 40 insertions(+), 15 deletions(-)
diff --git a/amiga/gui.c b/amiga/gui.c
index 76185e949..8027eeba0 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -5138,7 +5138,7 @@ void ami_gui_splash_close(Object *win_obj)
if(win_obj) DisposeObject(win_obj);
}
-void gui_file_gadget_open(struct browser_window *bw, hlcache_handle *hl,
+void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
struct form_control *gadget)
{
LOG(("File open dialog rquest for %p/%p", bw, gadget));
diff --git a/atari/gui.c b/atari/gui.c
index badb4206c..3b3e98943 100644
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -1098,7 +1098,7 @@ static void gui_init2(int argc, char** argv)
toolbar_init();
}
-void gui_file_gadget_open(struct browser_window *bw, hlcache_handle *hl,
+void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
struct form_control *gadget)
{
LOG(("File open dialog rquest for %p/%p", bw, gadget));
diff --git a/beos/gui.cpp b/beos/gui.cpp
index 6c9d1ed12..42edc61aa 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -1165,7 +1165,7 @@ bool path_add_part(char *path, int length, const char *newpart)
return true;
}
-void gui_file_gadget_open(struct browser_window *bw, hlcache_handle *hl,
+void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
struct form_control *gadget)
{
LOG(("File open dialog rquest for %p/%p", bw, gadget));
diff --git a/cocoa/gui.m b/cocoa/gui.m
index 3804ad249..7ee2372f3 100644
--- a/cocoa/gui.m
+++ b/cocoa/gui.m
@@ -324,7 +324,7 @@ void gui_401login_open(nsurl *url, const char *realm,
cb( false, cbpw );
}
-void gui_file_gadget_open(struct browser_window *bw, hlcache_handle *hl,
+void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
struct form_control *gadget)
{
LOG(("File open dialog rquest for %p/%p", bw, gadget));
diff --git a/desktop/browser.c b/desktop/browser.c
index 3d279f727..6ec31d22f 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -1564,7 +1564,7 @@ static nserror browser_window_callback(hlcache_handle *c,
case CONTENT_MSG_GADGETCLICK:
if (event->data.gadget_click.gadget->type == GADGET_FILE) {
- gui_file_gadget_open(bw, c,
+ gui_file_gadget_open(bw->window, c,
event->data.gadget_click.gadget);
}
diff --git a/desktop/gui.h b/desktop/gui.h
index 4bbf08718..26a9f4b43 100644
--- a/desktop/gui.h
+++ b/desktop/gui.h
@@ -116,7 +116,7 @@ void gui_drag_save_selection(struct gui_window *g, const char *selection);
void gui_start_selection(struct gui_window *g);
void gui_clear_selection(struct gui_window *g);
-void gui_file_gadget_open(struct browser_window *bw, hlcache_handle *hl,
+void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
struct form_control *gadget);
/**
diff --git a/gtk/gui.c b/gtk/gui.c
index 0f815a7a2..77b72f874 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -681,13 +681,6 @@ void gui_quit(void)
gtk_fetch_filetype_fin();
}
-void gui_file_gadget_open(struct browser_window *bw, hlcache_handle *hl,
- struct form_control *gadget)
-{
- LOG(("File open dialog rquest for %p/%p", bw, gadget));
- /* browser_window_set_gadget_filename(bw, gadget, "plinth"); */
-}
-
static void nsgtk_select_menu_clicked(GtkCheckMenuItem *checkmenuitem,
gpointer user_data)
{
diff --git a/gtk/window.c b/gtk/window.c
index 8f449ced2..8f05c3799 100644
--- a/gtk/window.c
+++ b/gtk/window.c
@@ -1162,3 +1162,35 @@ void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
LOG(("width: %i", *width));
LOG(("height: %i", *height));
}
+
+void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
+ struct form_control *gadget)
+{
+ GtkWidget *dialog;
+
+ LOG(("Awooga."));
+
+ dialog = gtk_file_chooser_dialog_new("Select File",
+ nsgtk_scaffolding_window(g->scaffold),
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ NULL);
+
+ LOG(("*** open dialog: %p", dialog));
+
+ int ret = gtk_dialog_run(GTK_DIALOG(dialog));
+ LOG(("*** return value: %d", ret));
+ if (ret == GTK_RESPONSE_ACCEPT) {
+ char *filename;
+
+ filename = gtk_file_chooser_get_filename(
+ GTK_FILE_CHOOSER(dialog));
+
+ browser_window_set_gadget_filename(g->bw, gadget, filename);
+
+ g_free(filename);
+ }
+
+ gtk_widget_destroy(dialog);
+}
diff --git a/monkey/browser.c b/monkey/browser.c
index 47fb07bc1..7c28cf8a3 100644
--- a/monkey/browser.c
+++ b/monkey/browser.c
@@ -390,7 +390,7 @@ gui_window_save_link(struct gui_window *g, const char *url,
g->win_num, url, title);
}
-void gui_file_gadget_open(struct browser_window *bw, hlcache_handle *hl,
+void gui_file_gadget_open(struct gui_browser *g, hlcache_handle *hl,
struct form_control *gadget)
{
LOG(("File open dialog rquest for %p/%p", bw, gadget));
diff --git a/riscos/gui.c b/riscos/gui.c
index 0c8ebecc7..900915483 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -2424,7 +2424,7 @@ bool path_add_part(char *path, int length, const char *newpart)
return true;
}
-void gui_file_gadget_open(struct browser_window *bw, hlcache_handle *hl,
+void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
struct form_control *gadget)
{
LOG(("File open dialog rquest for %p/%p", bw, gadget));
From ef5c516ee372d29ca636fa0f7bd422c312be0acf Mon Sep 17 00:00:00 2001
From: Daniel Silverstone
Date: Sun, 5 Jan 2014 17:01:27 +0000
Subject: [PATCH 056/773] Restore missing message send
---
render/html_interaction.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/render/html_interaction.c b/render/html_interaction.c
index f18daebd4..b04d42586 100644
--- a/render/html_interaction.c
+++ b/render/html_interaction.c
@@ -685,6 +685,10 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
break;
case GADGET_FILE:
status = messages_get("FormFile");
+ if (mouse & BROWSER_MOUSE_CLICK_1) {
+ msg_data.gadget_click.gadget = gadget;
+ content_broadcast(c, CONTENT_MSG_GADGETCLICK, msg_data);
+ }
break;
case GADGET_BUTTON:
/* This gadget cannot be activated */
From ff0112309147a9d9f8f66bc65108715db02f9447 Mon Sep 17 00:00:00 2001
From: Rob Kendrick
Date: Sun, 5 Jan 2014 17:14:10 +0000
Subject: [PATCH 057/773] Change FatMessages so drop instructions are click
instructions for some frontends
---
resources/FatMessages | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/resources/FatMessages b/resources/FatMessages
index 2d74f3d6d..22f7890d7 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -2611,7 +2611,12 @@ de.all.Form_Many:(Viele)
fr.all.Form_Many:(Plusieurs)
it.all.Form_Many:(Molti)
nl.all.Form_Many:(Veel)
-en.all.Form_Drop:Drop file here
+en.gtk.Form_Drop:Click to select file
+en.ro.Form_Drop:Drop file here
+en.ami.Form_Drop:Drop file here
+en.beos.Form_Drop:Drop file here
+en.fb.Form_Drop:Click to select file
+en.osx.Form_Drop:Click to select file
de.all.Form_Drop:Datei hier hinziehen
fr.all.Form_Drop:Déposer les fichiers ici
it.all.Form_Drop:Inserisci un file qui
From d24ee91311e9c86a5743bc6d7036c7e873dd29fa Mon Sep 17 00:00:00 2001
From: Rob Kendrick
Date: Sun, 5 Jan 2014 17:16:26 +0000
Subject: [PATCH 058/773] Under GTK, file gadgets are more like buttons
---
gtk/res/gtkdefault.css | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gtk/res/gtkdefault.css b/gtk/res/gtkdefault.css
index 9021eedd9..300c13add 100644
--- a/gtk/res/gtkdefault.css
+++ b/gtk/res/gtkdefault.css
@@ -12,7 +12,7 @@ input { font-size: 95%; border: medium inset #ddd; }
input[type=button], input[type=reset], input[type=submit], button {
background-color: #ddd; border: medium outset #ddd; }
input[type=checkbox], input[type=radio] { font-size: 105%; }
-input[type=file] { background-color: #ddd; border: medium inset #ddd; }
+input[type=file] { background-color: #ddd; border: medium outset #ddd; }
select { background-color: #ddd; border: medium inset #ddd; font-size: 95%; }
select:after { border-left:4px ridge #ddd; }
From 692d4a328c7ba7cbf13c66c5da67ac1e9bb323b2 Mon Sep 17 00:00:00 2001
From: Daniel Silverstone
Date: Sun, 5 Jan 2014 17:21:59 +0000
Subject: [PATCH 059/773] Fix some log statements
---
amiga/gui.c | 2 +-
atari/gui.c | 2 +-
beos/gui.cpp | 2 +-
cocoa/gui.m | 2 +-
monkey/browser.c | 2 +-
riscos/gui.c | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/amiga/gui.c b/amiga/gui.c
index 8027eeba0..bfb5d09ff 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -5141,7 +5141,7 @@ void ami_gui_splash_close(Object *win_obj)
void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
struct form_control *gadget)
{
- LOG(("File open dialog rquest for %p/%p", bw, gadget));
+ LOG(("File open dialog rquest for %p/%p", g, gadget));
/* browser_window_set_gadget_filename(bw, gadget, "filename"); */
}
diff --git a/atari/gui.c b/atari/gui.c
index 3b3e98943..e02c5434a 100644
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -1101,7 +1101,7 @@ static void gui_init2(int argc, char** argv)
void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
struct form_control *gadget)
{
- LOG(("File open dialog rquest for %p/%p", bw, gadget));
+ LOG(("File open dialog rquest for %p/%p", g, gadget));
/* browser_window_set_gadget_filename(bw, gadget, "filename"); */
}
diff --git a/beos/gui.cpp b/beos/gui.cpp
index 42edc61aa..32bd3a2d5 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -1168,7 +1168,7 @@ bool path_add_part(char *path, int length, const char *newpart)
void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
struct form_control *gadget)
{
- LOG(("File open dialog rquest for %p/%p", bw, gadget));
+ LOG(("File open dialog rquest for %p/%p", g, gadget));
/* browser_window_set_gadget_filename(bw, gadget, "filename"); */
}
diff --git a/cocoa/gui.m b/cocoa/gui.m
index 7ee2372f3..449b52c82 100644
--- a/cocoa/gui.m
+++ b/cocoa/gui.m
@@ -327,7 +327,7 @@ void gui_401login_open(nsurl *url, const char *realm,
void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
struct form_control *gadget)
{
- LOG(("File open dialog rquest for %p/%p", bw, gadget));
+ LOG(("File open dialog rquest for %p/%p", g, gadget));
/* browser_window_set_gadget_filename(bw, gadget, "filename"); */
}
diff --git a/monkey/browser.c b/monkey/browser.c
index 7c28cf8a3..5cd18359a 100644
--- a/monkey/browser.c
+++ b/monkey/browser.c
@@ -393,7 +393,7 @@ gui_window_save_link(struct gui_window *g, const char *url,
void gui_file_gadget_open(struct gui_browser *g, hlcache_handle *hl,
struct form_control *gadget)
{
- LOG(("File open dialog rquest for %p/%p", bw, gadget));
+ LOG(("File open dialog rquest for %p/%p", g, gadget));
/* browser_window_set_gadget_filename(bw, gadget, "filename"); */
}
diff --git a/riscos/gui.c b/riscos/gui.c
index 900915483..ae5ea383e 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -2427,7 +2427,7 @@ bool path_add_part(char *path, int length, const char *newpart)
void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
struct form_control *gadget)
{
- LOG(("File open dialog rquest for %p/%p", bw, gadget));
+ LOG(("File open dialog rquest for %p/%p", g, gadget));
/* browser_window_set_gadget_filename(bw, gadget, "filename"); */
}
From f97c1fc605caf49b73a11f960dc9a6c869e97abe Mon Sep 17 00:00:00 2001
From: Daniel Silverstone
Date: Sun, 5 Jan 2014 17:33:08 +0000
Subject: [PATCH 060/773] Add some more frontend stubs and fix up some others
---
cocoa/gui.m | 1 +
framebuffer/gui.c | 7 +++++++
monkey/browser.c | 2 +-
windows/gui.c | 7 +++++++
4 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/cocoa/gui.m b/cocoa/gui.m
index 449b52c82..72f64bf04 100644
--- a/cocoa/gui.m
+++ b/cocoa/gui.m
@@ -32,6 +32,7 @@
#import "desktop/textinput.h"
#import "desktop/401login.h"
#import "utils/utils.h"
+#import "utils/log.h"
#import "image/ico.h"
#import "content/fetchers/resource.h"
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index b4bb3ef43..08cb31318 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -1988,6 +1988,13 @@ gui_cert_verify(nsurl *url,
cb(false, cbpw);
}
+void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
+ struct form_control *gadget)
+{
+ LOG(("File open dialog rquest for %p/%p", g, gadget));
+ /* browser_window_set_gadget_filename(bw, gadget, "filename"); */
+}
+
/*
* Local Variables:
* c-basic-offset:8
diff --git a/monkey/browser.c b/monkey/browser.c
index 5cd18359a..73549f36a 100644
--- a/monkey/browser.c
+++ b/monkey/browser.c
@@ -390,7 +390,7 @@ gui_window_save_link(struct gui_window *g, const char *url,
g->win_num, url, title);
}
-void gui_file_gadget_open(struct gui_browser *g, hlcache_handle *hl,
+void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
struct form_control *gadget)
{
LOG(("File open dialog rquest for %p/%p", g, gadget));
diff --git a/windows/gui.c b/windows/gui.c
index 767f6812e..e20369a65 100644
--- a/windows/gui.c
+++ b/windows/gui.c
@@ -73,6 +73,13 @@ static const char windowclassname_main[] = "nswsmainwindow";
static struct nsws_pointers nsws_pointer;
+void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
+ struct form_control *gadget)
+{
+ LOG(("File open dialog rquest for %p/%p", g, gadget));
+ /* browser_window_set_gadget_filename(bw, gadget, "filename"); */
+}
+
void gui_poll(bool active)
{
MSG Msg; /* message from system */
From b2fff176df8236a2f5957e579a2905833ecc3a6e Mon Sep 17 00:00:00 2001
From: Chris Young
Date: Sun, 5 Jan 2014 22:55:34 +0000
Subject: [PATCH 061/773] This shouldn't be UTF-8
---
amiga/context_menu.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/amiga/context_menu.c b/amiga/context_menu.c
index 2ad2b89d9..1aa8f7ac2 100644
--- a/amiga/context_menu.c
+++ b/amiga/context_menu.c
@@ -742,17 +742,11 @@ static uint32 ami_context_menu_hook(struct Hook *hook,Object *item,APTR reserved
strlcpy(fname,filereq->fr_Drawer,1024);
AddPart(fname,filereq->fr_File,1024);
- if(utf8_from_local_encoding(fname,0,&utf8_fn) != UTF8_CONVERT_OK)
- {
- warn_user("NoMemory","");
- break;
- }
-
browser_window_drop_file_at_point(
file_input->bw,
file_input->x,
file_input->y,
- utf8_fn);
+ fname);
}
break;
From 4eff5ddf719e429b463f4615dc4c80c6683a18cd Mon Sep 17 00:00:00 2001
From: Chris Young
Date: Sun, 5 Jan 2014 23:04:28 +0000
Subject: [PATCH 062/773] Add file upload request on click
---
amiga/gui.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/amiga/gui.c b/amiga/gui.c
index bfb5d09ff..3a0dd97c5 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -5142,6 +5142,18 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
struct form_control *gadget)
{
LOG(("File open dialog rquest for %p/%p", g, gadget));
- /* browser_window_set_gadget_filename(bw, gadget, "filename"); */
+
+ if(AslRequestTags(filereq,
+ ASLFR_Window, g->shared->win,
+ ASLFR_SleepWindow, TRUE,
+ ASLFR_TitleText, messages_get("NetSurf"),
+ ASLFR_Screen, scrn,
+ ASLFR_DoSaveMode, FALSE,
+ TAG_DONE)) {
+ char fname[1024];
+ strlcpy(fname, filereq->fr_Drawer, 1024);
+ AddPart(fname, filereq->fr_File, 1024);
+ browser_window_set_gadget_filename(g->shared->bw, gadget, fname);
+ }
}
From 2a34df8dccdc6b8534a2158e71f0593e96fb9204 Mon Sep 17 00:00:00 2001
From: Chris Young
Date: Sun, 5 Jan 2014 23:08:08 +0000
Subject: [PATCH 063/773] Update description to reflect reality
---
resources/FatMessages | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/resources/FatMessages b/resources/FatMessages
index 22f7890d7..50b39dd57 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -2613,7 +2613,7 @@ it.all.Form_Many:(Molti)
nl.all.Form_Many:(Veel)
en.gtk.Form_Drop:Click to select file
en.ro.Form_Drop:Drop file here
-en.ami.Form_Drop:Drop file here
+en.ami.Form_Drop:Click or drop file here
en.beos.Form_Drop:Drop file here
en.fb.Form_Drop:Click to select file
en.osx.Form_Drop:Click to select file
@@ -4815,12 +4815,12 @@ nl.ro.HelpCacheConfig3:\Tamount of memory to be used for caching content.
en.ro.HelpCacheConfig4:\Sreduce the amount of memory.
de.ro.HelpCacheConfig4:Klicken mit AUSWAHL verringert die Größe des Cachespeichers.
fr.ro.HelpCacheConfig4:\Sréduire la quantité de mémoire.
-it.ro.HelpCacheConfig4:\Sriduce la quantit di memoria.
+it.ro.HelpCacheConfig4:\Sriduce la quantità di memoria.
nl.ro.HelpCacheConfig4:\Sreduce the amount of memory.
en.ro.HelpCacheConfig5:\Sincrease the amount of memory.
de.ro.HelpCacheConfig5:Klicken mit AUSWAHL vergrößert die Größe des Cachespeichers.
fr.ro.HelpCacheConfig5:\Saugmenter la quantité de mémoire.
-it.ro.HelpCacheConfig5:\Saumenta la quantit di memoria.
+it.ro.HelpCacheConfig5:\Saumenta la quantità di memoria.
nl.ro.HelpCacheConfig5:\Sincrease the amount of memory.
en.ro.HelpCacheConfig7:\Sreset the Cache options back to their default values.
de.ro.HelpCacheConfig7:Stellt die Standardeinstellungen wieder her.
From 69da9a55e16f0a09690ca5fc5cb0b0e1d0fe9c24 Mon Sep 17 00:00:00 2001
From: Michael Drake
Date: Mon, 6 Jan 2014 13:27:34 +0000
Subject: [PATCH 064/773] Assert a bit earlier when front end tries to redraw
SSL cert viewer that it's destroyed.
---
desktop/tree.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/desktop/tree.c b/desktop/tree.c
index 6097c22a6..4611a7747 100644
--- a/desktop/tree.c
+++ b/desktop/tree.c
@@ -133,6 +133,10 @@ static bool treeview_test_init(struct tree *tree)
switch (tree->flags) {
case TREE_COOKIES:
+ assert(ssl_current_session == NULL &&
+ "Call sslcert_viewer_init directly, "
+ "this compat. layer can't cope with simultanious "
+ "sslcert viewers");
err = cookie_manager_init(&cw_t, (struct core_window *)tree);
if (err != NSERROR_OK)
warn_user("Couldn't init new cookie manager.", 0);
@@ -180,7 +184,10 @@ static bool treeview_test_fini(struct tree *tree)
warn_user("Couldn't finalise hotlist.", 0);
break;
case TREE_SSLCERT:
+ assert(ssl_current_session != NULL &&
+ "Can't use sslcert window after sslcert_viewer_fini()");
err = sslcert_viewer_fini(ssl_current_session);
+ ssl_current_session = NULL;
if (err != NSERROR_OK)
warn_user("Couldn't finalise sslcert viewer.", 0);
break;
@@ -206,6 +213,8 @@ static bool treeview_test_redraw(struct tree *tree, int x, int y,
switch (tree->flags) {
case TREE_SSLCERT:
+ assert(ssl_current_session != NULL &&
+ "Can't use sslcert window after sslcert_viewer_fini()");
sslcert_viewer_redraw(ssl_current_session, x, y, &clip, ctx);
return true;
case TREE_COOKIES:
@@ -227,6 +236,8 @@ static bool treeview_test_mouse_action(struct tree *tree,
{
switch (tree->flags) {
case TREE_SSLCERT:
+ assert(ssl_current_session != NULL &&
+ "Can't use sslcert window after sslcert_viewer_fini()");
sslcert_viewer_mouse_action(ssl_current_session, mouse, x, y);
return true;
case TREE_COOKIES:
@@ -247,6 +258,8 @@ static bool treeview_test_keypress(struct tree *tree, uint32_t key)
{
switch (tree->flags) {
case TREE_SSLCERT:
+ assert(ssl_current_session != NULL &&
+ "Can't use sslcert window after sslcert_viewer_fini()");
sslcert_viewer_keypress(ssl_current_session, key);
return true;
case TREE_COOKIES:
From 870c7096842725f354708963c9630deb1c5386fc Mon Sep 17 00:00:00 2001
From: Chris Young
Date: Mon, 6 Jan 2014 18:29:05 +0000
Subject: [PATCH 065/773] Get Composite() to befriend the screen's BitMap to
ensure they are on the same graphics board. This should fix the slowness
when multiple graphics cards are installed.
---
amiga/bitmap.c | 2 +-
amiga/plotters.c | 2 ++
amiga/thumbnail.c | 1 +
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/amiga/bitmap.c b/amiga/bitmap.c
index c07f45c67..f25ac2b81 100644
--- a/amiga/bitmap.c
+++ b/amiga/bitmap.c
@@ -453,7 +453,7 @@ static struct BitMap *ami_bitmap_get_truecolour(struct bitmap *bitmap,int width,
COMPTAG_DestHeight,height,
COMPTAG_OffsetX,0,
COMPTAG_OffsetY,0,
- COMPTAG_FriendBitMap,friendbm,
+ COMPTAG_FriendBitMap, scrn->RastPort.BitMap,
TAG_DONE);
#endif
}
diff --git a/amiga/plotters.c b/amiga/plotters.c
index 6683fc58b..05db67f48 100755
--- a/amiga/plotters.c
+++ b/amiga/plotters.c
@@ -711,6 +711,7 @@ static bool ami_bitmap(int x, int y, int width, int height, struct bitmap *bitma
COMPTAG_SrcHeight,height,
COMPTAG_OffsetX,x,
COMPTAG_OffsetY,y,
+ COMPTAG_FriendBitMap, scrn->RastPort.BitMap,
TAG_DONE);
#endif
}
@@ -873,6 +874,7 @@ static void ami_bitmap_tile_hook(struct Hook *hook,struct RastPort *rp,struct Ba
COMPTAG_SrcHeight,bfbm->height,
COMPTAG_OffsetX,xf,
COMPTAG_OffsetY,yf,
+ COMPTAG_FriendBitMap, scrn->RastPort.BitMap,
TAG_DONE);
#endif
}
diff --git a/amiga/thumbnail.c b/amiga/thumbnail.c
index 61102feff..51630be96 100755
--- a/amiga/thumbnail.c
+++ b/amiga/thumbnail.c
@@ -84,6 +84,7 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
COMPTAG_DestHeight,bitmap->height,
COMPTAG_OffsetX,0,
COMPTAG_OffsetY,0,
+ COMPTAG_FriendBitMap, scrn->RastPort.BitMap,
TAG_DONE);
}
else
From be6f4d3997989012210ee3413c5186c7fb0ee29a Mon Sep 17 00:00:00 2001
From: Chris Young
Date: Mon, 6 Jan 2014 18:37:43 +0000
Subject: [PATCH 066/773] Probably shouldn't override thumbnail source alpha
---
amiga/thumbnail.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/amiga/thumbnail.c b/amiga/thumbnail.c
index 51630be96..9c149129d 100755
--- a/amiga/thumbnail.c
+++ b/amiga/thumbnail.c
@@ -69,7 +69,7 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
if(GfxBase->LibNode.lib_Version >= 53) // AutoDoc says v52, but this function isn't in OS4.0, so checking for v53 (OS4.1)
{
float resample_scale = bitmap->width / (float)plot_width;
- uint32 flags = COMPFLAG_IgnoreDestAlpha | COMPFLAG_SrcAlphaOverride;
+ uint32 flags = COMPFLAG_IgnoreDestAlpha;
if(nsoption_bool(scale_quality)) flags |= COMPFLAG_SrcFilter;
CompositeTags(COMPOSITE_Src,browserglob.bm,bitmap->nativebm,
From 28e670f52da46819f8f18844a407bf9ad93043cd Mon Sep 17 00:00:00 2001
From: Daniel Silverstone
Date: Mon, 6 Jan 2014 18:50:25 +0000
Subject: [PATCH 067/773] Support 'checked' properly in new form handler
---
render/form.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/render/form.c b/render/form.c
index 761fc4c69..49d6f217c 100644
--- a/render/form.c
+++ b/render/form.c
@@ -350,7 +350,7 @@ bool form_successful_controls_dom(struct form *_form,
dom_exception err;
dom_string *nodename = NULL, *inputname = NULL, *inputvalue = NULL, *inputtype = NULL;
struct fetch_multipart_data sentinel, *last_success, *success_new;
- bool had_submit = false, element_disabled;
+ bool had_submit = false, element_disabled, checked;
char *charset, *rawfile_temp = NULL, *basename;
uint32_t index, element_count;
struct image_input_coords *coords;
@@ -687,6 +687,15 @@ bool form_successful_controls_dom(struct form *_form,
dom_string_caseless_isequal(
inputtype, corestring_dom_checkbox)) {
LOG(("Examining radio or checkbox"));
+ err = dom_html_input_element_get_checked(
+ (dom_html_input_element *)form_element,
+ &checked);
+ if (err != DOM_NO_ERR) {
+ LOG(("Could not get input element checked"));
+ goto dom_no_memory;
+ }
+ if (!checked)
+ continue;
err = dom_html_input_element_get_value(
(dom_html_input_element *)form_element,
&inputvalue);
From b415c2f9ff8ff4938343237f50c97f31ce6d5a95 Mon Sep 17 00:00:00 2001
From: Vincent Sanders
Date: Mon, 6 Jan 2014 22:22:41 +0000
Subject: [PATCH 068/773] fixup logic error in save complete as directed by jmb
---
desktop/save_complete.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/desktop/save_complete.c b/desktop/save_complete.c
index efe223747..3e5234af4 100644
--- a/desktop/save_complete.c
+++ b/desktop/save_complete.c
@@ -435,7 +435,7 @@ static bool save_complete_save_html_objects(save_complete_ctx *ctx,
object = html_get_objects(c, &count);
for (; object != NULL; object = object->next) {
- if (object->content != NULL || object->box != NULL) {
+ if ((object->content != NULL) && (object->box != NULL)) {
if (save_complete_save_html_object(ctx,
object->content) == false)
return false;
From 277bcec7c6234823390903087dd553c9838c013c Mon Sep 17 00:00:00 2001
From: Vincent Sanders
Date: Fri, 10 Jan 2014 14:32:29 +0000
Subject: [PATCH 069/773] stop system colours being anything to do with
frontends
---
css/css.c | 6 +++---
css/select.c | 4 ++--
desktop/gui.h | 9 ---------
desktop/netsurf.c | 7 +++++--
desktop/netsurf.h | 8 +++++++-
desktop/scrollbar.c | 7 ++++---
desktop/system_colour.c | 36 +++++++++++++++++++-----------------
desktop/system_colour.h | 40 ++++++++++++++++++++++++++++++++++++++++
desktop/treeview.c | 14 +++++++-------
9 files changed, 87 insertions(+), 44 deletions(-)
create mode 100644 desktop/system_colour.h
diff --git a/css/css.c b/css/css.c
index 803906692..364511875 100644
--- a/css/css.c
+++ b/css/css.c
@@ -26,7 +26,7 @@
#include "content/hlcache.h"
#include "css/css.h"
#include "css/internal.h"
-#include "desktop/gui.h"
+#include "desktop/system_colour.h"
#include "render/html.h"
#include "utils/utils.h"
#include "utils/http.h"
@@ -221,7 +221,7 @@ static nserror nscss_create_css_data(struct content_css_data *c,
params.resolve_pw = NULL;
params.import = nscss_handle_import;
params.import_pw = c;
- params.color = gui_system_colour;
+ params.color = ns_system_colour;
params.color_pw = NULL;
params.font = NULL;
params.font_pw = NULL;
@@ -767,7 +767,7 @@ css_error nscss_register_import(struct content_css_data *c,
params.resolve_pw = NULL;
params.import = NULL;
params.import_pw = NULL;
- params.color = gui_system_colour;
+ params.color = ns_system_colour;
params.color_pw = NULL;
params.font = NULL;
params.font_pw = NULL;
diff --git a/css/select.c b/css/select.c
index 0202737b8..885cdecfd 100644
--- a/css/select.c
+++ b/css/select.c
@@ -26,7 +26,7 @@
#include "css/internal.h"
#include "css/select.h"
#include "css/utils.h"
-#include "desktop/gui.h"
+#include "desktop/system_colour.h"
#include "utils/nsoption.h"
#include "utils/corestrings.h"
#include "utils/log.h"
@@ -185,7 +185,7 @@ css_stylesheet *nscss_create_inline_style(const uint8_t *data, size_t len,
params.resolve_pw = NULL;
params.import = NULL;
params.import_pw = NULL;
- params.color = gui_system_colour;
+ params.color = ns_system_colour;
params.color_pw = NULL;
params.font = NULL;
params.font_pw = NULL;
diff --git a/desktop/gui.h b/desktop/gui.h
index 26a9f4b43..9317e8576 100644
--- a/desktop/gui.h
+++ b/desktop/gui.h
@@ -169,13 +169,4 @@ void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
*/
nsurl* gui_get_resource_url(const char *path);
-/** css callback to obtain named system colours from a frontend. */
-css_error gui_system_colour(void *pw, lwc_string *name, css_color *color);
-
-/** Obtain a named system colour from a frontend. */
-colour gui_system_colour_char(const char *name);
-
-bool gui_system_colour_init(void);
-void gui_system_colour_finalize(void);
-
#endif
diff --git a/desktop/netsurf.c b/desktop/netsurf.c
index fa026dc6a..36b0b589a 100644
--- a/desktop/netsurf.c
+++ b/desktop/netsurf.c
@@ -39,6 +39,7 @@
#include "desktop/netsurf.h"
#include "desktop/401login.h"
#include "desktop/browser.h"
+#include "desktop/system_colour.h"
#include "desktop/gui.h"
#include "utils/nsoption.h"
#include "desktop/searchweb.h"
@@ -211,7 +212,9 @@ nserror netsurf_init(const char *messages)
hlcache_initialise(&hlcache_parameters);
/* Initialize system colours */
- gui_system_colour_init();
+ error = ns_system_colour_init();
+ if (error != NSERROR_OK)
+ return error;
js_initialise();
@@ -270,7 +273,7 @@ void netsurf_exit(void)
urldb_destroy();
LOG(("Destroying System colours"));
- gui_system_colour_finalize();
+ ns_system_colour_finalize();
corestrings_fini();
LOG(("Remaining lwc strings:"));
diff --git a/desktop/netsurf.h b/desktop/netsurf.h
index bfdb647ff..aa1796f7c 100644
--- a/desktop/netsurf.h
+++ b/desktop/netsurf.h
@@ -28,8 +28,14 @@ extern const char * const netsurf_version;
extern const int netsurf_version_major;
extern const int netsurf_version_minor;
+/** Initialise netsurf core */
nserror netsurf_init(const char *messages);
-extern void netsurf_exit(void);
+
+/** Run primary event loop */
extern int netsurf_main_loop(void);
+/** finalise NetSurf core */
+extern void netsurf_exit(void);
+
+
#endif
diff --git a/desktop/scrollbar.c b/desktop/scrollbar.c
index d24ea727a..dadb82801 100644
--- a/desktop/scrollbar.c
+++ b/desktop/scrollbar.c
@@ -25,6 +25,7 @@
#include
#include
+#include "desktop/system_colour.h"
#include "desktop/mouse.h"
#include "desktop/scrollbar.h"
#include "utils/nsoption.h"
@@ -190,9 +191,9 @@ bool scrollbar_redraw(struct scrollbar *s, int x, int y,
int v[6]; /* array of triangle vertices */
int x0, y0, x1, y1;
- colour bg_fill_colour = gui_system_colour_char("Scrollbar");
- colour fg_fill_colour = gui_system_colour_char("ButtonFace");
- colour arrow_fill_colour = gui_system_colour_char("ButtonText");
+ colour bg_fill_colour = ns_system_colour_char("Scrollbar");
+ colour fg_fill_colour = ns_system_colour_char("ButtonFace");
+ colour arrow_fill_colour = ns_system_colour_char("ButtonText");
plot_style_t bg_fill_style = {
.fill_type = PLOT_OP_TYPE_SOLID,
diff --git a/desktop/system_colour.c b/desktop/system_colour.c
index 4ef170981..178c03536 100644
--- a/desktop/system_colour.c
+++ b/desktop/system_colour.c
@@ -21,45 +21,47 @@
*
*/
+#include
+
+#include "utils/config.h"
#include "utils/utils.h"
#include "utils/log.h"
#include "css/utils.h"
-#include "desktop/gui.h"
+#include "desktop/system_colour.h"
#include "utils/nsoption.h"
-
#define colour_list_len ((NSOPTION_SYS_COLOUR_END - NSOPTION_SYS_COLOUR_START) + 1)
static lwc_string *colour_list[colour_list_len];
-static lwc_string **gui_system_colour_pw = NULL;
+static lwc_string **ns_system_colour_pw = NULL;
-bool gui_system_colour_init(void)
+nserror ns_system_colour_init(void)
{
unsigned int ccount;
- if (gui_system_colour_pw != NULL)
- return false;
+ if (ns_system_colour_pw != NULL)
+ return NSERROR_INIT_FAILED;
/* Intern colour strings */
for (ccount = 0; ccount < colour_list_len; ccount++) {
struct nsoption_s *opt;
opt = &nsoptions[ccount + NSOPTION_SYS_COLOUR_START];
- if (lwc_intern_string(opt->key + SLEN("sys_colour_"),
- opt->key_len - SLEN("sys_colour_"),
+ if (lwc_intern_string(opt->key + SLEN("sys_colour_"),
+ opt->key_len - SLEN("sys_colour_"),
&(colour_list[ccount])) != lwc_error_ok) {
- return false;
+ return NSERROR_NOMEM;
}
}
- gui_system_colour_pw = colour_list;
-
- return true;
+ ns_system_colour_pw = colour_list;
+
+ return NSERROR_OK;
}
-void gui_system_colour_finalize(void)
+void ns_system_colour_finalize(void)
{
unsigned int ccount;
@@ -68,7 +70,7 @@ void gui_system_colour_finalize(void)
}
}
-colour gui_system_colour_char(const char *name)
+colour ns_system_colour_char(const char *name)
{
colour ret = 0;
unsigned int ccount;
@@ -83,19 +85,19 @@ colour gui_system_colour_char(const char *name)
return ret;
}
-css_error gui_system_colour(void *pw, lwc_string *name, css_color *colour)
+css_error ns_system_colour(void *pw, lwc_string *name, css_color *colour)
{
unsigned int ccount;
bool match;
for (ccount = 0; ccount < colour_list_len; ccount++) {
- if (lwc_string_caseless_isequal(name,
+ if (lwc_string_caseless_isequal(name,
colour_list[ccount],
&match) == lwc_error_ok && match) {
*colour = ns_color_to_nscss(nsoptions[ccount + NSOPTION_SYS_COLOUR_START].value.c);
return CSS_OK;
}
- }
+ }
return CSS_INVALID;
}
diff --git a/desktop/system_colour.h b/desktop/system_colour.h
new file mode 100644
index 000000000..b5d4baad4
--- /dev/null
+++ b/desktop/system_colour.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2014 vincent Sanders
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+/** \file
+ * Interface to system colour values.
+ */
+
+#ifndef _NETSURF_DESKTOP_SYSTEM_COLOUR_H_
+#define _NETSURF_DESKTOP_SYSTEM_COLOUR_H_
+
+#include
+
+#include "utils/errors.h"
+#include "desktop/plot_style.h"
+
+/** css callback to obtain named system colours. */
+css_error ns_system_colour(void *pw, lwc_string *name, css_color *color);
+
+/** Obtain a named system colour from a frontend. */
+colour ns_system_colour_char(const char *name);
+
+nserror ns_system_colour_init(void);
+void ns_system_colour_finalize(void);
+
+#endif
diff --git a/desktop/treeview.c b/desktop/treeview.c
index a137c46c5..d380882b1 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -21,7 +21,7 @@
*/
#include "css/utils.h"
-#include "desktop/gui.h"
+#include "desktop/system_colour.h"
#include "desktop/knockout.h"
#include "desktop/plotters.h"
#include "desktop/textarea.h"
@@ -3466,15 +3466,15 @@ static void treeview_init_plot_styles(int font_pt_size)
plot_style_even.bg.stroke_width = 0;
plot_style_even.bg.stroke_colour = 0;
plot_style_even.bg.fill_type = PLOT_OP_TYPE_SOLID;
- plot_style_even.bg.fill_colour = gui_system_colour_char("Window");
+ plot_style_even.bg.fill_colour = ns_system_colour_char("Window");
/* Text colour */
plot_style_even.text.family = PLOT_FONT_FAMILY_SANS_SERIF;
plot_style_even.text.size = font_pt_size * FONT_SIZE_SCALE;
plot_style_even.text.weight = 400;
plot_style_even.text.flags = FONTF_NONE;
- plot_style_even.text.foreground = gui_system_colour_char("WindowText");
- plot_style_even.text.background = gui_system_colour_char("Window");
+ plot_style_even.text.foreground = ns_system_colour_char("WindowText");
+ plot_style_even.text.background = ns_system_colour_char("Window");
/* Entry field text colour */
plot_style_even.itext = plot_style_even.text;
@@ -3484,13 +3484,13 @@ static void treeview_init_plot_styles(int font_pt_size)
/* Selected background colour */
plot_style_even.sbg = plot_style_even.bg;
- plot_style_even.sbg.fill_colour = gui_system_colour_char("Highlight");
+ plot_style_even.sbg.fill_colour = ns_system_colour_char("Highlight");
/* Selected text colour */
plot_style_even.stext = plot_style_even.text;
plot_style_even.stext.foreground =
- gui_system_colour_char("HighlightText");
- plot_style_even.stext.background = gui_system_colour_char("Highlight");
+ ns_system_colour_char("HighlightText");
+ plot_style_even.stext.background = ns_system_colour_char("Highlight");
/* Selected entry field text colour */
plot_style_even.sitext = plot_style_even.stext;
From 303a29a89c966d48ee349fc1a350777d981bd683 Mon Sep 17 00:00:00 2001
From: Vincent Sanders
Date: Fri, 10 Jan 2014 15:55:29 +0000
Subject: [PATCH 070/773] cleanups to fix new clang warnings
---
content/dirlist.c | 2 --
render/imagemap.c | 8 ++++----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/content/dirlist.c b/content/dirlist.c
index 433e21026..0c0e2aee2 100644
--- a/content/dirlist.c
+++ b/content/dirlist.c
@@ -27,8 +27,6 @@
#include "content/dirlist.h"
#include "utils/messages.h"
-static const char footer[] = " \n