Add bw function to get scrollbar type.

This commit is contained in:
Michael Drake 2014-10-25 12:04:11 +01:00
parent af3cb6bf94
commit eed2a97eca
7 changed files with 40 additions and 19 deletions

View File

@ -483,6 +483,17 @@ bool browser_window_is_frameset(struct browser_window *bw)
return (bw->children != NULL);
}
/* exported interface, documented in desktop/browser.h */
nserror browser_window_get_scrollbar_type(struct browser_window *bw,
browser_scrolling *h, browser_scrolling *v)
{
*h = bw->scrolling;
*v = bw->scrolling;
return NSERROR_OK;
}
/**
* Set or remove a selection.
*
@ -772,7 +783,7 @@ nserror browser_window_create(enum browser_window_create_flags flags,
/* window characteristics */
ret->browser_window_type = BROWSER_WINDOW_NORMAL;
ret->scrolling = SCROLLING_YES;
ret->scrolling = BW_SCROLLING_YES;
ret->border = true;
ret->no_resize = true;
ret->last_action = wallclock();

View File

@ -61,6 +61,12 @@ typedef enum {
BW_EDITOR_CAN_PASTE = (1 << 2) /**< Can paste, input */
} browser_editor_flags;
typedef enum {
BW_SCROLLING_AUTO,
BW_SCROLLING_YES,
BW_SCROLLING_NO
} browser_scrolling;
/** flags to browser_window_create */
enum browser_window_create_flags {
/** No flags set */
@ -602,6 +608,15 @@ bool browser_window_can_search(struct browser_window *bw);
*/
bool browser_window_is_frameset(struct browser_window *bw);
/**
* Find out if a browser window contains a frameset
*
* \param bw browser window to look at
* \return NSERROR_OK, or appropriate error otherwise
*/
nserror browser_window_get_scrollbar_type(struct browser_window *bw,
browser_scrolling *h, browser_scrolling *v);
/**
* Dump debug info concerning the browser window's contents to file

View File

@ -123,7 +123,7 @@ struct browser_window {
/** frame characteristics */
bool no_resize;
frame_scrolling scrolling;
browser_scrolling scrolling;
bool border;
colour border_colour;

View File

@ -32,12 +32,6 @@ struct frame_dimension {
} unit;
};
typedef enum {
SCROLLING_AUTO,
SCROLLING_YES,
SCROLLING_NO
} frame_scrolling;
/* Handy struct names */
struct content_html_iframe;
struct content_html_frames;

View File

@ -111,10 +111,10 @@ void browser_window_handle_scrollbars(struct browser_window *bw)
c_height = content_get_height(h);
}
if (bw->scrolling == SCROLLING_YES) {
if (bw->scrolling == BW_SCROLLING_YES) {
scroll_x = true;
scroll_y = true;
} else if (bw->scrolling == SCROLLING_AUTO &&
} else if (bw->scrolling == BW_SCROLLING_AUTO &&
bw->current_content) {
int bw_width = bw->width;
int bw_height = bw->height;

View File

@ -2015,7 +2015,7 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
/* update frameset and create default children */
f->cols = cols;
f->rows = rows;
f->scrolling = SCROLLING_NO;
f->scrolling = BW_SCROLLING_NO;
f->children = talloc_array(content->bctx, struct content_html_frames,
(rows * cols));
@ -2034,7 +2034,7 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
frame->name = NULL;
frame->url = NULL;
frame->no_resize = false;
frame->scrolling = SCROLLING_AUTO;
frame->scrolling = BW_SCROLLING_AUTO;
frame->border = default_border;
frame->border_colour = default_border_colour;
frame->children = NULL;
@ -2170,10 +2170,10 @@ bool box_create_frameset(struct content_html_frames *f, dom_node *n,
if (err == DOM_NO_ERR && s != NULL) {
if (dom_string_caseless_lwc_isequal(s,
corestring_lwc_yes))
frame->scrolling = SCROLLING_YES;
frame->scrolling = BW_SCROLLING_YES;
else if (dom_string_caseless_lwc_isequal(s,
corestring_lwc_no))
frame->scrolling = SCROLLING_NO;
frame->scrolling = BW_SCROLLING_NO;
dom_string_unref(s);
}
@ -2293,7 +2293,7 @@ bool box_iframe(BOX_SPECIAL_PARAMS)
iframe->margin_height = 0;
iframe->name = NULL;
iframe->url = url;
iframe->scrolling = SCROLLING_AUTO;
iframe->scrolling = BW_SCROLLING_AUTO;
iframe->border = true;
/* Add this iframe to the linked list of iframes */
@ -2328,10 +2328,10 @@ bool box_iframe(BOX_SPECIAL_PARAMS)
if (err == DOM_NO_ERR && s != NULL) {
if (dom_string_caseless_lwc_isequal(s,
corestring_lwc_yes))
iframe->scrolling = SCROLLING_YES;
iframe->scrolling = BW_SCROLLING_YES;
else if (dom_string_caseless_lwc_isequal(s,
corestring_lwc_no))
iframe->scrolling = SCROLLING_NO;
iframe->scrolling = BW_SCROLLING_NO;
dom_string_unref(s);
}

View File

@ -32,6 +32,7 @@
#include "content/content_type.h"
#include "css/css.h"
#include "desktop/browser.h"
#include "desktop/mouse.h"
#include "desktop/plot_style.h"
#include "desktop/frame_types.h"
@ -117,7 +118,7 @@ struct content_html_frames {
struct nsurl *url; /** frame url */
bool no_resize; /** frame is not resizable */
frame_scrolling scrolling; /** scrolling characteristics */
browser_scrolling scrolling; /** scrolling characteristics */
bool border; /** frame has a border */
colour border_colour; /** frame border colour */
@ -134,7 +135,7 @@ struct content_html_iframe {
char *name; /** frame name (for targetting) */
struct nsurl *url; /** frame url */
frame_scrolling scrolling; /** scrolling characteristics */
browser_scrolling scrolling; /** scrolling characteristics */
bool border; /** frame has a border */
colour border_colour; /** frame border colour */