[webkit-dev] Ruby Text Enhancements

Eric Mader emader at apple.com
Tue Sep 28 12:08:10 PDT 2010

On Sep 28, 2010, at 7:11 AM, David Hyatt wrote:

>>> "The ruby element allows one or more spans of phrasing content to be marked with ruby annotations."
>>>>> * That the text for the ruby text and ruby base are always the direct child of the RenderRubyText and RenderRubyBase object.
>>> I doubt that's a valid assumption.  I assume that you can have a content tree of markup underneath a RenderRubyText and a RenderRubyBase, e.g., if you put in some <i> and some <b>.  Anyway, I think you could just ask for the width() of the rubyText() and rubyBase() objects themselves rather than drilling down into their subtrees.
>> I couldn't figure out how to ask the RenderRubyText and RenderRubyRun objects for their width. They don't support the width() method. What method should I call?
> They should.  They are RenderBlocks, so they should have width() methods.  You may have just been getting bad results because you hooked in before the width was computed.  That's why computeLogicalWidth subclassing would work better for you.  Let the base class set up the margins and width, and then you override.

Doh! I was trying to call width() on RenderText objects. When I called it directly on firstChild() and lastChild() of the RenderRubyRun, it works, but returns the frame width, which isn't useful for my purposes. Instead I called maxPrefWidth() which has the values I'm after. (only, I guess, if the ruby text and ruby base is a single line…)

> dave
> (hyatt at apple.com)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100928/03893e2c/attachment.html>

More information about the webkit-dev mailing list