From c1628435f27d1a359c96a8727e054ef84d6e7612 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 6 Mar 2013 18:39:38 +0000 Subject: Fix min line width calc when an inline isn't to be wrapped in a block that allows wrap. --- render/layout.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'render/layout.c') diff --git a/render/layout.c b/render/layout.c index 2c234f609..d560a6d9c 100644 --- a/render/layout.c +++ b/render/layout.c @@ -2970,12 +2970,20 @@ struct box *layout_minmax_line(struct box *first, float frac; size_t i, j; struct box *b; + struct box *block; plot_font_style_t fstyle; + bool no_wrap; assert(first->parent); assert(first->parent->parent); assert(first->parent->parent->style); + block = first->parent->parent; + no_wrap = (css_computed_white_space(block->style) == + CSS_WHITE_SPACE_NOWRAP || + css_computed_white_space(block->style) == + CSS_WHITE_SPACE_PRE); + *line_has_height = false; /* corresponds to the pass 1 loop in layout_line() */ @@ -3065,11 +3073,11 @@ struct box *layout_minmax_line(struct box *first, if (!b->object && !(b->flags & IFRAME) && !b->gadget && !(b->flags & REPLACE_DIM)) { /* inline non-replaced, 10.3.1 and 10.6.1 */ - bool no_wrap; + bool no_wrap_box; if (!b->text) continue; - no_wrap = (css_computed_white_space(b->style) == + no_wrap_box = (css_computed_white_space(b->style) == CSS_WHITE_SPACE_NOWRAP || css_computed_white_space(b->style) == CSS_WHITE_SPACE_PRE); @@ -3118,9 +3126,16 @@ struct box *layout_minmax_line(struct box *first, } if (no_wrap) { - /* can't wrap, so min is the same as max */ + /* Don't wrap due to block style, + * so min is the same as max */ min = max; + } else if (no_wrap_box) { + /* This inline box can't be wrapped, + * for min, consider box's width */ + if (min < b->width) + min = b->width; + } else if (b->parent->flags & NEED_MIN) { /* If we care what the minimum width is, * calculate it. (It's only needed if we're -- cgit v1.2.3