Bug 1396450 - Don't apply ToLowerCase to font feature identifiers used in @font-feature-values rules, as the spec says they're case sensitive. r=xidorn

This commit is contained in:
Jonathan Kew 2018-05-14 10:05:25 +01:00
Родитель f5fa8a68b9
Коммит dba372ac43
5 изменённых файлов: 15 добавлений и 12 удалений

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

@ -20,10 +20,9 @@ gfxFontFeatureValueSet::GetFontFeatureValuesFor(const nsAString& aFamily,
const nsAString& aName, const nsAString& aName,
nsTArray<uint32_t>& aValues) nsTArray<uint32_t>& aValues)
{ {
nsAutoString family(aFamily), name(aName); nsAutoString family(aFamily);
ToLowerCase(family); ToLowerCase(family);
ToLowerCase(name); FeatureValueHashKey key(family, aVariantProperty, aName);
FeatureValueHashKey key(family, aVariantProperty, name);
aValues.Clear(); aValues.Clear();
FeatureValueHashEntry *entry = mFontFeatureValues.GetEntry(key); FeatureValueHashEntry *entry = mFontFeatureValues.GetEntry(key);
@ -64,9 +63,7 @@ gfxFontFeatureValueSet::AppendFeatureValueHashEntry(const nsAString& aFamily,
const nsAString& aName, const nsAString& aName,
uint32_t aAlternate) uint32_t aAlternate)
{ {
nsAutoString name(aName); FeatureValueHashKey key(aFamily, aAlternate, aName);
ToLowerCase(name);
FeatureValueHashKey key(aFamily, aAlternate, name);
FeatureValueHashEntry *entry = mFontFeatureValues.PutEntry(key); FeatureValueHashEntry *entry = mFontFeatureValues.PutEntry(key);
entry->mKey = key; entry->mKey = key;
return &entry->mValues; return &entry->mValues;

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

@ -17,6 +17,9 @@ span {
font-feature-settings: "ss05"; /* crossed W */ font-feature-settings: "ss05"; /* crossed W */
} }
/* tests that should NOT use the feature, due to case-sensitivity of font-feature-values names */
#test2, #test3 { font-feature-settings: "ss05" off; }
</style> </style>
</head> </head>
<body lang="en"> <body lang="en">

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

@ -58,13 +58,13 @@ div { margin: 0 20px; }
} }
#test2 { #test2 {
/* testing case-insensitivity of styleset name */ /* testing case-sensitivity of styleset name */
font-family: fontB; font-family: fontB;
font-variant-alternates: styleset(altW); font-variant-alternates: styleset(altW);
} }
#test3 { #test3 {
/* testing case-insensitivity of styleset name */ /* testing case-sensitivity of styleset name */
font-family: fontB; font-family: fontB;
font-variant-alternates: styleset(ALTW); font-variant-alternates: styleset(ALTW);
} }
@ -72,7 +72,7 @@ div { margin: 0 20px; }
#test4 { #test4 {
/* testing escapes in styleset name */ /* testing escapes in styleset name */
font-family: fontB; font-family: fontB;
font-variant-alternates: styleset(\41 ltW); font-variant-alternates: styleset(\41 lTw);
} }
#test5 { #test5 {

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

@ -19,6 +19,9 @@ span {
font-feature-settings: "ss05"; /* crossed W */ font-feature-settings: "ss05"; /* crossed W */
} }
/* tests that should NOT use the feature, due to case-sensitivity of font-feature-values names */
#test2, #test3 { font-feature-settings: "ss05" off; }
</style> </style>
</head> </head>
<body lang="en"> <body lang="en">

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

@ -65,13 +65,13 @@ div { margin: 0 20px; }
} }
#test2 { #test2 {
/* testing case-insensitivity of styleset name */ /* testing case-sensitivity of styleset name */
font-family: fontB; font-family: fontB;
font-variant-alternates: styleset(altW); font-variant-alternates: styleset(altW);
} }
#test3 { #test3 {
/* testing case-insensitivity of styleset name */ /* testing case-sensitivity of styleset name */
font-family: fontB; font-family: fontB;
font-variant-alternates: styleset(ALTW); font-variant-alternates: styleset(ALTW);
} }
@ -79,7 +79,7 @@ div { margin: 0 20px; }
#test4 { #test4 {
/* testing escapes in styleset name */ /* testing escapes in styleset name */
font-family: fontB; font-family: fontB;
font-variant-alternates: styleset(\41 ltW); font-variant-alternates: styleset(\41 lTw);
} }
#test5 { #test5 {