зеркало из https://github.com/mozilla/pjs.git
bug 731536 - text-transform:capitalize should affect the first alphanumeric char in a word, not the first non-punctuation char. r=smontagu
This commit is contained in:
Родитель
36c274c2bf
Коммит
4d3dc43a50
|
@ -60,16 +60,26 @@ static void
|
|||
SetupCapitalization(const PRUnichar* aWord, PRUint32 aLength,
|
||||
bool* aCapitalization)
|
||||
{
|
||||
// Capitalize the first non-punctuation character after a space or start
|
||||
// Capitalize the first alphanumeric character after a space or start
|
||||
// of the word.
|
||||
// The only space character a word can contain is NBSP.
|
||||
bool capitalizeNextChar = true;
|
||||
for (PRUint32 i = 0; i < aLength; ++i) {
|
||||
if (capitalizeNextChar && !nsContentUtils::IsFirstLetterPunctuation(aWord[i])) {
|
||||
aCapitalization[i] = true;
|
||||
capitalizeNextChar = false;
|
||||
PRUint32 ch = aWord[i];
|
||||
if (capitalizeNextChar) {
|
||||
if (NS_IS_HIGH_SURROGATE(ch) && i + 1 < aLength &&
|
||||
NS_IS_LOW_SURROGATE(aWord[i + 1])) {
|
||||
ch = SURROGATE_TO_UCS4(ch, aWord[i + 1]);
|
||||
}
|
||||
if (nsContentUtils::IsAlphanumeric(ch)) {
|
||||
aCapitalization[i] = true;
|
||||
capitalizeNextChar = false;
|
||||
}
|
||||
if (!IS_IN_BMP(ch)) {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
if (aWord[i] == 0xA0 /*NBSP*/) {
|
||||
if (ch == 0xA0 /*NBSP*/) {
|
||||
capitalizeNextChar = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -245,7 +245,7 @@
|
|||
Ʋx
|
||||
Ʌx
|
||||
Ʒx
|
||||
Ιx
|
||||
ͅX<!-- combining Greek ypogegrammeni - category Mn, doesn't get titlecased -->
|
||||
Ͱx
|
||||
Ͳx
|
||||
Ͷx
|
||||
|
@ -732,32 +732,32 @@
|
|||
Ⅾx
|
||||
Ⅿx
|
||||
Ↄx
|
||||
Ⓐx
|
||||
Ⓑx
|
||||
Ⓒx
|
||||
Ⓓx
|
||||
Ⓔx
|
||||
Ⓕx
|
||||
Ⓖx
|
||||
Ⓗx
|
||||
Ⓘx
|
||||
Ⓙx
|
||||
Ⓚx
|
||||
Ⓛx
|
||||
Ⓜx
|
||||
Ⓝx
|
||||
Ⓞx
|
||||
Ⓟx
|
||||
Ⓠx
|
||||
Ⓡx
|
||||
Ⓢx
|
||||
Ⓣx
|
||||
Ⓤx
|
||||
Ⓥx
|
||||
Ⓦx
|
||||
Ⓧx
|
||||
Ⓨx
|
||||
Ⓩx
|
||||
ⓐX<!-- circled Latin small letters - category So - not titlecased -->
|
||||
ⓑX
|
||||
ⓒX
|
||||
ⓓX
|
||||
ⓔX
|
||||
ⓕX
|
||||
ⓖX
|
||||
ⓗX
|
||||
ⓘX
|
||||
ⓙX
|
||||
ⓚX
|
||||
ⓛX
|
||||
ⓜX
|
||||
ⓝX
|
||||
ⓞX
|
||||
ⓟX
|
||||
ⓠX
|
||||
ⓡX
|
||||
ⓢX
|
||||
ⓣX
|
||||
ⓤX
|
||||
ⓥX
|
||||
ⓦX
|
||||
ⓧX
|
||||
ⓨX
|
||||
ⓩX<!-- end of circled Latin small letters -->
|
||||
Ⰰx
|
||||
Ⰱx
|
||||
Ⰲx
|
||||
|
|
|
@ -248,7 +248,7 @@
|
|||
ʋx
|
||||
ʌx
|
||||
ʒx
|
||||
ͅx
|
||||
ͅx<!-- combining Greek ypogegrammeni - category Mn, doesn't get titlecased -->
|
||||
ͱx
|
||||
ͳx
|
||||
ͷx
|
||||
|
@ -735,7 +735,7 @@
|
|||
ⅾx
|
||||
ⅿx
|
||||
ↄx
|
||||
ⓐx
|
||||
ⓐx<!-- circled Latin small letters - category So - not titlecased -->
|
||||
ⓑx
|
||||
ⓒx
|
||||
ⓓx
|
||||
|
@ -760,7 +760,7 @@
|
|||
ⓦx
|
||||
ⓧx
|
||||
ⓨx
|
||||
ⓩx
|
||||
ⓩx<!-- end of circled Latin small letters -->
|
||||
ⰰx
|
||||
ⰱx
|
||||
ⰲx
|
||||
|
|
Загрузка…
Ссылка в новой задаче