r3126 rjw - in /trunk/netsurf: desktop/browser.c render/box_construct.c riscos/window.c
by netsurf@semichrome.net
Author: rjw
Date: Sat Dec 30 02:10:46 2006
New Revision: 3126
URL: http://svn.semichrome.net?rev=3126&view=rev
Log:
Reflow iframes on layout (fix 1617625)
Modified:
trunk/netsurf/desktop/browser.c
trunk/netsurf/render/box_construct.c
trunk/netsurf/riscos/window.c
Modified: trunk/netsurf/desktop/browser.c
URL: http://svn.semichrome.net/trunk/netsurf/desktop/browser.c?rev=3126&r1=312...
==============================================================================
--- trunk/netsurf/desktop/browser.c (original)
+++ trunk/netsurf/desktop/browser.c Sat Dec 30 02:10:46 2006
@@ -462,6 +462,9 @@
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 @@
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 @@
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);
}
Modified: trunk/netsurf/render/box_construct.c
URL: http://svn.semichrome.net/trunk/netsurf/render/box_construct.c?rev=3126&r...
==============================================================================
--- trunk/netsurf/render/box_construct.c (original)
+++ trunk/netsurf/render/box_construct.c Sat Dec 30 02:10:46 2006
@@ -1923,7 +1923,7 @@
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 @@
/* acceptable encoding(s) for form data */
charset = (char *) xmlGetProp(n, (const xmlChar *) "accept-charset");
-
- form = form_new(faction, fmethod, charset,
+
+ /* target for form data */
+ target = (char *) xmlGetProp(n, (const xmlChar *) "target");
+
+ form = form_new(faction, target, fmethod, charset,
content->data.html.encoding);
if (!form) {
free(faction);
+ xmlFree(target);
xmlFree(charset);
return false;
}
Modified: trunk/netsurf/riscos/window.c
URL: http://svn.semichrome.net/trunk/netsurf/riscos/window.c?rev=3126&r1=3125&...
==============================================================================
--- trunk/netsurf/riscos/window.c (original)
+++ trunk/netsurf/riscos/window.c Sat Dec 30 02:10:46 2006
@@ -117,6 +117,7 @@
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 @@
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) {
@@ -1704,6 +1709,63 @@
ro_gui_theme_toolbar_editor_sync(g->toolbar);
gui_window_update_extent(g);
}
+ }
+}
+
+
+/**
+ * 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;
}
}
@@ -1848,25 +1910,8 @@
}
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 */