summaryrefslogtreecommitdiff
path: root/desktop/browser.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-07-21 10:59:53 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-07-21 10:59:53 +0000
commit2565a37a52a5c714e7c6bbd1808db0d6d37c6ea3 (patch)
treef3fe5f224c9e0e4089aca2d9012dfe1a74cf9c90 /desktop/browser.c
parent1930989f8ccdd574472ed72990b6a82fdcf9d5f4 (diff)
downloadnetsurf-2565a37a52a5c714e7c6bbd1808db0d6d37c6ea3.tar.gz
netsurf-2565a37a52a5c714e7c6bbd1808db0d6d37c6ea3.tar.bz2
Refactor text plotter and other font functions to remove dependency on CSS.
svn path=/trunk/netsurf/; revision=8641
Diffstat (limited to 'desktop/browser.c')
-rw-r--r--desktop/browser.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/desktop/browser.c b/desktop/browser.c
index 9185eff51..b188316ea 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -1405,6 +1405,7 @@ void browser_window_mouse_action_html(struct browser_window *bw,
struct form_control *gadget = 0;
struct content *object = NULL;
struct box *next_box;
+ plot_font_style_t fstyle;
bw->drag_type = DRAGGING_NONE;
bw->scrolling_box = NULL;
@@ -1554,7 +1555,10 @@ void browser_window_mouse_action_html(struct browser_window *bw,
int pixel_offset;
size_t idx;
- nsfont.font_position_in_string(text_box->style,
+ font_plot_style_from_css(text_box->style,
+ &fstyle);
+
+ nsfont.font_position_in_string(&fstyle,
text_box->text,
text_box->length,
x - gadget_box_x - text_box->x,
@@ -1596,7 +1600,10 @@ void browser_window_mouse_action_html(struct browser_window *bw,
BROWSER_MOUSE_DRAG_2))
selection_init(bw->sel, gadget_box);
- nsfont.font_position_in_string(text_box->style,
+ font_plot_style_from_css(text_box->style,
+ &fstyle);
+
+ nsfont.font_position_in_string(&fstyle,
text_box->text,
text_box->length,
x - gadget_box_x - text_box->x,
@@ -1694,7 +1701,10 @@ void browser_window_mouse_action_html(struct browser_window *bw,
int pixel_offset;
size_t idx;
- nsfont.font_position_in_string(text_box->style,
+ font_plot_style_from_css(text_box->style,
+ &fstyle);
+
+ nsfont.font_position_in_string(&fstyle,
text_box->text,
text_box->length,
x - text_box_x,
@@ -1972,7 +1982,11 @@ void browser_window_mouse_track_html(struct browser_window *bw,
if (box) {
int pixel_offset;
size_t idx;
- nsfont.font_position_in_string(box->style,
+ 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);
@@ -2052,8 +2066,14 @@ void browser_window_mouse_drag_end(struct browser_window *bw,
box = browser_window_pick_text_box(bw,
x, y, dir, &dx, &dy);
if (box) {
+ plot_font_style_t fstyle;
+
+ font_plot_style_from_css(
+ box->style,
+ &fstyle);
+
nsfont.font_position_in_string(
- box->style,
+ &fstyle,
box->text,
box->length,
dx,