NetSurf
|
Redrawing CONTENT_HTML implementation. More...
#include "utils/config.h"
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <dom/dom.h>
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/nsoption.h"
#include "utils/corestrings.h"
#include "netsurf/content.h"
#include "netsurf/browser_window.h"
#include "netsurf/plotters.h"
#include "netsurf/bitmap.h"
#include "netsurf/layout.h"
#include "content/content.h"
#include "content/content_protected.h"
#include "content/textsearch.h"
#include "css/utils.h"
#include "desktop/selection.h"
#include "desktop/print.h"
#include "desktop/scrollbar.h"
#include "desktop/textarea.h"
#include "desktop/gui_internal.h"
#include "html/box.h"
#include "html/box_inspect.h"
#include "html/box_manipulate.h"
#include "html/font.h"
#include "html/form_internal.h"
#include "html/private.h"
#include "html/layout.h"
Go to the source code of this file.
Functions | |
static bool | html_redraw_box_has_background (struct box *box) |
Determine if a box has a background that needs drawing. More... | |
static struct box * | html_redraw_find_bg_box (struct box *box) |
Find the background box for a box. More... | |
static bool | text_redraw (const char *utf8_text, size_t utf8_len, size_t offset, int space, const plot_font_style_t *fstyle, int x, int y, const struct rect *clip, int height, float scale, bool excluded, struct content *c, const struct selection *sel, const struct redraw_context *ctx) |
Redraw a short text string, complete with highlighting (for selection/search) More... | |
static bool | html_redraw_checkbox (int x, int y, int width, int height, bool selected, const struct redraw_context *ctx) |
Plot a checkbox. More... | |
static bool | html_redraw_radio (int x, int y, int width, int height, bool selected, const struct redraw_context *ctx) |
Plot a radio icon. More... | |
static bool | html_redraw_file (int x, int y, int width, int height, struct box *box, float scale, colour background_colour, const css_unit_ctx *unit_len_ctx, const struct redraw_context *ctx) |
Plot a file upload input. More... | |
static bool | html_redraw_background (int x, int y, struct box *box, float scale, const struct rect *clip, colour *background_colour, struct box *background, const css_unit_ctx *unit_len_ctx, const struct redraw_context *ctx) |
Plot background images. More... | |
static bool | html_redraw_inline_background (int x, int y, struct box *box, float scale, const struct rect *clip, struct rect b, bool first, bool last, colour *background_colour, const css_unit_ctx *unit_len_ctx, const struct redraw_context *ctx) |
Plot an inline's background and/or background image. More... | |
static bool | html_redraw_text_decoration_inline (struct box *box, int x, int y, float scale, colour colour, float ratio, const struct redraw_context *ctx) |
Plot text decoration for an inline box. More... | |
static bool | html_redraw_text_decoration_block (struct box *box, int x, int y, float scale, colour colour, float ratio, const struct redraw_context *ctx) |
Plot text decoration for an non-inline box. More... | |
static bool | html_redraw_text_decoration (struct box *box, int x_parent, int y_parent, float scale, colour background_colour, const struct redraw_context *ctx) |
Plot text decoration for a box. More... | |
static bool | html_redraw_text_box (const html_content *html, struct box *box, int x, int y, const struct rect *clip, float scale, colour current_background_color, const struct redraw_context *ctx) |
Redraw the text content of a box, possibly partially highlighted because the text has been selected, or matches a search operation. More... | |
bool | html_redraw_box (const html_content *html, struct box *box, int x_parent, int y_parent, const struct rect *clip, const float scale, colour current_background_color, const struct redraw_context *ctx) |
Recursively draw a box. More... | |
static bool | html_redraw_box_children (const html_content *html, struct box *box, int x_parent, int y_parent, const struct rect *clip, float scale, colour current_background_color, const struct redraw_context *ctx) |
Draw the various children of a box. More... | |
bool | html_redraw (struct content *c, struct content_redraw_data *data, const struct rect *clip, const struct redraw_context *ctx) |
Draw a CONTENT_HTML using the current set of plotters (plot). More... | |
Variables | |
bool | html_redraw_debug = false |
Render padding and margin box outlines in html_redraw(). More... | |
Redrawing CONTENT_HTML implementation.
Definition in file redraw.c.
bool html_redraw | ( | struct content * | c, |
struct content_redraw_data * | data, | ||
const struct rect * | clip, | ||
const struct redraw_context * | ctx | ||
) |
Draw a CONTENT_HTML using the current set of plotters (plot).
c | content of type CONTENT_HTML |
data | redraw data for this content redraw |
clip | current clip region |
ctx | current redraw context |
x, y, clip_[xy][01] are in target coordinates.
Definition at line 1944 of file redraw.c.
References html_content::background_colour, content_redraw_data::background_colour, box::border, BOTTOM, form_control::box, box_coords(), clip(), plotter_table::clip, form_control::data, plot_style_s::fill_colour, plot_style_s::fill_type, form_clip_inside_select_menu(), form_redraw_select_menu(), box::height, form_control::html, html_redraw_box(), redraw_context::interactive, html_content::layout, LEFT, NS_TRANSPARENT, NSERROR_OK, box::padding, redraw_context::plot, PLOT_OP_TYPE_SOLID, plotter_table::rectangle, result, form_control::select, TOP, html_content::visible_select_menu, and box_border::width.
|
static |
Plot background images.
The reason for the presence of background is the backwards compatibility mess that is backgrounds on <body>. The background will be drawn relative to box, using the background information contained within background.
x | coordinate of box |
y | coordinate of box |
box | box to draw background image of |
scale | scale for redraw |
clip | current clip rectangle |
background_colour | current background colour |
background | box containing background details (usually box) |
unit_len_ctx | Length conversion context |
ctx | current redraw context |
Definition at line 595 of file redraw.c.
References box::background, content_redraw_data::background_colour, redraw_context::background_images, BOTTOM, BOX_TABLE, BOX_TABLE_CELL, BOX_TABLE_ROW, box::children, clip(), plotter_table::clip, content_get_height(), content_get_opaque(), content_get_width(), content_redraw(), plot_style_s::fill_colour, plot_style_s::fill_type, box::height, height, content_redraw_data::height, LEFT, box::margin, box::next, nscss_color_is_transparent, nscss_color_to_ns, NSERROR_OK, box::padding, box::parent, parent, redraw_context::plot, PLOT_OP_TYPE_SOLID, plotter_table::rectangle, content_redraw_data::repeat_x, content_redraw_data::repeat_y, RIGHT, content_redraw_data::scale, box::style, TOP, box::type, box::width, width, content_redraw_data::width, box::x, content_redraw_data::x, rect::x0, rect::x1, box::y, content_redraw_data::y, rect::y0, and rect::y1.
Referenced by html_redraw_box().
bool html_redraw_box | ( | const html_content * | html, |
struct box * | box, | ||
int | x_parent, | ||
int | y_parent, | ||
const struct rect * | clip, | ||
const float | scale, | ||
colour | current_background_color, | ||
const struct redraw_context * | ctx | ||
) |
Recursively draw a box.
html | html content |
box | box to draw |
x_parent | coordinate of parent box |
y_parent | coordinate of parent box |
clip | clip rectangle |
scale | scale for redraw |
current_background_color | background colour under this box |
ctx | current redraw context |
x, y, clip_[xy][01] are in target coordinates.
Definition at line 1231 of file redraw.c.
References content_redraw_data::background_colour, plotter_table::bitmap, BITMAPF_NONE, box::border, BOTTOM, BOX_BLOCK, BOX_BR, BOX_FLOAT_LEFT, BOX_FLOAT_RIGHT, box_handle_scrollbars(), box_hscrollbar_present(), BOX_INLINE, BOX_INLINE_BLOCK, BOX_INLINE_END, BOX_TABLE, BOX_TABLE_CELL, BOX_TEXT, box_vscrollbar_present(), browser_window_redraw(), clip(), plotter_table::clip, content_get_type(), CONTENT_HTML, content_redraw(), form_control::data, box::descendant_x0, box::descendant_x1, box::descendant_y0, box::descendant_y1, box::flags, box::gadget, GADGET_CHECKBOX, GADGET_FILE, GADGET_PASSWORD, GADGET_RADIO, GADGET_TEXTAREA, GADGET_TEXTBOX, plotter_table::group_end, plotter_table::group_start, guit, box::height, height, content_redraw_data::height, html_redraw_background(), html_redraw_borders(), html_redraw_box(), html_redraw_box_children(), html_redraw_box_has_background(), html_redraw_checkbox(), html_redraw_debug, html_redraw_file(), html_redraw_find_bg_box(), html_redraw_inline_background(), html_redraw_inline_borders(), html_redraw_printing, html_redraw_printing_border, html_redraw_printing_top_cropped, html_redraw_radio(), html_redraw_text_box(), html_redraw_text_decoration(), IFRAME, box::iframe, box::inline_end, netsurf_table::layout, LEFT, box::list_marker, box::margin, messages_get_errorcode(), NEW_LINE, box::next, box::node, NSERROR_OK, NSLOG, box::object, box::padding, box::parent, redraw_context::plot, plot_fstyle_broken_object, plot_style_broken_object, plot_style_content_edge, plot_style_margin_edge, plot_style_padding_edge, PRINTED, plotter_table::rectangle, content_redraw_data::repeat_x, content_redraw_data::repeat_y, REPLACE_DIM, RIGHT, content_redraw_data::scale, box::scroll_x, box::scroll_y, scrollbar_get_offset(), scrollbar_redraw(), SCROLLBAR_WIDTH, form_control::selected, box::style, box::text, plotter_table::text, textarea_redraw(), TOP, box::type, form_control::type, html_content::unit_len_ctx, box_border::width, box::width, width, content_redraw_data::width, gui_layout_table::width, box::x, content_redraw_data::x, rect::x0, rect::x1, box::y, content_redraw_data::y, rect::y0, and rect::y1.
Referenced by html_redraw(), html_redraw_box(), and html_redraw_box_children().
|
static |
Draw the various children of a box.
html | html content |
box | box to draw children of |
x_parent | coordinate of parent box |
y_parent | coordinate of parent box |
clip | clip rectangle |
scale | scale for redraw |
current_background_color | background colour under this box |
ctx | current redraw context |
Definition at line 1182 of file redraw.c.
References BOX_FLOAT_LEFT, BOX_FLOAT_RIGHT, box::children, clip(), box::float_children, html_redraw_box(), box::next, box::next_float, box::scroll_x, box::scroll_y, scrollbar_get_offset(), box::type, box::x, and box::y.
Referenced by html_redraw_box().
|
static |
Determine if a box has a background that needs drawing.
box | Box to consider |
Definition at line 76 of file redraw.c.
References box::background, nscss_color_is_transparent, and box::style.
Referenced by html_redraw_box(), and html_redraw_find_bg_box().
|
static |
Plot a checkbox.
x | left coordinate |
y | top coordinate |
width | dimensions of checkbox |
height | dimensions of checkbox |
selected | the checkbox is selected |
ctx | current redraw context |
Definition at line 367 of file redraw.c.
References height, plotter_table::line, NSERROR_OK, redraw_context::plot, plot_style_fill_wbasec, plot_style_fill_wblobc, plot_style_stroke_darkwbasec, plot_style_stroke_lightwbasec, plot_style_stroke_wblobc, plotter_table::rectangle, width, rect::x0, rect::x1, rect::y0, and rect::y1.
Referenced by html_redraw_box().
|
static |
Plot a file upload input.
x | left coordinate |
y | top coordinate |
width | dimensions of input |
height | dimensions of input |
box | box of input |
scale | scale for redraw |
background_colour | current background colour |
unit_len_ctx | Length conversion context |
ctx | current redraw context |
Definition at line 536 of file redraw.c.
References plot_font_style::background, font_plot_style_from_css(), box::gadget, guit, height, netsurf_table::layout, messages_get(), NSERROR_OK, redraw_context::plot, box::style, text(), plotter_table::text, form_control::value, width, and gui_layout_table::width.
Referenced by html_redraw_box().
Find the background box for a box.
box | Box to find background box for |
Definition at line 99 of file redraw.c.
References box::children, html_redraw_box_has_background(), and box::parent.
Referenced by html_redraw_box().
|
static |
Plot an inline's background and/or background image.
x | coordinate of box |
y | coordinate of box |
box | BOX_INLINE which created the background |
scale | scale for redraw |
clip | coordinates of clip rectangle |
b | coordinates of border edge rectangle |
first | true if this is the first rectangle associated with the inline |
last | true if this is the last rectangle associated with the inline |
background_colour | updated to current background colour if plotted |
unit_len_ctx | Length conversion context |
ctx | current redraw context |
Definition at line 824 of file redraw.c.
References box::background, content_redraw_data::background_colour, clip(), plotter_table::clip, content_get_height(), content_get_opaque(), content_get_width(), content_redraw(), plot_style_s::fill_colour, plot_style_s::fill_type, height, content_redraw_data::height, html_redraw_printing, nscss_color_is_transparent, nscss_color_to_ns, NSERROR_OK, nsoption_bool, redraw_context::plot, PLOT_OP_TYPE_SOLID, plotter_table::rectangle, content_redraw_data::repeat_x, content_redraw_data::repeat_y, content_redraw_data::scale, box::style, width, content_redraw_data::width, content_redraw_data::x, rect::x0, rect::x1, content_redraw_data::y, rect::y0, and rect::y1.
Referenced by html_redraw_box().
|
static |
Plot a radio icon.
x | left coordinate |
y | top coordinate |
width | dimensions of radio icon |
height | dimensions of radio icon |
selected | the radio icon is selected |
ctx | current redraw context |
Definition at line 466 of file redraw.c.
References plotter_table::arc, plotter_table::disc, height, NSERROR_OK, redraw_context::plot, plot_style_fill_darkwbasec, plot_style_fill_lightwbasec, plot_style_fill_wbasec, plot_style_fill_wblobc, and width.
Referenced by html_redraw_box().
|
static |
Redraw the text content of a box, possibly partially highlighted because the text has been selected, or matches a search operation.
html | The html content to redraw text within. |
box | box with text content |
x | x co-ord of box |
y | y co-ord of box |
clip | current clip rectangle |
scale | current scale setting (1.0 = 100%) |
current_background_color | |
ctx | current redraw context |
Definition at line 1133 of file redraw.c.
References plot_font_style::background, box::byte_offset, clip(), font_plot_style_from_css(), box::height, box::length, box::object, html_content::sel, box::space, box::style, box::text, text_redraw(), and html_content::unit_len_ctx.
Referenced by html_redraw_box().
|
static |
Plot text decoration for a box.
box | box to plot decorations for |
x_parent | x coordinate of parent of box |
y_parent | y coordinate of parent of box |
scale | scale for redraw |
background_colour | current background colour |
ctx | current redraw context |
Definition at line 1073 of file redraw.c.
References blend_colour, BOX_INLINE, html_redraw_printing, html_redraw_text_decoration_block(), html_redraw_text_decoration_inline(), box::inline_end, NOF_ELEMENTS, nscss_color_to_ns, box::style, box::type, box::x, and box::y.
Referenced by html_redraw_box().
|
static |
Plot text decoration for an non-inline box.
box | box to plot decorations for, of type other than BOX_INLINE |
x | x coordinate of box |
y | y coordinate of box |
scale | scale for redraw |
colour | colour for decorations |
ratio | position of line as a ratio of line height |
ctx | current redraw context |
Definition at line 1024 of file redraw.c.
References BOX_BLOCK, BOX_INLINE_CONTAINER, BOX_TEXT, box::children, box::height, html_redraw_text_decoration_block(), plotter_table::line, box::next, NSERROR_OK, redraw_context::plot, PLOT_OP_TYPE_SOLID, plot_style_s::stroke_type, box::type, box::width, box::x, rect::x0, rect::x1, box::y, rect::y0, and rect::y1.
Referenced by html_redraw_text_decoration(), and html_redraw_text_decoration_block().
|
static |
Plot text decoration for an inline box.
box | box to plot decorations for, of type BOX_INLINE |
x | x coordinate of parent of box |
y | y coordinate of parent of box |
scale | scale for redraw |
colour | colour for decorations |
ratio | position of line as a ratio of line height |
ctx | current redraw context |
Definition at line 976 of file redraw.c.
References BOX_TEXT, box::height, box::inline_end, plotter_table::line, box::next, NSERROR_OK, redraw_context::plot, PLOT_OP_TYPE_SOLID, plot_style_s::stroke_type, box::type, box::width, box::x, rect::x0, rect::x1, box::y, rect::y0, and rect::y1.
Referenced by html_redraw_text_decoration().
|
static |
Redraw a short text string, complete with highlighting (for selection/search)
utf8_text | pointer to UTF-8 text string |
utf8_len | length of string, in bytes |
offset | byte offset within textual representation |
space | width of space that follows string (0 = no space) |
fstyle | text style to use (pass text size unscaled) |
x | x ordinate at which to plot text |
y | y ordinate at which to plot text |
clip | pointer to current clip rectangle |
height | height of text string |
scale | current display scale (1.0 = 100%) |
excluded | exclude this text string from the selection |
c | Content being redrawn. |
sel | Selection context |
search | Search context |
ctx | current redraw context |
Definition at line 158 of file redraw.c.
References plot_font_style::background, clip(), plotter_table::clip, colour_to_bw_furthest, content_textsearch_ishighlighted(), content::context, plot_style_s::fill_colour, plot_font_style::foreground, guit, height, redraw_context::interactive, netsurf_table::layout, max, min, NSERROR_OK, redraw_context::plot, plot_style_fill_white, plotter_table::rectangle, selection_highlighted(), plot_font_style::size, box::space, plotter_table::text, content::textsearch, gui_layout_table::width, rect::x0, rect::x1, rect::y0, and rect::y1.
Referenced by html_redraw_text_box().
bool html_redraw_debug = false |
Render padding and margin box outlines in html_redraw().
Definition at line 68 of file redraw.c.
Referenced by deskmenu_update(), html_debug(), html_redraw_box(), and menu_debug_render().