diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2014-11-17 13:51:41 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2014-12-03 12:25:52 +0100 |
commit | bceb717f5d088f440a8046acf2e1d8f0169fdab3 (patch) | |
tree | e50ac825057f121278e6850b464852acca228795 | |
parent | 6a603b5b55262c443bf780f3c112a586cb3d9901 (diff) | |
download | mupdf-bceb717f5d088f440a8046acf2e1d8f0169fdab3.tar.xz |
html: Don't create boxes for invisible elements.
-rw-r--r-- | source/html/layout.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/source/html/layout.c b/source/html/layout.c index 4f778cc5..c948e02b 100644 --- a/source/html/layout.c +++ b/source/html/layout.c @@ -187,6 +187,7 @@ static void generate_boxes(html_document *doc, fz_xml *node, struct box *top, st fz_context *ctx = doc->ctx; struct style style; struct box *box; + const char *tag; int display; while (node) @@ -194,9 +195,8 @@ static void generate_boxes(html_document *doc, fz_xml *node, struct box *top, st style.up = up_style; style.count = 0; - box = new_box(ctx, node); - - if (fz_xml_tag(node)) + tag = fz_xml_tag(node); + if (tag) { apply_styles(ctx, &style, rule, node); @@ -207,6 +207,8 @@ static void generate_boxes(html_document *doc, fz_xml *node, struct box *top, st if (display != DIS_NONE) { + box = new_box(ctx, node); + if (display == DIS_BLOCK) { top = insert_block_box(ctx, box, top); @@ -224,17 +226,18 @@ static void generate_boxes(html_document *doc, fz_xml *node, struct box *top, st if (fz_xml_down(node)) generate_boxes(doc, fz_xml_down(node), box, rule, &style); + compute_style(doc, &box->style, &style); // TODO: remove empty flow boxes } } else { + box = new_box(ctx, node); insert_inline_box(ctx, box, top); generate_text(ctx, box, fz_xml_text(node)); + compute_style(doc, &box->style, &style); } - compute_style(doc, &box->style, &style); - node = fz_xml_next(node); } } |