netsurf: branch master updated. e4d83d660e494d05ece1bd98799424dd035bdfad
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/e4d83d660e494d05ece1b...
...commit http://git.netsurf-browser.org/netsurf.git/commit/e4d83d660e494d05ece1bd9...
...tree http://git.netsurf-browser.org/netsurf.git/tree/e4d83d660e494d05ece1bd987...
The branch, master has been updated
via e4d83d660e494d05ece1bd98799424dd035bdfad (commit)
from 329fba581a38035ebc6b4f29af4f0a17841a3aef (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/e4d83d660e494d05ece...
commit e4d83d660e494d05ece1bd98799424dd035bdfad
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Open search form at lower right corner
diff --git a/atari/search.c b/atari/search.c
index 2717652..4d6f239 100644
--- a/atari/search.c
+++ b/atari/search.c
@@ -238,24 +238,38 @@ void search_destroy( struct gui_window * gw )
SEARCH_FORM_SESSION open_browser_search( struct gui_window * gw )
{
char * title;
- SEARCH_FORM_SESSION sfs;
+ SEARCH_FORM_SESSION sfs;
+ GRECT pos, treesize;
OBJECT * tree = get_tree(SEARCH);
if( tree == NULL ){
return( NULL );
- }
+ }
+
sfs = calloc(1, sizeof(struct s_search_form_session));
if( sfs == NULL )
return( NULL );
+
title = (char*)messages_get("FindTextNS");
if( title == NULL )
title = (char*)"Find text ...";
- search_destroy( gw );
- current = sfs;
+ search_destroy( gw );
+
+ /* setup dipslay position: right corner */
+ treesize.g_x = 0;
+ treesize.g_y = 0;
+ treesize.g_w = tree->ob_width;
+ treesize.g_h = tree->ob_height;
+ wind_calc_grect(WC_BORDER, WAT_FORM, &treesize, &pos);
+ pos.g_x = app.w - pos.g_w;
+ pos.g_y = app.h - pos.g_h;
+
+
+ current = sfs;
sfs->bw = gw->browser->bw;
sfs->formwind = mt_FormCreate( &app, tree, WAT_FORM,
NULL, title,
- NULL, true, false);
+ &pos, true, false);
ObjcAttachFormFunc( sfs->formwind, SEARCH_BT_SEARCH, evnt_bt_srch_click, NULL);
ObjcAttachFormFunc( sfs->formwind, SEARCH_CB_CASESENSE, evnt_cb_click, NULL);
-----------------------------------------------------------------------
Summary of changes:
atari/search.c | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/atari/search.c b/atari/search.c
index 2717652..4d6f239 100644
--- a/atari/search.c
+++ b/atari/search.c
@@ -238,24 +238,38 @@ void search_destroy( struct gui_window * gw )
SEARCH_FORM_SESSION open_browser_search( struct gui_window * gw )
{
char * title;
- SEARCH_FORM_SESSION sfs;
+ SEARCH_FORM_SESSION sfs;
+ GRECT pos, treesize;
OBJECT * tree = get_tree(SEARCH);
if( tree == NULL ){
return( NULL );
- }
+ }
+
sfs = calloc(1, sizeof(struct s_search_form_session));
if( sfs == NULL )
return( NULL );
+
title = (char*)messages_get("FindTextNS");
if( title == NULL )
title = (char*)"Find text ...";
- search_destroy( gw );
- current = sfs;
+ search_destroy( gw );
+
+ /* setup dipslay position: right corner */
+ treesize.g_x = 0;
+ treesize.g_y = 0;
+ treesize.g_w = tree->ob_width;
+ treesize.g_h = tree->ob_height;
+ wind_calc_grect(WC_BORDER, WAT_FORM, &treesize, &pos);
+ pos.g_x = app.w - pos.g_w;
+ pos.g_y = app.h - pos.g_h;
+
+
+ current = sfs;
sfs->bw = gw->browser->bw;
sfs->formwind = mt_FormCreate( &app, tree, WAT_FORM,
NULL, title,
- NULL, true, false);
+ &pos, true, false);
ObjcAttachFormFunc( sfs->formwind, SEARCH_BT_SEARCH, evnt_bt_srch_click, NULL);
ObjcAttachFormFunc( sfs->formwind, SEARCH_CB_CASESENSE, evnt_cb_click, NULL);
--
NetSurf Browser
10 years, 6 months
netsurf: branch master updated. 329fba581a38035ebc6b4f29af4f0a17841a3aef
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/329fba581a38035ebc6b4...
...commit http://git.netsurf-browser.org/netsurf.git/commit/329fba581a38035ebc6b4f2...
...tree http://git.netsurf-browser.org/netsurf.git/tree/329fba581a38035ebc6b4f29a...
The branch, master has been updated
via 329fba581a38035ebc6b4f29af4f0a17841a3aef (commit)
from 382c2f2289047a920bc0cf5f1e539074457beed7 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/329fba581a38035ebc6...
commit 329fba581a38035ebc6b4f29af4f0a17841a3aef
Author: Ole Loots <ole(a)monochrom.net>
Commit: Ole Loots <ole(a)monochrom.net>
Handle "Save window size" menu event.
diff --git a/atari/global_evnt.c b/atari/global_evnt.c
index 24e65b5..f002f3f 100755
--- a/atari/global_evnt.c
+++ b/atari/global_evnt.c
@@ -52,7 +52,6 @@
#include "atari/settings.h"
#include "cflib.h"
-extern const char * cfg_homepage_url;
extern struct gui_window *input_window;
extern OBJECT * h_gem_menu;
extern int mouse_click_time[3];
@@ -60,7 +59,14 @@ extern int mouse_hold_start[3];
extern browser_mouse_state bmstate;
extern short last_drag_x;
extern short last_drag_y;
-extern bool html_redraw_debug;
+extern bool html_redraw_debug;
+
+extern const char * option_homepage_url;
+extern int option_window_width;
+extern int option_window_height;
+extern int option_window_x;
+extern int option_window_y;
+extern char options[PATH_MAX];
/* Zero based resource tree ids: */
#define T_ABOUT 0
@@ -96,7 +102,7 @@ static void __CDECL menu_about(WINDOW *win, int item, int title, void *data)
static void __CDECL menu_new_win(WINDOW *win, int item, int title, void *data)
{
LOG(("%s", __FUNCTION__));
- browser_window_create(cfg_homepage_url, 0, 0, true, false);
+ browser_window_create(option_homepage_url, 0, 0, true, false);
}
static void __CDECL menu_open_url(WINDOW *win, int item, int title, void *data)
@@ -257,7 +263,21 @@ static void __CDECL menu_toolbars(WINDOW *win, int item, int title, void *data)
static void __CDECL menu_savewin(WINDOW *win, int item, int title, void *data)
{
- LOG(("%s", __FUNCTION__));
+ LOG(("%s", __FUNCTION__));
+ if (input_window && input_window->browser) {
+ GRECT rect;
+ wind_get_grect(input_window->root->handle->handle, WF_CURRXYWH, &rect);
+ option_window_width = rect.g_w;
+ option_window_height = rect.g_h;
+ option_window_x = rect.g_x;
+ option_window_y = rect.g_y;
+ nsoption_set_int(window_width, rect.g_w);
+ nsoption_set_int(window_height, rect.g_h);
+ nsoption_set_int(window_x, rect.g_x);
+ nsoption_set_int(window_y, rect.g_y);
+ nsoption_write((const char*)&options);
+ }
+
}
static void __CDECL menu_debug_render(WINDOW *win, int item, int title, void *data)
diff --git a/atari/gui.c b/atari/gui.c
index 07d9483..a2dde67 100755
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -91,11 +91,13 @@ bool rendering = false;
/* Comandline / Options: */
-int cfg_width;
-int cfg_height;
+int option_window_width;
+int option_window_height;
+int option_window_x;
+int option_window_y;
/* Defaults to option_homepage_url, commandline options overwrites that value */
-const char * cfg_homepage_url;
+const char * option_homepage_url;
/* path to choices file: */
char options[PATH_MAX];
@@ -173,8 +175,8 @@ gui_create_browser_window(struct browser_window *bw,
window_create(gw, bw, WIDGET_STATUSBAR|WIDGET_TOOLBAR|WIDGET_RESIZE|WIDGET_SCROLL );
if( gw->root->handle ) {
GRECT pos = {
- app.w/2-(cfg_width/2), (app.h/2)-(cfg_height/2)+16,
- cfg_width, cfg_height
+ option_window_x, option_window_y,
+ option_window_width, option_window_height
};
window_open( gw , pos );
/* Recalculate windows browser area now */
@@ -841,37 +843,51 @@ void gui_quit(void)
static bool
process_cmdline(int argc, char** argv)
{
- int opt;
+ int opt;
+ bool set_default_dimensions = true;
LOG(("argc %d, argv %p", argc, argv));
if ((nsoption_int(window_width) != 0) && (nsoption_int(window_height) != 0)) {
- cfg_width = nsoption_int(window_width);
- cfg_height = nsoption_int(window_height);
- } else {
+
+ option_window_width = nsoption_int(window_width);
+ option_window_height = nsoption_int(window_height);
+ option_window_x = nsoption_int(window_x);
+ option_window_y = nsoption_int(window_y);
+
+ if (option_window_width <= app.w && option_window_height < app.h) {
+ set_default_dimensions = false;
+ }
+ }
+
+ if (set_default_dimensions) {
if( sys_type() == SYS_TOS ){
/* on single tasking OS, start as fulled window: */
- cfg_width = app.w;
- cfg_height = app.h;
+ option_window_width = app.w;
+ option_window_height = app.h-20;
+ option_window_x = app.w/2-(option_window_width/2);
+ option_window_y = (app.h/2)-(option_window_height/2);
} else {
- cfg_width = 600;
- cfg_height = 360;
+ option_window_width = 600;
+ option_window_height = 360;
+ option_window_x = 10;
+ option_window_y = 30;
}
}
if (nsoption_charp(homepage_url) != NULL)
- cfg_homepage_url = nsoption_charp(homepage_url);
+ option_homepage_url = nsoption_charp(homepage_url);
else
- cfg_homepage_url = NETSURF_HOMEPAGE;
+ option_homepage_url = NETSURF_HOMEPAGE;
while((opt = getopt(argc, argv, "w:h:")) != -1) {
switch (opt) {
case 'w':
- cfg_width = atoi(optarg);
+ option_window_width = atoi(optarg);
break;
case 'h':
- cfg_height = atoi(optarg);
+ option_window_height = atoi(optarg);
break;
default:
@@ -883,7 +899,7 @@ process_cmdline(int argc, char** argv)
}
if (optind < argc) {
- cfg_homepage_url = argv[optind];
+ option_homepage_url = argv[optind];
}
return true;
}
@@ -1014,7 +1030,7 @@ int main(int argc, char** argv)
netsurf_init(&argc, &argv, options, messages);
gui_init(argc, argv);
gui_init2(argc, argv);
- browser_window_create(cfg_homepage_url, 0, 0, true, false);
+ browser_window_create(option_homepage_url, 0, 0, true, false);
graf_mouse( ARROW , NULL);
netsurf_main_loop();
netsurf_exit();
diff --git a/atari/toolbar.c b/atari/toolbar.c
index ab88a6b..b6dc468 100755
--- a/atari/toolbar.c
+++ b/atari/toolbar.c
@@ -52,7 +52,7 @@
#include "atari/res/netsurf.rsh"
-extern char * cfg_homepage_url;
+extern char * option_homepage_url;
extern void * h_gem_rsrc;
extern struct gui_window * input_window;
extern long atari_plot_flags;
@@ -302,19 +302,19 @@ static void __CDECL button_redraw( COMPONENT *c, long buff[8], void * data )
while( (todo.g_w > 0) && (todo.g_h > 0) ){
if (rc_intersect(&crect, &todo )) {
-
+
struct rect bgclip = {0,0,todo.g_w, todo.g_h};
pxy[0] = todo.g_x;
pxy[1] = todo.g_y;
pxy[2] = todo.g_w + todo.g_x-1;
pxy[3] = todo.g_h + todo.g_y-1;
-
+
vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy );
plot_set_dimensions(todo.g_x, todo.g_y, todo.g_w, todo.g_h);
plot_rectangle(0, 0, crect.g_w, crect.g_h, &plot_style_background);
-
+
if( img_toolbar == true ){
- plot_set_dimensions(icon_dim.g_x, icon_dim.g_y,
+ plot_set_dimensions(icon_dim.g_x, icon_dim.g_y,
icon_dim.g_w, icon_dim.g_h);
plot_clip( &icon_clip );
atari_plotters.bitmap( bmpx, bmpy, bmpw, bmph, icon,
@@ -403,11 +403,11 @@ void __CDECL evnt_throbber_redraw( COMPONENT *c, long buff[8])
pxy[2] = (short)buff[4] + buff[6]-1;
pxy[3] = (short)buff[5] + buff[7]-2;
vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy );
-
+
if (app.nplanes > 2 ) {
plot_set_dimensions(work.g_x, work.g_y, work.g_w, work.g_h);
plot_rectangle( 0, 0, work.g_w, work.g_h, &plot_style_background);
- }
+ }
else {
vsf_color(atari_plot_vdi_handle, WHITE );
v_bar(atari_plot_vdi_handle, (short*)&pxy );
@@ -502,20 +502,20 @@ void __CDECL evnt_url_redraw( COMPONENT *c, long buff[8], void * data)
if ( !rc_lintersect( (LGRECT*)&buff[4], &clip ) ) return;
plot_set_dimensions(work.g_x, work.g_y, work.g_w, work.g_h);
-
+
//left margin:
- plot_rectangle(0, 0, TOOLBAR_URL_MARGIN_LEFT, work.g_h,
+ plot_rectangle(0, 0, TOOLBAR_URL_MARGIN_LEFT, work.g_h,
&plot_style_background);
// right margin:
- plot_rectangle(work.g_w-TOOLBAR_URL_MARGIN_RIGHT, 0, work.g_w, work.g_h,
+ plot_rectangle(work.g_w-TOOLBAR_URL_MARGIN_RIGHT, 0, work.g_w, work.g_h,
&plot_style_background);
// top margin:
- plot_rectangle(0, 0, work.g_w, TOOLBAR_URL_MARGIN_TOP,
+ plot_rectangle(0, 0, work.g_w, TOOLBAR_URL_MARGIN_TOP,
&plot_style_background);
// bottom margin:
- plot_rectangle(0, work.g_h-TOOLBAR_URL_MARGIN_BOTTOM, work.g_w, work.g_h,
+ plot_rectangle(0, work.g_h-TOOLBAR_URL_MARGIN_BOTTOM, work.g_w, work.g_h,
&plot_style_background);
// TBD: request redraw of textarea for specific region.
@@ -612,7 +612,7 @@ static void __CDECL evnt_toolbar_redraw( COMPONENT *c, long buff[8], void *data
clip = work;
if( !rc_lintersect( (LGRECT*)&buff[4], &clip ) ) return;
if( work.g_y + work.g_h != clip.g_y + clip.g_h ) return;
-
+
vswr_mode(atari_plot_vdi_handle, MD_REPLACE );
vsl_color(atari_plot_vdi_handle, BLACK );
vsl_type(atari_plot_vdi_handle, 1 );
@@ -1019,13 +1019,13 @@ void tb_forward_click( struct gui_window * gw )
void tb_home_click( struct gui_window * gw )
{
- browser_window_go(gw->browser->bw, cfg_homepage_url, 0, true);
+ browser_window_go(gw->browser->bw, option_homepage_url, 0, true);
}
void tb_stop_click( struct gui_window * gw )
{
- browser_window_stop( gw->browser->bw );
+ browser_window_stop(gw->browser->bw);
}
-----------------------------------------------------------------------
Summary of changes:
atari/global_evnt.c | 28 ++++++++++++++++++++++---
atari/gui.c | 54 +++++++++++++++++++++++++++++++++-----------------
atari/toolbar.c | 30 ++++++++++++++--------------
3 files changed, 74 insertions(+), 38 deletions(-)
diff --git a/atari/global_evnt.c b/atari/global_evnt.c
index 24e65b5..f002f3f 100755
--- a/atari/global_evnt.c
+++ b/atari/global_evnt.c
@@ -52,7 +52,6 @@
#include "atari/settings.h"
#include "cflib.h"
-extern const char * cfg_homepage_url;
extern struct gui_window *input_window;
extern OBJECT * h_gem_menu;
extern int mouse_click_time[3];
@@ -60,7 +59,14 @@ extern int mouse_hold_start[3];
extern browser_mouse_state bmstate;
extern short last_drag_x;
extern short last_drag_y;
-extern bool html_redraw_debug;
+extern bool html_redraw_debug;
+
+extern const char * option_homepage_url;
+extern int option_window_width;
+extern int option_window_height;
+extern int option_window_x;
+extern int option_window_y;
+extern char options[PATH_MAX];
/* Zero based resource tree ids: */
#define T_ABOUT 0
@@ -96,7 +102,7 @@ static void __CDECL menu_about(WINDOW *win, int item, int title, void *data)
static void __CDECL menu_new_win(WINDOW *win, int item, int title, void *data)
{
LOG(("%s", __FUNCTION__));
- browser_window_create(cfg_homepage_url, 0, 0, true, false);
+ browser_window_create(option_homepage_url, 0, 0, true, false);
}
static void __CDECL menu_open_url(WINDOW *win, int item, int title, void *data)
@@ -257,7 +263,21 @@ static void __CDECL menu_toolbars(WINDOW *win, int item, int title, void *data)
static void __CDECL menu_savewin(WINDOW *win, int item, int title, void *data)
{
- LOG(("%s", __FUNCTION__));
+ LOG(("%s", __FUNCTION__));
+ if (input_window && input_window->browser) {
+ GRECT rect;
+ wind_get_grect(input_window->root->handle->handle, WF_CURRXYWH, &rect);
+ option_window_width = rect.g_w;
+ option_window_height = rect.g_h;
+ option_window_x = rect.g_x;
+ option_window_y = rect.g_y;
+ nsoption_set_int(window_width, rect.g_w);
+ nsoption_set_int(window_height, rect.g_h);
+ nsoption_set_int(window_x, rect.g_x);
+ nsoption_set_int(window_y, rect.g_y);
+ nsoption_write((const char*)&options);
+ }
+
}
static void __CDECL menu_debug_render(WINDOW *win, int item, int title, void *data)
diff --git a/atari/gui.c b/atari/gui.c
index 07d9483..a2dde67 100755
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -91,11 +91,13 @@ bool rendering = false;
/* Comandline / Options: */
-int cfg_width;
-int cfg_height;
+int option_window_width;
+int option_window_height;
+int option_window_x;
+int option_window_y;
/* Defaults to option_homepage_url, commandline options overwrites that value */
-const char * cfg_homepage_url;
+const char * option_homepage_url;
/* path to choices file: */
char options[PATH_MAX];
@@ -173,8 +175,8 @@ gui_create_browser_window(struct browser_window *bw,
window_create(gw, bw, WIDGET_STATUSBAR|WIDGET_TOOLBAR|WIDGET_RESIZE|WIDGET_SCROLL );
if( gw->root->handle ) {
GRECT pos = {
- app.w/2-(cfg_width/2), (app.h/2)-(cfg_height/2)+16,
- cfg_width, cfg_height
+ option_window_x, option_window_y,
+ option_window_width, option_window_height
};
window_open( gw , pos );
/* Recalculate windows browser area now */
@@ -841,37 +843,51 @@ void gui_quit(void)
static bool
process_cmdline(int argc, char** argv)
{
- int opt;
+ int opt;
+ bool set_default_dimensions = true;
LOG(("argc %d, argv %p", argc, argv));
if ((nsoption_int(window_width) != 0) && (nsoption_int(window_height) != 0)) {
- cfg_width = nsoption_int(window_width);
- cfg_height = nsoption_int(window_height);
- } else {
+
+ option_window_width = nsoption_int(window_width);
+ option_window_height = nsoption_int(window_height);
+ option_window_x = nsoption_int(window_x);
+ option_window_y = nsoption_int(window_y);
+
+ if (option_window_width <= app.w && option_window_height < app.h) {
+ set_default_dimensions = false;
+ }
+ }
+
+ if (set_default_dimensions) {
if( sys_type() == SYS_TOS ){
/* on single tasking OS, start as fulled window: */
- cfg_width = app.w;
- cfg_height = app.h;
+ option_window_width = app.w;
+ option_window_height = app.h-20;
+ option_window_x = app.w/2-(option_window_width/2);
+ option_window_y = (app.h/2)-(option_window_height/2);
} else {
- cfg_width = 600;
- cfg_height = 360;
+ option_window_width = 600;
+ option_window_height = 360;
+ option_window_x = 10;
+ option_window_y = 30;
}
}
if (nsoption_charp(homepage_url) != NULL)
- cfg_homepage_url = nsoption_charp(homepage_url);
+ option_homepage_url = nsoption_charp(homepage_url);
else
- cfg_homepage_url = NETSURF_HOMEPAGE;
+ option_homepage_url = NETSURF_HOMEPAGE;
while((opt = getopt(argc, argv, "w:h:")) != -1) {
switch (opt) {
case 'w':
- cfg_width = atoi(optarg);
+ option_window_width = atoi(optarg);
break;
case 'h':
- cfg_height = atoi(optarg);
+ option_window_height = atoi(optarg);
break;
default:
@@ -883,7 +899,7 @@ process_cmdline(int argc, char** argv)
}
if (optind < argc) {
- cfg_homepage_url = argv[optind];
+ option_homepage_url = argv[optind];
}
return true;
}
@@ -1014,7 +1030,7 @@ int main(int argc, char** argv)
netsurf_init(&argc, &argv, options, messages);
gui_init(argc, argv);
gui_init2(argc, argv);
- browser_window_create(cfg_homepage_url, 0, 0, true, false);
+ browser_window_create(option_homepage_url, 0, 0, true, false);
graf_mouse( ARROW , NULL);
netsurf_main_loop();
netsurf_exit();
diff --git a/atari/toolbar.c b/atari/toolbar.c
index ab88a6b..b6dc468 100755
--- a/atari/toolbar.c
+++ b/atari/toolbar.c
@@ -52,7 +52,7 @@
#include "atari/res/netsurf.rsh"
-extern char * cfg_homepage_url;
+extern char * option_homepage_url;
extern void * h_gem_rsrc;
extern struct gui_window * input_window;
extern long atari_plot_flags;
@@ -302,19 +302,19 @@ static void __CDECL button_redraw( COMPONENT *c, long buff[8], void * data )
while( (todo.g_w > 0) && (todo.g_h > 0) ){
if (rc_intersect(&crect, &todo )) {
-
+
struct rect bgclip = {0,0,todo.g_w, todo.g_h};
pxy[0] = todo.g_x;
pxy[1] = todo.g_y;
pxy[2] = todo.g_w + todo.g_x-1;
pxy[3] = todo.g_h + todo.g_y-1;
-
+
vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy );
plot_set_dimensions(todo.g_x, todo.g_y, todo.g_w, todo.g_h);
plot_rectangle(0, 0, crect.g_w, crect.g_h, &plot_style_background);
-
+
if( img_toolbar == true ){
- plot_set_dimensions(icon_dim.g_x, icon_dim.g_y,
+ plot_set_dimensions(icon_dim.g_x, icon_dim.g_y,
icon_dim.g_w, icon_dim.g_h);
plot_clip( &icon_clip );
atari_plotters.bitmap( bmpx, bmpy, bmpw, bmph, icon,
@@ -403,11 +403,11 @@ void __CDECL evnt_throbber_redraw( COMPONENT *c, long buff[8])
pxy[2] = (short)buff[4] + buff[6]-1;
pxy[3] = (short)buff[5] + buff[7]-2;
vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy );
-
+
if (app.nplanes > 2 ) {
plot_set_dimensions(work.g_x, work.g_y, work.g_w, work.g_h);
plot_rectangle( 0, 0, work.g_w, work.g_h, &plot_style_background);
- }
+ }
else {
vsf_color(atari_plot_vdi_handle, WHITE );
v_bar(atari_plot_vdi_handle, (short*)&pxy );
@@ -502,20 +502,20 @@ void __CDECL evnt_url_redraw( COMPONENT *c, long buff[8], void * data)
if ( !rc_lintersect( (LGRECT*)&buff[4], &clip ) ) return;
plot_set_dimensions(work.g_x, work.g_y, work.g_w, work.g_h);
-
+
//left margin:
- plot_rectangle(0, 0, TOOLBAR_URL_MARGIN_LEFT, work.g_h,
+ plot_rectangle(0, 0, TOOLBAR_URL_MARGIN_LEFT, work.g_h,
&plot_style_background);
// right margin:
- plot_rectangle(work.g_w-TOOLBAR_URL_MARGIN_RIGHT, 0, work.g_w, work.g_h,
+ plot_rectangle(work.g_w-TOOLBAR_URL_MARGIN_RIGHT, 0, work.g_w, work.g_h,
&plot_style_background);
// top margin:
- plot_rectangle(0, 0, work.g_w, TOOLBAR_URL_MARGIN_TOP,
+ plot_rectangle(0, 0, work.g_w, TOOLBAR_URL_MARGIN_TOP,
&plot_style_background);
// bottom margin:
- plot_rectangle(0, work.g_h-TOOLBAR_URL_MARGIN_BOTTOM, work.g_w, work.g_h,
+ plot_rectangle(0, work.g_h-TOOLBAR_URL_MARGIN_BOTTOM, work.g_w, work.g_h,
&plot_style_background);
// TBD: request redraw of textarea for specific region.
@@ -612,7 +612,7 @@ static void __CDECL evnt_toolbar_redraw( COMPONENT *c, long buff[8], void *data
clip = work;
if( !rc_lintersect( (LGRECT*)&buff[4], &clip ) ) return;
if( work.g_y + work.g_h != clip.g_y + clip.g_h ) return;
-
+
vswr_mode(atari_plot_vdi_handle, MD_REPLACE );
vsl_color(atari_plot_vdi_handle, BLACK );
vsl_type(atari_plot_vdi_handle, 1 );
@@ -1019,13 +1019,13 @@ void tb_forward_click( struct gui_window * gw )
void tb_home_click( struct gui_window * gw )
{
- browser_window_go(gw->browser->bw, cfg_homepage_url, 0, true);
+ browser_window_go(gw->browser->bw, option_homepage_url, 0, true);
}
void tb_stop_click( struct gui_window * gw )
{
- browser_window_stop( gw->browser->bw );
+ browser_window_stop(gw->browser->bw);
}
--
NetSurf Browser
10 years, 6 months
netsurf: branch master updated. 382c2f2289047a920bc0cf5f1e539074457beed7
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/382c2f2289047a920bc0c...
...commit http://git.netsurf-browser.org/netsurf.git/commit/382c2f2289047a920bc0cf5...
...tree http://git.netsurf-browser.org/netsurf.git/tree/382c2f2289047a920bc0cf5f1...
The branch, master has been updated
via 382c2f2289047a920bc0cf5f1e539074457beed7 (commit)
via 514bee5786a4506922e3e80a0e4a8672dee7daee (commit)
from 8660bed543b54c114fdf809c4c479adf58a2a739 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/382c2f2289047a920bc...
commit 382c2f2289047a920bc0cf5f1e539074457beed7
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Only warp pointer once for a sequence of consecutive move events. Further reduces lag when dragging scrollbar.
diff --git a/framebuffer/fbtk/event.c b/framebuffer/fbtk/event.c
index ca64fd3..0c68912 100644
--- a/framebuffer/fbtk/event.c
+++ b/framebuffer/fbtk/event.c
@@ -188,14 +188,31 @@ fbtk_warp_pointer(fbtk_widget_t *widget, int x, int y, bool relative)
bool
fbtk_event(fbtk_widget_t *root, nsfb_event_t *event, int timeout)
{
+ nsfb_bbox_t cloc;
bool unused = false; /* is the event available */
+ bool move_pointer = false; /* whether pointer move events occured */
/* ensure we have the root widget */
root = fbtk_get_root_widget(root);
do {
- if (nsfb_event(root->u.root.fb, event, timeout) == false)
+ if (nsfb_event(root->u.root.fb, event, timeout) == false) {
+ if (move_pointer)
+ fbtk_warp_pointer(root, cloc.x0, cloc.y0,
+ false);
return false;
+ }
+
+ if (move_pointer && event->type != NSFB_EVENT_MOVE_RELATIVE &&
+ event->type != NSFB_EVENT_MOVE_ABSOLUTE) {
+ /* Flush the movements */
+ fbtk_warp_pointer(root, cloc.x0, cloc.y0, false);
+
+ } else if (!move_pointer &&
+ event->type == NSFB_EVENT_MOVE_RELATIVE) {
+ /* Get current pointer coords */
+ nsfb_cursor_loc_get(root->u.root.fb, &cloc);
+ }
switch (event->type) {
case NSFB_EVENT_KEY_DOWN:
@@ -213,14 +230,20 @@ fbtk_event(fbtk_widget_t *root, nsfb_event_t *event, int timeout)
break;
case NSFB_EVENT_MOVE_RELATIVE:
- fbtk_warp_pointer(root, event->value.vector.x,
- event->value.vector.y, true);
+ /* Consecutive move events are consolidated into a
+ * single pointer warp */
+ move_pointer = true;
+ cloc.x0 += event->value.vector.x;
+ cloc.y0 += event->value.vector.y;
timeout = 0;
break;
case NSFB_EVENT_MOVE_ABSOLUTE:
- fbtk_warp_pointer(root, event->value.vector.x,
- event->value.vector.y, false);
+ /* Consecutive move events are consolidated into a
+ * single pointer warp */
+ move_pointer = true;
+ cloc.x0 = event->value.vector.x;
+ cloc.y0 = event->value.vector.y;
timeout = 0;
break;
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/514bee5786a4506922e...
commit 514bee5786a4506922e3e80a0e4a8672dee7daee
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Handle consecutive queued mouse move events together. Reduces pointer lag when busy.
diff --git a/framebuffer/fbtk/event.c b/framebuffer/fbtk/event.c
index 051afb1..ca64fd3 100644
--- a/framebuffer/fbtk/event.c
+++ b/framebuffer/fbtk/event.c
@@ -193,36 +193,42 @@ fbtk_event(fbtk_widget_t *root, nsfb_event_t *event, int timeout)
/* ensure we have the root widget */
root = fbtk_get_root_widget(root);
- if (nsfb_event(root->u.root.fb, event, timeout) == false)
- return false;
-
- switch (event->type) {
- case NSFB_EVENT_KEY_DOWN:
- case NSFB_EVENT_KEY_UP:
- if ((event->value.controlcode >= NSFB_KEY_MOUSE_1) &&
- (event->value.controlcode <= NSFB_KEY_MOUSE_5)) {
- fbtk_click(root, event);
- } else {
- fbtk_input(root, event);
+ do {
+ if (nsfb_event(root->u.root.fb, event, timeout) == false)
+ return false;
+
+ switch (event->type) {
+ case NSFB_EVENT_KEY_DOWN:
+ case NSFB_EVENT_KEY_UP:
+ if ((event->value.controlcode >= NSFB_KEY_MOUSE_1) &&
+ (event->value.controlcode <= NSFB_KEY_MOUSE_5)) {
+ fbtk_click(root, event);
+ } else {
+ fbtk_input(root, event);
+ }
+ break;
+
+ case NSFB_EVENT_CONTROL:
+ unused = true;
+ break;
+
+ case NSFB_EVENT_MOVE_RELATIVE:
+ fbtk_warp_pointer(root, event->value.vector.x,
+ event->value.vector.y, true);
+ timeout = 0;
+ break;
+
+ case NSFB_EVENT_MOVE_ABSOLUTE:
+ fbtk_warp_pointer(root, event->value.vector.x,
+ event->value.vector.y, false);
+ timeout = 0;
+ break;
+
+ default:
+ break;
}
- break;
-
- case NSFB_EVENT_CONTROL:
- unused = true;
- break;
-
- case NSFB_EVENT_MOVE_RELATIVE:
- fbtk_warp_pointer(root, event->value.vector.x, event->value.vector.y, true);
- break;
-
- case NSFB_EVENT_MOVE_ABSOLUTE:
- fbtk_warp_pointer(root, event->value.vector.x, event->value.vector.y, false);
- break;
-
- default:
- break;
-
- }
+ } while (event->type == NSFB_EVENT_MOVE_RELATIVE ||
+ event->type == NSFB_EVENT_MOVE_ABSOLUTE);
return unused;
}
-----------------------------------------------------------------------
Summary of changes:
framebuffer/fbtk/event.c | 81 +++++++++++++++++++++++++++++++---------------
1 files changed, 55 insertions(+), 26 deletions(-)
diff --git a/framebuffer/fbtk/event.c b/framebuffer/fbtk/event.c
index 051afb1..0c68912 100644
--- a/framebuffer/fbtk/event.c
+++ b/framebuffer/fbtk/event.c
@@ -188,41 +188,70 @@ fbtk_warp_pointer(fbtk_widget_t *widget, int x, int y, bool relative)
bool
fbtk_event(fbtk_widget_t *root, nsfb_event_t *event, int timeout)
{
+ nsfb_bbox_t cloc;
bool unused = false; /* is the event available */
+ bool move_pointer = false; /* whether pointer move events occured */
/* ensure we have the root widget */
root = fbtk_get_root_widget(root);
- if (nsfb_event(root->u.root.fb, event, timeout) == false)
- return false;
-
- switch (event->type) {
- case NSFB_EVENT_KEY_DOWN:
- case NSFB_EVENT_KEY_UP:
- if ((event->value.controlcode >= NSFB_KEY_MOUSE_1) &&
- (event->value.controlcode <= NSFB_KEY_MOUSE_5)) {
- fbtk_click(root, event);
- } else {
- fbtk_input(root, event);
+ do {
+ if (nsfb_event(root->u.root.fb, event, timeout) == false) {
+ if (move_pointer)
+ fbtk_warp_pointer(root, cloc.x0, cloc.y0,
+ false);
+ return false;
}
- break;
-
- case NSFB_EVENT_CONTROL:
- unused = true;
- break;
-
- case NSFB_EVENT_MOVE_RELATIVE:
- fbtk_warp_pointer(root, event->value.vector.x, event->value.vector.y, true);
- break;
- case NSFB_EVENT_MOVE_ABSOLUTE:
- fbtk_warp_pointer(root, event->value.vector.x, event->value.vector.y, false);
- break;
+ if (move_pointer && event->type != NSFB_EVENT_MOVE_RELATIVE &&
+ event->type != NSFB_EVENT_MOVE_ABSOLUTE) {
+ /* Flush the movements */
+ fbtk_warp_pointer(root, cloc.x0, cloc.y0, false);
- default:
- break;
+ } else if (!move_pointer &&
+ event->type == NSFB_EVENT_MOVE_RELATIVE) {
+ /* Get current pointer coords */
+ nsfb_cursor_loc_get(root->u.root.fb, &cloc);
+ }
- }
+ switch (event->type) {
+ case NSFB_EVENT_KEY_DOWN:
+ case NSFB_EVENT_KEY_UP:
+ if ((event->value.controlcode >= NSFB_KEY_MOUSE_1) &&
+ (event->value.controlcode <= NSFB_KEY_MOUSE_5)) {
+ fbtk_click(root, event);
+ } else {
+ fbtk_input(root, event);
+ }
+ break;
+
+ case NSFB_EVENT_CONTROL:
+ unused = true;
+ break;
+
+ case NSFB_EVENT_MOVE_RELATIVE:
+ /* Consecutive move events are consolidated into a
+ * single pointer warp */
+ move_pointer = true;
+ cloc.x0 += event->value.vector.x;
+ cloc.y0 += event->value.vector.y;
+ timeout = 0;
+ break;
+
+ case NSFB_EVENT_MOVE_ABSOLUTE:
+ /* Consecutive move events are consolidated into a
+ * single pointer warp */
+ move_pointer = true;
+ cloc.x0 = event->value.vector.x;
+ cloc.y0 = event->value.vector.y;
+ timeout = 0;
+ break;
+
+ default:
+ break;
+ }
+ } while (event->type == NSFB_EVENT_MOVE_RELATIVE ||
+ event->type == NSFB_EVENT_MOVE_ABSOLUTE);
return unused;
}
--
NetSurf Browser
10 years, 6 months
netsurf: branch master updated. 8660bed543b54c114fdf809c4c479adf58a2a739
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/8660bed543b54c114fdf8...
...commit http://git.netsurf-browser.org/netsurf.git/commit/8660bed543b54c114fdf809...
...tree http://git.netsurf-browser.org/netsurf.git/tree/8660bed543b54c114fdf809c4...
The branch, master has been updated
via 8660bed543b54c114fdf809c4c479adf58a2a739 (commit)
via 305938bb48d95b54b0c60724942f257ddc46532b (commit)
via d9d7dcb758761e3123fa0fb2d9c6ebc626041662 (commit)
from 59ba5dd43cceeeef02732ef1d9f4200120017630 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/8660bed543b54c114fd...
commit 8660bed543b54c114fdf809c4c479adf58a2a739
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Change a couple of 'if's to 'else if's.
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index aa92870..10c2e46 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -234,9 +234,8 @@ fb_pan(fbtk_widget_t *widget,
/* redraw newly exposed area */
bwidget->scrolly += bwidget->pany;
fb_queue_redraw(widget, 0, 0, width, - bwidget->pany);
- }
- if (bwidget->pany > 0) {
+ } else if (bwidget->pany > 0) {
/* pan down by less then viewport height */
srcbox.x0 = x;
srcbox.y0 = y + bwidget->pany;
@@ -253,7 +252,8 @@ fb_pan(fbtk_widget_t *widget,
/* redraw newly exposed area */
bwidget->scrolly += bwidget->pany;
- fb_queue_redraw(widget, 0, height - bwidget->pany, width, height);
+ fb_queue_redraw(widget, 0, height - bwidget->pany,
+ width, height);
}
if (bwidget->panx < 0) {
@@ -274,9 +274,8 @@ fb_pan(fbtk_widget_t *widget,
/* redraw newly exposed area */
bwidget->scrollx += bwidget->panx;
fb_queue_redraw(widget, 0, 0, -bwidget->panx, height);
- }
- if (bwidget->panx > 0) {
+ } else if (bwidget->panx > 0) {
/* pan right by less then viewport width */
srcbox.x0 = x + bwidget->panx;
srcbox.y0 = y;
@@ -293,10 +292,10 @@ fb_pan(fbtk_widget_t *widget,
/* redraw newly exposed area */
bwidget->scrollx += bwidget->panx;
- fb_queue_redraw(widget, width - bwidget->panx, 0, width, height);
+ fb_queue_redraw(widget, width - bwidget->panx, 0,
+ width, height);
}
-
bwidget->pan_required = false;
bwidget->panx = 0;
bwidget->pany = 0;
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/305938bb48d95b54b0c...
commit 305938bb48d95b54b0c60724942f257ddc46532b
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Avoid a load of repeat operations when panning by greater than viewport size.
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index d6a340d..aa92870 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -202,8 +202,8 @@ fb_pan(fbtk_widget_t *widget,
y = fbtk_get_absy(widget);
/* if the pan exceeds the viewport size just redraw the whole area */
- if (bwidget->pany > height || bwidget->pany < -height ||
- bwidget->panx > width || bwidget->panx < -width) {
+ if (bwidget->pany >= height || bwidget->pany <= -height ||
+ bwidget->panx >= width || bwidget->panx <= -width) {
bwidget->scrolly += bwidget->pany;
bwidget->scrollx += bwidget->panx;
@@ -212,6 +212,8 @@ fb_pan(fbtk_widget_t *widget,
/* ensure we don't try to scroll again */
bwidget->panx = 0;
bwidget->pany = 0;
+ bwidget->pan_required = false;
+ return;
}
if (bwidget->pany < 0) {
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/d9d7dcb758761e3123f...
commit d9d7dcb758761e3123fa0fb2d9c6ebc626041662
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Avoid redrawing the whole screen when scrolling by zero pixels.
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index 4822a9e..d6a340d 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -119,7 +119,6 @@ widget_scroll_y(struct gui_window *gw, int y, bool abs)
} else {
bwidget->pany += y;
}
- bwidget->pan_required = true;
content_height = content_get_height(gw->bw->current_content) * scale;
@@ -133,6 +132,11 @@ widget_scroll_y(struct gui_window *gw, int y, bool abs)
if ((bwidget->scrolly + bwidget->pany) > (content_height - height))
bwidget->pany = (content_height - height) - bwidget->scrolly;
+ if (bwidget->pany == 0)
+ return;
+
+ bwidget->pan_required = true;
+
fbtk_request_redraw(gw->browser);
fbtk_set_scroll_position(gw->vscroll, bwidget->scrolly + bwidget->pany);
@@ -152,13 +156,11 @@ widget_scroll_x(struct gui_window *gw, int x, bool abs)
} else {
bwidget->panx += x;
}
- bwidget->pan_required = true;
content_width = content_get_width(gw->bw->current_content) * scale;
width = fbtk_get_width(gw->browser);
-
/* dont pan off the left */
if ((bwidget->scrollx + bwidget->panx) < 0)
bwidget->panx = - bwidget->scrollx;
@@ -167,6 +169,11 @@ widget_scroll_x(struct gui_window *gw, int x, bool abs)
if ((bwidget->scrollx + bwidget->panx) > (content_width - width))
bwidget->panx = (content_width - width) - bwidget->scrollx;
+ if (bwidget->panx == 0)
+ return;
+
+ bwidget->pan_required = true;
+
fbtk_request_redraw(gw->browser);
fbtk_set_scroll_position(gw->hscroll, bwidget->scrollx + bwidget->panx);
-----------------------------------------------------------------------
Summary of changes:
framebuffer/gui.c | 32 ++++++++++++++++++++------------
1 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index 4822a9e..10c2e46 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -119,7 +119,6 @@ widget_scroll_y(struct gui_window *gw, int y, bool abs)
} else {
bwidget->pany += y;
}
- bwidget->pan_required = true;
content_height = content_get_height(gw->bw->current_content) * scale;
@@ -133,6 +132,11 @@ widget_scroll_y(struct gui_window *gw, int y, bool abs)
if ((bwidget->scrolly + bwidget->pany) > (content_height - height))
bwidget->pany = (content_height - height) - bwidget->scrolly;
+ if (bwidget->pany == 0)
+ return;
+
+ bwidget->pan_required = true;
+
fbtk_request_redraw(gw->browser);
fbtk_set_scroll_position(gw->vscroll, bwidget->scrolly + bwidget->pany);
@@ -152,13 +156,11 @@ widget_scroll_x(struct gui_window *gw, int x, bool abs)
} else {
bwidget->panx += x;
}
- bwidget->pan_required = true;
content_width = content_get_width(gw->bw->current_content) * scale;
width = fbtk_get_width(gw->browser);
-
/* dont pan off the left */
if ((bwidget->scrollx + bwidget->panx) < 0)
bwidget->panx = - bwidget->scrollx;
@@ -167,6 +169,11 @@ widget_scroll_x(struct gui_window *gw, int x, bool abs)
if ((bwidget->scrollx + bwidget->panx) > (content_width - width))
bwidget->panx = (content_width - width) - bwidget->scrollx;
+ if (bwidget->panx == 0)
+ return;
+
+ bwidget->pan_required = true;
+
fbtk_request_redraw(gw->browser);
fbtk_set_scroll_position(gw->hscroll, bwidget->scrollx + bwidget->panx);
@@ -195,8 +202,8 @@ fb_pan(fbtk_widget_t *widget,
y = fbtk_get_absy(widget);
/* if the pan exceeds the viewport size just redraw the whole area */
- if (bwidget->pany > height || bwidget->pany < -height ||
- bwidget->panx > width || bwidget->panx < -width) {
+ if (bwidget->pany >= height || bwidget->pany <= -height ||
+ bwidget->panx >= width || bwidget->panx <= -width) {
bwidget->scrolly += bwidget->pany;
bwidget->scrollx += bwidget->panx;
@@ -205,6 +212,8 @@ fb_pan(fbtk_widget_t *widget,
/* ensure we don't try to scroll again */
bwidget->panx = 0;
bwidget->pany = 0;
+ bwidget->pan_required = false;
+ return;
}
if (bwidget->pany < 0) {
@@ -225,9 +234,8 @@ fb_pan(fbtk_widget_t *widget,
/* redraw newly exposed area */
bwidget->scrolly += bwidget->pany;
fb_queue_redraw(widget, 0, 0, width, - bwidget->pany);
- }
- if (bwidget->pany > 0) {
+ } else if (bwidget->pany > 0) {
/* pan down by less then viewport height */
srcbox.x0 = x;
srcbox.y0 = y + bwidget->pany;
@@ -244,7 +252,8 @@ fb_pan(fbtk_widget_t *widget,
/* redraw newly exposed area */
bwidget->scrolly += bwidget->pany;
- fb_queue_redraw(widget, 0, height - bwidget->pany, width, height);
+ fb_queue_redraw(widget, 0, height - bwidget->pany,
+ width, height);
}
if (bwidget->panx < 0) {
@@ -265,9 +274,8 @@ fb_pan(fbtk_widget_t *widget,
/* redraw newly exposed area */
bwidget->scrollx += bwidget->panx;
fb_queue_redraw(widget, 0, 0, -bwidget->panx, height);
- }
- if (bwidget->panx > 0) {
+ } else if (bwidget->panx > 0) {
/* pan right by less then viewport width */
srcbox.x0 = x + bwidget->panx;
srcbox.y0 = y;
@@ -284,10 +292,10 @@ fb_pan(fbtk_widget_t *widget,
/* redraw newly exposed area */
bwidget->scrollx += bwidget->panx;
- fb_queue_redraw(widget, width - bwidget->panx, 0, width, height);
+ fb_queue_redraw(widget, width - bwidget->panx, 0,
+ width, height);
}
-
bwidget->pan_required = false;
bwidget->panx = 0;
bwidget->pany = 0;
--
NetSurf Browser
10 years, 6 months
netsurf: branch master updated. d3b88090204682944e5148ee008e8df08c587f97
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/d3b88090204682944e514...
...commit http://git.netsurf-browser.org/netsurf.git/commit/d3b88090204682944e5148e...
...tree http://git.netsurf-browser.org/netsurf.git/tree/d3b88090204682944e5148ee0...
The branch, master has been updated
via d3b88090204682944e5148ee008e8df08c587f97 (commit)
from 0a9b28d3e079dbc81c5cd110d5759f5d73d8555b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/d3b88090204682944e5...
commit d3b88090204682944e5148ee008e8df08c587f97
Author: Vincent Sanders <vince(a)netsurf-browser.org>
Commit: Vincent Sanders <vince(a)netsurf-browser.org>
add libdom
diff --git a/cocoa/Makefile.target b/cocoa/Makefile.target
index 0fea501..b3ababd 100644
--- a/cocoa/Makefile.target
+++ b/cocoa/Makefile.target
@@ -5,7 +5,7 @@
POSTEXES += NetSurf.app
LDFLAGS += -L/usr/lib
- LDFLAGS += $(shell $(PKG_CONFIG) --libs libxml-2.0 libhubbub libcss)
+ LDFLAGS += $(shell $(PKG_CONFIG) --libs libxml-2.0 libhubbub libcss libdom)
LDFLAGS += -L/usr/X11/lib
LDFLAGS += -lm -lxml2 -lcurl -liconv
LDFLAGS += -lssl -lcrypto
@@ -16,7 +16,7 @@
CFLAGS += -g -Os -Wno-uninitialized
- CFLAGS += $(shell $(PKG_CONFIG) --cflags libxml-2.0 libhubbub libcss)
+ CFLAGS += $(shell $(PKG_CONFIG) --cflags libxml-2.0 libhubbub libcss libdom)
# shut up zconf.h and zlib.h
#CFLAGS += -D_LARGEFILE64_SOURCE=1
-----------------------------------------------------------------------
Summary of changes:
cocoa/Makefile.target | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cocoa/Makefile.target b/cocoa/Makefile.target
index 0fea501..b3ababd 100644
--- a/cocoa/Makefile.target
+++ b/cocoa/Makefile.target
@@ -5,7 +5,7 @@
POSTEXES += NetSurf.app
LDFLAGS += -L/usr/lib
- LDFLAGS += $(shell $(PKG_CONFIG) --libs libxml-2.0 libhubbub libcss)
+ LDFLAGS += $(shell $(PKG_CONFIG) --libs libxml-2.0 libhubbub libcss libdom)
LDFLAGS += -L/usr/X11/lib
LDFLAGS += -lm -lxml2 -lcurl -liconv
LDFLAGS += -lssl -lcrypto
@@ -16,7 +16,7 @@
CFLAGS += -g -Os -Wno-uninitialized
- CFLAGS += $(shell $(PKG_CONFIG) --cflags libxml-2.0 libhubbub libcss)
+ CFLAGS += $(shell $(PKG_CONFIG) --cflags libxml-2.0 libhubbub libcss libdom)
# shut up zconf.h and zlib.h
#CFLAGS += -D_LARGEFILE64_SOURCE=1
--
NetSurf Browser
10 years, 6 months
netsurf: branch master updated. 888d8eac4f102f6ecb75878e7717c3495e81a215
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/888d8eac4f102f6ecb758...
...commit http://git.netsurf-browser.org/netsurf.git/commit/888d8eac4f102f6ecb75878...
...tree http://git.netsurf-browser.org/netsurf.git/tree/888d8eac4f102f6ecb75878e7...
The branch, master has been updated
via 888d8eac4f102f6ecb75878e7717c3495e81a215 (commit)
from 2f408f0ecbadcfc895c5067940d840108bbbb77f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/888d8eac4f102f6ecb7...
commit 888d8eac4f102f6ecb75878e7717c3495e81a215
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
A few tweaks from when I was looking for internal font renderer bug in wrong place.
diff --git a/framebuffer/framebuffer.c b/framebuffer/framebuffer.c
index 9195398..fda8aae 100644
--- a/framebuffer/framebuffer.c
+++ b/framebuffer/framebuffer.c
@@ -136,12 +136,14 @@ static bool framebuffer_plot_text(int x, int y, const char *text, size_t length,
if (buffer == NULL)
return true;
- /* y is given to the fonts baseline we need it to the fonts top */
- y-=((fb_font->height * 75)/100);
+ /* y is given as the baseline, at 3/4 from top.
+ * we need it to the top */
+ y -= ((fb_font->height * 3) / 4);
- y+=1; /* the coord is the bottom-left of the pixels offset by 1 to make
- * it work since fb coords are the top-left of pixels
- */
+ /* the coord is the bottom-left of the pixels offset by 1 to make
+ * it work since fb coords are the top-left of pixels
+ */
+ y += 1;
blen = strlen(buffer);
@@ -154,7 +156,7 @@ static bool framebuffer_plot_text(int x, int y, const char *text, size_t length,
chrp = fb_font->data + ((unsigned char)buffer[chr] * fb_font->height);
nsfb_plot_glyph1(nsfb, &loc, (uint8_t *)chrp, 32, fstyle->foreground);
- x+=fb_font->width;
+ x += fb_font->width;
}
-----------------------------------------------------------------------
Summary of changes:
framebuffer/framebuffer.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/framebuffer/framebuffer.c b/framebuffer/framebuffer.c
index 9195398..fda8aae 100644
--- a/framebuffer/framebuffer.c
+++ b/framebuffer/framebuffer.c
@@ -136,12 +136,14 @@ static bool framebuffer_plot_text(int x, int y, const char *text, size_t length,
if (buffer == NULL)
return true;
- /* y is given to the fonts baseline we need it to the fonts top */
- y-=((fb_font->height * 75)/100);
+ /* y is given as the baseline, at 3/4 from top.
+ * we need it to the top */
+ y -= ((fb_font->height * 3) / 4);
- y+=1; /* the coord is the bottom-left of the pixels offset by 1 to make
- * it work since fb coords are the top-left of pixels
- */
+ /* the coord is the bottom-left of the pixels offset by 1 to make
+ * it work since fb coords are the top-left of pixels
+ */
+ y += 1;
blen = strlen(buffer);
@@ -154,7 +156,7 @@ static bool framebuffer_plot_text(int x, int y, const char *text, size_t length,
chrp = fb_font->data + ((unsigned char)buffer[chr] * fb_font->height);
nsfb_plot_glyph1(nsfb, &loc, (uint8_t *)chrp, 32, fstyle->foreground);
- x+=fb_font->width;
+ x += fb_font->width;
}
--
NetSurf Browser
10 years, 6 months
libnsfb: branch master updated. babd30a2b471d1177895327fd555175ca04017a0
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/libnsfb.git/shortlog/babd30a2b471d11778953...
...commit http://git.netsurf-browser.org/libnsfb.git/commit/babd30a2b471d1177895327...
...tree http://git.netsurf-browser.org/libnsfb.git/tree/babd30a2b471d1177895327fd...
The branch, master has been updated
via babd30a2b471d1177895327fd555175ca04017a0 (commit)
via cc6b21e5d3f36aae6340203f9a1998e7c4d382b6 (commit)
from 3526f1b2ccbb0fb8d2bb1fc344294f28f47e2222 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/libnsfb.git/commitdiff/babd30a2b471d117789...
commit babd30a2b471d1177895327fd555175ca04017a0
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Tiny simplification of freetype glyph renderer.
diff --git a/src/plot/common.c b/src/plot/common.c
index 2b8a939..5a83942 100644
--- a/src/plot/common.c
+++ b/src/plot/common.c
@@ -196,17 +196,14 @@ glyph8(nsfb_t *nsfb,
int xoff, yoff; /* x and y offset into image */
int x = loc->x0;
int y = loc->y0;
- int width = loc->x1 - loc->x0;
- int height = loc->y1 - loc->y0;
+ int width;
+ int height;
if (!nsfb_plot_clip_ctx(nsfb, loc))
return true;
- if (height > (loc->y1 - loc->y0))
- height = (loc->y1 - loc->y0);
-
- if (width > (loc->x1 - loc->x0))
- width = (loc->x1 - loc->x0);
+ height = (loc->y1 - loc->y0);
+ width = (loc->x1 - loc->x0);
xoff = loc->x0 - x;
yoff = loc->y0 - y;
commitdiff http://git.netsurf-browser.org/libnsfb.git/commitdiff/cc6b21e5d3f36aae634...
commit cc6b21e5d3f36aae6340203f9a1998e7c4d382b6
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Don't add top clipping to bottom clipping. Fixes internal font rendering.
diff --git a/src/plot/common.c b/src/plot/common.c
index 5675ad6..2b8a939 100644
--- a/src/plot/common.c
+++ b/src/plot/common.c
@@ -143,19 +143,16 @@ glyph1(nsfb_t *nsfb,
int xoff, yoff; /* x and y offset into image */
int x = loc->x0;
int y = loc->y0;
- int width = loc->x1 - loc->x0;
- int height = loc->y1 - loc->y0;
+ int width;
+ int height;
const uint8_t *fntd;
uint8_t row;
if (!nsfb_plot_clip_ctx(nsfb, loc))
return true;
- if (height > (loc->y1 - loc->y0))
- height = (loc->y1 - loc->y0);
-
- if (width > (loc->x1 - loc->x0))
- width = (loc->x1 - loc->x0);
+ height = loc->y1 - y;
+ width = loc->x1 - x;
xoff = loc->x0 - x;
yoff = loc->y0 - y;
-----------------------------------------------------------------------
Summary of changes:
src/plot/common.c | 22 ++++++++--------------
1 files changed, 8 insertions(+), 14 deletions(-)
diff --git a/src/plot/common.c b/src/plot/common.c
index 5675ad6..5a83942 100644
--- a/src/plot/common.c
+++ b/src/plot/common.c
@@ -143,19 +143,16 @@ glyph1(nsfb_t *nsfb,
int xoff, yoff; /* x and y offset into image */
int x = loc->x0;
int y = loc->y0;
- int width = loc->x1 - loc->x0;
- int height = loc->y1 - loc->y0;
+ int width;
+ int height;
const uint8_t *fntd;
uint8_t row;
if (!nsfb_plot_clip_ctx(nsfb, loc))
return true;
- if (height > (loc->y1 - loc->y0))
- height = (loc->y1 - loc->y0);
-
- if (width > (loc->x1 - loc->x0))
- width = (loc->x1 - loc->x0);
+ height = loc->y1 - y;
+ width = loc->x1 - x;
xoff = loc->x0 - x;
yoff = loc->y0 - y;
@@ -199,17 +196,14 @@ glyph8(nsfb_t *nsfb,
int xoff, yoff; /* x and y offset into image */
int x = loc->x0;
int y = loc->y0;
- int width = loc->x1 - loc->x0;
- int height = loc->y1 - loc->y0;
+ int width;
+ int height;
if (!nsfb_plot_clip_ctx(nsfb, loc))
return true;
- if (height > (loc->y1 - loc->y0))
- height = (loc->y1 - loc->y0);
-
- if (width > (loc->x1 - loc->x0))
- width = (loc->x1 - loc->x0);
+ height = (loc->y1 - loc->y0);
+ width = (loc->x1 - loc->x0);
xoff = loc->x0 - x;
yoff = loc->y0 - y;
--
NetSurf Framebuffer library
10 years, 6 months
netsurf: branch master updated. 2f408f0ecbadcfc895c5067940d840108bbbb77f
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/2f408f0ecbadcfc895c50...
...commit http://git.netsurf-browser.org/netsurf.git/commit/2f408f0ecbadcfc895c5067...
...tree http://git.netsurf-browser.org/netsurf.git/tree/2f408f0ecbadcfc895c506794...
The branch, master has been updated
via 2f408f0ecbadcfc895c5067940d840108bbbb77f (commit)
via 81e079e7470c0beb1cc0f88da63c340b5ed4f631 (commit)
from 483d32cadc516e2e4ba391b38a1029f9710cefe0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/2f408f0ecbadcfc895c...
commit 2f408f0ecbadcfc895c5067940d840108bbbb77f
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
More use of interns.
diff --git a/render/box_construct.c b/render/box_construct.c
index fbaa9db..e103d44 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -40,6 +40,7 @@
#include "render/box.h"
#include "render/form.h"
#include "render/html_internal.h"
+#include "utils/corestrings.h"
#include "utils/locale.h"
#include "utils/log.h"
#include "utils/messages.h"
@@ -1647,13 +1648,17 @@ bool box_a(BOX_SPECIAL_PARAMS)
/* target frame [16.3] */
err = dom_element_get_attribute(n, kstr_target, &s);
if (err == DOM_NO_ERR && s != NULL) {
- if (!strcasecmp(dom_string_data(s), "_blank"))
+ if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc__blank))
box->target = TARGET_BLANK;
- else if (!strcasecmp(dom_string_data(s), "_top"))
+ else if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc__top))
box->target = TARGET_TOP;
- else if (!strcasecmp(dom_string_data(s), "_parent"))
+ else if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc__parent))
box->target = TARGET_PARENT;
- else if (!strcasecmp(dom_string_data(s), "_self"))
+ else if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc__self))
/* the default may have been overridden by a
* <base target=...>, so this is different to 0 */
box->target = TARGET_SELF;
@@ -1941,7 +1946,8 @@ bool box_object(BOX_SPECIAL_PARAMS)
return false;
}
- if (strcasecmp(dom_string_data(name), "param") != 0) {
+ if (!dom_string_caseless_lwc_isequal(name,
+ corestring_lwc_param)) {
/* The first non-param child is the start of
* the alt html. Therefore, we should break
* out of this loop. */
@@ -2122,7 +2128,8 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
/* common extension: frameborder="yes|no" to control all children */
err = dom_element_get_attribute(n, kstr_frameborder, &s);
if (err == DOM_NO_ERR && s != NULL) {
- if (strcasecmp(dom_string_data(s), "no") == 0)
+ if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc_no) == 0)
default_border = false;
dom_string_unref(s);
}
@@ -2194,12 +2201,13 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
}
if (type != DOM_ELEMENT_NODE ||
- (strcasecmp(
- dom_string_data(name),
- "frame") != 0 &&
- strcasecmp(
- dom_string_data(name),
- "frameset") != 0)) {
+ (!dom_string_caseless_lwc_isequal(
+ name,
+ corestring_lwc_frame) &&
+ !dom_string_caseless_lwc_isequal(
+ name,
+ corestring_lwc_frameset
+ ))) {
err = dom_node_get_next_sibling(c,
&next);
if (err != DOM_NO_ERR) {
@@ -2229,7 +2237,8 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
return false;
}
- if (strcasecmp(dom_string_data(s), "frameset") == 0) {
+ if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc_frameset)) {
dom_string_unref(s);
frame->border = 0;
if (box_create_frameset(frame, c,
@@ -2290,10 +2299,11 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
err = dom_element_get_attribute(c, kstr_scrolling, &s);
if (err == DOM_NO_ERR && s != NULL) {
- if (strcasecmp(dom_string_data(s), "yes") == 0)
+ if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc_yes))
frame->scrolling = SCROLLING_YES;
- else if (strcasecmp(dom_string_data(s),
- "no") == 0)
+ else if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc_no))
frame->scrolling = SCROLLING_NO;
dom_string_unref(s);
}
@@ -2447,9 +2457,11 @@ bool box_iframe(BOX_SPECIAL_PARAMS)
err = dom_element_get_attribute(n, kstr_scrolling, &s);
if (err == DOM_NO_ERR && s != NULL) {
- if (strcasecmp(dom_string_data(s), "yes") == 0)
+ if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc_yes))
iframe->scrolling = SCROLLING_YES;
- else if (strcasecmp(dom_string_data(s), "no") == 0)
+ else if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc_no))
iframe->scrolling = SCROLLING_NO;
dom_string_unref(s);
}
@@ -2497,21 +2509,33 @@ bool box_input(BOX_SPECIAL_PARAMS)
box->gadget = gadget;
gadget->box = box;
- if (type && strcasecmp(dom_string_data(type), "password") == 0) {
+ if (type && dom_string_caseless_lwc_isequal(type,
+ corestring_lwc_password)) {
if (box_input_text(n, content, box, 0, true) == false)
goto no_memory;
- } else if (type && strcasecmp(dom_string_data(type), "file") == 0) {
+
+ } else if (type && dom_string_caseless_lwc_isequal(type,
+ corestring_lwc_file)) {
box->type = BOX_INLINE_BLOCK;
- } else if (type && strcasecmp(dom_string_data(type), "hidden") == 0) {
+
+ } else if (type && dom_string_caseless_lwc_isequal(type,
+ corestring_lwc_hidden)) {
/* no box for hidden inputs */
box->type = BOX_NONE;
+
} else if (type &&
- (strcasecmp(dom_string_data(type), "checkbox") == 0 ||
- strcasecmp(dom_string_data(type), "radio") == 0)) {
+ (dom_string_caseless_lwc_isequal(type,
+ corestring_lwc_checkbox) ||
+ dom_string_caseless_lwc_isequal(type,
+ corestring_lwc_radio))) {
+
} else if (type &&
- (strcasecmp(dom_string_data(type), "submit") == 0 ||
- strcasecmp(dom_string_data(type), "reset") == 0 ||
- strcasecmp(dom_string_data(type), "button") == 0)) {
+ (dom_string_caseless_lwc_isequal(type,
+ corestring_lwc_submit) ||
+ dom_string_caseless_lwc_isequal(type,
+ corestring_lwc_reset) ||
+ dom_string_caseless_lwc_isequal(type,
+ corestring_lwc_button))) {
struct box *inline_container, *inline_box;
if (box_button(n, content, box, 0) == false)
@@ -2551,7 +2575,9 @@ bool box_input(BOX_SPECIAL_PARAMS)
box_add_child(inline_container, inline_box);
box_add_child(box, inline_container);
- } else if (type && strcasecmp(dom_string_data(type), "image") == 0) {
+
+ } else if (type && dom_string_caseless_lwc_isequal(type,
+ corestring_lwc_image)) {
gadget->type = GADGET_IMAGE;
if (box->style && css_computed_display(box->style,
@@ -2703,14 +2729,16 @@ bool box_select(BOX_SPECIAL_PARAMS)
return false;
}
- if (strcasecmp(dom_string_data(name), "option") == 0) {
+ if (dom_string_caseless_lwc_isequal(name,
+ corestring_lwc_option)) {
dom_string_unref(name);
if (box_select_add_option(gadget, c) == false) {
dom_node_unref(c);
goto no_memory;
}
- } else if (strcasecmp(dom_string_data(name), "optgroup") == 0) {
+ } else if (dom_string_caseless_lwc_isequal(name,
+ corestring_lwc_optgroup)) {
dom_string_unref(name);
err = dom_node_get_first_child(c, &c2);
@@ -2729,8 +2757,8 @@ bool box_select(BOX_SPECIAL_PARAMS)
return false;
}
- if (strcasecmp(dom_string_data(c2_name),
- "option") == 0) {
+ if (dom_string_caseless_lwc_isequal(c2_name,
+ corestring_lwc_option)) {
dom_string_unref(c2_name);
if (box_select_add_option(gadget,
@@ -3051,7 +3079,7 @@ bool box_embed(BOX_SPECIAL_PARAMS)
return false;
}
- if (strcasecmp(dom_string_data(name), "src") == 0) {
+ if (dom_string_caseless_lwc_isequal(name, corestring_lwc_src)) {
dom_string_unref(name);
continue;
}
diff --git a/utils/corestrings.c b/utils/corestrings.c
index 7779409..05c5ac6 100644
--- a/utils/corestrings.c
+++ b/utils/corestrings.c
@@ -46,6 +46,8 @@ lwc_string *corestring_lwc_div;
lwc_string *corestring_lwc_embed;
lwc_string *corestring_lwc_file;
lwc_string *corestring_lwc_font;
+lwc_string *corestring_lwc_frame;
+lwc_string *corestring_lwc_frameset;
lwc_string *corestring_lwc_h1;
lwc_string *corestring_lwc_h2;
lwc_string *corestring_lwc_h3;
@@ -66,9 +68,13 @@ lwc_string *corestring_lwc_link;
lwc_string *corestring_lwc_meta;
lwc_string *corestring_lwc_middle;
lwc_string *corestring_lwc_multipart_form_data;
+lwc_string *corestring_lwc_no;
lwc_string *corestring_lwc_noscript;
lwc_string *corestring_lwc_object;
+lwc_string *corestring_lwc_optgroup;
+lwc_string *corestring_lwc_option;
lwc_string *corestring_lwc_p;
+lwc_string *corestring_lwc_param;
lwc_string *corestring_lwc_password;
lwc_string *corestring_lwc_poly;
lwc_string *corestring_lwc_polygon;
@@ -79,6 +85,7 @@ lwc_string *corestring_lwc_rectangle;
lwc_string *corestring_lwc_refresh;
lwc_string *corestring_lwc_reset;
lwc_string *corestring_lwc_right;
+lwc_string *corestring_lwc_src;
lwc_string *corestring_lwc_style;
lwc_string *corestring_lwc_submit;
lwc_string *corestring_lwc_table;
@@ -95,6 +102,7 @@ lwc_string *corestring_lwc_title;
lwc_string *corestring_lwc_top;
lwc_string *corestring_lwc_tr;
lwc_string *corestring_lwc_url;
+lwc_string *corestring_lwc_yes;
lwc_string *corestring_lwc__blank;
lwc_string *corestring_lwc__parent;
lwc_string *corestring_lwc__self;
@@ -175,6 +183,8 @@ void corestrings_fini(void)
CSS_LWC_STRING_UNREF(embed);
CSS_LWC_STRING_UNREF(file);
CSS_LWC_STRING_UNREF(font);
+ CSS_LWC_STRING_UNREF(frame);
+ CSS_LWC_STRING_UNREF(frameset);
CSS_LWC_STRING_UNREF(h1);
CSS_LWC_STRING_UNREF(h2);
CSS_LWC_STRING_UNREF(h3);
@@ -195,9 +205,13 @@ void corestrings_fini(void)
CSS_LWC_STRING_UNREF(meta);
CSS_LWC_STRING_UNREF(middle);
CSS_LWC_STRING_UNREF(multipart_form_data);
+ CSS_LWC_STRING_UNREF(no);
CSS_LWC_STRING_UNREF(noscript);
CSS_LWC_STRING_UNREF(object);
+ CSS_LWC_STRING_UNREF(optgroup);
+ CSS_LWC_STRING_UNREF(option);
CSS_LWC_STRING_UNREF(p);
+ CSS_LWC_STRING_UNREF(param);
CSS_LWC_STRING_UNREF(password);
CSS_LWC_STRING_UNREF(poly);
CSS_LWC_STRING_UNREF(polygon);
@@ -208,6 +222,7 @@ void corestrings_fini(void)
CSS_LWC_STRING_UNREF(refresh);
CSS_LWC_STRING_UNREF(reset);
CSS_LWC_STRING_UNREF(right);
+ CSS_LWC_STRING_UNREF(src);
CSS_LWC_STRING_UNREF(style);
CSS_LWC_STRING_UNREF(submit);
CSS_LWC_STRING_UNREF(table);
@@ -224,6 +239,7 @@ void corestrings_fini(void)
CSS_LWC_STRING_UNREF(top);
CSS_LWC_STRING_UNREF(tr);
CSS_LWC_STRING_UNREF(url);
+ CSS_LWC_STRING_UNREF(yes);
CSS_LWC_STRING_UNREF(_blank);
CSS_LWC_STRING_UNREF(_parent);
CSS_LWC_STRING_UNREF(_self);
@@ -324,6 +340,8 @@ nserror corestrings_init(void)
CSS_LWC_STRING_INTERN(embed);
CSS_LWC_STRING_INTERN(file);
CSS_LWC_STRING_INTERN(font);
+ CSS_LWC_STRING_INTERN(frame);
+ CSS_LWC_STRING_INTERN(frameset);
CSS_LWC_STRING_INTERN(h1);
CSS_LWC_STRING_INTERN(h2);
CSS_LWC_STRING_INTERN(h3);
@@ -343,9 +361,13 @@ nserror corestrings_init(void)
CSS_LWC_STRING_INTERN(link);
CSS_LWC_STRING_INTERN(meta);
CSS_LWC_STRING_INTERN(middle);
+ CSS_LWC_STRING_INTERN(no);
CSS_LWC_STRING_INTERN(noscript);
CSS_LWC_STRING_INTERN(object);
+ CSS_LWC_STRING_INTERN(optgroup);
+ CSS_LWC_STRING_INTERN(object);
CSS_LWC_STRING_INTERN(p);
+ CSS_LWC_STRING_INTERN(param);
CSS_LWC_STRING_INTERN(password);
CSS_LWC_STRING_INTERN(poly);
CSS_LWC_STRING_INTERN(polygon);
@@ -356,6 +378,7 @@ nserror corestrings_init(void)
CSS_LWC_STRING_INTERN(refresh);
CSS_LWC_STRING_INTERN(reset);
CSS_LWC_STRING_INTERN(right);
+ CSS_LWC_STRING_INTERN(src);
CSS_LWC_STRING_INTERN(style);
CSS_LWC_STRING_INTERN(submit);
CSS_LWC_STRING_INTERN(table);
@@ -371,12 +394,14 @@ nserror corestrings_init(void)
CSS_LWC_STRING_INTERN(top);
CSS_LWC_STRING_INTERN(tr);
CSS_LWC_STRING_INTERN(url);
+ CSS_LWC_STRING_INTERN(yes);
CSS_LWC_STRING_INTERN(_blank);
CSS_LWC_STRING_INTERN(_parent);
CSS_LWC_STRING_INTERN(_self);
CSS_LWC_STRING_INTERN(_top);
#undef CSS_LWC_STRING_INTERN
+
lerror = lwc_intern_string("multipart/form-data",
SLEN("multipart/form-data"),
&corestring_lwc_multipart_form_data);
diff --git a/utils/corestrings.h b/utils/corestrings.h
index df289df..a3bda16 100644
--- a/utils/corestrings.h
+++ b/utils/corestrings.h
@@ -50,6 +50,8 @@ extern lwc_string *corestring_lwc_div;
extern lwc_string *corestring_lwc_embed;
extern lwc_string *corestring_lwc_file;
extern lwc_string *corestring_lwc_font;
+extern lwc_string *corestring_lwc_frame;
+extern lwc_string *corestring_lwc_frameset;
extern lwc_string *corestring_lwc_h1;
extern lwc_string *corestring_lwc_h2;
extern lwc_string *corestring_lwc_h3;
@@ -70,9 +72,13 @@ extern lwc_string *corestring_lwc_link;
extern lwc_string *corestring_lwc_meta;
extern lwc_string *corestring_lwc_middle;
extern lwc_string *corestring_lwc_multipart_form_data;
+extern lwc_string *corestring_lwc_no;
extern lwc_string *corestring_lwc_noscript;
extern lwc_string *corestring_lwc_object;
+extern lwc_string *corestring_lwc_optgroup;
+extern lwc_string *corestring_lwc_option;
extern lwc_string *corestring_lwc_p;
+extern lwc_string *corestring_lwc_param;
extern lwc_string *corestring_lwc_password;
extern lwc_string *corestring_lwc_poly;
extern lwc_string *corestring_lwc_polygon;
@@ -83,6 +89,7 @@ extern lwc_string *corestring_lwc_rectangle;
extern lwc_string *corestring_lwc_refresh;
extern lwc_string *corestring_lwc_reset;
extern lwc_string *corestring_lwc_right;
+extern lwc_string *corestring_lwc_src;
extern lwc_string *corestring_lwc_style;
extern lwc_string *corestring_lwc_submit;
extern lwc_string *corestring_lwc_table;
@@ -99,6 +106,7 @@ extern lwc_string *corestring_lwc_title;
extern lwc_string *corestring_lwc_top;
extern lwc_string *corestring_lwc_tr;
extern lwc_string *corestring_lwc_url;
+extern lwc_string *corestring_lwc_yes;
extern lwc_string *corestring_lwc__blank;
extern lwc_string *corestring_lwc__parent;
extern lwc_string *corestring_lwc__self;
commitdiff http://git.netsurf-browser.org/netsurf.git/commitdiff/81e079e7470c0beb1cc...
commit 81e079e7470c0beb1cc0f88da63c340b5ed4f631
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Use interns for string comparisons.
diff --git a/render/html.c b/render/html.c
index b49f05f..759c244 100644
--- a/render/html.c
+++ b/render/html.c
@@ -766,7 +766,7 @@ static bool html_meta_refresh_process_element(html_content *c, dom_node *n)
if (equiv == NULL)
return true;
- if (strcasecmp(dom_string_data(equiv), "refresh") != 0) {
+ if (!dom_string_caseless_lwc_isequal(equiv, corestring_lwc_refresh)) {
dom_string_unref(equiv);
return true;
}
@@ -982,8 +982,8 @@ static bool html_meta_refresh(html_content *c, dom_node *head)
}
/* Recurse into noscript elements */
- if (strcasecmp(dom_string_data(name),
- "noscript") == 0) {
+ if (dom_string_caseless_lwc_isequal(name,
+ corestring_lwc_noscript)) {
if (html_meta_refresh(c, n) == false) {
/* Some error occurred */
dom_string_unref(name);
@@ -995,8 +995,8 @@ static bool html_meta_refresh(html_content *c, dom_node *head)
dom_node_unref(n);
return true;
}
- } else if (strcasecmp(dom_string_data(name),
- "meta") == 0) {
+ } else if (dom_string_caseless_lwc_isequal(name,
+ corestring_lwc_meta)) {
if (html_meta_refresh_process_element(c,
n) == false) {
/* Some error occurred */
@@ -1428,7 +1428,8 @@ html_process_style_element(html_content *c,
/* type='text/css', or not present (invalid but common) */
exc = dom_element_get_attribute(style, corestring_dom_type, &val);
if (exc == DOM_NO_ERR && val != NULL) {
- if (strcasecmp(dom_string_data(val), "text/css") != 0) {
+ if (!dom_string_caseless_lwc_isequal(val,
+ corestring_lwc_text_css)) {
dom_string_unref(val);
return true;
}
@@ -1675,14 +1676,14 @@ html_process_stylesheet(dom_node *node, dom_string *name, void *vctx)
hlcache_child_context child;
/* deal with style nodes */
- if (strcasecmp(dom_string_data(name), "style") == 0) {
+ if (dom_string_caseless_lwc_isequal(name, corestring_lwc_style)) {
if (!html_process_style_element(ctx->c, &ctx->count, node))
return false;
return true;
}
/* if it is not a link node skip it */
- if (strcasecmp(dom_string_data(name), "link") != 0) {
+ if (!dom_string_caseless_lwc_isequal(name, corestring_lwc_link)) {
return true;
}
@@ -1705,7 +1706,8 @@ html_process_stylesheet(dom_node *node, dom_string *name, void *vctx)
/* type='text/css' or not present */
exc = dom_element_get_attribute(node, corestring_dom_type, &type_attr);
if (exc == DOM_NO_ERR && type_attr != NULL) {
- if (strcasecmp(dom_string_data(type_attr), "text/css") != 0) {
+ if (!dom_string_caseless_lwc_isequal(type_attr,
+ corestring_lwc_text_css)) {
dom_string_unref(type_attr);
return true;
}
diff --git a/utils/corestrings.c b/utils/corestrings.c
index f460753..7779409 100644
--- a/utils/corestrings.c
+++ b/utils/corestrings.c
@@ -63,8 +63,10 @@ lwc_string *corestring_lwc_input;
lwc_string *corestring_lwc_justify;
lwc_string *corestring_lwc_left;
lwc_string *corestring_lwc_link;
+lwc_string *corestring_lwc_meta;
lwc_string *corestring_lwc_middle;
lwc_string *corestring_lwc_multipart_form_data;
+lwc_string *corestring_lwc_noscript;
lwc_string *corestring_lwc_object;
lwc_string *corestring_lwc_p;
lwc_string *corestring_lwc_password;
@@ -74,8 +76,10 @@ lwc_string *corestring_lwc_post;
lwc_string *corestring_lwc_radio;
lwc_string *corestring_lwc_rect;
lwc_string *corestring_lwc_rectangle;
+lwc_string *corestring_lwc_refresh;
lwc_string *corestring_lwc_reset;
lwc_string *corestring_lwc_right;
+lwc_string *corestring_lwc_style;
lwc_string *corestring_lwc_submit;
lwc_string *corestring_lwc_table;
lwc_string *corestring_lwc_tbody;
@@ -83,12 +87,14 @@ lwc_string *corestring_lwc_td;
lwc_string *corestring_lwc_text;
lwc_string *corestring_lwc_textarea;
lwc_string *corestring_lwc_texttop;
+lwc_string *corestring_lwc_text_css;
lwc_string *corestring_lwc_tfoot;
lwc_string *corestring_lwc_th;
lwc_string *corestring_lwc_thead;
lwc_string *corestring_lwc_title;
lwc_string *corestring_lwc_top;
lwc_string *corestring_lwc_tr;
+lwc_string *corestring_lwc_url;
lwc_string *corestring_lwc__blank;
lwc_string *corestring_lwc__parent;
lwc_string *corestring_lwc__self;
@@ -186,8 +192,10 @@ void corestrings_fini(void)
CSS_LWC_STRING_UNREF(justify);
CSS_LWC_STRING_UNREF(left);
CSS_LWC_STRING_UNREF(link);
+ CSS_LWC_STRING_UNREF(meta);
CSS_LWC_STRING_UNREF(middle);
CSS_LWC_STRING_UNREF(multipart_form_data);
+ CSS_LWC_STRING_UNREF(noscript);
CSS_LWC_STRING_UNREF(object);
CSS_LWC_STRING_UNREF(p);
CSS_LWC_STRING_UNREF(password);
@@ -197,8 +205,10 @@ void corestrings_fini(void)
CSS_LWC_STRING_UNREF(radio);
CSS_LWC_STRING_UNREF(rect);
CSS_LWC_STRING_UNREF(rectangle);
+ CSS_LWC_STRING_UNREF(refresh);
CSS_LWC_STRING_UNREF(reset);
CSS_LWC_STRING_UNREF(right);
+ CSS_LWC_STRING_UNREF(style);
CSS_LWC_STRING_UNREF(submit);
CSS_LWC_STRING_UNREF(table);
CSS_LWC_STRING_UNREF(tbody);
@@ -206,12 +216,14 @@ void corestrings_fini(void)
CSS_LWC_STRING_UNREF(text);
CSS_LWC_STRING_UNREF(textarea);
CSS_LWC_STRING_UNREF(texttop);
+ CSS_LWC_STRING_UNREF(text_css);
CSS_LWC_STRING_UNREF(tfoot);
CSS_LWC_STRING_UNREF(th);
CSS_LWC_STRING_UNREF(thead);
CSS_LWC_STRING_UNREF(title);
CSS_LWC_STRING_UNREF(top);
CSS_LWC_STRING_UNREF(tr);
+ CSS_LWC_STRING_UNREF(url);
CSS_LWC_STRING_UNREF(_blank);
CSS_LWC_STRING_UNREF(_parent);
CSS_LWC_STRING_UNREF(_self);
@@ -329,7 +341,9 @@ nserror corestrings_init(void)
CSS_LWC_STRING_INTERN(justify);
CSS_LWC_STRING_INTERN(left);
CSS_LWC_STRING_INTERN(link);
+ CSS_LWC_STRING_INTERN(meta);
CSS_LWC_STRING_INTERN(middle);
+ CSS_LWC_STRING_INTERN(noscript);
CSS_LWC_STRING_INTERN(object);
CSS_LWC_STRING_INTERN(p);
CSS_LWC_STRING_INTERN(password);
@@ -339,8 +353,10 @@ nserror corestrings_init(void)
CSS_LWC_STRING_INTERN(radio);
CSS_LWC_STRING_INTERN(rect);
CSS_LWC_STRING_INTERN(rectangle);
+ CSS_LWC_STRING_INTERN(refresh);
CSS_LWC_STRING_INTERN(reset);
CSS_LWC_STRING_INTERN(right);
+ CSS_LWC_STRING_INTERN(style);
CSS_LWC_STRING_INTERN(submit);
CSS_LWC_STRING_INTERN(table);
CSS_LWC_STRING_INTERN(tbody);
@@ -354,6 +370,7 @@ nserror corestrings_init(void)
CSS_LWC_STRING_INTERN(title);
CSS_LWC_STRING_INTERN(top);
CSS_LWC_STRING_INTERN(tr);
+ CSS_LWC_STRING_INTERN(url);
CSS_LWC_STRING_INTERN(_blank);
CSS_LWC_STRING_INTERN(_parent);
CSS_LWC_STRING_INTERN(_self);
@@ -367,6 +384,11 @@ nserror corestrings_init(void)
(corestring_lwc_multipart_form_data == NULL))
goto error;
+ lerror = lwc_intern_string("text/css", SLEN("text/css"),
+ &corestring_lwc_text_css);
+ if ((lerror != lwc_error_ok) || (corestring_lwc_text_css == NULL))
+ goto error;
+
#define CSS_DOM_STRING_INTERN(NAME) \
do { \
diff --git a/utils/corestrings.h b/utils/corestrings.h
index 4eb73b6..df289df 100644
--- a/utils/corestrings.h
+++ b/utils/corestrings.h
@@ -67,8 +67,10 @@ extern lwc_string *corestring_lwc_input;
extern lwc_string *corestring_lwc_justify;
extern lwc_string *corestring_lwc_left;
extern lwc_string *corestring_lwc_link;
+extern lwc_string *corestring_lwc_meta;
extern lwc_string *corestring_lwc_middle;
extern lwc_string *corestring_lwc_multipart_form_data;
+extern lwc_string *corestring_lwc_noscript;
extern lwc_string *corestring_lwc_object;
extern lwc_string *corestring_lwc_p;
extern lwc_string *corestring_lwc_password;
@@ -78,8 +80,10 @@ extern lwc_string *corestring_lwc_post;
extern lwc_string *corestring_lwc_radio;
extern lwc_string *corestring_lwc_rect;
extern lwc_string *corestring_lwc_rectangle;
+extern lwc_string *corestring_lwc_refresh;
extern lwc_string *corestring_lwc_reset;
extern lwc_string *corestring_lwc_right;
+extern lwc_string *corestring_lwc_style;
extern lwc_string *corestring_lwc_submit;
extern lwc_string *corestring_lwc_table;
extern lwc_string *corestring_lwc_tbody;
@@ -87,12 +91,14 @@ extern lwc_string *corestring_lwc_td;
extern lwc_string *corestring_lwc_text;
extern lwc_string *corestring_lwc_textarea;
extern lwc_string *corestring_lwc_texttop;
+extern lwc_string *corestring_lwc_text_css;
extern lwc_string *corestring_lwc_tfoot;
extern lwc_string *corestring_lwc_th;
extern lwc_string *corestring_lwc_thead;
extern lwc_string *corestring_lwc_title;
extern lwc_string *corestring_lwc_top;
extern lwc_string *corestring_lwc_tr;
+extern lwc_string *corestring_lwc_url;
extern lwc_string *corestring_lwc__blank;
extern lwc_string *corestring_lwc__parent;
extern lwc_string *corestring_lwc__self;
-----------------------------------------------------------------------
Summary of changes:
render/box_construct.c | 92 +++++++++++++++++++++++++++++++-----------------
render/html.c | 20 ++++++-----
utils/corestrings.c | 47 ++++++++++++++++++++++++
utils/corestrings.h | 14 +++++++
4 files changed, 132 insertions(+), 41 deletions(-)
diff --git a/render/box_construct.c b/render/box_construct.c
index fbaa9db..e103d44 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -40,6 +40,7 @@
#include "render/box.h"
#include "render/form.h"
#include "render/html_internal.h"
+#include "utils/corestrings.h"
#include "utils/locale.h"
#include "utils/log.h"
#include "utils/messages.h"
@@ -1647,13 +1648,17 @@ bool box_a(BOX_SPECIAL_PARAMS)
/* target frame [16.3] */
err = dom_element_get_attribute(n, kstr_target, &s);
if (err == DOM_NO_ERR && s != NULL) {
- if (!strcasecmp(dom_string_data(s), "_blank"))
+ if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc__blank))
box->target = TARGET_BLANK;
- else if (!strcasecmp(dom_string_data(s), "_top"))
+ else if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc__top))
box->target = TARGET_TOP;
- else if (!strcasecmp(dom_string_data(s), "_parent"))
+ else if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc__parent))
box->target = TARGET_PARENT;
- else if (!strcasecmp(dom_string_data(s), "_self"))
+ else if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc__self))
/* the default may have been overridden by a
* <base target=...>, so this is different to 0 */
box->target = TARGET_SELF;
@@ -1941,7 +1946,8 @@ bool box_object(BOX_SPECIAL_PARAMS)
return false;
}
- if (strcasecmp(dom_string_data(name), "param") != 0) {
+ if (!dom_string_caseless_lwc_isequal(name,
+ corestring_lwc_param)) {
/* The first non-param child is the start of
* the alt html. Therefore, we should break
* out of this loop. */
@@ -2122,7 +2128,8 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
/* common extension: frameborder="yes|no" to control all children */
err = dom_element_get_attribute(n, kstr_frameborder, &s);
if (err == DOM_NO_ERR && s != NULL) {
- if (strcasecmp(dom_string_data(s), "no") == 0)
+ if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc_no) == 0)
default_border = false;
dom_string_unref(s);
}
@@ -2194,12 +2201,13 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
}
if (type != DOM_ELEMENT_NODE ||
- (strcasecmp(
- dom_string_data(name),
- "frame") != 0 &&
- strcasecmp(
- dom_string_data(name),
- "frameset") != 0)) {
+ (!dom_string_caseless_lwc_isequal(
+ name,
+ corestring_lwc_frame) &&
+ !dom_string_caseless_lwc_isequal(
+ name,
+ corestring_lwc_frameset
+ ))) {
err = dom_node_get_next_sibling(c,
&next);
if (err != DOM_NO_ERR) {
@@ -2229,7 +2237,8 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
return false;
}
- if (strcasecmp(dom_string_data(s), "frameset") == 0) {
+ if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc_frameset)) {
dom_string_unref(s);
frame->border = 0;
if (box_create_frameset(frame, c,
@@ -2290,10 +2299,11 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
err = dom_element_get_attribute(c, kstr_scrolling, &s);
if (err == DOM_NO_ERR && s != NULL) {
- if (strcasecmp(dom_string_data(s), "yes") == 0)
+ if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc_yes))
frame->scrolling = SCROLLING_YES;
- else if (strcasecmp(dom_string_data(s),
- "no") == 0)
+ else if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc_no))
frame->scrolling = SCROLLING_NO;
dom_string_unref(s);
}
@@ -2447,9 +2457,11 @@ bool box_iframe(BOX_SPECIAL_PARAMS)
err = dom_element_get_attribute(n, kstr_scrolling, &s);
if (err == DOM_NO_ERR && s != NULL) {
- if (strcasecmp(dom_string_data(s), "yes") == 0)
+ if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc_yes))
iframe->scrolling = SCROLLING_YES;
- else if (strcasecmp(dom_string_data(s), "no") == 0)
+ else if (dom_string_caseless_lwc_isequal(s,
+ corestring_lwc_no))
iframe->scrolling = SCROLLING_NO;
dom_string_unref(s);
}
@@ -2497,21 +2509,33 @@ bool box_input(BOX_SPECIAL_PARAMS)
box->gadget = gadget;
gadget->box = box;
- if (type && strcasecmp(dom_string_data(type), "password") == 0) {
+ if (type && dom_string_caseless_lwc_isequal(type,
+ corestring_lwc_password)) {
if (box_input_text(n, content, box, 0, true) == false)
goto no_memory;
- } else if (type && strcasecmp(dom_string_data(type), "file") == 0) {
+
+ } else if (type && dom_string_caseless_lwc_isequal(type,
+ corestring_lwc_file)) {
box->type = BOX_INLINE_BLOCK;
- } else if (type && strcasecmp(dom_string_data(type), "hidden") == 0) {
+
+ } else if (type && dom_string_caseless_lwc_isequal(type,
+ corestring_lwc_hidden)) {
/* no box for hidden inputs */
box->type = BOX_NONE;
+
} else if (type &&
- (strcasecmp(dom_string_data(type), "checkbox") == 0 ||
- strcasecmp(dom_string_data(type), "radio") == 0)) {
+ (dom_string_caseless_lwc_isequal(type,
+ corestring_lwc_checkbox) ||
+ dom_string_caseless_lwc_isequal(type,
+ corestring_lwc_radio))) {
+
} else if (type &&
- (strcasecmp(dom_string_data(type), "submit") == 0 ||
- strcasecmp(dom_string_data(type), "reset") == 0 ||
- strcasecmp(dom_string_data(type), "button") == 0)) {
+ (dom_string_caseless_lwc_isequal(type,
+ corestring_lwc_submit) ||
+ dom_string_caseless_lwc_isequal(type,
+ corestring_lwc_reset) ||
+ dom_string_caseless_lwc_isequal(type,
+ corestring_lwc_button))) {
struct box *inline_container, *inline_box;
if (box_button(n, content, box, 0) == false)
@@ -2551,7 +2575,9 @@ bool box_input(BOX_SPECIAL_PARAMS)
box_add_child(inline_container, inline_box);
box_add_child(box, inline_container);
- } else if (type && strcasecmp(dom_string_data(type), "image") == 0) {
+
+ } else if (type && dom_string_caseless_lwc_isequal(type,
+ corestring_lwc_image)) {
gadget->type = GADGET_IMAGE;
if (box->style && css_computed_display(box->style,
@@ -2703,14 +2729,16 @@ bool box_select(BOX_SPECIAL_PARAMS)
return false;
}
- if (strcasecmp(dom_string_data(name), "option") == 0) {
+ if (dom_string_caseless_lwc_isequal(name,
+ corestring_lwc_option)) {
dom_string_unref(name);
if (box_select_add_option(gadget, c) == false) {
dom_node_unref(c);
goto no_memory;
}
- } else if (strcasecmp(dom_string_data(name), "optgroup") == 0) {
+ } else if (dom_string_caseless_lwc_isequal(name,
+ corestring_lwc_optgroup)) {
dom_string_unref(name);
err = dom_node_get_first_child(c, &c2);
@@ -2729,8 +2757,8 @@ bool box_select(BOX_SPECIAL_PARAMS)
return false;
}
- if (strcasecmp(dom_string_data(c2_name),
- "option") == 0) {
+ if (dom_string_caseless_lwc_isequal(c2_name,
+ corestring_lwc_option)) {
dom_string_unref(c2_name);
if (box_select_add_option(gadget,
@@ -3051,7 +3079,7 @@ bool box_embed(BOX_SPECIAL_PARAMS)
return false;
}
- if (strcasecmp(dom_string_data(name), "src") == 0) {
+ if (dom_string_caseless_lwc_isequal(name, corestring_lwc_src)) {
dom_string_unref(name);
continue;
}
diff --git a/render/html.c b/render/html.c
index b49f05f..759c244 100644
--- a/render/html.c
+++ b/render/html.c
@@ -766,7 +766,7 @@ static bool html_meta_refresh_process_element(html_content *c, dom_node *n)
if (equiv == NULL)
return true;
- if (strcasecmp(dom_string_data(equiv), "refresh") != 0) {
+ if (!dom_string_caseless_lwc_isequal(equiv, corestring_lwc_refresh)) {
dom_string_unref(equiv);
return true;
}
@@ -982,8 +982,8 @@ static bool html_meta_refresh(html_content *c, dom_node *head)
}
/* Recurse into noscript elements */
- if (strcasecmp(dom_string_data(name),
- "noscript") == 0) {
+ if (dom_string_caseless_lwc_isequal(name,
+ corestring_lwc_noscript)) {
if (html_meta_refresh(c, n) == false) {
/* Some error occurred */
dom_string_unref(name);
@@ -995,8 +995,8 @@ static bool html_meta_refresh(html_content *c, dom_node *head)
dom_node_unref(n);
return true;
}
- } else if (strcasecmp(dom_string_data(name),
- "meta") == 0) {
+ } else if (dom_string_caseless_lwc_isequal(name,
+ corestring_lwc_meta)) {
if (html_meta_refresh_process_element(c,
n) == false) {
/* Some error occurred */
@@ -1428,7 +1428,8 @@ html_process_style_element(html_content *c,
/* type='text/css', or not present (invalid but common) */
exc = dom_element_get_attribute(style, corestring_dom_type, &val);
if (exc == DOM_NO_ERR && val != NULL) {
- if (strcasecmp(dom_string_data(val), "text/css") != 0) {
+ if (!dom_string_caseless_lwc_isequal(val,
+ corestring_lwc_text_css)) {
dom_string_unref(val);
return true;
}
@@ -1675,14 +1676,14 @@ html_process_stylesheet(dom_node *node, dom_string *name, void *vctx)
hlcache_child_context child;
/* deal with style nodes */
- if (strcasecmp(dom_string_data(name), "style") == 0) {
+ if (dom_string_caseless_lwc_isequal(name, corestring_lwc_style)) {
if (!html_process_style_element(ctx->c, &ctx->count, node))
return false;
return true;
}
/* if it is not a link node skip it */
- if (strcasecmp(dom_string_data(name), "link") != 0) {
+ if (!dom_string_caseless_lwc_isequal(name, corestring_lwc_link)) {
return true;
}
@@ -1705,7 +1706,8 @@ html_process_stylesheet(dom_node *node, dom_string *name, void *vctx)
/* type='text/css' or not present */
exc = dom_element_get_attribute(node, corestring_dom_type, &type_attr);
if (exc == DOM_NO_ERR && type_attr != NULL) {
- if (strcasecmp(dom_string_data(type_attr), "text/css") != 0) {
+ if (!dom_string_caseless_lwc_isequal(type_attr,
+ corestring_lwc_text_css)) {
dom_string_unref(type_attr);
return true;
}
diff --git a/utils/corestrings.c b/utils/corestrings.c
index f460753..05c5ac6 100644
--- a/utils/corestrings.c
+++ b/utils/corestrings.c
@@ -46,6 +46,8 @@ lwc_string *corestring_lwc_div;
lwc_string *corestring_lwc_embed;
lwc_string *corestring_lwc_file;
lwc_string *corestring_lwc_font;
+lwc_string *corestring_lwc_frame;
+lwc_string *corestring_lwc_frameset;
lwc_string *corestring_lwc_h1;
lwc_string *corestring_lwc_h2;
lwc_string *corestring_lwc_h3;
@@ -63,10 +65,16 @@ lwc_string *corestring_lwc_input;
lwc_string *corestring_lwc_justify;
lwc_string *corestring_lwc_left;
lwc_string *corestring_lwc_link;
+lwc_string *corestring_lwc_meta;
lwc_string *corestring_lwc_middle;
lwc_string *corestring_lwc_multipart_form_data;
+lwc_string *corestring_lwc_no;
+lwc_string *corestring_lwc_noscript;
lwc_string *corestring_lwc_object;
+lwc_string *corestring_lwc_optgroup;
+lwc_string *corestring_lwc_option;
lwc_string *corestring_lwc_p;
+lwc_string *corestring_lwc_param;
lwc_string *corestring_lwc_password;
lwc_string *corestring_lwc_poly;
lwc_string *corestring_lwc_polygon;
@@ -74,8 +82,11 @@ lwc_string *corestring_lwc_post;
lwc_string *corestring_lwc_radio;
lwc_string *corestring_lwc_rect;
lwc_string *corestring_lwc_rectangle;
+lwc_string *corestring_lwc_refresh;
lwc_string *corestring_lwc_reset;
lwc_string *corestring_lwc_right;
+lwc_string *corestring_lwc_src;
+lwc_string *corestring_lwc_style;
lwc_string *corestring_lwc_submit;
lwc_string *corestring_lwc_table;
lwc_string *corestring_lwc_tbody;
@@ -83,12 +94,15 @@ lwc_string *corestring_lwc_td;
lwc_string *corestring_lwc_text;
lwc_string *corestring_lwc_textarea;
lwc_string *corestring_lwc_texttop;
+lwc_string *corestring_lwc_text_css;
lwc_string *corestring_lwc_tfoot;
lwc_string *corestring_lwc_th;
lwc_string *corestring_lwc_thead;
lwc_string *corestring_lwc_title;
lwc_string *corestring_lwc_top;
lwc_string *corestring_lwc_tr;
+lwc_string *corestring_lwc_url;
+lwc_string *corestring_lwc_yes;
lwc_string *corestring_lwc__blank;
lwc_string *corestring_lwc__parent;
lwc_string *corestring_lwc__self;
@@ -169,6 +183,8 @@ void corestrings_fini(void)
CSS_LWC_STRING_UNREF(embed);
CSS_LWC_STRING_UNREF(file);
CSS_LWC_STRING_UNREF(font);
+ CSS_LWC_STRING_UNREF(frame);
+ CSS_LWC_STRING_UNREF(frameset);
CSS_LWC_STRING_UNREF(h1);
CSS_LWC_STRING_UNREF(h2);
CSS_LWC_STRING_UNREF(h3);
@@ -186,10 +202,16 @@ void corestrings_fini(void)
CSS_LWC_STRING_UNREF(justify);
CSS_LWC_STRING_UNREF(left);
CSS_LWC_STRING_UNREF(link);
+ CSS_LWC_STRING_UNREF(meta);
CSS_LWC_STRING_UNREF(middle);
CSS_LWC_STRING_UNREF(multipart_form_data);
+ CSS_LWC_STRING_UNREF(no);
+ CSS_LWC_STRING_UNREF(noscript);
CSS_LWC_STRING_UNREF(object);
+ CSS_LWC_STRING_UNREF(optgroup);
+ CSS_LWC_STRING_UNREF(option);
CSS_LWC_STRING_UNREF(p);
+ CSS_LWC_STRING_UNREF(param);
CSS_LWC_STRING_UNREF(password);
CSS_LWC_STRING_UNREF(poly);
CSS_LWC_STRING_UNREF(polygon);
@@ -197,8 +219,11 @@ void corestrings_fini(void)
CSS_LWC_STRING_UNREF(radio);
CSS_LWC_STRING_UNREF(rect);
CSS_LWC_STRING_UNREF(rectangle);
+ CSS_LWC_STRING_UNREF(refresh);
CSS_LWC_STRING_UNREF(reset);
CSS_LWC_STRING_UNREF(right);
+ CSS_LWC_STRING_UNREF(src);
+ CSS_LWC_STRING_UNREF(style);
CSS_LWC_STRING_UNREF(submit);
CSS_LWC_STRING_UNREF(table);
CSS_LWC_STRING_UNREF(tbody);
@@ -206,12 +231,15 @@ void corestrings_fini(void)
CSS_LWC_STRING_UNREF(text);
CSS_LWC_STRING_UNREF(textarea);
CSS_LWC_STRING_UNREF(texttop);
+ CSS_LWC_STRING_UNREF(text_css);
CSS_LWC_STRING_UNREF(tfoot);
CSS_LWC_STRING_UNREF(th);
CSS_LWC_STRING_UNREF(thead);
CSS_LWC_STRING_UNREF(title);
CSS_LWC_STRING_UNREF(top);
CSS_LWC_STRING_UNREF(tr);
+ CSS_LWC_STRING_UNREF(url);
+ CSS_LWC_STRING_UNREF(yes);
CSS_LWC_STRING_UNREF(_blank);
CSS_LWC_STRING_UNREF(_parent);
CSS_LWC_STRING_UNREF(_self);
@@ -312,6 +340,8 @@ nserror corestrings_init(void)
CSS_LWC_STRING_INTERN(embed);
CSS_LWC_STRING_INTERN(file);
CSS_LWC_STRING_INTERN(font);
+ CSS_LWC_STRING_INTERN(frame);
+ CSS_LWC_STRING_INTERN(frameset);
CSS_LWC_STRING_INTERN(h1);
CSS_LWC_STRING_INTERN(h2);
CSS_LWC_STRING_INTERN(h3);
@@ -329,9 +359,15 @@ nserror corestrings_init(void)
CSS_LWC_STRING_INTERN(justify);
CSS_LWC_STRING_INTERN(left);
CSS_LWC_STRING_INTERN(link);
+ CSS_LWC_STRING_INTERN(meta);
CSS_LWC_STRING_INTERN(middle);
+ CSS_LWC_STRING_INTERN(no);
+ CSS_LWC_STRING_INTERN(noscript);
+ CSS_LWC_STRING_INTERN(object);
+ CSS_LWC_STRING_INTERN(optgroup);
CSS_LWC_STRING_INTERN(object);
CSS_LWC_STRING_INTERN(p);
+ CSS_LWC_STRING_INTERN(param);
CSS_LWC_STRING_INTERN(password);
CSS_LWC_STRING_INTERN(poly);
CSS_LWC_STRING_INTERN(polygon);
@@ -339,8 +375,11 @@ nserror corestrings_init(void)
CSS_LWC_STRING_INTERN(radio);
CSS_LWC_STRING_INTERN(rect);
CSS_LWC_STRING_INTERN(rectangle);
+ CSS_LWC_STRING_INTERN(refresh);
CSS_LWC_STRING_INTERN(reset);
CSS_LWC_STRING_INTERN(right);
+ CSS_LWC_STRING_INTERN(src);
+ CSS_LWC_STRING_INTERN(style);
CSS_LWC_STRING_INTERN(submit);
CSS_LWC_STRING_INTERN(table);
CSS_LWC_STRING_INTERN(tbody);
@@ -354,12 +393,15 @@ nserror corestrings_init(void)
CSS_LWC_STRING_INTERN(title);
CSS_LWC_STRING_INTERN(top);
CSS_LWC_STRING_INTERN(tr);
+ CSS_LWC_STRING_INTERN(url);
+ CSS_LWC_STRING_INTERN(yes);
CSS_LWC_STRING_INTERN(_blank);
CSS_LWC_STRING_INTERN(_parent);
CSS_LWC_STRING_INTERN(_self);
CSS_LWC_STRING_INTERN(_top);
#undef CSS_LWC_STRING_INTERN
+
lerror = lwc_intern_string("multipart/form-data",
SLEN("multipart/form-data"),
&corestring_lwc_multipart_form_data);
@@ -367,6 +409,11 @@ nserror corestrings_init(void)
(corestring_lwc_multipart_form_data == NULL))
goto error;
+ lerror = lwc_intern_string("text/css", SLEN("text/css"),
+ &corestring_lwc_text_css);
+ if ((lerror != lwc_error_ok) || (corestring_lwc_text_css == NULL))
+ goto error;
+
#define CSS_DOM_STRING_INTERN(NAME) \
do { \
diff --git a/utils/corestrings.h b/utils/corestrings.h
index 4eb73b6..a3bda16 100644
--- a/utils/corestrings.h
+++ b/utils/corestrings.h
@@ -50,6 +50,8 @@ extern lwc_string *corestring_lwc_div;
extern lwc_string *corestring_lwc_embed;
extern lwc_string *corestring_lwc_file;
extern lwc_string *corestring_lwc_font;
+extern lwc_string *corestring_lwc_frame;
+extern lwc_string *corestring_lwc_frameset;
extern lwc_string *corestring_lwc_h1;
extern lwc_string *corestring_lwc_h2;
extern lwc_string *corestring_lwc_h3;
@@ -67,10 +69,16 @@ extern lwc_string *corestring_lwc_input;
extern lwc_string *corestring_lwc_justify;
extern lwc_string *corestring_lwc_left;
extern lwc_string *corestring_lwc_link;
+extern lwc_string *corestring_lwc_meta;
extern lwc_string *corestring_lwc_middle;
extern lwc_string *corestring_lwc_multipart_form_data;
+extern lwc_string *corestring_lwc_no;
+extern lwc_string *corestring_lwc_noscript;
extern lwc_string *corestring_lwc_object;
+extern lwc_string *corestring_lwc_optgroup;
+extern lwc_string *corestring_lwc_option;
extern lwc_string *corestring_lwc_p;
+extern lwc_string *corestring_lwc_param;
extern lwc_string *corestring_lwc_password;
extern lwc_string *corestring_lwc_poly;
extern lwc_string *corestring_lwc_polygon;
@@ -78,8 +86,11 @@ extern lwc_string *corestring_lwc_post;
extern lwc_string *corestring_lwc_radio;
extern lwc_string *corestring_lwc_rect;
extern lwc_string *corestring_lwc_rectangle;
+extern lwc_string *corestring_lwc_refresh;
extern lwc_string *corestring_lwc_reset;
extern lwc_string *corestring_lwc_right;
+extern lwc_string *corestring_lwc_src;
+extern lwc_string *corestring_lwc_style;
extern lwc_string *corestring_lwc_submit;
extern lwc_string *corestring_lwc_table;
extern lwc_string *corestring_lwc_tbody;
@@ -87,12 +98,15 @@ extern lwc_string *corestring_lwc_td;
extern lwc_string *corestring_lwc_text;
extern lwc_string *corestring_lwc_textarea;
extern lwc_string *corestring_lwc_texttop;
+extern lwc_string *corestring_lwc_text_css;
extern lwc_string *corestring_lwc_tfoot;
extern lwc_string *corestring_lwc_th;
extern lwc_string *corestring_lwc_thead;
extern lwc_string *corestring_lwc_title;
extern lwc_string *corestring_lwc_top;
extern lwc_string *corestring_lwc_tr;
+extern lwc_string *corestring_lwc_url;
+extern lwc_string *corestring_lwc_yes;
extern lwc_string *corestring_lwc__blank;
extern lwc_string *corestring_lwc__parent;
extern lwc_string *corestring_lwc__self;
--
NetSurf Browser
10 years, 6 months