Implement the new CSS property value unicode-bidi: isolate-override. Bug 774335, r=dbaron

This commit is contained in:
Simon Montagu 2012-08-07 01:42:46 -07:00
parent e09f58837c
commit 4ae7b52fd9
9 changed files with 11 additions and 64 deletions

View File

@ -742,6 +742,7 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
#define NS_STYLE_UNICODE_BIDI_EMBED 0x1
#define NS_STYLE_UNICODE_BIDI_ISOLATE 0x2
#define NS_STYLE_UNICODE_BIDI_OVERRIDE 0x4
#define NS_STYLE_UNICODE_BIDI_ISOLATE_OVERRIDE 0x6
#define NS_STYLE_UNICODE_BIDI_PLAINTEXT 0x8
// See nsStyleTable (here for HTML 4.0 for now, should probably change to side flags)

View File

@ -88,7 +88,7 @@ bdo, bdo[dir] {
unicode-bidi: bidi-override;
}
bdo[dir="auto"] {
unicode-bidi: bidi-override -moz-isolate;
unicode-bidi: -moz-isolate-override;
}
textarea[dir="auto"], pre[dir="auto"] { unicode-bidi: -moz-plaintext; }

View File

@ -101,6 +101,7 @@ CSS_KEY(-moz-inline-flex, _moz_inline_flex)
CSS_KEY(-moz-inline-grid, _moz_inline_grid)
CSS_KEY(-moz-inline-stack, _moz_inline_stack)
CSS_KEY(-moz-isolate, _moz_isolate)
CSS_KEY(-moz-isolate-override, _moz_isolate_override)
CSS_KEY(-moz-japanese-formal, _moz_japanese_formal)
CSS_KEY(-moz-japanese-informal, _moz_japanese_informal)
CSS_KEY(-moz-kannada, _moz_kannada)

View File

@ -519,7 +519,6 @@ protected:
bool ParseTextDecoration();
bool ParseTextDecorationLine(nsCSSValue& aValue);
bool ParseTextOverflow(nsCSSValue& aValue);
bool ParseUnicodeBidi(nsCSSValue& aValue);
bool ParseShadowItem(nsCSSValue& aValue, bool aIsBoxShadow);
bool ParseShadowList(nsCSSProperty aProperty);
@ -6171,8 +6170,6 @@ CSSParserImpl::ParseSingleValueProperty(nsCSSValue& aValue,
return ParseTextDecorationLine(aValue);
case eCSSProperty_text_overflow:
return ParseTextOverflow(aValue);
case eCSSProperty_unicode_bidi:
return ParseUnicodeBidi(aValue);
default:
NS_ABORT_IF_FALSE(false, "should not reach here");
return false;
@ -9291,33 +9288,6 @@ CSSParserImpl::ParseTextOverflow(nsCSSValue& aValue)
}
return true;
}
bool
CSSParserImpl::ParseUnicodeBidi(nsCSSValue& aValue)
{
if (ParseVariant(aValue, VARIANT_HK, nsCSSProps::kUnicodeBidiKTable)) {
if (eCSSUnit_Enumerated == aValue.GetUnit()) {
PRInt32 intValue = aValue.GetIntValue();
// unicode-bidi can have either one or two values, but the only legal
// combination of two values is 'isolate bidi-override'
if (intValue == NS_STYLE_UNICODE_BIDI_ISOLATE ||
intValue == NS_STYLE_UNICODE_BIDI_OVERRIDE) {
// look for more keywords
nsCSSValue second;
if (ParseEnum(second, nsCSSProps::kUnicodeBidiKTable)) {
intValue |= second.GetIntValue();
if (intValue != (NS_STYLE_UNICODE_BIDI_ISOLATE |
NS_STYLE_UNICODE_BIDI_OVERRIDE)) {
return false;
}
}
aValue.SetIntValue(intValue, eCSSUnit_Enumerated);
}
}
return true;
}
return false;
}
bool
CSSParserImpl::ParseTransitionProperty()

View File

