Bug 47596

Summary: Ruby isn't displayed correctly after switching from display:none to display:inline
Product: WebKit Reporter: Alexey Proskuryakov <ap>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: hyatt, rolandsteiner
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
URL: http://kids.gakken.co.jp/kagaku/110ban/text/1480.html
Attachments:
Description Flags
test case none

Description Alexey Proskuryakov 2010-10-13 09:27:30 PDT
Created attachment 70615 [details]
test case

See attached test case, or try switching Furigana on at <http://kids.gakken.co.jp/kagaku/110ban/text/1480.html>.

I'm not sure whether this is really expected to work. The default style for rt is block, but the site sets it to inline when toggling ruby on. But then, CSS3 Ruby Module has a whole lot of custom display styles for ruby, see <http://www.w3.org/TR/css3-ruby/#display>. So, perhaps both block and inline need some custom translation when applied to this element.

I haven't checked whether this works in IE8.
Comment 1 Alexey Proskuryakov 2010-10-13 09:27:56 PDT
<rdar://problem/8452319>
Comment 2 Alexey Proskuryakov 2010-10-13 13:41:52 PDT
I checked now, and this works in IE.
Comment 3 Roland Steiner 2010-10-13 19:39:40 PDT
It could be argued that the current behavior is correct as the ruby text is displayed inline, rather than as ruby text, just as specified by the JS.

Toggling works if the code is changed to toggle between 'none' and empty string (i.e., not overwriting the browser default.

It doesn't work correctly if toggling between 'none' and 'ruby-text' - this is due to the fact that so far we avoided implementing the ruby-specific display types, because of questions of the state and direction of the ruby spec(s). IIRC the current code explicitly "aborts" ruby rendering if the user tampers with the display type.

If compatibility with IE is a goal, then one short term solution might be to just entirely ignore the display type on <rt> unless it's 'none', but I'm not sure that's a good idea. OTOH, even if we fully implement the ruby display-types, the example would still not work as intended, because it'd then need to specify 'ruby-text' rather than 'inline' (the latter would continue to be displayed as-is).

Any inputs or other suggestions?
Comment 4 Alexey Proskuryakov 2010-10-13 22:32:43 PDT
From the very little data that I have (this single site), it appears that IE compatibility can be a reasonable goal, yes.
Comment 5 Dave Hyatt 2010-10-14 12:22:12 PDT
Ignoring the display type is probably ok actually.  I imagine that's what IE is doing.
Comment 6 Roland Steiner 2010-10-14 21:52:16 PDT
Ignoring the display type does, however, imply that you could never (e.g., in user style sheets, or using JS) change <rt> to be displayed inline rather than as ruby text, on any site or device.

Are you positive that sacrificing this functionality is a good exchange for the sake of IE compatibility?
Comment 7 Alexey Proskuryakov 2010-10-14 23:36:39 PDT
Would it make sense to decide whether to display <rt> inline based on whether <rp> was forced to be anything but display:none?
Comment 8 Roland Steiner 2010-10-18 19:18:17 PDT
I'm not sure about this suggestion - on one hand it could certainly serve as a heuristic.

On the other hand, not all ruby uses <rp>, and it would be a pretty opaque condition to describe to new developers.
Comment 9 Alexey Proskuryakov 2010-11-09 20:00:04 PST
See also: bug 44515.