mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-23 06:51:26 +03:00
Layout: Fix auto margins to be affected by {min|max}-width constraints.
This commit is contained in:
parent
e431e6181b
commit
6f7b5e3f22
@ -1545,16 +1545,20 @@ layout_solve_width(struct box *box,
|
||||
|
||||
/* Find width */
|
||||
if (width == AUTO) {
|
||||
/* any other 'auto' become 0 or the minimum required values */
|
||||
if (box->margin[LEFT] == AUTO)
|
||||
box->margin[LEFT] = lm;
|
||||
if (box->margin[RIGHT] == AUTO)
|
||||
box->margin[RIGHT] = rm;
|
||||
int margin_left = box->margin[LEFT];
|
||||
int margin_right = box->margin[RIGHT];
|
||||
|
||||
if (margin_left == AUTO) {
|
||||
margin_left = lm;
|
||||
}
|
||||
if (margin_right == AUTO) {
|
||||
margin_right = rm;
|
||||
}
|
||||
|
||||
width = available_width -
|
||||
(box->margin[LEFT] + box->border[LEFT].width +
|
||||
(margin_left + box->border[LEFT].width +
|
||||
box->padding[LEFT] + box->padding[RIGHT] +
|
||||
box->border[RIGHT].width + box->margin[RIGHT]);
|
||||
box->border[RIGHT].width + margin_right);
|
||||
width = width < 0 ? 0 : width;
|
||||
auto_width = true;
|
||||
}
|
||||
@ -1572,8 +1576,16 @@ layout_solve_width(struct box *box,
|
||||
}
|
||||
|
||||
/* Width was auto, and unconstrained by min/max width, so we're done */
|
||||
if (auto_width)
|
||||
if (auto_width) {
|
||||
/* any other 'auto' become 0 or the minimum required values */
|
||||
if (box->margin[LEFT] == AUTO) {
|
||||
box->margin[LEFT] = lm;
|
||||
}
|
||||
if (box->margin[RIGHT] == AUTO) {
|
||||
box->margin[RIGHT] = rm;
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
||||
/* Width was not auto, or was constrained by min/max width
|
||||
* Need to compute left/right margins */
|
||||
|
Loading…
Reference in New Issue
Block a user