NetSurf
Macros | Functions
frames.c File Reference

Frame and frameset creation and manipulation (implementation). More...

#include <assert.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <math.h>
#include "utils/log.h"
#include "utils/utils.h"
#include "netsurf/content.h"
#include "content/hlcache.h"
#include "html/html.h"
#include "html/box.h"
#include "html/box_inspect.h"
#include "desktop/browser_private.h"
#include "desktop/frames.h"
#include "desktop/scrollbar.h"
Include dependency graph for frames.c:

Go to the source code of this file.

Macros

#define FRAME_RESIZE   6
 maximum frame resize margin More...
 

Functions

static bool browser_window_resolve_frame_dimension (struct browser_window *bw, struct browser_window *sibling, int x, int y, bool width, bool height)
 
void browser_window_scroll_callback (void *client_data, struct scrollbar_msg_data *scrollbar_data)
 Callback for (i)frame scrollbars. More...
 
void browser_window_handle_scrollbars (struct browser_window *bw)
 Create, remove, and update browser window scrollbars. More...
 
nserror browser_window_invalidate_iframe (struct browser_window *bw)
 Invalidate an iframe causing a redraw. More...
 
nserror browser_window_create_iframes (struct browser_window *bw)
 Create and open iframes for a browser window. More...
 
void browser_window_recalculate_iframes (struct browser_window *bw)
 Recalculate iframe positions following a resize. More...
 
nserror browser_window_destroy_iframes (struct browser_window *bw)
 Destroy iframes opened in browser_window_create_iframes() More...
 
static void browser_window_recalculate_frameset_internal (struct browser_window *bw)
 Recalculate frameset positions following a resize. More...
 
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. More...
 
nserror browser_window_create_frameset (struct browser_window *bw)
 Create and open a frameset for a browser window. More...
 
void browser_window_recalculate_frameset (struct browser_window *bw)
 Recalculate frameset positions following a resize. More...
 
void browser_window_resize_frame (struct browser_window *bw, int x, int y)
 Resize a browser window that is a frame. More...
 
static bool browser_window_resize_frames (struct browser_window *bw, browser_mouse_state mouse, int x, int y, browser_pointer_shape *pointer)
 
bool browser_window_frame_resize_start (struct browser_window *bw, browser_mouse_state mouse, int x, int y, browser_pointer_shape *pointer)
 

Detailed Description

Frame and frameset creation and manipulation (implementation).

Definition in file frames.c.

Macro Definition Documentation

◆ FRAME_RESIZE

#define FRAME_RESIZE   6

maximum frame resize margin

Definition at line 45 of file frames.c.

Function Documentation

◆ browser_window_create_frameset()

nserror browser_window_create_frameset ( struct browser_window bw)

Create and open a frameset for a browser window.

Parameters
[in,out]bwThe browser window to create the frameset for
Returns
NSERROR_OK or error code on faliure

Definition at line 693 of file frames.c.

References browser_window_create_frameset_internal(), content_get_type(), CONTENT_HTML, browser_window::current_content, html_get_frameset(), and NSERROR_OK.

Referenced by browser_window_content_ready().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ browser_window_create_frameset_internal()

static nserror browser_window_create_frameset_internal ( struct browser_window bw,
struct content_html_frames frameset 
)
static

Create and open a frameset for a browser window.

Parameters
[in,out]bwThe browser window to create the frameset for
[in]framesetThe frameset to create
Returns
NSERROR_OK or error code on faliure

Definition at line 572 of file frames.c.

References content_html_frames::border, content_html_frames::border_colour, browser_window_create_frameset_internal(), browser_window::BROWSER_WINDOW_FRAME, browser_window::BROWSER_WINDOW_FRAMESET, browser_window_initialise_common(), browser_window_navigate(), browser_window_recalculate_frameset_internal(), browser_window_update_extent(), browser_window::bw, BW_CREATE_NONE, BW_NAVIGATE_HISTORY, BW_NAVIGATE_UNVERIFIABLE, content_html_frames::children, browser_window::children, content_html_frames::cols, browser_window::cols, content_get_type(), CONTENT_HTML, content_html_frames::height, hlcache_handle_get_url(), content_html_frames::margin_height, content_html_frames::margin_width, content_html_frames::name, content_html_frames::no_resize, NSERROR_NOMEM, NSERROR_OK, NSLOG, parent, content_html_frames::rows, browser_window::rows, browser_window::scale, gui_window::scale, content_html_frames::scrolling, content_html_frames::url, content_html_frames::width, and browser_window::window.

Referenced by browser_window_create_frameset(), and browser_window_create_frameset_internal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ browser_window_create_iframes()

nserror browser_window_create_iframes ( struct browser_window bw)

Create and open iframes for a browser window.

Parameters
bwThe browser window to create iframes for.
Returns
NSERROR_OK or error code on faliure.

Definition at line 192 of file frames.c.

References content_html_iframe::border, browser_window::border, content_html_iframe::border_colour, browser_window::border_colour, content_html_iframe::box, browser_window::box, box_bounds(), browser_window_initialise_common(), browser_window_navigate(), browser_window_recalculate_iframes(), browser_window_set_dimensions(), browser_window_set_position(), browser_window::browser_window_type, browser_window_update_extent(), BW_CREATE_NONE, BW_NAVIGATE_UNVERIFIABLE, content_get_type(), CONTENT_HTML, browser_window::current_content, hlcache_handle_get_url(), html_get_iframe(), box::iframe, browser_window::iframe_count, browser_window::iframes, content_html_iframe::margin_height, browser_window::margin_height, content_html_iframe::margin_width, browser_window::margin_width, content_html_iframe::name, browser_window::name, content_html_iframe::next, browser_window::no_resize, NSERROR_NOMEM, NSERROR_OK, browser_window::parent, browser_window::scale, content_html_iframe::scrolling, browser_window::scrolling, content_html_iframe::url, browser_window::window, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by browser_window_content_ready().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ browser_window_destroy_iframes()

