summaryrefslogtreecommitdiff
path: root/content/handlers/html/box_inspect.c
diff options
context:
space:
mode:
Diffstat (limited to 'content/handlers/html/box_inspect.c')
-rw-r--r--content/handlers/html/box_inspect.c57
1 files changed, 35 insertions, 22 deletions
diff --git a/content/handlers/html/box_inspect.c b/content/handlers/html/box_inspect.c
index df9a1b4e2..6591b6446 100644
--- a/content/handlers/html/box_inspect.c
+++ b/content/handlers/html/box_inspect.c
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <dom/dom.h>
+#include "utils/utils.h"
#include "utils/nsurl.h"
#include "utils/errors.h"
#include "netsurf/types.h"
@@ -56,7 +57,7 @@ enum box_walk_dir {
/**
* Determine if a point lies within a box.
*
- * \param[in] len_ctx CSS length conversion context to use.
+ * \param[in] unit_len_ctx CSS length conversion context to use.
* \param[in] box Box to consider
* \param[in] x Coordinate relative to box
* \param[in] y Coordinate relative to box
@@ -71,7 +72,7 @@ enum box_walk_dir {
* This is a helper function for box_at_point().
*/
static bool
-box_contains_point(const nscss_len_ctx *len_ctx,
+box_contains_point(const css_unit_ctx *unit_len_ctx,
const struct box *box,
int x,
int y,
@@ -101,30 +102,34 @@ box_contains_point(const nscss_len_ctx *len_ctx,
/* Adjust rect to css clip region */
if (css_rect.left_auto == false) {
- r.x0 += FIXTOINT(nscss_len2px(len_ctx,
- css_rect.left,
- css_rect.lunit,
- box->style));
+ r.x0 += FIXTOINT(css_unit_len2device_px(
+ box->style,
+ unit_len_ctx,
+ css_rect.left,
+ css_rect.lunit));
}
if (css_rect.top_auto == false) {
- r.y0 += FIXTOINT(nscss_len2px(len_ctx,
- css_rect.top,
- css_rect.tunit,
- box->style));
+ r.y0 += FIXTOINT(css_unit_len2device_px(
+ box->style,
+ unit_len_ctx,
+ css_rect.top,
+ css_rect.tunit));
}
if (css_rect.right_auto == false) {
r.x1 = box->border[LEFT].width +
- FIXTOINT(nscss_len2px(len_ctx,
- css_rect.right,
- css_rect.runit,
- box->style));
+ FIXTOINT(css_unit_len2device_px(
+ box->style,
+ unit_len_ctx,
+ css_rect.right,
+ css_rect.runit));
}
if (css_rect.bottom_auto == false) {
r.y1 = box->border[TOP].width +
- FIXTOINT(nscss_len2px(len_ctx,
- css_rect.bottom,
- css_rect.bunit,
- box->style));
+ FIXTOINT(css_unit_len2device_px(
+ box->style,
+ unit_len_ctx,
+ css_rect.bottom,
+ css_rect.bunit));
}
/* Test if point is in clipped box */
@@ -208,7 +213,7 @@ box_move_xy(struct box *b, enum box_walk_dir dir, int *x, int *y)
rb = b;
break;
}
- /* fall through */
+ fallthrough;
case BOX_WALK_NEXT_SIBLING:
do {
@@ -575,7 +580,7 @@ void box_bounds(struct box *box, struct rect *r)
/* Exported function documented in html/box.h */
struct box *
-box_at_point(const nscss_len_ctx *len_ctx,
+box_at_point(const css_unit_ctx *unit_len_ctx,
struct box *box,
const int x, const int y,
int *box_x, int *box_y)
@@ -587,7 +592,7 @@ box_at_point(const nscss_len_ctx *len_ctx,
skip_children = false;
while ((box = box_next_xy(box, box_x, box_y, skip_children))) {
- if (box_contains_point(len_ctx, box, x - *box_x, y - *box_y,
+ if (box_contains_point(unit_len_ctx, box, x - *box_x, y - *box_y,
&physically)) {
*box_x -= scrollbar_get_offset(box->scroll_x);
*box_y -= scrollbar_get_offset(box->scroll_y);
@@ -656,7 +661,7 @@ void box_dump(FILE *stream, struct box *box, unsigned int depth, bool style)
if (box->max_width != UNKNOWN_MAX_WIDTH) {
fprintf(stream, "min%i max%i ", box->min_width, box->max_width);
}
- fprintf(stream, "(%i %i %i %i) ",
+ fprintf(stream, "desc(%i %i %i %i) ",
box->descendant_x0, box->descendant_y0,
box->descendant_x1, box->descendant_y1);
@@ -720,6 +725,14 @@ void box_dump(FILE *stream, struct box *box, unsigned int depth, bool style)
fprintf(stream, "TEXT ");
break;
+ case BOX_FLEX:
+ fprintf(stream, "FLEX ");
+ break;
+
+ case BOX_INLINE_FLEX:
+ fprintf(stream, "INLINE_FLEX ");
+ break;
+
default:
fprintf(stream, "Unknown box type ");
}