diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2016-01-06 15:43:28 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2016-01-06 15:43:28 +0100 |
commit | 0ae5e72a2baa3a19aa51be4d6a91c4d23edac20f (patch) | |
tree | 38e67045e1f5293baf62036150e3be6f5eb804a1 | |
parent | 0ab9b380091f2c7dc2125244b0de2b8d1a5049fc (diff) | |
download | mupdf-0ae5e72a2baa3a19aa51be4d6a91c4d23edac20f.tar.xz |
epub: Only look for CSS in html head node.
-rw-r--r-- | source/html/html-layout.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/source/html/html-layout.c b/source/html/html-layout.c index d3f80cef..1291b3c8 100644 --- a/source/html/html-layout.c +++ b/source/html/html-layout.c @@ -1171,16 +1171,17 @@ static char *concat_text(fz_context *ctx, fz_xml *root) static fz_css_rule * html_load_css(fz_context *ctx, fz_archive *zip, const char *base_uri, fz_css_rule *css, fz_xml *root) { - fz_xml *node; + fz_xml *html, *head, *node; fz_buffer *buf; char path[2048]; fz_var(buf); - for (node = root; node; node = fz_xml_next(node)) + html = fz_xml_find(root, "html"); + head = fz_xml_find_down(html, "head"); + for (node = fz_xml_down(head); node; node = fz_xml_next(node)) { - const char *tag = fz_xml_tag(node); - if (tag && !strcmp(tag, "link")) + if (fz_xml_is_tag(node, "link")) { char *rel = fz_xml_att(node, "rel"); if (rel && !fz_strcasecmp(rel, "stylesheet")) @@ -1212,7 +1213,7 @@ html_load_css(fz_context *ctx, fz_archive *zip, const char *base_uri, fz_css_rul } } } - if (tag && !strcmp(tag, "style")) + else if (fz_xml_is_tag(node, "style")) { char *s = concat_text(ctx, node); fz_try(ctx) @@ -1221,8 +1222,6 @@ html_load_css(fz_context *ctx, fz_archive *zip, const char *base_uri, fz_css_rul fz_warn(ctx, "ignoring inline stylesheet"); fz_free(ctx, s); } - if (fz_xml_down(node)) - css = html_load_css(ctx, zip, base_uri, css, fz_xml_down(node)); } return css; } |