diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2018-04-02 20:25:19 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2018-04-02 20:25:19 +0100 |
commit | 3c3685eb9635cc46fe78b31d54967b62b948581e (patch) | |
tree | 6fc6b9509b878dbeed471493da81fe615ae18ec4 | |
parent | 473a40bc114d70d84610d40b425cf1e9bc548359 (diff) | |
download | netsurf-3c3685eb9635cc46fe78b31d54967b62b948581e.tar.gz netsurf-3c3685eb9635cc46fe78b31d54967b62b948581e.tar.bz2 |
Layout: Percentage max-width constrained boxes don't affect min on minmax pass.
-rw-r--r-- | render/layout.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/render/layout.c b/render/layout.c index b1d5557bd..121137adc 100644 --- a/render/layout.c +++ b/render/layout.c @@ -503,6 +503,23 @@ static void layout_minmax_table(struct box *table, assert(0 <= table->min_width && table->min_width <= table->max_width); } +/** + * Helper to check if a box has percentage max width. + * + * \param[in] b Box to check. + * \return true iff box has percnetage max width. + */ +static inline bool box_has_percentage_max_width(struct box *b) +{ + css_unit unit = CSS_UNIT_PX; + enum css_max_width_e type; + css_fixed value = 0; + + assert(b != NULL); + + type = css_computed_max_width(b->style, &value, &unit); + return ((type == CSS_MAX_WIDTH_SET) && (unit == CSS_UNIT_PCT)); +} /** * Calculate minimum and maximum width of a line. @@ -834,7 +851,7 @@ layout_minmax_line(struct box *first, b->style)); } - if (min < width) + if (min < width && !box_has_percentage_max_width(b)) min = width; if (width > 0) max += width; |