NetSurf
|
HTML Box tree inspection interface. More...
Go to the source code of this file.
Functions | |
void | box_coords (struct box *box, int *x, int *y) |
Find the absolute coordinates of a box. More... | |
void | box_bounds (struct box *box, struct rect *r) |
Find the bounds of a box. More... | |
struct box * | box_at_point (const css_unit_ctx *unit_len_ctx, struct box *box, const int x, const int y, int *box_x, int *box_y) |
Find the boxes at a point. More... | |
struct box * | box_find_by_id (struct box *box, lwc_string *id) |
Find a box based upon its id attribute. More... | |
bool | box_visible (struct box *box) |
Determine if a box is visible when the tree is rendered. More... | |
void | box_dump (FILE *stream, struct box *box, unsigned int depth, bool style) |
Print a box tree to a file. More... | |
bool | box_vscrollbar_present (const struct box *box) |
Determine if a box has a vertical scrollbar. More... | |
bool | box_hscrollbar_present (const struct box *box) |
Determine if a box has a horizontal scrollbar. More... | |
struct box * | box_pick_text_box (struct html_content *html, int x, int y, int dir, int *dx, int *dy) |
Peform pick text on browser window contents to locate the box under the mouse pointer, or nearest in the given direction if the pointer is not over a text box. More... | |
static bool | box_is_first_child (struct box *b) |
Check if layout box is a first child. More... | |
static unsigned | box_count_children (const struct box *b) |
HTML Box tree inspection interface.
Definition in file box_inspect.h.
struct box * box_at_point | ( | const css_unit_ctx * | unit_len_ctx, |
struct box * | box, | ||
const int | x, | ||
const int | y, | ||
int * | box_x, | ||
int * | box_y | ||
) |
Find the boxes at a point.
unit_len_ctx | CSS length conversion context for document. |
box | box to search children of |
x | point to find, in global document coordinates |
y | point to find, in global document coordinates |
box_x | position of box, in global document coordinates, updated to position of returned box, if any |
box_y | position of box, in global document coordinates, updated to position of returned box, if any |
To find all the boxes in the hierarchy at a certain point, use code like this:
Definition at line 583 of file box_inspect.c.
References box_contains_point(), box_next_xy(), box::scroll_x, box::scroll_y, scrollbar_get_offset(), box::x, and box::y.
Referenced by get_mouse_action_node(), html_drop_file_at_point(), html_get_contextual_content(), and html_scroll_at_point().
Find the bounds of a box.
box | the box to calculate bounds of |
r | receives bounds |
Definition at line 567 of file box_inspect.c.
References BOTTOM, box_coords(), box::height, height, LEFT, box::padding, RIGHT, TOP, box::width, width, rect::x0, rect::x1, rect::y0, and rect::y1.
Referenced by browser_window_create_iframes(), and form_control_bounding_rect().
void box_coords | ( | struct box * | box, |
int * | x, | ||
int * | y | ||
) |
Find the absolute coordinates of a box.
box | the box to calculate coordinates of |
x | updated to x coordinate |
y | updated to y coordinate |
Definition at line 549 of file box_inspect.c.
References box_is_float, box::float_container, box::parent, box::scroll_x, box::scroll_y, scrollbar_get_offset(), box::x, and box::y.
Referenced by box_bounds(), box_textarea_callback(), coords_from_range(), form_select_menu_callback(), form_select_mouse_drag_end(), html__redraw_a_box(), html_box_drag_start(), html_drop_file_at_point(), html_get_id_offset(), html_object_callback(), html_overflow_scroll_drag_end(), html_redraw(), html_redraw_a_box(), html_set_focus(), html_textsearch_bounds(), layout_calculate_descendant_bboxes(), mouse_action_drag_content(), mouse_action_drag_scrollbar(), mouse_action_drag_textarea(), and mouse_action_select_menu().
|
inlinestatic |
Definition at line 142 of file box_inspect.h.
References box::children, count(), and box::next.
Referenced by layout_flex_ctx__create().
void box_dump | ( | FILE * | stream, |
struct box * | box, | ||
unsigned int | depth, | ||
bool | style | ||
) |
Print a box tree to a file.
Definition at line 649 of file box_inspect.c.
References BOTTOM, BOX_BLOCK, BOX_BR, box_dump(), BOX_FLEX, BOX_FLOAT_LEFT, BOX_FLOAT_RIGHT, BOX_INLINE, BOX_INLINE_BLOCK, BOX_INLINE_CONTAINER, BOX_INLINE_END, BOX_INLINE_FLEX, BOX_TABLE, BOX_TABLE_CELL, BOX_TABLE_ROW, BOX_TABLE_ROW_GROUP, BOX_TEXT, box::byte_offset, box::children, box::col, box::columns, box::descendant_x0, box::descendant_x1, box::descendant_y0, box::descendant_y1, box::float_children, box::float_container, box::gadget, box::height, hlcache_handle_get_url(), box::href, box::id, box::iframe, box::inline_end, box::last, LEFT, box::length, box::list_marker, box::margin, column::max, box::max_width, column::min, box::min_width, box::next, box::next_float, box::node, nscss_dump_computed_style(), nsurl_access(), box::object, box::parent, column::positioned, box::prev, RIGHT, box::rows, box::space, box::start_column, box::style, box::target, box::text, box::title, TOP, column::type, box::type, UNKNOWN_MAX_WIDTH, column::width, box::width, box::x, and box::y.
Referenced by box_dump(), html_box_convert_done(), html_debug_dump(), layout_minmax_block(), and layout_minmax_table().
Find a box based upon its id attribute.
box | box tree to search |
id | id to look for |
Definition at line 614 of file box_inspect.c.
References box_find_by_id(), box::children, box::id, and box::next.
Referenced by box_find_by_id(), and html_get_id_offset().
bool box_hscrollbar_present | ( | const struct box * | box | ) |
Determine if a box has a horizontal scrollbar.
box | scrolling box |
Definition at line 839 of file box_inspect.c.
References box::border, box::descendant_x1, LEFT, box::padding, RIGHT, box_border::width, and box::width.
Referenced by html_redraw_box(), and layout_block_add_scrollbar().
|
inlinestatic |
Check if layout box is a first child.
[in] | b | Box to check. |
Definition at line 137 of file box_inspect.h.
References box::children, and box::parent.
Referenced by layout_block_context(), and layout_next_margin_block().
struct box * box_pick_text_box | ( | struct html_content * | html, |
int | x, | ||
int | y, | ||
int | dir, | ||
int * | dx, | ||
int * | dy | ||
) |
Peform pick text on browser window contents to locate the box under the mouse pointer, or nearest in the given direction if the pointer is not over a text box.
html | an HTML content |
x | coordinate of mouse |
y | coordinate of mouse |
dir | direction to search (-1 = above-left, +1 = below-right) |
dx | receives x ordinate of mouse relative to text box |
dy | receives y ordinate of mouse relative to text box |
Definition at line 850 of file box_inspect.c.
References BOTTOM, box_nearest_text_box(), box::height, html_content::layout, LEFT, box::margin, box::object, box::padding, RIGHT, box::text, TOP, box::width, box::x, and box::y.
Referenced by html_selection_drag_end(), and mouse_action_drag_selection().
bool box_visible | ( | struct box * | box | ) |
Determine if a box is visible when the tree is rendered.
box | box to check |
Definition at line 636 of file box_inspect.c.
References box::style.
Referenced by html_object_callback().
bool box_vscrollbar_present | ( | const struct box * | box | ) |
Determine if a box has a vertical scrollbar.
box | scrolling box |
Definition at line 829 of file box_inspect.c.
References box::border, BOTTOM, box::descendant_y1, box::height, box::padding, TOP, and box_border::width.
Referenced by html_redraw_box(), and layout_block_add_scrollbar().