summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2006-12-30 02:10:46 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2006-12-30 02:10:46 +0000
commitf4b8d3a0091a4a3a3d0d0bab5a683cb7600b66e5 (patch)
tree5f56105fcb4121c8263e8491116899fbc22fc644
parent1353585036eac67feeffdda4de20d91f036c1576 (diff)
downloadnetsurf-f4b8d3a0091a4a3a3d0d0bab5a683cb7600b66e5.tar.gz
netsurf-f4b8d3a0091a4a3a3d0d0bab5a683cb7600b66e5.tar.bz2
Reflow iframes on layout (fix 1617625)
svn path=/trunk/netsurf/; revision=3126
-rw-r--r--desktop/browser.c10
-rw-r--r--render/box_construct.c8
-rw-r--r--riscos/window.c83
3 files changed, 78 insertions, 23 deletions
diff --git a/desktop/browser.c b/desktop/browser.c
index 0cb541358..42d46b532 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -462,6 +462,9 @@ void browser_window_callback(content_msg msg, struct content *c,
case CONTENT_MSG_REFORMAT:
if (c == bw->current_content &&
c->type == CONTENT_HTML) {
+ /* reflow iframe positions */
+ if (c->data.html.iframe)
+ browser_window_recalculate_iframes(bw);
/* box tree may have changed, need to relabel */
selection_reinit(bw->sel, c->data.html.layout);
}
@@ -671,6 +674,7 @@ void browser_window_update(struct browser_window *bw,
if (scroll_to_top)
gui_window_set_scroll(bw->window, 0, 0);
+ /* todo: don't do this if the user has scrolled */
/* if frag_id exists, then try to scroll to it */
if (bw->frag_id && bw->current_content->type == CONTENT_HTML) {
if ((pos = box_find_by_id(bw->current_content->data.html.layout, bw->frag_id)) != 0) {
@@ -920,8 +924,10 @@ void browser_window_reformat(struct browser_window *bw, int width, int height)
if (c->type == CONTENT_HTML && c->data.html.frameset)
browser_window_recalculate_frameset(bw);
- if (c->type == CONTENT_HTML && c->data.html.iframe)
- browser_window_recalculate_iframes(bw);
+
+ /* CONTENT_MSG_REFORMAT handles the repositioning of iframes */
+// if (c->type == CONTENT_HTML && c->data.html.iframe)
+// browser_window_recalculate_iframes(bw);
}
diff --git a/render/box_construct.c b/render/box_construct.c
index 41df9ad3b..1f1cc86a4 100644
--- a/render/box_construct.c
+++ b/render/box_construct.c
@@ -1923,7 +1923,7 @@ bool box_iframe(BOX_SPECIAL_PARAMS)
bool box_form(BOX_SPECIAL_PARAMS)
{
- char *xmlaction, *action, *faction, *method, *enctype, *charset;
+ char *xmlaction, *action, *faction, *method, *enctype, *charset, *target;
form_method fmethod;
struct form *form;
url_func_result result;
@@ -1969,11 +1969,15 @@ bool box_form(BOX_SPECIAL_PARAMS)
/* acceptable encoding(s) for form data */
charset = (char *) xmlGetProp(n, (const xmlChar *) "accept-charset");
+
+ /* target for form data */
+ target = (char *) xmlGetProp(n, (const xmlChar *) "target");
- form = form_new(faction, fmethod, charset,
+ form = form_new(faction, target, fmethod, charset,
content->data.html.encoding);
if (!form) {
free(faction);
+ xmlFree(target);
xmlFree(charset);
return false;
}
diff --git a/riscos/window.c b/riscos/window.c
index 304b49890..9d9af0e50 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -117,6 +117,7 @@ struct ro_gui_pointer_entry ro_gui_pointer_table[] = {
static void ro_gui_window_remove_update_boxes(struct gui_window *g);
+static void gui_window_set_extent(struct gui_window *g, int width, int height);
static void ro_gui_window_open(wimp_open *open);
static void ro_gui_window_close(wimp_w w);
static void ro_gui_window_redraw(wimp_draw *redraw);
@@ -893,6 +894,10 @@ void gui_window_update_extent(struct gui_window *g)
assert(g);
+ /* update the extent (this is only done by _open on a window
+ * dimension change) */
+ gui_window_set_extent(g, -1, -1);
+
state.w = g->window;
error = xwimp_get_window_state(&state);
if (error) {
@@ -1709,6 +1714,63 @@ void ro_gui_window_update_theme(void) {
/**
+ * Updates a windows extent.
+ *
+ * \param g the gui_window to update
+ * \param width the minimum width, or -1 to use window width
+ * \param height the minimum height, or -1 to use window height
+ */
+
+void gui_window_set_extent(struct gui_window *g, int width, int height)
+{
+ int toolbar_height = 0;
+ struct content *content;
+ wimp_window_state state;
+ os_error *error;
+
+ content = g->bw->current_content;
+ if (g->toolbar)
+ toolbar_height = ro_gui_theme_toolbar_full_height(g->toolbar);
+
+ /* get the current state */
+ if ((height != -1) || (width != -1)) {
+ state.w = g->window;
+ error = xwimp_get_window_state(&state);
+ if (error) {
+ LOG(("xwimp_get_window_state: 0x%x: %s",
+ error->errnum, error->errmess));
+ warn_user("WimpError", error->errmess);
+ return;
+ }
+ if (width == -1)
+ width = state.visible.x1 - state.visible.x0;
+ if (height == -1) {
+ height = state.visible.y1 - state.visible.y0;
+ height -= toolbar_height;
+ }
+ }
+
+ /* the top-level framed window is a total pain. to get it to maximise to the
+ * top of the screen we need to fake it having a suitably large extent */
+ if (g->bw->children && (g->bw->browser_window_type == BROWSER_WINDOW_NORMAL))
+ height = 16384;
+
+ if (content) {
+ width = max(width, content->width * 2 * g->option.scale);
+ height = max(height, content->height * 2 * g->option.scale);
+ }
+ os_box extent = { 0, -height, width, toolbar_height };
+ error = xwimp_set_extent(g->window, &extent);
+ if (error) {
+ LOG(("xwimp_set_extent: 0x%x: %s",
+ error->errnum, error->errmess));
+ warn_user("WimpError", error->errmess);
+ return;
+ }
+}
+
+
+/**
* Open a window using the given wimp_open, handling toolbars and resizing.
*/
@@ -1848,25 +1910,8 @@ void ro_gui_window_open(wimp_open *open)
}
g->old_width = width;
g->old_height = height;
-
- /* the top-level framed window is a total pain. to get it to maximise to the
- * top of the screen we need to fake it having a suitably large extent */
- if (g->bw->children && (g->bw->browser_window_type == BROWSER_WINDOW_NORMAL))
- height = 16384;
-
- if (content && height < content->height * 2 * g->option.scale)
- height = content->height * 2 * g->option.scale;
- if (content && width < content->width * 2 * g->option.scale)
- width = content->width * 2 * g->option.scale;
- os_box extent = { 0, -height, width, toolbar_height };
- error = xwimp_set_extent(g->window, &extent);
- if (error) {
- LOG(("xwimp_set_extent: 0x%x: %s",
- error->errnum, error->errmess));
- warn_user("WimpError", error->errmess);
- return;
- }
-
+
+ gui_window_set_extent(g, width, height);
}
/* first resize stops any flickering by making the URL window on top */