summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--content/content.c2
-rw-r--r--render/html.c5
-rw-r--r--render/html.h2
-rw-r--r--riscos/gif.c2
-rw-r--r--riscos/gui.c113
-rw-r--r--riscos/jpeg.c3
-rw-r--r--riscos/png.c3
7 files changed, 74 insertions, 56 deletions
diff --git a/content/content.c b/content/content.c
index 3b0ba7e77..2c7f5d00e 100644
--- a/content/content.c
+++ b/content/content.c
@@ -62,7 +62,7 @@ struct handler_entry {
};
static const struct handler_entry handler_map[] = {
{html_create, html_process_data, html_convert, html_revive,
- html_reformat, html_destroy, 0,
+ html_reformat, html_destroy, html_redraw,
html_add_instance, html_remove_instance, 0},
{textplain_create, textplain_process_data, textplain_convert,
textplain_revive, textplain_reformat, textplain_destroy, 0, 0, 0, 0},
diff --git a/render/html.c b/render/html.c
index d93550bc8..440b8fd0c 100644
--- a/render/html.c
+++ b/render/html.c
@@ -358,7 +358,10 @@ void html_fetch_object(struct content *c, char *url, struct box *box)
/* start fetch */
c->data.html.object[i].content = fetchcache(url, c->url,
html_object_callback,
- c, i, 0, 0);
+ c, i,
+ c->width, c->height); /* we don't know the object's
+ dimensions yet; use
+ parent's as an estimate */
c->active++;
if (c->data.html.object[i].content->status == CONTENT_STATUS_DONE)
html_object_callback(CONTENT_MSG_DONE,
diff --git a/render/html.h b/render/html.h
index f58d46255..e44b1958f 100644
--- a/render/html.h
+++ b/render/html.h
@@ -23,5 +23,7 @@ void html_add_instance(struct content *c, struct browser_window *bw,
void html_remove_instance(struct content *c, struct browser_window *bw,
struct content *page, struct box *box,
struct object_params *params, void **state);
+void html_redraw(struct content *c, long x, long y,
+ unsigned long width, unsigned long height);
#endif
diff --git a/riscos/gif.c b/riscos/gif.c
index 4adaa8a10..d9848cb21 100644
--- a/riscos/gif.c
+++ b/riscos/gif.c
@@ -333,7 +333,7 @@ void nsgif_redraw(struct content *c, long x, long y,
xosspriteop_put_sprite_scaled(osspriteop_PTR,
c->data.gif.sprite_area,
(osspriteop_id) (c->data.gif.sprite_area + 1),
- x, y, 8, 0, table);
+ x, y - c->height * 2, 8, 0, table);
xfree(table);
}
diff --git a/riscos/gui.c b/riscos/gui.c
index ce5127458..4ee99673d 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -7,24 +7,26 @@
* Copyright 2003 John M Bell <jmb202@ecs.soton.ac.uk>
*/
-#include "netsurf/desktop/options.h"
-#include "netsurf/riscos/font.h"
-#include "netsurf/desktop/gui.h"
-#include "netsurf/utils/utils.h"
-#include "netsurf/desktop/netsurf.h"
-#include "oslib/osfile.h"
+#include <assert.h>
+#include <math.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include "oslib/colourtrans.h"
#include "oslib/os.h"
+#include "oslib/osfile.h"
+#include "oslib/osgbpb.h"
#include "oslib/wimp.h"
-#include "oslib/colourtrans.h"
#include "oslib/wimpspriteop.h"
-#include "oslib/osgbpb.h"
+#include "netsurf/desktop/gui.h"
+#include "netsurf/desktop/netsurf.h"
+#include "netsurf/desktop/options.h"
+#include "netsurf/render/html.h"
+#include "netsurf/riscos/font.h"
#include "netsurf/riscos/theme.h"
#include "netsurf/utils/log.h"
-#include <assert.h>
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-#include <math.h>
+#include "netsurf/utils/utils.h"
const char *__dynamic_da_name = "NetSurf";
@@ -155,8 +157,11 @@ static void ro_gui_transform_menus(void);
static void ro_gui_create_menu(wimp_menu* menu, int x, int y, gui_window* g);
static int window_x_units(int scr_units, wimp_window_state* win);
static int window_y_units(int scr_units, wimp_window_state* win);
-static void ro_gui_window_redraw_box(gui_window* g, struct box * box, signed long x,
- signed long y, os_box* clip, unsigned long current_background_color);
+static void ro_gui_window_redraw_box(struct content *content, struct box * box,
+ signed long x, signed long y, os_box* clip,
+ unsigned long current_background_color,
+ signed long gadget_subtract_x, signed long gadget_subtract_y,
+ bool *select_on);
static void ro_gui_toolbar_redraw(gui_window* g, wimp_draw* redraw);
static void gui_disable_icon(wimp_w w, wimp_i i);
static void gui_enable_icon(wimp_w w, wimp_i i);
@@ -581,6 +586,19 @@ gui_safety gui_window_set_redraw_safety(gui_window* g, gui_safety s)
return old;
}
+
+os_box *clip;
+
+void html_redraw(struct content *c, long x, long y,
+ unsigned long width, unsigned long height)
+{
+ bool select_on = false;
+ assert(c->data.html.layout != NULL);
+ ro_gui_window_redraw_box(c, c->data.html.layout->children,
+ x, y, clip, 0xffffff, x, y, &select_on);
+}
+
+
int select_on = 0;
/* validation strings can't be const */
@@ -599,8 +617,11 @@ static char select_text_none[] = "<None>";
static char empty_text[] = "";
-void ro_gui_window_redraw_box(gui_window* g, struct box * box, signed long x,
- signed long y, os_box* clip, unsigned long current_background_color)
+void ro_gui_window_redraw_box(struct content *content, struct box * box,
+ signed long x, signed long y, os_box* clip,
+ unsigned long current_background_color,
+ signed long gadget_subtract_x, signed long gadget_subtract_y,
+ bool *select_on)
{
struct box * c;
char* select_text;
@@ -634,7 +655,7 @@ void ro_gui_window_redraw_box(gui_window* g, struct box * box, signed long x,
{
content_redraw(box->object,
(int) x + (int) box->x * 2,
- (int) y - (int) box->y * 2 - (int) box->height * 2,
+ (int) y - (int) box->y * 2,
box->width * 2, box->height * 2);
}
/* if (box->img != 0)
@@ -765,13 +786,13 @@ void ro_gui_window_redraw_box(gui_window* g, struct box * box, signed long x,
if (box->type == BOX_INLINE && box->font != 0)
{
-if (g->data.browser.bw->current_content->data.html.text_selection.selected == 1)
+if (content->data.html.text_selection.selected == 1)
{
struct box_position* start;
struct box_position* end;
- start = &(g->data.browser.bw->current_content->data.html.text_selection.start);
- end = &(g->data.browser.bw->current_content->data.html.text_selection.end);
+ start = &(content->data.html.text_selection.start);
+ end = &(content->data.html.text_selection.end);
if (start->box == box)
{
@@ -795,10 +816,10 @@ if (g->data.browser.bw->current_content->data.html.text_selection.selected == 1)
os_plot(os_PLOT_RECTANGLE | os_PLOT_TO,
(int) x + (int) box->x * 2 + (int) box->width * 2 - 2,
(int) y - (int) box->y * 2 - 2);
- select_on = 1;
+ *select_on = true;
}
}
- else if (select_on == 1)
+ else if (*select_on)
{
if (end->box != box)
{
@@ -819,7 +840,7 @@ if (g->data.browser.bw->current_content->data.html.text_selection.selected == 1)
os_plot(os_PLOT_RECTANGLE | os_PLOT_TO,
(int) x + (int) box->x * 2 + end->pixel_offset * 2 - 2,
(int) y - (int) box->y * 2 - 2);
- select_on = 0;
+ *select_on = false;
}
}
}
@@ -837,29 +858,31 @@ if (g->data.browser.bw->current_content->data.html.text_selection.selected == 1)
}
else
{
- if (g->data.browser.bw->current_content->data.html.text_selection.selected == 1)
+ if (content->data.html.text_selection.selected == 1)
{
struct box_position* start;
struct box_position* end;
- start = &(g->data.browser.bw->current_content->data.html.text_selection.start);
- end = &(g->data.browser.bw->current_content->data.html.text_selection.end);
+ start = &(content->data.html.text_selection.start);
+ end = &(content->data.html.text_selection.end);
if (start->box == box && end->box != box)
- select_on = 1;
- else if (select_on == 1 && end->box == box)
- select_on = 0;
+ *select_on = true;
+ else if (*select_on && end->box == box)
+ *select_on = false;
}
}
for (c = box->children; c != 0; c = c->next)
if (c->type != BOX_FLOAT_LEFT && c->type != BOX_FLOAT_RIGHT)
- ro_gui_window_redraw_box(g, c, (int) x + (int) box->x * 2,
- (int) y - (int) box->y * 2, clip, current_background_color);
+ ro_gui_window_redraw_box(content, c, (int) x + (int) box->x * 2,
+ (int) y - (int) box->y * 2, clip, current_background_color,
+ gadget_subtract_x, gadget_subtract_y, select_on);
for (c = box->float_children; c != 0; c = c->next_float)
- ro_gui_window_redraw_box(g, c, (int) x + (int) box->x * 2,
- (int) y - (int) box->y * 2, clip, current_background_color);
+ ro_gui_window_redraw_box(content, c, (int) x + (int) box->x * 2,
+ (int) y - (int) box->y * 2, clip, current_background_color,
+ gadget_subtract_x, gadget_subtract_y, select_on);
}
@@ -894,25 +917,13 @@ void ro_gui_window_redraw(gui_window* g, wimp_draw* redraw)
more = wimp_redraw_window(redraw);
wimp_set_font_colours(wimp_COLOUR_WHITE, wimp_COLOUR_BLACK);
- select_on = 0;
-
while (more)
{
- if (c->type == CONTENT_HTML) {
- gadget_subtract_x = redraw->box.x0 - redraw->xscroll;
- gadget_subtract_y = redraw->box.y1 - redraw->yscroll;
- assert(c->data.html.layout != NULL);
- ro_gui_window_redraw_box(g,
- c->data.html.layout->children,
- redraw->box.x0 - redraw->xscroll, redraw->box.y1 - redraw->yscroll,
- &redraw->clip, 0xffffff);
-
- } else {
- content_redraw(c,
- (int) redraw->box.x0 - (int) redraw->xscroll,
- (int) redraw->box.y1 - (int) redraw->yscroll - (int) c->height * 2,
- c->width * 2, c->height * 2);
- }
+ clip = &redraw->clip;
+ content_redraw(c,
+ (int) redraw->box.x0 - (int) redraw->xscroll,
+ (int) redraw->box.y1 - (int) redraw->yscroll,
+ c->width * 2, c->height * 2);
more = wimp_get_rectangle(redraw);
}
}
diff --git a/riscos/jpeg.c b/riscos/jpeg.c
index 6f091a904..816c4a2da 100644
--- a/riscos/jpeg.c
+++ b/riscos/jpeg.c
@@ -79,7 +79,8 @@ void jpeg_redraw(struct content *c, long x, long y,
factors.ydiv = c->height * 2;
xjpeg_plot_scaled((jpeg_image *) c->data.jpeg.data,
- x, y, &factors, (int) c->data.jpeg.length,
+ x, y - c->height * 2,
+ &factors, (int) c->data.jpeg.length,
jpeg_SCALE_DITHERED);
}
diff --git a/riscos/png.c b/riscos/png.c
index 96d049b59..8903159aa 100644
--- a/riscos/png.c
+++ b/riscos/png.c
@@ -325,7 +325,8 @@ void nspng_redraw(struct content *c, long x, long y,
xosspriteop_put_sprite_scaled(osspriteop_PTR,
c->data.png.sprite_area,
(osspriteop_id) (c->data.png.sprite_area + 1),
- x, y, os_ACTION_OVERWRITE, &factors, table);
+ x, y - c->height * 2,
+ os_ACTION_OVERWRITE, &factors, table);
xfree(table);
}