Assume a vbox with 2 wrapping labels saying
Hello World
Hi Ho
being measured for their minimum width for 3 rows of text.
This should be layouted like
Hello
World
Hi Ho
and measured accordingly.
However, previously this was layouted as
Hello World
Hi Ho
with 1.5 lines being assigned to both labels.
That will obviously not compute the above wrapping which clearly
results in a smaller min width.
A reftest testing exactly this was included.
... when they are wrong.
Instead, remove them.
Or in other words: GTK4 does not have a fill child property anymore, so
we don't need to run the measuring loop above to determine the size.
This reverts commit cf7fa931d3.
We store the baseline in the cache and we do not know if baselines might
be queried in the future. So always store them.
No reftest because I don't know how to write one.
premature optimization == √😈
Having a short text and a large max-width-chars should request the
natural width of the text, not the limit from max-width-chars.
This caused huge message dialogs.
Reftests added.
Instead of translating font-variant-caps directly
to OpenType features, translate them to a PangoVariant,
now that that enumeration reflects all the css values.
This allows pango to emulate Small Caps for fonts that
don't support the OpenType feature.
When scrolling embedded widgets out of view,
they sometimes get left behind because we don't
reallocated them. To avoid that, move _all_ children
out of view in size_allocate, and let the current
child allocation plumbing move the visible ones
back in place.
Use a label that is long enough to require wrapping and force it into a
hardcoded width. Use a sentence where all the words have the same size
to not get unwanted wrapping behavior.
Also append a 2nd row to check that the first row gets the proper height
allocated.
Found by Marco Melorio.
The width of a logical rect after line breaking is sometimes not
wide enough to cause line breaking to break at the exact same points.
(Is that by design or a bug in Pango? I don't know.)
So don't use the width, and only relyon values we actually set to
pango_layout_set_width().
Don't just use the natural size as the max size, the natural size
is the ideal size, not necessarily the maximum size.
Also check the nat size for opposite min size.
For size -1 in the opposite orientation, GtkBoxLayout used to measure
the children based on their min size in the box's orientation instead of
-1. That wasn't really intended, but was a side effect of how the sizing
code did (not) distribute extra size above the minimum size.
This is clearly not what we want.
What we want is measuring the orientation as is for size -1. Then we
want to just take the maximum of all children and use that.
A reftest is incldued that ensures a vbox wraps a label just like an
hbox does.
The old code couldn't properly do height-for-width because it only
computed the widest and smallest layout instead of looking at the actual
passed in for-size.
The label-sizing reftest has been adapted as the label code is now smart
enough to always display the whole text and no longer requests a too
small width-for-single-row when wrapping.