From 8b2a23081f5fdf09e4448a79e85b07b715549eda Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 7 Apr 2008 09:00:21 +0000 Subject: Various text selection improvements: + Fix redraw bug where parts of old selections would get left behind + Enable selection of list marker boxes (bullet points and numbers) + Improve formatting of copied-to-clipboard or saved text selections + Select click anywhere outside current selection now clears current selection svn path=/trunk/netsurf/; revision=4079 --- render/box.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'render/box.c') diff --git a/render/box.c b/render/box.c index 9598a0cf4..9aadcda86 100644 --- a/render/box.c +++ b/render/box.c @@ -335,6 +335,17 @@ non_float_children: } } + /* marker boxes */ + if (box->list_marker) { + if (box_contains_point(box->list_marker, x - bx, y - by)) { + *box_x = bx + box->list_marker->x - + box->list_marker->scroll_x; + *box_y = by + box->list_marker->y - + box->list_marker->scroll_y; + return box->list_marker; + } + } + siblings: /* siblings and siblings of ancestors */ while (box) { @@ -405,6 +416,22 @@ bool box_contains_point(struct box *box, int x, int y) y < box->y + box->padding[TOP] + box->height + box->border[BOTTOM] + box->padding[BOTTOM]) return true; + if (box->list_marker && box->list_marker->x <= x + + box->list_marker->border[LEFT] && + x < box->list_marker->x + + box->list_marker->padding[LEFT] + + box->list_marker->width + + box->list_marker->border[RIGHT] + + box->list_marker->padding[RIGHT] && + box->list_marker->y <= y + + box->list_marker->border[TOP] && + y < box->list_marker->y + + box->list_marker->padding[TOP] + + box->list_marker->height + + box->list_marker->border[BOTTOM] + + box->list_marker->padding[BOTTOM]) { + return true; + } } else { if (box->x + box->descendant_x0 <= x && x < box->x + box->descendant_x1 && -- cgit v1.2.3