summaryrefslogtreecommitdiff
path: root/content/handlers/html/box_construct.c
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2021-02-07 00:07:24 +0000
committerVincent Sanders <vince@kyllikki.org>2021-02-07 00:07:24 +0000
commitff225194f338519a4856f24b1196ded583ff51af (patch)
tree66dbd3115361e7c18165439d5322124484db4ffa /content/handlers/html/box_construct.c
parent55fadc802ac80286e4f7266866ad789c78f57483 (diff)
downloadnetsurf-ff225194f338519a4856f24b1196ded583ff51af.tar.gz
netsurf-ff225194f338519a4856f24b1196ded583ff51af.tar.bz2
use list style formatting from libcss
Diffstat (limited to 'content/handlers/html/box_construct.c')
-rw-r--r--content/handlers/html/box_construct.c47
1 files changed, 29 insertions, 18 deletions
diff --git a/content/handlers/html/box_construct.c b/content/handlers/html/box_construct.c
index 6c6fc2400..a13357809 100644
--- a/content/handlers/html/box_construct.c
+++ b/content/handlers/html/box_construct.c
@@ -47,7 +47,6 @@
#include "html/box_special.h"
#include "html/box_normalise.h"
#include "html/form_internal.h"
-#include "html/list_counter_style.h"
/**
* Context for box tree construction
@@ -424,6 +423,7 @@ box_construct_marker(struct box *box,
struct box *marker;
enum css_list_style_type_e list_style_type;
size_t counter_len;
+ css_error css_res;
marker = box_create(NULL, box->style, false, NULL, NULL, title,
NULL, ctx->bctx);
@@ -467,25 +467,36 @@ box_construct_marker(struct box *box,
return false;
}
- counter_len = list_counter_style_value(marker->text,
- LIST_MARKER_SIZE,
- list_style_type,
- marker->rows);
- if (counter_len > LIST_MARKER_SIZE) {
- /* use computed size as marker did not fit allocation */
- marker->text = talloc_realloc(ctx->bctx,
- marker->text,
- char,
- counter_len);
- if (marker->text == NULL) {
- return false;
- }
- counter_len = list_counter_style_value(marker->text,
+ css_res = css_computed_format_list_style(box->style,
+ marker->rows,
+ marker->text,
+ LIST_MARKER_SIZE,
+ &counter_len);
+ if (css_res == CSS_OK) {
+ if (counter_len > LIST_MARKER_SIZE) {
+ /*
+ * use computed size as marker did not fit
+ * in default allocation
+ */
+ marker->text = talloc_realloc(ctx->bctx,
+ marker->text,
+ char,
+ counter_len);
+ if (marker->text == NULL) {
+ return false;
+ }
+ css_computed_format_list_style(box->style,
+ marker->rows,
+ marker->text,
counter_len,
- list_style_type,
- marker->rows);
+ &counter_len);
+ }
+ marker->length = counter_len;
+ } else {
+ /* failed to format marker so use none type */
+ marker->text = NULL;
+ marker->length = 0;
}
- marker->length = counter_len;
break;
}