@ -2758,10 +2758,9 @@ CSS_PROP_TEXTRESET(
unicode-bidi,
unicode_bidi,
UnicodeBidi,
CSS_PROPERTY_PARSE_VALUE |
CSS_PROPERTY_VALUE_PARSER_FUNCTION,
CSS_PROPERTY_PARSE_VALUE,
"",
0,
VARIANT_HK,
kUnicodeBidiKTable,
CSS_PROP_NO_OFFSET,
eStyleAnimType_None)

View File

@ -1370,6 +1370,7 @@ const PRInt32 nsCSSProps::kUnicodeBidiKTable[] = {
eCSSKeyword_embed, NS_STYLE_UNICODE_BIDI_EMBED,
eCSSKeyword_bidi_override, NS_STYLE_UNICODE_BIDI_OVERRIDE,
eCSSKeyword__moz_isolate, NS_STYLE_UNICODE_BIDI_ISOLATE,
eCSSKeyword__moz_isolate_override, NS_STYLE_UNICODE_BIDI_ISOLATE_OVERRIDE,
eCSSKeyword__moz_plaintext, NS_STYLE_UNICODE_BIDI_PLAINTEXT,
eCSSKeyword_UNKNOWN,-1
};

View File

@ -828,21 +828,6 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult) const
aResult);
}
}
else if (eCSSProperty_unicode_bidi == aProperty) {
MOZ_STATIC_ASSERT(NS_STYLE_UNICODE_BIDI_NORMAL == 0,
"unicode-bidi style constants not as expected");
PRInt32 intValue = GetIntValue();
if (NS_STYLE_UNICODE_BIDI_NORMAL == intValue) {
AppendASCIItoUTF16(nsCSSProps::LookupPropertyValue(aProperty, intValue),
aResult);
} else {
nsStyleUtil::AppendBitmaskCSSValue(
aProperty, intValue,
NS_STYLE_UNICODE_BIDI_EMBED,
NS_STYLE_UNICODE_BIDI_PLAINTEXT,
aResult);
}
}
else {
const nsAFlatCString& name = nsCSSProps::LookupPropertyValue(aProperty, GetIntValue());
AppendASCIItoUTF16(name, aResult);

View File

@ -2725,19 +2725,9 @@ nsIDOMCSSValue*
nsComputedDOMStyle::DoGetUnicodeBidi()
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
PRInt32 intValue = GetStyleTextReset()->mUnicodeBidi;
if (NS_STYLE_UNICODE_BIDI_NORMAL == intValue) {
val->SetIdent(eCSSKeyword_normal);
} else {
nsAutoString unicodeBidiString;
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_unicode_bidi, intValue,
NS_STYLE_UNICODE_BIDI_EMBED,
NS_STYLE_UNICODE_BIDI_PLAINTEXT,
unicodeBidiString);
val->SetString(unicodeBidiString);
}
val->SetIdent(
nsCSSProps::ValueToKeywordEnum(GetStyleTextReset()->mUnicodeBidi,
nsCSSProps::kUnicodeBidiKTable));
return val;
}

View File

@ -3387,8 +3387,8 @@ var gCSSProperties = {
inherited: false,
type: CSS_TYPE_LONGHAND,
initial_values: [ "normal" ],
other_values: [ "embed", "bidi-override", "-moz-isolate", "-moz-plaintext", "-moz-isolate bidi-override", "bidi-override -moz-isolate" ],
invalid_values: [ "auto", "none", "normal embed", "normal bidi-override", "normal -moz-isolate", "normal -moz-plaintext", "embed normal", "embed -moz-isolate", "embed bidi-override", "embed -moz-plaintext", "bidi-override normal", "bidi-override embed", "bidi-override -moz-plaintext", "-moz-isolate normal", "-moz-isolate embed", "-moz-isolate -moz-plaintext", "-moz-plaintext normal", "-moz-plaintext embed", "-moz-plaintext bidi-override", "-moz-plaintext -moz-isolate" ]
other_values: [ "embed", "bidi-override", "-moz-isolate", "-moz-plaintext", "-moz-isolate-override" ],
invalid_values: [ "auto", "none" ]
},
"vertical-align": {
domProp: "verticalAlign",