summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2007-01-03 15:15:54 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2007-01-03 15:15:54 +0000
commit0b875957cbf20593e5968ed29d9ccbbd2ff1a337 (patch)
treef1c92db641e1ac937ed16a9853d9f0e8801c2895 /desktop
parentcf0718f6490f01f1c4a3f0c90caf69c738c1c33d (diff)
downloadnetsurf-0b875957cbf20593e5968ed29d9ccbbd2ff1a337.tar.gz
netsurf-0b875957cbf20593e5968ed29d9ccbbd2ff1a337.tar.bz2
Format frame content to correct initial size. Scale iframe co-ordinates.
svn path=/trunk/netsurf/; revision=3134
Diffstat (limited to 'desktop')
-rw-r--r--desktop/browser.c8
-rw-r--r--desktop/frames.c80
2 files changed, 50 insertions, 38 deletions
diff --git a/desktop/browser.c b/desktop/browser.c
index 42d46b532..628fbc9b3 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -282,6 +282,7 @@ void browser_window_go_post(struct browser_window *bw, const char *url,
browser_window_destroy_children(bw);
gui_window_get_dimensions(bw->window, &width, &height, true);
+ LOG(("Loading '%s' width %i, height %i", url2, width, height));
browser_window_set_status(bw, messages_get("Loading"));
bw->history_add = history_add;
@@ -462,6 +463,9 @@ void browser_window_callback(content_msg msg, struct content *c,
case CONTENT_MSG_REFORMAT:
if (c == bw->current_content &&
c->type == CONTENT_HTML) {
+ /* reposition frames */
+ if (c->data.html.frameset)
+ browser_window_recalculate_frameset(bw);
/* reflow iframe positions */
if (c->data.html.iframe)
browser_window_recalculate_iframes(bw);
@@ -922,8 +926,8 @@ void browser_window_reformat(struct browser_window *bw, int width, int height)
content_reformat(c, width, height);
- if (c->type == CONTENT_HTML && c->data.html.frameset)
- browser_window_recalculate_frameset(bw);
+// if (c->type == CONTENT_HTML && c->data.html.frameset)
+// browser_window_recalculate_frameset(bw);
/* CONTENT_MSG_REFORMAT handles the repositioning of iframes */
// if (c->type == CONTENT_HTML && c->data.html.iframe)
diff --git a/desktop/frames.c b/desktop/frames.c
index 1991a702c..922ac01ab 100644
--- a/desktop/frames.c
+++ b/desktop/frames.c
@@ -149,11 +149,9 @@ void browser_window_create_frameset(struct browser_window *bw,
struct content_html_frames *frame;
struct browser_window *window;
- /* we use a 3 stage approach such that the content is initially formatted to the
- * correct frameset dimensions */
assert(bw && frameset);
- /* create children */
+ /* 1. Create children */
assert(bw->children == NULL);
assert(frameset->cols + frameset->rows != 0);
@@ -195,16 +193,26 @@ void browser_window_create_frameset(struct browser_window *bw,
/* gui window */
window->window = gui_create_browser_window(window, bw);
- if (frame->children)
- browser_window_create_frameset(window, frame);
}
}
- /* calculate dimensions */
+ /* 2. Calculate dimensions */
gui_window_update_extent(bw->window);
browser_window_recalculate_frameset(bw);
- /* launch content */
+ /* 3. Recurse for grandchildren */
+ for (row = 0; row < bw->rows; row++) {
+ for (col = 0; col < bw->cols; col++) {
+ index = (row * bw->cols) + col;
+ frame = &frameset->children[index];
+ window = &bw->children[index];
+
+ if (frame->children)
+ browser_window_create_frameset(window, frame);
+ }
+ }
+
+ /* 4. Launch content */
for (row = 0; row < bw->rows; row++) {
for (col = 0; col < bw->cols; col++) {
index = (row * bw->cols) + col;
@@ -457,20 +465,20 @@ bool browser_window_resolve_frame_dimension(struct browser_window *bw, struct br
/* extend/shrink the box to the pointer */
if (width) {
- if (bw->drag_resize_left)
- bw_dimension = bw->x1 - x;
- else
- bw_dimension = x - bw->x0;
+ if (bw->drag_resize_left)
+ bw_dimension = bw->x1 - x;
+ else
+ bw_dimension = x - bw->x0;
bw_pixels = (bw->x1 - bw->x0);
sibling_pixels = (sibling->x1 - sibling->x0);
bw_d = &bw->frame_width;
sibling_d = &sibling->frame_width;
frame_size = bw->parent->x1 - bw->parent->x0;
} else {
- if (bw->drag_resize_up)
- bw_dimension = bw->y1 - y;
- else
- bw_dimension = y - bw->y0;
+ if (bw->drag_resize_up)
+ bw_dimension = bw->y1 - y;
+ else
+ bw_dimension = y - bw->y0;
bw_pixels = (bw->y1 - bw->y0);
sibling_pixels = (sibling->y1 - sibling->y0);
bw_d = &bw->frame_height;
@@ -489,11 +497,11 @@ bool browser_window_resolve_frame_dimension(struct browser_window *bw, struct br
/* our frame dimensions are now known to be:
*
- * <-- frame_size --> [VISIBLE PIXELS]
+ * <-- frame_size --> [VISIBLE PIXELS]
* |<-- bw_pixels -->|<-- sibling_pixels -->| [VISIBLE PIXELS, BEFORE RESIZE]
* |<-- bw_d->value-->|<-- sibling_d->value-->| [SPECIFIED UNITS, BEFORE RESIZE]
* |<--bw_dimension-->|<--sibling_dimension-->| [VISIBLE PIXELS, AFTER RESIZE]
- * |<-- total_new -->| [VISIBLE PIXELS, AFTER RESIZE]
+ * |<-- total_new -->| [VISIBLE PIXELS, AFTER RESIZE]
*
* when we resize, we must retain the original unit specification such that any
* subsequent resizing of the parent window will recalculate the page as the
@@ -515,27 +523,27 @@ bool browser_window_resolve_frame_dimension(struct browser_window *bw, struct br
* dimension.
*/
if (bw_d->unit == FRAME_DIMENSION_RELATIVE) {
- if ((sibling_pixels == 0) && (bw_dimension == 0))
- return false;
- if (sibling_d->value == 0)
- bw_d->value = 1;
- if (sibling_pixels == 0)
- sibling_d->value = (sibling_d->value * bw_pixels) / bw_dimension;
- else
- sibling_d->value =
- (sibling_d->value * sibling_dimension) / sibling_pixels;
+ if ((sibling_pixels == 0) && (bw_dimension == 0))
+ return false;
+ if (sibling_d->value == 0)
+ bw_d->value = 1;
+ if (sibling_pixels == 0)
+ sibling_d->value = (sibling_d->value * bw_pixels) / bw_dimension;
+ else
+ sibling_d->value =
+ (sibling_d->value * sibling_dimension) / sibling_pixels;
/* todo: the availble resize may have changed, update the drag box */
return true;
} else if (sibling_d->unit == FRAME_DIMENSION_RELATIVE) {
- if ((bw_pixels == 0) && (sibling_dimension == 0))
- return false;
- if (bw_d->value == 0)
- bw_d->value = 1;
- if (bw_pixels == 0)
- bw_d->value = (bw_d->value * sibling_pixels) / sibling_dimension;
- else
- bw_d->value = (bw_d->value * bw_dimension) / bw_pixels;
+ if ((bw_pixels == 0) && (sibling_dimension == 0))
+ return false;
+ if (bw_d->value == 0)
+ bw_d->value = 1;
+ if (bw_pixels == 0)
+ bw_d->value = (bw_d->value * sibling_pixels) / sibling_dimension;
+ else
+ bw_d->value = (bw_d->value * bw_dimension) / bw_pixels;
/* todo: the availble resize may have changed, update the drag box */
return true;
@@ -557,7 +565,7 @@ bool browser_window_resolve_frame_dimension(struct browser_window *bw, struct br
return true;
}
assert(!"Invalid frame dimension unit");
- return false;
+ return false;
}
@@ -609,7 +617,7 @@ bool browser_window_resize_frames(struct browser_window *bw, browser_mouse_state
right &= (col < parent->cols - 1);
up &= (row > 0);
down &= (row < parent->rows - 1);
-
+
/* check the sibling frames can be resized */
if (left)
left &= !parent->children[row * parent->cols + (col - 1)].no_resize;