summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2014-08-04 14:49:35 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2014-08-04 14:49:35 +0100
commita807d762f9bfd06c903ab220c68e021c8ae99d37 (patch)
tree255a97a7b6552ad206bd0ac0bef625d8e8bcc5d0 /render
parent04ea4b52a07b49655b39df8f26496b66049a7f81 (diff)
downloadnetsurf-a807d762f9bfd06c903ab220c68e021c8ae99d37.tar.gz
netsurf-a807d762f9bfd06c903ab220c68e021c8ae99d37.tar.bz2
mailto urls don't have passwords or ports, so we don't need to look for ':'.
Diffstat (limited to 'render')
-rw-r--r--render/box.c76
-rw-r--r--render/layout.c2
2 files changed, 76 insertions, 2 deletions
diff --git a/render/box.c b/render/box.c
index dd7c31f69..494311994 100644
--- a/render/box.c
+++ b/render/box.c
@@ -342,6 +342,79 @@ void box_bounds(struct box *box, struct rect *r)
r->y1 = r->y0 + height;
}
+enum box_walk_dir {
+ BOX_WALK_CHILDREN,
+ BOX_WALK_PARENT,
+ BOX_WALK_NEXT_SIBLING,
+ BOX_WALK_FLOAT_CHILDREN,
+ BOX_WALK_NEXT_FLOAT_SIBLING
+};
+
+static inline struct box *box_move_xy(struct box *b, enum box_walk_dir dir,
+ int *x, int *y)
+{
+ switch (dir) {
+ case BOX_WALK_CHILDREN:
+ b = b->children;
+ *x += b->x;
+ *y += b->y;
+ return b;
+
+ case BOX_WALK_PARENT:
+ *x -= b->x;
+ *y -= b->y;
+ return b->parent;
+
+ case BOX_WALK_NEXT_SIBLING:
+ *x -= b->x;
+ *y -= b->y;
+ b = b->next;
+ *x += b->x;
+ *y += b->y;
+ return b;
+
+ case BOX_WALK_FLOAT_CHILDREN:
+ b = b->float_children;
+ *x += b->x;
+ *y += b->y;
+ return b;
+
+ case BOX_WALK_NEXT_FLOAT_SIBLING:
+ *x -= b->x;
+ *y -= b->y;
+ b = b->next_float;
+ *x += b->x;
+ *y += b->y;
+ return b;
+ }
+}
+
+
+static struct box *box_next_xy(struct box *b, int *x, int *y)
+{
+ assert(b != NULL);
+
+ if (b->float_children != NULL) {
+ /* Next node is float child */
+ b = box_move_xy(b, BOX_WALK_FLOAT_CHILDREN, x, y);
+ } else if (b->children != NULL) {
+ /* Next node is child */
+ b = box_move_xy(b, BOX_WALK_CHILDREN, x, y);
+ } else if (b->type == BOX_FLOAT_LEFT || b->type == BOX_FLOAT_RIGHT) {
+ /* Go to next float sibling */
+ b = box_move_xy(b, BOX_WALK_NEXT_FLOAT_SIBLING, x, y);
+ } else {
+ /* Go to next sibling, or nearest ancestor with next sibling. */
+ while (b->next == NULL && b->parent != NULL) {
+ b = box_move_xy(b, BOX_WALK_PARENT, x, y);
+ }
+
+ b = box_move_xy(b, BOX_WALK_NEXT_SIBLING, x, y);
+ }
+
+ return b;
+}
+
/**
* Find the boxes at a point.
@@ -373,7 +446,8 @@ struct box *box_at_point(struct box *box, const int x, const int y,
int bx = *box_x, by = *box_y;
struct box *child, *sibling;
bool physically;
-
+printf("x0:%i y0:%i x1:%i y1:%i\n", box->descendant_x0, box->descendant_y0,
+ box->descendant_y0, box->descendant_y1);
assert(box);
/* consider floats first, since they will often overlap other boxes */
diff --git a/render/layout.c b/render/layout.c
index 5b0d8a004..e0f0a349d 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -5068,7 +5068,7 @@ static void layout_get_box_bbox(struct box *box, int *desc_x0, int *desc_y0,
css_computed_font_size(box->style, &font_size, &font_unit);
text_height = nscss_len2px(font_size, font_unit, box->style);
-
+printf("%i", text_height);
*desc_y0 = (*desc_y0 < -text_height) ? *desc_y0 : -text_height;
}
}