60 switch(scrollbar_data->
msg) {
78 .
x0 = scrollbar_data->
x0,
79 .y0 = scrollbar_data->
y0,
80 .x1 = scrollbar_data->
x1,
81 .y1 = scrollbar_data->
y1
119 int bw_width = bw->
width;
120 int bw_height = bw->
height;
126 scroll_y = (c_height > bw_height) ?
true :
false;
127 scroll_x = (c_width > bw_width) ?
true :
false;
134 if (!scroll_x && bw->
scroll_x != NULL) {
139 if (!scroll_y && bw->
scroll_y != NULL) {
164 int visible = length;
180 if (scroll_x && scroll_y)
211 if (iframe == NULL) {
218 for (cur = iframe; cur; cur = cur->
next) {
221 bw->
iframes = calloc(iframes,
sizeof(*bw));
228 for (cur = iframe; cur; cur = cur->
next) {
229 window = &(bw->
iframes[index++]);
244 if (cur->
name != NULL) {
246 if (window->
name == NULL) {
272 for (cur = iframe; cur; cur = cur->
next) {
273 window = &(bw->
iframes[index++]);
336 int bw_width, bw_height;
337 int avail_width, avail_height;
338 int row, row2, col, index;
341 int size, extent, applied;
343 int new_width, new_height;
364 for (row = 0; row <
bw->
rows; row++) {
365 avail_width = bw_width;
367 for (col = 0; col <
bw->
cols; col++) {
368 index = (row *
bw->
cols) + col;
371 switch (
window->frame_width.unit) {
372 case FRAME_DIMENSION_PIXELS:
373 widths[col][row] =
window->frame_width.value *
377 widths[col][row] += 1;
379 widths[col][row] += 1;
382 case FRAME_DIMENSION_PERCENT:
383 widths[col][row] = bw_width *
384 window->frame_width.value / 100;
386 case FRAME_DIMENSION_RELATIVE:
387 widths[col][row] = 0;
388 relative +=
window->frame_width.value;
392 assert(
window->frame_width.unit ==
393 FRAME_DIMENSION_PIXELS ||
394 window->frame_width.unit ==
395 FRAME_DIMENSION_PERCENT ||
396 window->frame_width.unit ==
397 FRAME_DIMENSION_RELATIVE);
400 avail_width -= widths[col][row];
404 if ((relative > 0) && (avail_width > 0)) {
406 for (col = 0; col <
bw->
cols; col++) {
407 index = (row *
bw->
cols) + col;
410 if (
window->frame_width.unit ==
411 FRAME_DIMENSION_RELATIVE) {
412 size = avail_width *
window->
416 relative -=
window->frame_width.value;
417 widths[col][row] += size;
420 }
else if (bw_width != avail_width) {
422 extent = avail_width;
424 for (col = 0; col <
bw->
cols; col++) {
425 if (col ==
bw->
cols - 1) {
427 widths[col][row] += extent - applied;
429 widths[col][row] < 0 ?
430 0 : widths[col][row];
433 size = (widths[col][row] * extent) /
436 widths[col][row] += size;
444 for (col = 0; col <
bw->
cols; col++) {
445 avail_height = bw_height;
447 for (row = 0; row <
bw->
rows; row++) {
448 index = (row *
bw->
cols) + col;
451 switch (
window->frame_height.unit) {
452 case FRAME_DIMENSION_PIXELS:
453 heights[col][row] =
window->frame_height.value *
457 heights[col][row] += 1;
459 heights[col][row] += 1;
462 case FRAME_DIMENSION_PERCENT:
463 heights[col][row] = bw_height *
464 window->frame_height.value / 100;
466 case FRAME_DIMENSION_RELATIVE:
467 heights[col][row] = 0;
468 relative +=
window->frame_height.value;
472 assert(
window->frame_height.unit ==
473 FRAME_DIMENSION_PIXELS ||
474 window->frame_height.unit ==
475 FRAME_DIMENSION_PERCENT ||
476 window->frame_height.unit ==
477 FRAME_DIMENSION_RELATIVE);
480 avail_height -= heights[col][row];
483 if (avail_height == 0)
487 if ((relative > 0) && (avail_height > 0)) {
489 for (row = 0; row <
bw->
rows; row++) {
490 index = (row *
bw->
cols) + col;
493 if (
window->frame_height.unit ==
494 FRAME_DIMENSION_RELATIVE) {
495 size = avail_height *
window->
498 avail_height -= size;
499 relative -=
window->frame_height.value;
500 heights[col][row] += size;
503 }
else if (bw_height != avail_height) {
505 extent = avail_height;
507 for (row = 0; row <
bw->
rows; row++) {
508 if (row ==
bw->
rows - 1) {
510 heights[col][row] += extent - applied;
512 heights[col][row] < 0 ?
513 0 : heights[col][row];
516 size = (heights[col][row] * extent) /
517 (bw_height - extent);
519 heights[col][row] += size;
527 for (row = 0; row <
bw->
rows; row++) {
529 for (col = 0; col <
bw->
cols; col++) {
530 index = (row *
bw->
cols) + col;
534 for (row2 = 0; row2 < row; row2++)
535 y+= heights[col][row2];
540 new_width = widths[col][row] - 1;
541 new_height = heights[col][row] - 1;
555 x += widths[col][row];
580 assert(
bw && frameset);
584 assert(frameset->
cols + frameset->
rows != 0);
593 for (row = 0; row <
bw->
rows; row++) {
594 for (col = 0; col <
bw->
cols; col++) {
595 index = (row *
bw->
cols) + col;
605 window->browser_window_type =
608 window->browser_window_type =
633 NSLOG(netsurf, INFO,
"Created frame '%s'",
637 "Created frame (unnamed)");
646 for (row = 0; row <
bw->
rows; row++) {
647 for (col = 0; col <
bw->
cols; col++) {
648 index = (row *
bw->
cols) + col;
660 if (
window->current_content &&
669 for (row = 0; row <
bw->
rows; row++) {
670 for (col = 0; col <
bw->
cols; col++) {
671 index = (row *
bw->
cols) + col;
702 if (frameset == NULL) {
744 int col = -1, row = -1, i;
757 assert((col >= 0) && (row >= 0));
761 sibling = &
parent->children[row *
parent->cols + (col - 1)];
763 sibling = &
parent->children[row *
parent->cols + (col + 1)];
772 sibling = &
parent->children[(row - 1) *
parent->cols + col];
774 sibling = &
parent->children[(row + 1) *
parent->cols + col];
792 int bw_dimension, sibling_dimension;
793 int bw_pixels, sibling_pixels;
803 bw_dimension = bw->
x + bw->
width - x;
805 bw_dimension = x - bw->
x;
807 bw_pixels = bw->
width;
808 sibling_pixels = sibling->
width;
814 bw_dimension = bw->
y + bw->
height - y;
816 bw_dimension = y - bw->
y;
819 sibling_pixels = sibling->
height;
824 sibling_dimension = bw_pixels + sibling_pixels - bw_dimension;
827 if ((bw_dimension == bw_pixels) || (frame_size == 0))
830 total_new = bw_dimension + sibling_dimension;
831 if ((bw_dimension + sibling_dimension) == 0)
849 if (bw_d->
unit == sibling_d->
unit) {
850 float total_specified = bw_d->
value + sibling_d->
value;
851 bw_d->
value = (total_specified * bw_dimension) / total_new;
852 sibling_d->
value = total_specified - bw_d->
value;
862 if ((sibling_pixels == 0) && (bw_dimension == 0))
864 if (fabs(sibling_d->
value) < 0.0001)
866 if (sibling_pixels == 0)
867 sibling_d->
value = (sibling_d->
value * bw_pixels) / bw_dimension;
870 (sibling_d->
value * sibling_dimension) / sibling_pixels;
875 if ((bw_pixels == 0) && (sibling_dimension == 0))
877 if (fabs(bw_d->
value) < 0.0001)
880 bw_d->
value = (bw_d->
value * sibling_pixels) / sibling_dimension;
882 bw_d->
value = (bw_d->
value * bw_dimension) / bw_pixels;
893 float total_specified = bw_d->
value + frame_size * sibling_d->
value / 100;
894 bw_d->
value = (total_specified * bw_dimension) / total_new;
895 sibling_d->
value = (total_specified - bw_d->
value) * 100 / frame_size;
898 float total_specified = bw_d->
value * frame_size / 100 + sibling_d->
value;
899 sibling_d->
value = (total_specified * sibling_dimension) / total_new;
900 bw_d->
value = (total_specified - sibling_d->
value) * 100 / frame_size;
903 assert(!
"Invalid frame dimension unit");
913 bool left, right, up, down;
914 int i, resize_margin;
923 if (resize_margin * 2 >
bw->
width)
925 left = (
x <
bw->
x + resize_margin);
930 up = (
y <
bw->
y + resize_margin);
934 if (left || right || up || down) {
935 int row = -1, col = -1;
952 assert((row >= 0) && (col >= 0));
956 right &= (col <
parent->cols - 1);
958 down &= (row <
parent->rows - 1);
962 left &= !
parent->children[row *
963 parent->cols + (col - 1)].
966 right &= !
parent->children[row *
967 parent->cols + (col + 1)].
970 up &= !
parent->children[(row - 1) *
974 down &= !
parent->children[(row + 1) *
985 if (left || right || up || down) {
1026 mouse,
x,
y, pointer))
1032 mouse,
x,
y, pointer))
1049 x + offx,
y + offy, pointer);
void box_bounds(struct box *box, struct rect *r)
Find the bounds of a box.
HTML Box tree inspection interface.
Browser window private structure.
nserror browser_window_initialise_common(enum browser_window_create_flags flags, struct browser_window *bw, const struct browser_window *existing)
Initialise common parts of a browser window.
void browser_window_update_extent(struct browser_window *bw)
Update the extent of the inside of a browser window to that of the current content.
nserror browser_window_get_dimensions(struct browser_window *bw, int *width, int *height)
Get the dimensions of the area a browser window occupies.
nserror browser_window_destroy_internal(struct browser_window *bw)
Release all memory associated with a browser window.
nserror browser_window_invalidate_rect(struct browser_window *bw, struct rect *rect)
Cause an area of a browser window to be marked invalid and hence redrawn.
struct browser_window * browser_window_get_root(struct browser_window *bw)
Get the root level browser window.
nserror browser_window_navigate(struct browser_window *bw, struct nsurl *url, struct nsurl *referrer, enum browser_window_nav_flags flags, char *post_urlenc, struct fetch_multipart_data *post_multipart, struct hlcache_handle *parent)
Start fetching a page in a browser window.
void browser_window_set_drag_type(struct browser_window *bw, browser_drag_type type, const struct rect *rect)
Set drag type for a browser window, and inform front end.
void browser_window_set_position(struct browser_window *bw, int x, int y)
Set the position of the current browser window with respect to the parent browser window.
void browser_window_set_dimensions(struct browser_window *bw, int width, int height)
Set the dimensions of the area a browser window occupies.
void browser_window_reformat(struct browser_window *bw, bool background, int width, int height)
Reformat a browser window contents to a new width or height.
void browser_window_get_position(struct browser_window *bw, bool root, int *pos_x, int *pos_y)
Get the position of the current browser window with respect to the root or parent browser window.
@ BW_CREATE_NONE
No flags set.
@ BW_NAVIGATE_HISTORY
this will form a new history node (don't set for back/reload/etc)
@ BW_NAVIGATE_UNVERIFIABLE
Transation not caused by user interaction (e.g.
void browser_window_set_pointer(struct browser_window *bw, browser_pointer_shape shape)
Change the shape of the mouse pointer.
@ CONTENT_HTML
content is HTML
nserror
Enumeration of error codes.
@ NSERROR_NOMEM
Memory exhaustion.
static struct directory * root
#define FRAME_RESIZE
maximum frame resize margin
nserror browser_window_destroy_iframes(struct browser_window *bw)
Destroy iframes opened in browser_window_create_iframes()
void browser_window_recalculate_frameset(struct browser_window *bw)
Recalculate frameset positions following a resize.
void browser_window_scroll_callback(void *client_data, struct scrollbar_msg_data *scrollbar_data)
Callback for (i)frame scrollbars.
static void browser_window_recalculate_frameset_internal(struct browser_window *bw)
Recalculate frameset positions following a resize.
void browser_window_recalculate_iframes(struct browser_window *bw)
Recalculate iframe positions following a resize.
bool browser_window_frame_resize_start(struct browser_window *bw, browser_mouse_state mouse, int x, int y, browser_pointer_shape *pointer)
void browser_window_handle_scrollbars(struct browser_window *bw)
Create, remove, and update browser window scrollbars.
nserror browser_window_create_iframes(struct browser_window *bw)
Create and open iframes for a browser window.
static bool browser_window_resolve_frame_dimension(struct browser_window *bw, struct browser_window *sibling, int x, int y, bool width, bool height)
nserror browser_window_invalidate_iframe(struct browser_window *bw)
Invalidate an iframe causing a redraw.
static bool browser_window_resize_frames(struct browser_window *bw, browser_mouse_state mouse, int x, int y, browser_pointer_shape *pointer)
static nserror browser_window_create_frameset_internal(struct browser_window *bw, struct content_html_frames *frameset)
Create and open a frameset for a browser window.
void browser_window_resize_frame(struct browser_window *bw, int x, int y)
Resize a browser window that is a frame.
nserror browser_window_create_frameset(struct browser_window *bw)
Create and open a frameset for a browser window.
Frame and frameset creation and manipulation (interface).
High-level resource cache interface.
void html_redraw_a_box(hlcache_handle *h, struct box *box)
Redraw a box.
struct content_html_iframe * html_get_iframe(hlcache_handle *h)
Retrieve iframes used in an HTML document.
struct content_html_frames * html_get_frameset(hlcache_handle *h)
Retrieve framesets used in an HTML document.
Interface to text/html content handler.
Public content interface.
struct nsurl * hlcache_handle_get_url(const struct hlcache_handle *handle)
Retrieve the URL associated with a high level cache handle.
int content_get_height(struct hlcache_handle *h)
Retrieve height of content.
int content_get_width(struct hlcache_handle *h)
Retrieve width of content.
content_type content_get_type(struct hlcache_handle *h)
Retrieve computed type of content.
browser_pointer_shape
Mouse pointer type.
@ BROWSER_POINTER_DEFAULT
browser_mouse_state
Mouse state: 1 is primary mouse button.
@ BROWSER_MOUSE_DRAG_1
start of button 1 drag
@ BROWSER_MOUSE_DRAG_2
start of button 2 drag
#define NSLOG(catname, level, logmsg, args...)
Interface to utility string handling.
struct browser_window * iframe
Iframe's browser_window, or NULL if none.
@ BROWSER_WINDOW_FRAMESET
browser_scrolling scrolling
struct browser_window * iframes
struct scrollbar * scroll_x
Horizontal scroll.
struct browser_window::@59 drag
Current drag status.
struct browser_window * bw
float scale
scale of window contents
struct frame_dimension frame_height
int rows
frameset characteristics
struct scrollbar * scroll_y
Vertical scroll.
int iframe_count
[iframe_count] iframes
unsigned int resize_left
Frame resize directions for current frame resize drag.
struct browser_window * parent
unsigned int resize_right
struct gui_window * window
Platform specific window data only valid at top level.
int start_x
Mouse position at start of current scroll drag.
bool no_resize
frame characteristics
struct box * box
iframe parent box
struct browser_window * children
[cols * rows] children
struct hlcache_handle * current_content
Content handle of page currently displayed which must have READY or DONE status or NULL for no conten...
char * name
frame name for targetting
enum browser_window::@60 browser_window_type
Window characteristics.
struct frame_dimension frame_width
frame dimensions
Frame tree (frameset or frame tag)
char * name
frame margin height
int rows
number of columns in frameset
struct content_html_frames * children
frame border colour
int margin_width
frame width
struct nsurl * url
frame name (for targetting)
browser_scrolling scrolling
frame is not resizable
bool border
scrolling characteristics
colour border_colour
frame has a border
int margin_height
frame margin width
struct frame_dimension width
number of rows in frameset
struct frame_dimension height
frame width
Inline frame list (iframe tag)
struct content_html_iframe * next
frame border colour
int margin_height
frame margin width
browser_scrolling scrolling
frame url
struct nsurl * url
frame name (for targetting)
colour border_colour
frame has a border
bool border
scrolling characteristics
char * name
frame margin height
enum frame_dimension::@63 unit
@ FRAME_DIMENSION_RELATIVE
int height
height of drawing area
Interface to time operations.
Interface to a number of general purpose functionality.