Closed Bug 1205787 Opened 4 years ago Closed 4 years ago

support the (deprecated) writing-mode values from SVG1.1 as aliases for standard CSS writing-mode values

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla43
Tracking Status
firefox43 --- fixed

People

(Reporter: jfkthame, Assigned: jfkthame)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete)

Attachments

(2 files)

I think we should consider adding support for the SVG1.1 writing-mode values, as documented at https://drafts.csswg.org/css-writing-modes/#svg-writing-mode. These will simply be mapped at parse time to the standard CSS values, so there's minimal cost or complexity, and this will allow us to support existing content that specifies (typically, for Japanese) writing-mode:tb-rl for vertical text.

For an example, see http://item.rakuten.co.jp/tamagobolo/002-002/. After the second photo of bunnies in a basket on that page, there's a chunk of text that is intended to be displayed vertically. This works in IE (because it has writing-mode:tb-rl) and in Chrome (because it has -webkit-writing-mode:vertical-rl), but not in Firefox (the author provided a prefixed -moz-writing-mode:vertical-rl rule, which we have never implemented, but used the legacy SVG1.1 value in the unprefixed rule, so we drop it).

By aliasing the SVG1.1 values, we can make content like this work automatically.

We primarily want this for vertical content (styled with writing-mode:tb or tb-rl), but if we do this we should also add the values that alias to horizontal-tb, as such content may use these to reset to horizontal mode within a child block, and we don't want to ignore that.
Is this something we should do? I don't much like it, but on the whole I think it's probably worthwhile.
Attachment #8662526 - Flags: review?(cam)
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
(In reply to Jonathan Kew (:jfkthame) from comment #1)
> Is this something we should do? I don't much like it, but on the whole I
> think it's probably worthwhile.

I tend to agree, especially given you found some content to make work.
Comment on attachment 8662526 [details] [diff] [review]
Map the writing-mode values from SVG1.1 to their CSS equivalents

Review of attachment 8662526 [details] [diff] [review]:
-----------------------------------------------------------------

Can you add these new values to the initial_values/other_values arrays in property_database.js as appropriate, and can you add a couple of reftests just checking that these new values behave as expected.
Attachment #8662526 - Flags: review?(cam) → review+
Should we also map glyph-orientation-vertical to text-orientation? per https://drafts.csswg.org/css-writing-modes/#glyph-orientation
Here's a simple reftest that checks a couple of these values are behaving as expected. We can't simply add them to other_values in property_database.js, BTW, because a number of the values compute to the same as the initial value (horizontal-tb), which causes test_value_computation to report errors. So if we really care about adding these to the mochitest suite, we'll need to handle them in a separate custom way. I'm not sure it's worth it... wdyt?
Attachment #8663285 - Flags: review?(cam)
(In reply to Robert Longson from comment #4)
> Should we also map glyph-orientation-vertical to text-orientation? per
> https://drafts.csswg.org/css-writing-modes/#glyph-orientation

AFAICT, Internet Explorer doesn't seem to implement this, at least for HTML content (maybe it does for SVG?), which makes it much less likely that there's content out there that would benefit.
(In reply to Jonathan Kew (:jfkthame) from comment #5)
> We can't simply add them to other_values in property_database.js,
> BTW, because a number of the values compute to the same as the initial value
> (horizontal-tb), which causes test_value_computation to report errors.

Those ones we can add to initial_values, can't we?  That array's for values that compute to the same thing that the initial value does.
Attachment #8663285 - Flags: review?(cam) → review+
(In reply to Cameron McCormack (:heycam) from comment #7)

> Those ones we can add to initial_values, can't we?  That array's for values
> that compute to the same thing that the initial value does.

Duh... yes, of course, that should've been obvious to me!
https://hg.mozilla.org/integration/mozilla-inbound/rev/8c793d5c945cc962795dca70ea85096d82d36da1
Bug 1205787 - Map the writing-mode values from SVG1.1 to their CSS equivalents. r=heycam

https://hg.mozilla.org/integration/mozilla-inbound/rev/58e3968c2dbe32b704e15fe136ffd09132b5db86
Bug 1205787 - Reftest using legacy SVG1.1 writing-mode values. r=heycam
https://hg.mozilla.org/mozilla-central/rev/8c793d5c945c
https://hg.mozilla.org/mozilla-central/rev/58e3968c2dbe
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in before you can comment on or make changes to this bug.