[project @ 2003-09-03 21:58:54 by jmb]

Call content_reshape_instance

svn path=/import/netsurf/; revision=265
This commit is contained in:
John Mark Bell 2003-09-03 21:58:54 +00:00
parent e851bbcf37
commit b19462e1ff
6 changed files with 55 additions and 45 deletions

View File

@ -1,4 +1,4 @@
$Id: TODO-HTML,v 1.3 2003/07/07 22:10:51 jmb Exp $ $Id: TODO-HTML,v 1.4 2003/09/03 21:58:54 jmb Exp $
TODO-HTML file for NetSurf. TODO-HTML file for NetSurf.
@ -40,4 +40,7 @@ Forms:
Frames: Frames:
Actually support them. NetSurf passes the test suite's Actually support them. NetSurf passes the test suite's
single test for non-frames-supporting browsers. single test for non-frames-supporting browsers.
General:
height="some%" - 13.7.1

View File

@ -63,7 +63,7 @@ struct handler_entry {
static const struct handler_entry handler_map[] = { static const struct handler_entry handler_map[] = {
{html_create, html_process_data, html_convert, html_revive, {html_create, html_process_data, html_convert, html_revive,
html_reformat, html_destroy, html_redraw, html_reformat, html_destroy, html_redraw,
html_add_instance, html_remove_instance, 0}, html_add_instance, html_remove_instance, html_reshape_instance},
{textplain_create, textplain_process_data, textplain_convert, {textplain_create, textplain_process_data, textplain_convert,
textplain_revive, textplain_reformat, textplain_destroy, 0, 0, 0, 0}, textplain_revive, textplain_reformat, textplain_destroy, 0, 0, 0, 0},
#ifdef riscos #ifdef riscos

View File

@ -326,6 +326,7 @@ void browser_window_callback(content_msg msg, struct content *c,
if (bw->current_content->status == CONTENT_STATUS_DONE) { if (bw->current_content->status == CONTENT_STATUS_DONE) {
content_add_instance(bw->current_content, bw, 0, 0, 0, &bw->current_content_state); content_add_instance(bw->current_content, bw, 0, 0, 0, &bw->current_content_state);
browser_window_reformat(bw, 0); browser_window_reformat(bw, 0);
content_reshape_instance(bw->current_content, bw, 0, 0, 0, &bw->current_content_state);
sprintf(status, "Page complete (%gs)", ((float) (clock() - bw->time0)) / CLOCKS_PER_SEC); sprintf(status, "Page complete (%gs)", ((float) (clock() - bw->time0)) / CLOCKS_PER_SEC);
browser_window_set_status(bw, status); browser_window_set_status(bw, status);
browser_window_stop_throbber(bw); browser_window_stop_throbber(bw);

View File

@ -504,6 +504,22 @@ void html_add_instance(struct content *c, struct browser_window *bw,
} }
void html_reshape_instance(struct content *c, struct browser_window *bw,
struct content *page, struct box *box,
struct object_params *params, void **state)
{
unsigned int i;
for (i = 0; i != c->data.html.object_count; i++) {
if (c->data.html.object[i].content == 0)
continue;
content_reshape_instance(c->data.html.object[i].content,
bw, c,
c->data.html.object[i].box,
c->data.html.object[i].box->object_params,
&c->data.html.object[i].box->object_state);
}
}
void html_remove_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 content *page, struct box *box,
struct object_params *params, void **state) struct object_params *params, void **state)

View File

@ -20,6 +20,9 @@ void html_fetch_object(struct content *c, char *url, struct box *box);
void html_add_instance(struct content *c, struct browser_window *bw, void html_add_instance(struct content *c, struct browser_window *bw,
struct content *page, struct box *box, struct content *page, struct box *box,
struct object_params *params, void **state); struct object_params *params, void **state);
void html_reshape_instance(struct content *c, struct browser_window *bw,
struct content *page, struct box *box,
struct object_params *params, void **state);
void html_remove_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 content *page, struct box *box,
struct object_params *params, void **state); struct object_params *params, void **state);

View File

@ -7,8 +7,7 @@
/* /*
* TODO: * TODO:
* - Reshaping plugin (ie. call plugin_reshape_instance from somewhere) * - Reshaping plugin by request [Plugin_Reshape_Request (&4d545)]
* [Plugin_Reshape (&4d544), Plugin_Reshape_Request (&4d545)]
* - Finish off stream protocol implementation * - Finish off stream protocol implementation
* [Plugin_Stream_Write (&4d54a), Plugin_Stream_Written (&4d54b)] * [Plugin_Stream_Write (&4d54a), Plugin_Stream_Written (&4d54b)]
* - Parse and act upon the rest of the Plugin_Opening flags * - Parse and act upon the rest of the Plugin_Opening flags
@ -19,7 +18,7 @@
* - Handle standalone objects * - Handle standalone objects
*/ */
#define NDEBUG #undef NDEBUG
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
@ -134,7 +133,6 @@ void plugin_add_instance(struct content *c, struct browser_window *bw,
char sysvar[40]; char sysvar[40];
char *varval; char *varval;
os_error *e; os_error *e;
// wimp_message *m = xcalloc(256, sizeof(char));
wimp_message m; wimp_message m;
plugin_message_open *pmo; plugin_message_open *pmo;
os_box b; os_box b;
@ -150,7 +148,6 @@ void plugin_add_instance(struct content *c, struct browser_window *bw,
"Cannot handle standalone objects at this time"); "Cannot handle standalone objects at this time");
gui_window_set_status(bw->window, gui_window_set_status(bw->window,
"Plugin Error: Cannot handle standalone objects at this time"); "Plugin Error: Cannot handle standalone objects at this time");
// xfree(m);
xfree(npm); xfree(npm);
xfree(npl); xfree(npl);
return; return;
@ -193,7 +190,6 @@ void plugin_add_instance(struct content *c, struct browser_window *bw,
offset = offset + strlen(params->filename) + 1; offset = offset + strlen(params->filename) + 1;
if (offset > 235) { if (offset > 235) {
LOG(("filename too long")); LOG(("filename too long"));
// xfree(m);
xfree(npm); xfree(npm);
xfree(npl); xfree(npl);
return; return;
@ -223,7 +219,6 @@ void plugin_add_instance(struct content *c, struct browser_window *bw,
flags = plugin_process_opening(params, temp); flags = plugin_process_opening(params, temp);
plugin_remove_message_from_linked_list(temp->reply); plugin_remove_message_from_linked_list(temp->reply);
plugin_remove_message_from_linked_list(temp); plugin_remove_message_from_linked_list(temp);
// xfree(m);
xfree(npm); xfree(npm);
xfree(npl); xfree(npl);
} else { } else {
@ -253,7 +248,6 @@ void plugin_add_instance(struct content *c, struct browser_window *bw,
flags = plugin_process_opening(params, temp); flags = plugin_process_opening(params, temp);
plugin_remove_message_from_linked_list(temp->reply); plugin_remove_message_from_linked_list(temp->reply);
plugin_remove_message_from_linked_list(temp); plugin_remove_message_from_linked_list(temp);
// xfree(m);
xfree(npm); xfree(npm);
xfree(npl); xfree(npl);
} else { } else {
@ -261,7 +255,6 @@ void plugin_add_instance(struct content *c, struct browser_window *bw,
/* no reply so give up */ /* no reply so give up */
LOG(("No reply to message %p", temp)); LOG(("No reply to message %p", temp));
plugin_remove_message_from_linked_list(temp); plugin_remove_message_from_linked_list(temp);
// xfree(m);
xfree(npm); xfree(npm);
xfree(npl); xfree(npl);
return; return;
@ -327,7 +320,6 @@ void plugin_remove_instance(struct content *c, struct browser_window *bw,
struct content *page, struct box *box, struct content *page, struct box *box,
struct object_params *params, void **state) struct object_params *params, void **state)
{ {
// wimp_message *m = xcalloc(256, sizeof(char));
wimp_message m; wimp_message m;
plugin_message_close *pmc; plugin_message_close *pmc;
struct plugin_message *temp; struct plugin_message *temp;
@ -335,7 +327,6 @@ void plugin_remove_instance(struct content *c, struct browser_window *bw,
if (params == 0) { if (params == 0) {
// xfree(m);
return; return;
} }
@ -352,7 +343,6 @@ void plugin_remove_instance(struct content *c, struct browser_window *bw,
xwimp_send_message(wimp_USER_MESSAGE_RECORDED, &m, xwimp_send_message(wimp_USER_MESSAGE_RECORDED, &m,
(wimp_t)params->plugin_task); (wimp_t)params->plugin_task);
// xfree(m);
while (temp == 0) while (temp == 0)
gui_poll(); gui_poll();
@ -392,15 +382,19 @@ void plugin_reshape_instance(struct content *c, struct browser_window *bw,
* Therefore, broadcast a Message_PlugIn_Reshape (&4D544) with the values * Therefore, broadcast a Message_PlugIn_Reshape (&4D544) with the values
* given to us. * given to us.
*/ */
// wimp_message *m = xcalloc(256, sizeof(char));
wimp_message m; wimp_message m;
plugin_message_reshape *pmr; plugin_message_reshape *pmr;
os_box bbox; os_box bbox;
unsigned long x, y;
bbox.x0 = box->x; box_coords(box, (unsigned long*)&x, (unsigned long*)&y);
bbox.y0 = box->y; bbox.x0 = ((int)x << 1);
bbox.x1 = (box->x + box->width); bbox.y1 = -(((int)y << 1));
bbox.y1 = (box->y + box->height); bbox.x1 = (bbox.x0 + (box->width << 1));
bbox.y0 = (bbox.y1 - (box->height << 1));
LOG(("Box w, h: %ld %ld", box->width, box->height));
LOG(("BBox: [(%d,%d),(%d,%d)]", bbox.x0, bbox.y0, bbox.x1, bbox.y1));
pmr = (plugin_message_reshape*)&m.data; pmr = (plugin_message_reshape*)&m.data;
pmr->flags = 0; pmr->flags = 0;
@ -409,16 +403,13 @@ void plugin_reshape_instance(struct content *c, struct browser_window *bw,
pmr->parent_window = (wimp_w) bw->window->data.browser.window; pmr->parent_window = (wimp_w) bw->window->data.browser.window;
pmr->bbox = bbox; pmr->bbox = bbox;
m.size = 36; m.size = 52;
m.your_ref = 0; m.your_ref = 0;
m.action = message_PLUG_IN_RESHAPE; m.action = message_PLUG_IN_RESHAPE;
LOG(("Sending Message &4D544")); LOG(("Sending Message &4D544"));
xwimp_send_message(wimp_USER_MESSAGE, &m, (wimp_t)params->plugin_task); xwimp_send_message(wimp_USER_MESSAGE, &m, (wimp_t)params->plugin_task);
// xfree(m);
LOG(("plugin_reshape_instance"));
} }
@ -570,15 +561,17 @@ void plugin_write_parameters_file(struct object_params *params)
/* otherwise, we check the data attribute */ /* otherwise, we check the data attribute */
else if(params->data !=0 && params->type != 0) { else if(params->data !=0 && params->type != 0) {
pilist = plugin_add_item_to_pilist(pilist, 1, "DATA", params->data, pilist = plugin_add_item_to_pilist(pilist, 1, "DATA",
params->type); params->data,
params->type);
} }
/* if codebase is specified, write it as well */ /* if codebase is specified, write it as well */
if(params->codebase != 0) { if(params->codebase != 0) {
pilist = plugin_add_item_to_pilist(pilist, 1, "CODEBASE", pilist = plugin_add_item_to_pilist(pilist, 1,
params->codebase, NULL); "CODEBASE",
params->codebase, NULL);
} }
@ -614,23 +607,28 @@ void plugin_write_parameters_file(struct object_params *params)
xfree(temp); xfree(temp);
} }
/* Now write mandatory special parameters /* Now write mandatory special parameters */
/* BASEHREF */ /* BASEHREF */
pilist = plugin_add_item_to_pilist(pilist, 4, "BASEHREF", params->basehref, NULL); pilist = plugin_add_item_to_pilist(pilist, 4, "BASEHREF",
params->basehref, NULL);
/* USERAGENT */ /* USERAGENT */
pilist = plugin_add_item_to_pilist(pilist, 4, "USERAGENT", "NetSurf", NULL); pilist = plugin_add_item_to_pilist(pilist, 4, "USERAGENT",
"NetSurf", NULL);
/* UAVERSION */ /* UAVERSION */
pilist = plugin_add_item_to_pilist(pilist, 4, "UAVERSION", "0.01", NULL); pilist = plugin_add_item_to_pilist(pilist, 4, "UAVERSION",
"0.01", NULL);
/* APIVERSION */ /* APIVERSION */
pilist = plugin_add_item_to_pilist(pilist, 4, "APIVERSION", "1.10", NULL); pilist = plugin_add_item_to_pilist(pilist, 4, "APIVERSION",
"1.10", NULL);
/* BGCOLOR - needs fixing to work properly. /* BGCOLOR - needs fixing to work properly.
* Currently, it assumes FFFFFF00 (BBGGRR00) */ * Currently, it assumes FFFFFF00 (BBGGRR00) */
pilist = plugin_add_item_to_pilist(pilist, 4, "BGCOLOR", "FFFFFF00", NULL); pilist = plugin_add_item_to_pilist(pilist, 4, "BGCOLOR",
"FFFFFF00", NULL);
/* Write file */ /* Write file */
fp = fopen(params->filename, "wb+"); fp = fopen(params->filename, "wb+");
@ -736,7 +734,6 @@ struct plugin_param_item *plugin_add_item_to_pilist(struct plugin_param_item *pi
*/ */
void plugin_create_stream(struct browser_window *bw, struct object_params *params, struct content *c) { void plugin_create_stream(struct browser_window *bw, struct object_params *params, struct content *c) {
// wimp_message *m = xcalloc(256, sizeof(char));
wimp_message m; wimp_message m;
plugin_message_stream_new *pmsn; plugin_message_stream_new *pmsn;
struct plugin_message *temp; struct plugin_message *temp;
@ -758,7 +755,6 @@ void plugin_create_stream(struct browser_window *bw, struct object_params *param
offset = offset + strlen(c->url) + 1; offset = offset + strlen(c->url) + 1;
if (offset > 235) { if (offset > 235) {
LOG(("URL too long")); LOG(("URL too long"));
// xfree(m);
return; return;
} }
@ -768,7 +764,6 @@ void plugin_create_stream(struct browser_window *bw, struct object_params *param
offset = offset + strlen(c->mime_type) + 1; offset = offset + strlen(c->mime_type) + 1;
if (offset > 235) { if (offset > 235) {
LOG(("mime_type too long")); LOG(("mime_type too long"));
// xfree(m);
return; return;
} }
pmsn->target_window.offset = 0; pmsn->target_window.offset = 0;
@ -798,7 +793,6 @@ void plugin_create_stream(struct browser_window *bw, struct object_params *param
/* clean up */ /* clean up */
plugin_remove_message_from_linked_list(temp->reply); plugin_remove_message_from_linked_list(temp->reply);
plugin_remove_message_from_linked_list(temp); plugin_remove_message_from_linked_list(temp);
// xfree(m);
} }
/** /**
@ -807,7 +801,6 @@ void plugin_create_stream(struct browser_window *bw, struct object_params *param
*/ */
void plugin_write_stream_as_file(struct browser_window *bw, struct object_params *params, struct content *c) { void plugin_write_stream_as_file(struct browser_window *bw, struct object_params *params, struct content *c) {
// wimp_message *m = xcalloc(256, sizeof(char));
wimp_message m; wimp_message m;
plugin_message_stream_as_file *pmsaf; plugin_message_stream_as_file *pmsaf;
int offset = 0; int offset = 0;
@ -832,7 +825,6 @@ void plugin_write_stream_as_file(struct browser_window *bw, struct object_params
offset = offset + strlen(c->url) + 1; offset = offset + strlen(c->url) + 1;
if (offset > 235) { if (offset > 235) {
LOG(("URL too long")); LOG(("URL too long"));
// xfree(m);
return; return;
} }
@ -844,7 +836,6 @@ void plugin_write_stream_as_file(struct browser_window *bw, struct object_params
offset = offset + strlen(filename) + 1; offset = offset + strlen(filename) + 1;
if (offset > 235) { if (offset > 235) {
LOG(("filename too long")); LOG(("filename too long"));
// xfree(m);
return; return;
} }
@ -859,7 +850,6 @@ void plugin_write_stream_as_file(struct browser_window *bw, struct object_params
LOG(("Sending message &4D54C")); LOG(("Sending message &4D54C"));
xwimp_send_message(wimp_USER_MESSAGE, &m, (wimp_t)params->plugin_task); xwimp_send_message(wimp_USER_MESSAGE, &m, (wimp_t)params->plugin_task);
// xfree(m);
} }
/** /**
@ -868,7 +858,6 @@ void plugin_write_stream_as_file(struct browser_window *bw, struct object_params
*/ */
void plugin_destroy_stream(struct browser_window *bw, struct object_params *params, struct content *c) { void plugin_destroy_stream(struct browser_window *bw, struct object_params *params, struct content *c) {
// wimp_message *m = xcalloc(256, sizeof(char));
wimp_message m; wimp_message m;
plugin_message_stream_destroy *pmsd; plugin_message_stream_destroy *pmsd;
int offset = 0; int offset = 0;
@ -892,7 +881,6 @@ void plugin_destroy_stream(struct browser_window *bw, struct object_params *para
offset = offset + strlen(c->url) + 1; offset = offset + strlen(c->url) + 1;
if (offset > 235) { if (offset > 235) {
LOG(("URL too long")); LOG(("URL too long"));
// xfree(m);
return; return;
} }
@ -902,7 +890,6 @@ void plugin_destroy_stream(struct browser_window *bw, struct object_params *para
LOG(("Sending message &4D549")); LOG(("Sending message &4D549"));
xwimp_send_message(wimp_USER_MESSAGE, &m, (wimp_t)params->plugin_task); xwimp_send_message(wimp_USER_MESSAGE, &m, (wimp_t)params->plugin_task);
// xfree(m);
} }
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/