summaryrefslogtreecommitdiff
path: root/source/html/css-parse.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2014-11-13 12:06:46 +0100
committerTor Andersson <tor.andersson@artifex.com>2014-12-03 12:25:51 +0100
commiteea982f2ea75a39a0c1218f528cfaa6678baf263 (patch)
tree7f282e3459cc050b8806000d827d142274ddf1d7 /source/html/css-parse.c
parent2dca8942c2ad00fefdd95133c2620f318ccde1b2 (diff)
downloadmupdf-eea982f2ea75a39a0c1218f528cfaa6678baf263.tar.xz
html: Parse external CSS files and basic pagination.
Show a translated view of the continuous layout for each page.
Diffstat (limited to 'source/html/css-parse.c')
-rw-r--r--source/html/css-parse.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/source/html/css-parse.c b/source/html/css-parse.c
index fe91a933..93c5ff58 100644
--- a/source/html/css-parse.c
+++ b/source/html/css-parse.c
@@ -745,3 +745,30 @@ struct rule *fz_parse_css(fz_context *ctx, struct rule *chain, const char *sourc
next(&buf);
return parse_stylesheet(&buf, chain);
}
+
+struct rule *fz_parse_css_file(fz_context *ctx, struct rule *chain, const char *filename)
+{
+ fz_stream *stm = NULL;
+ fz_buffer *buf = NULL;
+
+ fz_var(buf);
+
+ stm = fz_open_file(ctx, filename);
+ fz_try(ctx)
+ {
+ buf = fz_read_all(stm, 0);
+ fz_write_buffer_byte(ctx, buf, 0);
+ chain = fz_parse_css(ctx, chain, buf->data);
+ }
+ fz_always(ctx)
+ {
+ fz_drop_buffer(ctx, buf);
+ fz_close(stm);
+ }
+ fz_catch(ctx)
+ {
+ fz_rethrow(ctx);
+ }
+
+ return chain;
+}