summaryrefslogtreecommitdiff
path: root/render/layout.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-03-06 18:39:38 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2013-03-06 18:39:38 +0000
commitc1628435f27d1a359c96a8727e054ef84d6e7612 (patch)
tree96bfa632ff3b4457d4441278ee4443da36e6630e /render/layout.c
parente3cb0ba4504332b5cfd772d44ea8c34ffa53eca4 (diff)
downloadnetsurf-c1628435f27d1a359c96a8727e054ef84d6e7612.tar.gz
netsurf-c1628435f27d1a359c96a8727e054ef84d6e7612.tar.bz2
Fix min line width calc when an inline isn't to be wrapped in a block that allows wrap.
Diffstat (limited to 'render/layout.c')
-rw-r--r--render/layout.c21
1 files changed, 18 insertions, 3 deletions
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