Bug 820902. nsAttrValue::Equals should do ASCII-case-insensitive compares when it's doing case-insensitive compares. r=sicking

This commit is contained in:
Boris Zbarsky 2012-12-13 17:08:44 -05:00
Родитель aad442ab75
Коммит 7516b78554
4 изменённых файлов: 58 добавлений и 4 удалений

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

@ -1066,7 +1066,7 @@ nsAttrValue::Equals(const nsAString& aValue,
nsDependentString dep(static_cast<PRUnichar*>(str->Data()),
str->StorageSize()/sizeof(PRUnichar) - 1);
return aCaseSensitive == eCaseMatters ? aValue.Equals(dep) :
aValue.Equals(dep, nsCaseInsensitiveStringComparator());
nsContentUtils::EqualsIgnoreASCIICase(aValue, dep);
}
return aValue.IsEmpty();
}
@ -1074,8 +1074,9 @@ nsAttrValue::Equals(const nsAString& aValue,
if (aCaseSensitive == eCaseMatters) {
return static_cast<nsIAtom*>(GetPtr())->Equals(aValue);
}
return nsDependentAtomString(static_cast<nsIAtom*>(GetPtr())).
Equals(aValue, nsCaseInsensitiveStringComparator());
return nsContentUtils::EqualsIgnoreASCIICase(
nsDependentAtomString(static_cast<nsIAtom*>(GetPtr())),
aValue);
default:
break;
}
@ -1083,7 +1084,7 @@ nsAttrValue::Equals(const nsAString& aValue,
nsAutoString val;
ToString(val);
return aCaseSensitive == eCaseMatters ? val.Equals(aValue) :
val.Equals(aValue, nsCaseInsensitiveStringComparator());
nsContentUtils::EqualsIgnoreASCIICase(val, aValue);
}
bool

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

@ -0,0 +1,26 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
.ascii > span {
background-color: yellow;
}
</style>
</head>
<body>
<div class="ascii"><span lang="paSSfield-killroyß">case-sensitive</span></div>
<div class="ascii"><span lang="passfield-killroyß">lowercase</span></div>
<div class="ascii"><span lang="PASSFIELD-KILLROYß">uppercase</span></div>
<div class="nonascii"><span lang="paſſfield-killroyß">small long s (C)</span></div>
<div class="nonascii"><span lang="passfield-&#x212a;illroyß">kelvin sign (C)</span></div>
<div class="nonascii"><span lang="paßfield-killroyß">small sharp s (F)</span></div>
<div class="nonascii"><span lang="paẞfield-killroyß">capital sharp s (F)</span></div>
<div class="nonascii"><span lang="passfield-killroyẞ">capital sharp s (S)</span></div>
<div class="nonascii"><span lang="passfield-killroyß">fi ligature (U+fb01) (F)</span></div>
<div class="nonascii"><span lang="passfıeld-killroyß"> dotless i (T)</span></div>
<div class="nonascii"><span lang="passfİeld-killroyß">dotted I (T)</span></div>
</body>
</html>

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

@ -0,0 +1,26 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<style type="text/css">
span[lang="paSSfield-killroyß"] {
background-color: yellow;
}
</style>
</head>
<body>
<div class="ascii"><span lang="paSSfield-killroyß">case-sensitive</span></div>
<div class="ascii"><span lang="passfield-killroyß">lowercase</span></div>
<div class="ascii"><span lang="PASSFIELD-KILLROYß">uppercase</span></div>
<div class="nonascii"><span lang="paſſfield-killroyß">small long s (C)</span></div>
<div class="nonascii"><span lang="passfield-&#x212a;illroyß">kelvin sign (C)</span></div>
<div class="nonascii"><span lang="paßfield-killroyß">small sharp s (F)</span></div>
<div class="nonascii"><span lang="paẞfield-killroyß">capital sharp s (F)</span></div>
<div class="nonascii"><span lang="passfield-killroyẞ">capital sharp s (S)</span></div>
<div class="nonascii"><span lang="passfield-killroyß">fi ligature (U+fb01) (F)</span></div>
<div class="nonascii"><span lang="passfıeld-killroyß"> dotless i (T)</span></div>
<div class="nonascii"><span lang="passfİeld-killroyß">dotted I (T)</span></div>
</body>
</html>

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

@ -1 +1,2 @@
== state-dependent-in-any.html state-dependent-in-any-ref.html
== attr-case-insensitive-1.html attr-case-insensitive-1-ref.html