On Sun, Nov 07, 2010 at 12:43:42AM +0000, corvid wrote:
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.)
Thanks for committing the patch! I just noticed one thing that might complicate stuff a bit. Consider the following page: <div style="text-indent: 3em; border: 1px solid"> <div style="text-indent: 3em; border: 1px solid"> foo </div> bar </div> It seems that the inner <div> should not be indented, just text. The spec says: "More precisely, it specifies the indentation of the first box that flows into the block's first line box" I'd interpet it in dillo terms as to do the indent only if the first word is not a textblock widget. The question is then whether the "bar" should be indented. From the spec I would say yes, but firefox does not seem to do it... What do you think? Cheers, Johannes