From 2a4b9b2217bd2931b6cd615f7d4727ae24a8c35c Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 10 Feb 2013 11:50:04 +0000 Subject: Comment current html wrap/text-splitting behaviour. --- render/layout.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'render') diff --git a/render/layout.c b/render/layout.c index 331e1efdb..25d6c2448 100644 --- a/render/layout.c +++ b/render/layout.c @@ -2712,8 +2712,7 @@ bool layout_line(struct box *first, int *width, int *y, !(split_box->flags & REPLACE_DIM) && !(split_box->flags & IFRAME) && !split_box->gadget && split_box->text) { - /* skip leading spaces, otherwise code gets fooled into - * thinking it's all one long word */ + /* skip leading spaces */ for (i = 0; i != split_box->length && split_box->text[i] == ' '; i++) ; @@ -2721,15 +2720,18 @@ bool layout_line(struct box *first, int *width, int *y, for (; i != split_box->length && split_box->text[i] != ' '; i++) ; + /* if not at end of text, we've found a split point */ if (i != split_box->length) space = i; } - /* space != 0 implies split_box->text != 0 */ + /* space != 0 implies split_box->text != 0 + * and that there is a place we could split the text at */ if (space == 0 || no_wrap) w = split_box->width; else { + /* find width of the text to where we could split */ font_plot_style_from_css(split_box->style, &fstyle); /** \todo handle errors */ font_func->font_width(&fstyle, split_box->text, -- cgit v1.2.3