nserror browser_window_destroy_iframes ( struct browser_window bw)

Destroy iframes opened in browser_window_create_iframes()

Parameters
bwThe browser window to destroy iframes for.
Returns
NSERROR_OK

Definition at line 307 of file frames.c.

References browser_window::box, browser_window_destroy_internal(), browser_window::bw, box::iframe, browser_window::iframe_count, browser_window::iframes, and NSERROR_OK.

Referenced by browser_window__handle_ssl_query_response(), browser_window__handle_userpass_response(), browser_window_destroy_internal(), and browser_window_navigate().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ browser_window_frame_resize_start()

bool browser_window_frame_resize_start ( struct browser_window bw,
browser_mouse_state  mouse,
int  x,
int  y,
browser_pointer_shape pointer 
)

Definition at line 1039 of file frames.c.

References browser_window_get_position(), browser_window_get_root(), browser_window_resize_frames(), browser_window::bw, root, browser_window::x, and browser_window::y.

Referenced by default_mouse_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ browser_window_handle_scrollbars()

void browser_window_handle_scrollbars ( struct browser_window bw)

Create, remove, and update browser window scrollbars.

Parameters
bwThe browser window

Definition at line 99 of file frames.c.

References browser_window_scroll_callback(), BW_SCROLLING_AUTO, BW_SCROLLING_YES, content_get_height(), content_get_width(), browser_window::current_content, browser_window::height, NSERROR_OK, browser_window::scroll_x, browser_window::scroll_y, scrollbar_create(), scrollbar_destroy(), scrollbar_make_pair(), scrollbar_set_extents(), SCROLLBAR_WIDTH, browser_window::scrolling, browser_window::width, and browser_window::window.

Referenced by browser_window_content_done(), browser_window_recalculate_frameset_internal(), browser_window_recalculate_iframes(), and browser_window_update_extent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ browser_window_invalidate_iframe()

nserror browser_window_invalidate_iframe ( struct browser_window bw)

Invalidate an iframe causing a redraw.

Parameters
bwThe browser window to invalidate

Definition at line 185 of file frames.c.

References browser_window::box, browser_window::current_content, html_redraw_a_box(), NSERROR_OK, and browser_window::parent.

Referenced by browser_window_update().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ browser_window_recalculate_frameset()

void browser_window_recalculate_frameset ( struct browser_window bw)

Recalculate frameset positions following a resize.

Parameters
bwThe browser window to reposition framesets for

Definition at line 718 of file frames.c.

References browser_window_recalculate_frameset_internal(), content_get_type(), CONTENT_HTML, browser_window::current_content, and html_get_frameset().

Referenced by browser_window_callback(), and browser_window_set_scale().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ browser_window_recalculate_frameset_internal()

static void browser_window_recalculate_frameset_internal ( struct browser_window bw)
static

Recalculate frameset positions following a resize.

Parameters
bwThe browser window to reposition framesets for

Definition at line 332 of file frames.c.

References browser_window_get_dimensions(), browser_window_handle_scrollbars(), browser_window_recalculate_frameset_internal(), browser_window_reformat(), browser_window::bw, browser_window::children, browser_window::cols, browser_window::frame_height, browser_window::frame_width, browser_window::height, gui_window::height, browser_window::parent, browser_window::rows, browser_window::scale, gui_window::scale, frame_dimension::value, browser_window::width, gui_window::width, browser_window::window, browser_window::x, and browser_window::y.

Referenced by browser_window_create_frameset_internal(), browser_window_recalculate_frameset(), browser_window_recalculate_frameset_internal(), and browser_window_resize_frame().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ browser_window_recalculate_iframes()

void browser_window_recalculate_iframes ( struct browser_window bw)

Recalculate iframe positions following a resize.

Parameters
bwThe browser window to reposition iframes for

Definition at line 291 of file frames.c.

References browser_window_handle_scrollbars(), browser_window::bw, browser_window::iframe_count, browser_window::iframes, and browser_window::window.

Referenced by browser_window_callback(), and browser_window_create_iframes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ browser_window_resize_frame()

void browser_window_resize_frame ( struct browser_window bw,
int  x,
int  y 
)

Resize a browser window that is a frame.

Parameters
bwThe browser window to resize
xThe new width to set.
yThe new height to set.

Definition at line 740 of file frames.c.

References browser_window_recalculate_frameset_internal(), browser_window_resolve_frame_dimension(), browser_window::bw, browser_window::drag, browser_window::parent, parent, browser_window::resize_down, browser_window::resize_left, browser_window::resize_right, browser_window::resize_up, browser_window::x, and browser_window::y.

Referenced by browser_window_mouse_track_internal().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ browser_window_resize_frames()

static bool browser_window_resize_frames ( struct browser_window bw,
browser_mouse_state  mouse,
int  x,
int  y,
browser_pointer_shape pointer 
)
static

◆ browser_window_resolve_frame_dimension()

bool browser_window_resolve_frame_dimension ( struct browser_window bw,
struct browser_window sibling,
int  x,
int  y,
bool  width,
bool  height 
)
static

◆ browser_window_scroll_callback()

void browser_window_scroll_callback ( void *  client_data,
struct scrollbar_msg_data scrollbar_data 
)