Bug 1370802: There's actually no need for lang to be lowercased. r=heycam

MozReview-Commit-ID: KwtbLqR9Y81

--HG--
extra : rebase_source : 644eadfb0d20e5ee5e1b26eab348903e8033b868
This commit is contained in:
Emilio Cobos Álvarez 2017-06-17 02:27:59 +02:00
Родитель fcca8a7219
Коммит f7a6c272b7
3 изменённых файлов: 3 добавлений и 26 удалений

Просмотреть файл

@ -1224,19 +1224,8 @@ MapLangAttributeInto(const nsMappedAttributes* aAttributes, GenericSpecifiedValu
}
MOZ_ASSERT(langValue->Type() == nsAttrValue::eAtom);
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Font))) {
nsIAtom* atom = langValue->GetAtomValue();
const nsDependentAtomString atomString(atom);
Maybe<nsCOMPtr<nsIAtom>> lowerAtom;
if (nsContentUtils::StringContainsASCIIUpper(atomString)) {
nsAutoString dest;
dest.SetCapacity(atomString.Length());
nsContentUtils::ASCIIToLower(atomString, dest);
lowerAtom.emplace(NS_AtomizeMainThread(dest));
}
aData->SetIdentAtomValueIfUnset(
eCSSProperty__x_lang, lowerAtom ? lowerAtom->get() : atom);
aData->SetIdentAtomValueIfUnset(eCSSProperty__x_lang,
langValue->GetAtomValue());
}
if (aData->ShouldComputeStyleStruct(NS_STYLE_INHERIT_BIT(Text))) {
if (!aData->PropertyIsSet(eCSSProperty_text_emphasis_position)) {

Просмотреть файл

@ -593,17 +593,8 @@ nsHTMLStyleSheet::CalculateMappedServoDeclarations(nsPresContext* aPresContext)
nsIStyleRule*
nsHTMLStyleSheet::LangRuleFor(const nsIAtom* aLanguage)
{
Maybe<nsCOMPtr<nsIAtom>> lowerAtom;
nsDependentAtomString langString(aLanguage);
if (nsContentUtils::StringContainsASCIIUpper(langString)) {
nsString dest;
nsContentUtils::ASCIIToLower(langString, dest);
lowerAtom.emplace(NS_AtomizeMainThread(dest));
}
const nsIAtom* key = lowerAtom ? *lowerAtom : aLanguage;
auto entry =
static_cast<LangRuleTableEntry*>(mLangRuleTable.Add(key, fallible));
static_cast<LangRuleTableEntry*>(mLangRuleTable.Add(aLanguage, fallible));
if (!entry) {
NS_ASSERTION(false, "out of memory");
return nullptr;

Просмотреть файл

@ -3607,9 +3607,6 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, GeckoStyleContext* aContext,
// This is not a real CSS property, it is an HTML attribute mapped to CSS.
const nsCSSValue* langValue = aRuleData->ValueForLang();
if (eCSSUnit_AtomIdent == langValue->GetUnit()) {
MOZ_ASSERT(!nsContentUtils::StringContainsASCIIUpper(
nsDependentAtomString(langValue->GetAtomValue())));
aFont->mLanguage = langValue->GetAtomValue();
aFont->mExplicitLanguage = true;
}