[webkit-dev] Ruby Text Enhancements

Eric Mader emader at apple.com
Mon Sep 27 13:40:03 PDT 2010


A generic question: is there any in-depth documentation I can ready about block layout and how the various methods are supposed to be used? I've looked at the technical articles at http://webkit.org/coding/technical-articles.html but they seem to only have fairly high-level information and left me hungry for much more.

Specific comments below.

Regards,
Eric

On Sep 24, 2010, at 8:02 PM, David Hyatt wrote:

> It would probably be simpler to just subclass computeLogicalWidth (recently renamed from calcWidth) and modify the m_marginLeft and m_marginRight variables after calling the base class method.  Then you don't have to add any new member variables.
> 
> The big problem with building the overhang into margins at the initial calculation time, though, is that you may not get a relayout when objects around you change, so you won't get an opportunity to adjust your margins when that happens.  Your margins are also computed before you've even know what's going on the line, so it could be really tricky to have all the information you need.

Are you saying that subclassing computeLogicalWidth() would still mean that I'm computing the margins at the initial calculation time?

> It just doesn't seem like you can deal with all the corner cases without integrating right into line layout.  I don't see how else you can know if you have adequate available space to actually overhang without knowing what you've seen so far on the line and how much space you have left on the line.

This would require special-casing the ruby blocks in line layout code, right? I was trying to avoid this, hoping that I could just extend the existing ruby objects.

>>> This method makes several assumptions that I'm not 100% sure are always safe:
>>> * That a RenderRuby object holds only 1 RenderRubyRun object.
> 
> I believe you can have multiple RenderRubyRuns inside a single RenderRuby.
> 
> http://www.whatwg.org/specs/web-apps/current-work/multipage/text-level-semantics.html#the-ruby-element
> 
> "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?


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


More information about the webkit-dev mailing list