void html_mouse_track(struct content *c, struct browser_window *bw, browser_mouse_state mouse, int x, int y) { html_content *html = (html_content*) c; browser_drag_type drag_type = browser_window_get_drag_type(bw); if (drag_type == DRAGGING_SELECTION && !mouse) { int dir = -1; size_t idx; if (selection_dragging_start(&html->sel)) dir = 1; idx = html_selection_drag_end(html, mouse, x, y, dir); if (idx != 0) selection_track(&html->sel, mouse, idx); browser_window_set_drag_type(bw, DRAGGING_NONE, NULL); } switch (drag_type) { case DRAGGING_SELECTION: { struct box *box; int dir = -1; int dx, dy; if (selection_dragging_start(&html->sel)) dir = 1; box = box_pick_text_box(html, x, y, dir, &dx, &dy); if (box) { int pixel_offset; size_t idx; plot_font_style_t fstyle; font_plot_style_from_css(box->style, &fstyle); nsfont.font_position_in_string(&fstyle, box->text, box->length, dx, &idx, &pixel_offset); selection_track(&html->sel, mouse, box->byte_offset + idx); } } break; default: html_mouse_action(c, bw, mouse, x, y); break; } }
void html_mouse_track(struct content *c, struct browser_window *bw, browser_mouse_state mouse, int x, int y) { html_mouse_action(c, bw, mouse, x, y); }