mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Support for unicode-bidi: -moz-isolate and -moz-plaintext in style system. Bug 613149, r=dbaron
This commit is contained in:
parent
faff8b349f
commit
5aadea5d7b
@ -523,7 +523,7 @@ nsBidiPresUtils::Resolve(nsBlockFrame* aBlockFrame)
|
||||
// TraverseFrames.
|
||||
const nsStyleTextReset* text = aBlockFrame->GetStyleTextReset();
|
||||
PRUnichar ch = 0;
|
||||
if (text->mUnicodeBidi == NS_STYLE_UNICODE_BIDI_OVERRIDE) {
|
||||
if (text->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_OVERRIDE) {
|
||||
const nsStyleVisibility* vis = aBlockFrame->GetStyleVisibility();
|
||||
if (NS_STYLE_DIRECTION_RTL == vis->mDirection) {
|
||||
ch = kRLO;
|
||||
@ -833,25 +833,20 @@ nsBidiPresUtils::TraverseFrames(nsBlockFrame* aBlockFrame,
|
||||
if (frame->IsFrameOfType(nsIFrame::eBidiInlineContainer)) {
|
||||
const nsStyleVisibility* vis = frame->GetStyleVisibility();
|
||||
const nsStyleTextReset* text = frame->GetStyleTextReset();
|
||||
switch (text->mUnicodeBidi) {
|
||||
case NS_STYLE_UNICODE_BIDI_NORMAL:
|
||||
break;
|
||||
case NS_STYLE_UNICODE_BIDI_EMBED:
|
||||
if (NS_STYLE_DIRECTION_RTL == vis->mDirection) {
|
||||
ch = kRLE;
|
||||
}
|
||||
else if (NS_STYLE_DIRECTION_LTR == vis->mDirection) {
|
||||
ch = kLRE;
|
||||
}
|
||||
break;
|
||||
case NS_STYLE_UNICODE_BIDI_OVERRIDE:
|
||||
if (NS_STYLE_DIRECTION_RTL == vis->mDirection) {
|
||||
ch = kRLO;
|
||||
}
|
||||
else if (NS_STYLE_DIRECTION_LTR == vis->mDirection) {
|
||||
ch = kLRO;
|
||||
}
|
||||
break;
|
||||
if (text->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_OVERRIDE) {
|
||||
if (NS_STYLE_DIRECTION_RTL == vis->mDirection) {
|
||||
ch = kRLO;
|
||||
}
|
||||
else if (NS_STYLE_DIRECTION_LTR == vis->mDirection) {
|
||||
ch = kLRO;
|
||||
}
|
||||
} else if (text->mUnicodeBidi & NS_STYLE_UNICODE_BIDI_EMBED) {
|
||||
if (NS_STYLE_DIRECTION_RTL == vis->mDirection) {
|
||||
ch = kRLE;
|
||||
}
|
||||
else if (NS_STYLE_DIRECTION_LTR == vis->mDirection) {
|
||||
ch = kLRE;
|
||||
}
|
||||
}
|
||||
|
||||
// Add a dummy frame pointer representing a bidi control code before the
|
||||
|
@ -717,9 +717,11 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
|
||||
#define NS_STYLE_LINE_HEIGHT_BLOCK_HEIGHT 0
|
||||
|
||||
// See nsStyleText
|
||||
#define NS_STYLE_UNICODE_BIDI_NORMAL 0
|
||||
#define NS_STYLE_UNICODE_BIDI_EMBED 1
|
||||
#define NS_STYLE_UNICODE_BIDI_OVERRIDE 2
|
||||
#define NS_STYLE_UNICODE_BIDI_NORMAL 0x0
|
||||
#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_PLAINTEXT 0x8
|
||||
|
||||
// See nsStyleTable (here for HTML 4.0 for now, should probably change to side flags)
|
||||
#define NS_STYLE_TABLE_FRAME_NONE 0
|
||||
|
@ -127,6 +127,7 @@ CSS_KEY(-moz-initial, _moz_initial)
|
||||
CSS_KEY(-moz-inline-box, _moz_inline_box)
|
||||
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-japanese-formal, _moz_japanese_formal)
|
||||
CSS_KEY(-moz-japanese-informal, _moz_japanese_informal)
|
||||
CSS_KEY(-moz-kannada, _moz_kannada)
|
||||
@ -158,6 +159,7 @@ CSS_KEY(-moz-none, _moz_none)
|
||||
CSS_KEY(-moz-oddtreerow, _moz_oddtreerow)
|
||||
CSS_KEY(-moz-oriya, _moz_oriya)
|
||||
CSS_KEY(-moz-persian, _moz_persian)
|
||||
CSS_KEY(-moz-plaintext, _moz_plaintext)
|
||||
CSS_KEY(-moz-popup, _moz_popup)
|
||||
CSS_KEY(-moz-pull-down-menu, _moz_pull_down_menu)
|
||||
CSS_KEY(-moz-right, _moz_right)
|
||||
|
@ -519,6 +519,7 @@ 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);
|
||||
@ -5604,6 +5605,8 @@ 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;
|
||||
@ -8186,6 +8189,33 @@ 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()
|
||||
{
|
||||
|
@ -2360,8 +2360,9 @@ CSS_PROP_TEXTRESET(
|
||||
unicode-bidi,
|
||||
unicode_bidi,
|
||||
UnicodeBidi,
|
||||
CSS_PROPERTY_PARSE_VALUE,
|
||||
VARIANT_HK,
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_VALUE_PARSER_FUNCTION,
|
||||
0,
|
||||
kUnicodeBidiKTable,
|
||||
CSS_PROP_NO_OFFSET,
|
||||
eStyleAnimType_None)
|
||||
|
@ -1259,6 +1259,8 @@ const PRInt32 nsCSSProps::kUnicodeBidiKTable[] = {
|
||||
eCSSKeyword_normal, NS_STYLE_UNICODE_BIDI_NORMAL,
|
||||
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_plaintext, NS_STYLE_UNICODE_BIDI_PLAINTEXT,
|
||||
eCSSKeyword_UNKNOWN,-1
|
||||
};
|
||||
|
||||
|
@ -869,6 +869,20 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult) const
|
||||
aResult);
|
||||
}
|
||||
}
|
||||
else if (eCSSProperty_unicode_bidi == aProperty) {
|
||||
PR_STATIC_ASSERT(NS_STYLE_UNICODE_BIDI_NORMAL == 0);
|
||||
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);
|
||||
|
@ -2632,13 +2632,25 @@ nsComputedDOMStyle::DoGetDirection()
|
||||
return val;
|
||||
}
|
||||
|
||||
PR_STATIC_ASSERT(NS_STYLE_UNICODE_BIDI_NORMAL == 0);
|
||||
|
||||
nsIDOMCSSValue*
|
||||
nsComputedDOMStyle::DoGetUnicodeBidi()
|
||||
{
|
||||
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
||||
val->SetIdent(
|
||||
nsCSSProps::ValueToKeywordEnum(GetStyleTextReset()->mUnicodeBidi,
|
||||
nsCSSProps::kUnicodeBidiKTable));
|
||||
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);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
|
@ -2667,8 +2667,8 @@ var gCSSProperties = {
|
||||
inherited: false,
|
||||
type: CSS_TYPE_LONGHAND,
|
||||
initial_values: [ "normal" ],
|
||||
other_values: [ "embed", "bidi-override" ],
|
||||
invalid_values: [ "auto", "none" ]
|
||||
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" ]
|
||||
},
|
||||
"vertical-align": {
|
||||
domProp: "verticalAlign",
|
||||
|
@ -1585,7 +1585,7 @@ nsSVGGlyphFrame::EnsureTextRun(float *aDrawScale, float *aMetricsScale,
|
||||
|
||||
// Get the unicodeBidi property from the parent, because it doesn't
|
||||
// inherit
|
||||
bool bidiOverride = (mParent->GetStyleTextReset()->mUnicodeBidi ==
|
||||
bool bidiOverride = !!(mParent->GetStyleTextReset()->mUnicodeBidi &
|
||||
NS_STYLE_UNICODE_BIDI_OVERRIDE);
|
||||
nsBidiLevel baseDirection =
|
||||
GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL ?
|
||||
|
Loading…
Reference in New Issue
Block a user