39#define SPACE_LEN(b) ((b->space == 0) ? 0 : 1)
63 unsigned *start_offset,
74 *end_offset = box_length;
86 len = box_length - offset;
92 *start_offset = offset;
93 *end_offset = offset + len;
181 if (x < rdwi->r.x0) {
184 if (y < rdwi->r.y0) {
254 const css_unit_ctx *unit_len_ctx,
256 const char *whitespace_text,
257 size_t whitespace_length)
259 bool add_space =
false;
264 if (whitespace_text != NULL &&
265 whitespace_length > 0) {
315 const css_unit_ctx *unit_len_ctx,
325 const char *whitespace_text =
"";
326 size_t whitespace_length = 0;
372 whitespace_text = NULL;
482 if (html->
layout == NULL) {
516 if (html->
layout == NULL) {
538 if (html->
layout == NULL) {
void box_coords(struct box *box, int *x, int *y)
Find the absolute coordinates of a box.
HTML Box tree inspection interface.
void font_plot_style_from_css(const css_unit_ctx *unit_len_ctx, const css_computed_style *css, plot_font_style_t *fstyle)
Populate a font style using data from a computed CSS style.
Internal font handling interfaces.
static nserror coords_from_range(struct box *box, unsigned start_idx, unsigned end_idx, struct rdw_info *rdwi, bool do_marker)
Traverse the given box subtree adding the boxes inside the selection to the coordinate range.
static unsigned selection_label_subtree(struct box *box, unsigned idx)
Label each text box in the given box subtree with its position in a textual representation of the con...
static bool selected_part(struct box *box, unsigned start_idx, unsigned end_idx, unsigned *start_offset, unsigned *end_offset)
Tests whether a text box lies partially within the given range of byte offsets, returning the start a...
nserror html_textselection_get_end(struct content *c, unsigned *end_idx)
get maximum index of text section.
nserror html_textselection_copy(struct content *c, unsigned start_idx, unsigned end_idx, struct selection_string *selstr)
static nserror selection_copy_box(const char *text, size_t length, struct box *box, const css_unit_ctx *unit_len_ctx, struct selection_string *handle, const char *whitespace_text, size_t whitespace_length)
Append the contents of a box to a selection along with style information.
nserror html_textselection_redraw(struct content *c, unsigned start_idx, unsigned end_idx)
static nserror selection_copy(struct box *box, const css_unit_ctx *unit_len_ctx, unsigned start_idx, unsigned end_idx, struct selection_string *selstr, save_text_whitespace *before, bool *first, bool do_marker)
Traverse the given box subtree, calling selection copy for all boxes that lie (partially) within the ...
HTML text selection handling.
void content__request_redraw(struct content *c, int x, int y, int width, int height)
Request a redraw of an area of a content.
bool selection_string_append(const char *text, size_t length, bool space, plot_font_style_t *style, struct selection_string *sel_string)
Append text to selection string.
Text selection within browser windows (interface).
nserror
Enumeration of error codes.
@ NSERROR_INVALID
Invalid data.
@ NSERROR_NOMEM
Memory exhaustion.
plotter style interfaces, generic styles and style colour helpers.
Private data for text/html content.
void save_text_solve_whitespace(struct box *box, bool *first, save_text_whitespace *before, const char **whitespace_text, size_t *whitespace_length)
Decide what whitespace to place before the next bit of content-related text that is saved.
Text export of HTML (interface).
int width
Width of content box (excluding padding etc.).
struct box * parent
Parent box, or NULL.
size_t byte_offset
Byte offset within a textual representation of this content.
struct box * children
First child box, or NULL.
int height
Height of content box (excluding padding etc.).
struct box * list_marker
List marker box if this is a list-item, or NULL.
struct box * next
Next sibling box, or NULL.
box_type type
Type of box.
css_computed_style * style
Style for this box.
size_t length
Length of text.
char * text
Text, or NULL if none.
int padding[4]
Padding: TOP, RIGHT, BOTTOM, LEFT.
int x
Coordinate of left padding edge relative to parent box, or relative to ancestor that contains this bo...
int space
Width of space after current text (depends on font and size).
int y
Coordinate of top padding edge, relative as for x.
Content which corresponds to a single URL.
Data specific to CONTENT_HTML.
css_unit_ctx unit_len_ctx
CSS length conversion context for document.
struct box * layout
Box tree, or NULL.
Interface to a number of general purpose functionality.
static nserror text(const struct redraw_context *ctx, const struct plot_font_style *fstyle, int x, int y, const char *text, size_t length)
Text plotting.