From 3043c58aaf60284f1d08c1d2b50b2e108b150564 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Mon, 3 Oct 2011 21:32:32 +0000 Subject: Fix handling of preformatted text svn path=/trunk/netsurf/; revision=12938 --- render/box_construct.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'render/box_construct.c') diff --git a/render/box_construct.c b/render/box_construct.c index 144d8d80c..caa170477 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -1012,12 +1012,26 @@ bool box_construct_text(struct box_construct_ctx *ctx) current += len; - if (current[0] == '\r' && current[1] == '\n') { - current += 2; - props.inline_container = NULL; - } else if (current[0] != 0) { - current++; - props.inline_container = NULL; + if (current[0] != '\0') { + /* Linebreak: create new inline container */ + props.inline_container = box_create(NULL, NULL, + false, NULL, NULL, NULL, NULL, + ctx->content); + if (props.inline_container == NULL) { + free(text); + return false; + } + + props.inline_container->type = + BOX_INLINE_CONTAINER; + + box_add_child(props.containing_block, + props.inline_container); + + if (current[0] == '\r' && current[1] == '\n') + current += 2; + else + current++; } } while (*current); -- cgit v1.2.3