NetSurf
|
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"
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) |
Frame and frameset creation and manipulation (implementation).
Definition in file frames.c.
nserror browser_window_create_frameset | ( | struct browser_window * | bw | ) |
Create and open a frameset for a browser window.
[in,out] | bw | The browser window to create the frameset for |
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().
|
static |
Create and open a frameset for a browser window.
[in,out] | bw | The browser window to create the frameset for |
[in] | frameset | The frameset to create |
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().
nserror browser_window_create_iframes | ( | struct browser_window * | bw | ) |
Create and open iframes for a browser window.
bw | The browser window to create iframes for. |
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().
nserror browser_window_destroy_iframes | ( | struct browser_window * | bw | ) |
Destroy iframes opened in browser_window_create_iframes()
bw | The browser window to destroy iframes for. |
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().
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().
void browser_window_handle_scrollbars | ( | struct browser_window * | bw | ) |
Create, remove, and update browser window scrollbars.
bw | The 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().
nserror browser_window_invalidate_iframe | ( | struct browser_window * | bw | ) |
Invalidate an iframe causing a redraw.
bw | The 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().
void browser_window_recalculate_frameset | ( | struct browser_window * | bw | ) |
Recalculate frameset positions following a resize.
bw | The 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().
|
static |
Recalculate frameset positions following a resize.
bw | The 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().
void browser_window_recalculate_iframes | ( | struct browser_window * | bw | ) |
Recalculate iframe positions following a resize.
bw | The 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().
void browser_window_resize_frame | ( | struct browser_window * | bw, |
int | x, | ||
int | y | ||
) |
Resize a browser window that is a frame.
bw | The browser window to resize |
x | The new width to set. |
y | The 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().
|
static |
Definition at line 908 of file frames.c.
References BROWSER_MOUSE_DRAG_1, BROWSER_MOUSE_DRAG_2, BROWSER_POINTER_DOWN, BROWSER_POINTER_LD, BROWSER_POINTER_LEFT, BROWSER_POINTER_LU, BROWSER_POINTER_RD, BROWSER_POINTER_RIGHT, BROWSER_POINTER_RU, BROWSER_POINTER_UP, browser_window::BROWSER_WINDOW_FRAME, browser_window::BROWSER_WINDOW_FRAMESET, browser_window::BROWSER_WINDOW_IFRAME, browser_window::BROWSER_WINDOW_NORMAL, browser_window_resize_frames(), browser_window_set_drag_type(), browser_window::browser_window_type, browser_window::bw, browser_window::children, browser_window::cols, browser_window::drag, DRAGGING_FRAME, FRAME_RESIZE, browser_window::height, height, browser_window::iframe_count, browser_window::iframes, browser_window::no_resize, browser_window::parent, parent, browser_window::resize_down, browser_window::resize_left, browser_window::resize_right, browser_window::resize_up, browser_window::rows, browser_window::start_x, browser_window::start_y, browser_window::width, browser_window::x, and browser_window::y.
Referenced by browser_window_frame_resize_start(), and browser_window_resize_frames().
|
static |
Definition at line 788 of file frames.c.
References browser_window::drag, frame_dimension::FRAME_DIMENSION_PIXELS, frame_dimension::FRAME_DIMENSION_RELATIVE, browser_window::frame_height, browser_window::frame_width, browser_window::height, height, browser_window::parent, browser_window::resize_left, browser_window::resize_up, frame_dimension::unit, frame_dimension::value, browser_window::width, width, browser_window::x, and browser_window::y.
Referenced by browser_window_resize_frame().
void browser_window_scroll_callback | ( | void * | client_data, |
struct scrollbar_msg_data * | scrollbar_data | ||
) |
Callback for (i)frame scrollbars.
Definition at line 55 of file frames.c.
References browser_window::box, BROWSER_POINTER_DEFAULT, browser_window::BROWSER_WINDOW_IFRAME, browser_window_invalidate_rect(), browser_window_set_drag_type(), browser_window_set_pointer(), browser_window::browser_window_type, browser_window::bw, browser_window::current_content, DRAGGING_NONE, DRAGGING_SCR_X, DRAGGING_SCR_Y, browser_window::height, html_redraw_a_box(), scrollbar_msg_data::msg, browser_window::parent, browser_window::scroll_x, browser_window::scroll_y, scrollbar_msg_data::scrollbar, scrollbar_get_offset(), scrollbar_is_horizontal(), SCROLLBAR_MSG_MOVED, SCROLLBAR_MSG_SCROLL_FINISHED, SCROLLBAR_MSG_SCROLL_START, browser_window::width, scrollbar_msg_data::x0, rect::x0, scrollbar_msg_data::x1, rect::x1, scrollbar_msg_data::y0, rect::y0, scrollbar_msg_data::y1, and rect::y1.
Referenced by browser_window_handle_scrollbars().