summaryrefslogtreecommitdiff
path: root/source/html
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-05-13 18:27:14 +0200
committerTor Andersson <tor.andersson@artifex.com>2015-05-15 16:12:23 +0200
commiteaaca0513d26fa9e7cc515dbba950536c0005c06 (patch)
tree7b7cf32ece52963bdf3bf02d3bed4717addba112 /source/html
parent8bd1881b799489a42cef76da033be157d0ff609d (diff)
downloadmupdf-eaaca0513d26fa9e7cc515dbba950536c0005c06.tar.xz
epub: Parse (and ignore) @page selector.
Diffstat (limited to 'source/html')
-rw-r--r--source/html/css-parse.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/source/html/css-parse.c b/source/html/css-parse.c
index 36ad111d..e57eb798 100644
--- a/source/html/css-parse.c
+++ b/source/html/css-parse.c
@@ -867,6 +867,26 @@ static fz_css_rule *parse_ruleset(struct lexbuf *buf)
return fz_new_css_rule(buf->ctx, s, p);
}
+static fz_css_rule *parse_at_page(struct lexbuf *buf)
+{
+ fz_css_selector *s = NULL;
+ fz_css_property *p = NULL;
+
+ white(buf);
+ if (accept(buf, ':'))
+ {
+ expect(buf, CSS_KEYWORD);
+ white(buf);
+ }
+ expect(buf, '{');
+ p = parse_declaration_list(buf);
+ expect(buf, '}');
+ white(buf);
+
+ s = fz_new_css_selector(buf->ctx, "@page");
+ return fz_new_css_rule(buf->ctx, s, p);
+}
+
static void parse_at_rule(struct lexbuf *buf)
{
expect(buf, CSS_KEYWORD);
@@ -920,7 +940,16 @@ static fz_css_rule *parse_stylesheet(struct lexbuf *buf, fz_css_rule *chain)
{
if (accept(buf, '@'))
{
- parse_at_rule(buf);
+ if (buf->lookahead == CSS_KEYWORD && !strcmp(buf->string, "page"))
+ {
+ next(buf);
+ rule = *nextp = parse_at_page(buf);
+ nextp = &rule->next;
+ }
+ else
+ {
+ parse_at_rule(buf);
+ }
}
else
{