summaryrefslogtreecommitdiff
path: root/source/html
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-04-25 16:40:10 +0200
committerTor Andersson <tor.andersson@artifex.com>2017-04-25 16:41:57 +0200
commit77e2257e7615aa9e3c35341e76666e285a3cb126 (patch)
treed3cc64a10c47ad7c1d4b77e6457cb08914359f6c /source/html
parenta59b4e9f1d595cdfbfaf0ac85246ad08444ddd90 (diff)
downloadmupdf-77e2257e7615aa9e3c35341e76666e285a3cb126.tar.xz
Fix 697123: Handle nesting of block-boxes deep inside inline-boxes.
When we climb up the box tree to create a new block box for block-level elements that are deep inside inline-level elements, we should propagate this to the caller so it can also climb up. Otherwise other child elements in the inline-level element will be inserted before the block box that was created for the content that was shunted up the tree.
Diffstat (limited to 'source/html')
-rw-r--r--source/html/html-layout.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source/html/html-layout.c b/source/html/html-layout.c
index 8520c782..c8250e62 100644
--- a/source/html/html-layout.c
+++ b/source/html/html-layout.c
@@ -595,11 +595,12 @@ static void insert_inline_box(fz_context *ctx, fz_html_box *box, fz_html_box *to
}
}
-static void generate_boxes(fz_context *ctx, fz_xml *node, fz_html_box *top,
+static fz_html_box *
+generate_boxes(fz_context *ctx, fz_xml *node, fz_html_box *top,
fz_css_match *up_match, int list_counter, int markup_dir, int markup_lang, struct genstate *g)
{
fz_css_match match;
- fz_html_box *box;
+ fz_html_box *box, *last_top;
const char *tag;
int display;
@@ -743,7 +744,9 @@ static void generate_boxes(fz_context *ctx, fz_xml *node, fz_html_box *top,
int child_counter = list_counter;
if (!strcmp(tag, "ul") || !strcmp(tag, "ol"))
child_counter = 0;
- generate_boxes(ctx, fz_xml_down(node), box, &match, child_counter, child_dir, child_lang, g);
+ last_top = generate_boxes(ctx, fz_xml_down(node), box, &match, child_counter, child_dir, child_lang, g);
+ if (last_top != box)
+ top = last_top;
}
}
}
@@ -777,6 +780,8 @@ static void generate_boxes(fz_context *ctx, fz_xml *node, fz_html_box *top,
node = fz_xml_next(node);
}
+
+ return top;
}
static void measure_image(fz_context *ctx, fz_html_flow *node, float max_w, float max_h)