From af7461adcd082d60276b747eda66fec2684f3701 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 26 Apr 2017 15:01:53 +0200 Subject: Make CSS rule debug printing functions static. --- source/html/css-apply.c | 22 +++++++--------------- source/html/html-imp.h | 1 + source/html/html-layout.c | 5 +++++ 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/source/html/css-apply.c b/source/html/css-apply.c index 65323baa..08ce586f 100644 --- a/source/html/css-apply.c +++ b/source/html/css-apply.c @@ -740,8 +740,6 @@ fz_add_css_font_face(fz_context *ctx, fz_html_font_set *set, fz_archive *zip, co custom->is_italic == is_italic) return; /* already loaded */ - printf("epub: @font-face: family='%s' b=%d i=%d src=%s\n", family, is_bold, is_italic, src); - fz_var(buf); fz_var(font); @@ -1324,8 +1322,7 @@ fz_apply_css_style(fz_context *ctx, fz_html_font_set *set, fz_css_style *style, * Pretty printing */ -void -print_value(fz_css_value *val) +static void print_value(fz_css_value *val) { printf("%s", val->data); if (val->args) @@ -1341,8 +1338,7 @@ print_value(fz_css_value *val) } } -void -print_property(fz_css_property *prop) +static void print_property(fz_css_property *prop) { printf("\t%s: ", prop->name); print_value(prop->value); @@ -1351,8 +1347,7 @@ print_property(fz_css_property *prop) printf(";\n"); } -void -print_condition(fz_css_condition *cond) +static void print_condition(fz_css_condition *cond) { if (cond->type == '=') printf("[%s=%s]", cond->key, cond->val); @@ -1364,19 +1359,16 @@ print_condition(fz_css_condition *cond) print_condition(cond->next); } -void -print_selector(fz_css_selector *sel) +static void print_selector(fz_css_selector *sel) { if (sel->combine) { -putchar('('); print_selector(sel->left); if (sel->combine == ' ') printf(" "); else printf(" %c ", sel->combine); print_selector(sel->right); -putchar(')'); } else if (sel->name) printf("%s", sel->name); @@ -1388,8 +1380,7 @@ putchar(')'); } } -void -print_rule(fz_css_rule *rule) +static void print_rule(fz_css_rule *rule) { fz_css_selector *sel; fz_css_property *prop; @@ -1411,8 +1402,9 @@ print_rule(fz_css_rule *rule) } void -print_rules(fz_css_rule *rule) +fz_debug_css(fz_context *ctx, fz_css *css) { + fz_css_rule *rule = css->rule; while (rule) { print_rule(rule); diff --git a/source/html/html-imp.h b/source/html/html-imp.h index 1cf2c6eb..85d05b24 100644 --- a/source/html/html-imp.h +++ b/source/html/html-imp.h @@ -255,6 +255,7 @@ fz_css *fz_new_css(fz_context *ctx); void fz_parse_css(fz_context *ctx, fz_css *css, const char *source, const char *file); fz_css_property *fz_parse_css_properties(fz_context *ctx, fz_pool *pool, const char *source); void fz_drop_css(fz_context *ctx, fz_css *css); +void fz_debug_css(fz_context *ctx, fz_css *css); void fz_match_css(fz_context *ctx, fz_css_match *match, fz_css *css, fz_xml *node); void fz_match_css_at_page(fz_context *ctx, fz_css_match *match, fz_css *css); diff --git a/source/html/html-layout.c b/source/html/html-layout.c index a6e56e06..0b28e282 100644 --- a/source/html/html-layout.c +++ b/source/html/html-layout.c @@ -2699,6 +2699,11 @@ fz_parse_html(fz_context *ctx, fz_html_font_set *set, fz_archive *zip, const cha fz_warn(ctx, "ignoring styles due to errors: %s", fz_caught_message(ctx)); } +#ifndef NDEBUG + if (fz_atoi(getenv("FZ_DEBUG_CSS"))) + fz_debug_css(ctx, g.css); +#endif + g.pool = fz_new_pool(ctx); fz_try(ctx) { -- cgit v1.2.3