зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1040668 followup 3 - Wrap lang attribute mapping code in NS_STYLE_INHERIT_BIT test. r=dbaron
--HG-- extra : source : 08c7fa7f0d4563c69b3a17ae676eaddfed237034
This commit is contained in:
Родитель
a258f02037
Коммит
cc43119a67
|
@ -1301,6 +1301,43 @@ nsGenericHTMLElement::ParseScrollingValue(const nsAString& aString,
|
|||
return aResult.ParseEnumValue(aString, kScrollingTable, false);
|
||||
}
|
||||
|
||||
static inline void
|
||||
MapLangAttributeInto(const nsMappedAttributes* aAttributes, nsRuleData* aData)
|
||||
{
|
||||
if (!(aData->mSIDs & (NS_STYLE_INHERIT_BIT(Font) |
|
||||
NS_STYLE_INHERIT_BIT(Text)))) {
|
||||
return;
|
||||
}
|
||||
|
||||
const nsAttrValue* langValue = aAttributes->GetAttr(nsGkAtoms::lang);
|
||||
if (!langValue || langValue->Type() != nsAttrValue::eString) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Font)) {
|
||||
nsCSSValue* lang = aData->ValueForLang();
|
||||
if (lang->GetUnit() == eCSSUnit_Null) {
|
||||
lang->SetStringValue(langValue->GetStringValue(), eCSSUnit_Ident);
|
||||
}
|
||||
}
|
||||
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Text)) {
|
||||
nsCSSValue* emphasisPos = aData->ValueForTextEmphasisPosition();
|
||||
if (emphasisPos->GetUnit() == eCSSUnit_Null) {
|
||||
const nsAString& lang = langValue->GetStringValue();
|
||||
if (nsStyleUtil::MatchesLanguagePrefix(lang, MOZ_UTF16("zh"))) {
|
||||
emphasisPos->SetIntValue(NS_STYLE_TEXT_EMPHASIS_POSITION_DEFAULT_ZH,
|
||||
eCSSUnit_Enumerated);
|
||||
} else if (nsStyleUtil::MatchesLanguagePrefix(lang, MOZ_UTF16("ja")) ||
|
||||
nsStyleUtil::MatchesLanguagePrefix(lang, MOZ_UTF16("mn"))) {
|
||||
// This branch is currently no part of the spec.
|
||||
// See bug 1040668 comment 69 and comment 75.
|
||||
emphasisPos->SetIntValue(NS_STYLE_TEXT_EMPHASIS_POSITION_DEFAULT,
|
||||
eCSSUnit_Enumerated);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle attributes common to all html elements
|
||||
*/
|
||||
|
@ -1327,31 +1364,7 @@ nsGenericHTMLElement::MapCommonAttributesIntoExceptHidden(const nsMappedAttribut
|
|||
}
|
||||
}
|
||||
|
||||
const nsAttrValue* langValue = aAttributes->GetAttr(nsGkAtoms::lang);
|
||||
if (langValue && langValue->Type() == nsAttrValue::eString) {
|
||||
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Font)) {
|
||||
nsCSSValue* lang = aData->ValueForLang();
|
||||
if (lang->GetUnit() == eCSSUnit_Null) {
|
||||
lang->SetStringValue(langValue->GetStringValue(), eCSSUnit_Ident);
|
||||
}
|
||||
}
|
||||
if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Text)) {
|
||||
nsCSSValue* emphasisPos = aData->ValueForTextEmphasisPosition();
|
||||
if (emphasisPos->GetUnit() == eCSSUnit_Null) {
|
||||
const nsAString& lang = langValue->GetStringValue();
|
||||
if (nsStyleUtil::MatchesLanguagePrefix(lang, MOZ_UTF16("zh"))) {
|
||||
emphasisPos->SetIntValue(NS_STYLE_TEXT_EMPHASIS_POSITION_DEFAULT_ZH,
|
||||
eCSSUnit_Enumerated);
|
||||
} else if (nsStyleUtil::MatchesLanguagePrefix(lang, MOZ_UTF16("ja")) ||
|
||||
nsStyleUtil::MatchesLanguagePrefix(lang, MOZ_UTF16("mn"))) {
|
||||
// This branch is currently no part of the spec.
|
||||
// See bug 1040668 comment 69 and comment 75.
|
||||
emphasisPos->SetIntValue(NS_STYLE_TEXT_EMPHASIS_POSITION_DEFAULT,
|
||||
eCSSUnit_Enumerated);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
MapLangAttributeInto(aAttributes, aData);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Загрузка…
Ссылка в новой задаче