- From: David Hyatt <hyatt@apple.com>
- Date: Wed, 01 Dec 2010 16:11:46 -0600
- To: Koji Ishii <kojiishi@gluesoft.co.jp>
- Cc: "www-style@w3.org list" <www-style@w3.org>
On Dec 1, 2010, at 10:24 AM, Koji Ishii wrote: > Dave, > > Would you mind if I ask a question? It may be odd for me to ask this, but how accurate can a browser detect when "ruby overlaps the previous line"? > > Given the case of the first line after page break, I started to think if there were any other such cases. Is it possible to share with us what you have in WebKit now? > In WebKit, lines have a concept of a lineTop and a lineBottom. The lineTop and lineBottom represent the highest and lowest border edges of any inline boxes on the line (excluding line-height and overflow). The overlap code checks to see if the Ruby intrudes into the previous line's vertical range (above lineBottom of the previous line). If the Ruby does intrude, then the line with the Ruby is moved down just enough so that the top edge of the Ruby lines up with the lineBottom of the previous line. In addition, for first lines, the Ruby is allowed to extend into the padding area at the before side of the block. So think of the "previous line's lineBottom" in that case as being the border edge. For vertical-lr this is flipped. Ruby is checking to see if it intrudes into the next line, and the next line gets moved. Rubies on the last line can extend into the padding area at the after side of the block. > Cases I thought are: > * Floating box moves to either left or right, so it can still detect where the previous line is. > * Text after floating box probably knows where the line before the floating box is. Floating doesn't confuse the above algorithm, since if you introduce big vertical spaces between lines, that space will be in between the lineBottom of the previous line and the lineTop of the line with the Ruby on it. > * If the element has top or bottom (left or right in vertical) property specified, it's probably hard to determine what the "previous" line is. > I don't really understand what you mean here. Are you talking about positioning? > As far as I thought for a while, the top/bottom case and the first line after page break (and column break if multicol) you mentioned are the only two cases where browser cannot know where the previous line is. > If the algorithm has to cross blocks to detect overlap it gets significantly more complicated. WebKit doesn't attempt to cross blocks right now, so it doesn't detect that a Ruby can fit in a margin area between two blocks (or at the top of the document or the top of a column/page). If we did want to support this behavior automatically, I'd be inclined to only do it when at the top of a document, column or page, since that is much easier to handle than the between-blocks case. dave (hyatt@apple.com)
Received on Wednesday, 1 December 2010 22:12:20 UTC