diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2014-11-26 17:26:51 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2014-12-03 12:25:52 +0100 |
commit | f1bfe4b861621ad7554670acf91cb029e4482569 (patch) | |
tree | 35fc70c4643a8ad04e1910d271b5f65916429aec /source/html/css-apply.c | |
parent | c4a45e25b92269e9e44594fd410b272718d939bc (diff) | |
download | mupdf-f1bfe4b861621ad7554670acf91cb029e4482569.tar.xz |
html: Free inline style properties at the end.
Diffstat (limited to 'source/html/css-apply.c')
-rw-r--r-- | source/html/css-apply.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/source/html/css-apply.c b/source/html/css-apply.c index 81308c82..48d4f04d 100644 --- a/source/html/css-apply.c +++ b/source/html/css-apply.c @@ -476,13 +476,14 @@ add_property(fz_css_match *match, const char *name, fz_css_value *value, int spe } void -fz_match_css(fz_context *ctx, fz_css_match *match, fz_css_rule *rule, fz_xml *node) +fz_match_css(fz_context *ctx, fz_css_match *match, fz_css_rule *css, fz_xml *node) { + fz_css_rule *rule; fz_css_selector *sel; - fz_css_property *prop; + fz_css_property *prop, *head, *tail; const char *s; - while (rule) + for (rule = css; rule; rule = rule->next) { sel = rule->selector; while (sel) @@ -495,19 +496,21 @@ fz_match_css(fz_context *ctx, fz_css_match *match, fz_css_rule *rule, fz_xml *no } sel = sel->next; } - rule = rule->next; } s = fz_xml_att(node, "style"); if (s) { - prop = fz_parse_css_properties(ctx, s); + head = tail = prop = fz_parse_css_properties(ctx, s); while (prop) { add_property(match, prop->name, prop->value, INLINE_SPECIFICITY); + tail = prop; prop = prop->next; } - // TODO: free props (hitch a ride with fz_css_rule?) + if (tail) + tail->next = css->garbage; + css->garbage = head; } } |