summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2004-07-18 17:38:01 +0000
committerJames Bursa <james@netsurf-browser.org>2004-07-18 17:38:01 +0000
commit58e2d033ece8c60f495ddba9a93ecab793a7a50f (patch)
tree6e4b9d4dfbdfe3ad02f1c8a8d7a7e3d4f9f74e29 /render
parentb09fdba4ed8caed190d2fcf7e51a165fc130bdd1 (diff)
downloadnetsurf-58e2d033ece8c60f495ddba9a93ecab793a7a50f.tar.gz
netsurf-58e2d033ece8c60f495ddba9a93ecab793a7a50f.tar.bz2
[project @ 2004-07-18 17:38:01 by bursa]
Improve form control interaction code. Replace box_under_area() with simpler box_at_point(). Detect objects for menu once on menu opening. Remove obsolete text selection code. svn path=/import/netsurf/; revision=1096
Diffstat (limited to 'render')
-rw-r--r--render/box.c30
-rw-r--r--render/box.h1
-rw-r--r--render/html.h19
3 files changed, 33 insertions, 17 deletions
diff --git a/render/box.c b/render/box.c
index ef3b60283..145c3a18b 100644
--- a/render/box.c
+++ b/render/box.c
@@ -2785,3 +2785,33 @@ struct box *box_at_point(struct box *box, int x, int y,
return 0;
}
+
+
+/**
+ * Find the box containing an object at the given coordinates, if any.
+ *
+ * \param c content to search, must have type CONTENT_HTML
+ * \param x coordinates in document units
+ * \param y coordinates in document units
+ */
+
+struct box *box_object_at_point(struct content *c, int x, int y)
+{
+ struct box *box = c->data.html.layout;
+ int box_x = 0, box_y = 0;
+ struct content *content = c;
+ struct box *object_box = 0;
+
+ assert(c->type == CONTENT_HTML);
+
+ while ((box = box_at_point(box, x, y, &box_x, &box_y, &content))) {
+ if (box->style &&
+ box->style->visibility == CSS_VISIBILITY_HIDDEN)
+ continue;
+
+ if (box->object)
+ object_box = box;
+ }
+
+ return object_box;
+}
diff --git a/render/box.h b/render/box.h
index d97406352..58328884b 100644
--- a/render/box.h
+++ b/render/box.h
@@ -251,5 +251,6 @@ void box_coords(struct box *box, int *x, int *y);
struct box *box_at_point(struct box *box, int x, int y,
int *box_x, int *box_y,
struct content **content);
+struct box *box_object_at_point(struct content *c, int x, int y);
#endif
diff --git a/render/html.h b/render/html.h
index 6d9ad8b80..4dc1ca2a4 100644
--- a/render/html.h
+++ b/render/html.h
@@ -26,21 +26,13 @@ struct content;
struct object_params;
struct imagemap;
-struct box_position {
- struct box *box;
- int actual_box_x;
- int actual_box_y;
- int plot_index;
- int pixel_offset;
- int char_offset;
-};
-
/** Data specific to CONTENT_HTML. */
struct content_html_data {
htmlParserCtxt *parser; /**< HTML parser context. */
xmlChar *encoding; /**< Encoding of source. */
- bool getenc; /**< Need to get the encoding from the document, as server is broken. */
+ bool getenc; /**< Need to get the encoding from the document, as it
+ * wasn't specified in the Content-Type header. */
char *base_url; /**< Base URL (may be a copy of content->url). */
@@ -54,13 +46,6 @@ struct content_html_data {
struct content **stylesheet_content;
struct css_style *style; /**< Base style. */
- struct {
- struct box_position start;
- struct box_position end;
- enum { alter_UNKNOWN, alter_START, alter_END } altering;
- int selected; /* 0 = unselected, 1 = selected */
- } text_selection;
-
struct font_set *fonts; /**< Set of fonts. */
/** Number of entries in object. */