Bug 1141931 part 1 - Compute unicode-bidi property to proper values for ruby boxes. r=heycam

This commit is contained in:
Xidorn Quan 2015-04-08 11:22:34 +12:00
parent 8c07cb0b1c
commit b82185f80d
5 changed files with 28 additions and 2 deletions

View File

@ -4,6 +4,7 @@
}
rbc {
display: ruby-base-container;
unicode-bidi: -moz-isolate;
}
[pseudo] {
font-size: inherit;

View File

@ -1,3 +1,4 @@
rbc {
display: ruby-base-container;
unicode-bidi: isolate;
}

View File

@ -823,7 +823,7 @@ marquee[direction="up"], marquee[direction="down"] {
rtc > rt {
font-size: inherit;
}
ruby, rb, rt, rbc, rtc {
unicode-bidi: isolate;
ruby, rb, rt, rtc {
unicode-bidi: -moz-isolate;
}
}

View File

@ -447,6 +447,7 @@ nsStyleContext::GetUniqueStyleData(const nsStyleStructID& aSID)
UNIQUE_CASE(Display)
UNIQUE_CASE(Text)
UNIQUE_CASE(TextReset)
#undef UNIQUE_CASE
@ -706,6 +707,24 @@ nsStyleContext::ApplyStyleFixups(bool aSkipParentDisplayBasedStyleFixup)
CreateEmptyStyleData(eStyleStruct_Border);
CreateEmptyStyleData(eStyleStruct_Padding);
}
if (disp->IsRubyDisplayType()) {
// Per CSS Ruby spec section Bidi Reordering, for all ruby boxes,
// the 'normal' and 'embed' values of 'unicode-bidi' should compute to
// 'isolate', and 'bidi-override' should compute to 'isolate-override'.
const nsStyleTextReset* textReset = StyleTextReset();
uint8_t unicodeBidi = textReset->mUnicodeBidi;
if (unicodeBidi == NS_STYLE_UNICODE_BIDI_NORMAL ||
unicodeBidi == NS_STYLE_UNICODE_BIDI_EMBED) {
unicodeBidi = NS_STYLE_UNICODE_BIDI_ISOLATE;
} else if (unicodeBidi == NS_STYLE_UNICODE_BIDI_OVERRIDE) {
unicodeBidi = NS_STYLE_UNICODE_BIDI_ISOLATE_OVERRIDE;
}
if (unicodeBidi != textReset->mUnicodeBidi) {
auto mutableTextReset = static_cast<nsStyleTextReset*>(
GetUniqueStyleData(eStyleStruct_TextReset));
mutableTextReset->mUnicodeBidi = unicodeBidi;
}
}
// Elements with display:inline whose writing-mode is orthogonal to their
// parent's mode will be converted to display:inline-block.

View File

@ -76,18 +76,23 @@
@supports (display:ruby) {
*|*::-moz-ruby {
display: ruby;
unicode-bidi: -moz-isolate;
}
*|*::-moz-ruby-base {
display: ruby-base;
unicode-bidi: -moz-isolate;
}
*|*::-moz-ruby-text {
display: ruby-text;
unicode-bidi: -moz-isolate;
}
*|*::-moz-ruby-base-container {
display: ruby-base-container;
unicode-bidi: -moz-isolate;
}
*|*::-moz-ruby-text-container {
display: ruby-text-container;
unicode-bidi: -moz-isolate;
}
}