Bug 47596 - Ruby isn't displayed correctly after switching from display:none to display:inline
Summary: Ruby isn't displayed correctly after switching from display:none to display:i...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL: http://kids.gakken.co.jp/kagaku/110ba...
Keywords: InRadar
Depends on:
Reported: 2010-10-13 09:27 PDT by Alexey Proskuryakov
Modified: 2010-11-09 20:00 PST (History)
2 users (show)

See Also:

test case (708 bytes, text/html)
2010-10-13 09:27 PDT, Alexey Proskuryakov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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
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.