diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2011-10-03 21:32:32 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2011-10-03 21:32:32 +0000 |
commit | 3043c58aaf60284f1d08c1d2b50b2e108b150564 (patch) | |
tree | 9c3559186103099364d3a46fc5cde2217f0949bf /render | |
parent | 2c41d4b44eae435f780bc3ba81978019a06fcf3d (diff) | |
download | netsurf-3043c58aaf60284f1d08c1d2b50b2e108b150564.tar.gz netsurf-3043c58aaf60284f1d08c1d2b50b2e108b150564.tar.bz2 |
Fix handling of preformatted text
svn path=/trunk/netsurf/; revision=12938
Diffstat (limited to 'render')
-rw-r--r-- | render/box_construct.c | 26 |
1 files changed, 20 insertions, 6 deletions
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); |