7 Nov
2010
7 Nov
'10
1:44 a.m.
Johannes wrote:
On Sat, Nov 06, 2010 at 03:04:16PM +0000, corvid wrote:
"Percentage values: refer to parent element's width"
So a Textblock wants to decide how big it is, and it asks its children how big they are, and the child has, say, text-indent: 50%, and so it gets to wordWrap and asks "So, ah...how big are _you_?". And the parent doesn't know yet.
Ah interesting....
What about using something like availWidth in Textblock::wordWrap() as an aproximation of the future width of the Textblock? Maybe this would be good enough. In which cases would this be way off?
That's a good idea! It seems to work pretty well in general... (You will note that this ignores negative values (LENGTH_PERCENTAGE) and allows overflow.)