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:
Jonathan Kew 2012-03-14 06:47:14 +00:00
Родитель 36c274c2bf
Коммит 4d3dc43a50
3 изменённых файлов: 45 добавлений и 35 удалений

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

@ -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 @@
&#x01B2;x
&#x0245;x
&#x01B7;x
&#x0399;x
&#x0345;X<!-- combining Greek ypogegrammeni - category Mn, doesn't get titlecased -->
&#x0370;x
&#x0372;x
&#x0376;x
@ -732,32 +732,32 @@
&#x216E;x
&#x216F;x
&#x2183;x
&#x24B6;x
&#x24B7;x
&#x24B8;x
&#x24B9;x
&#x24BA;x
&#x24BB;x
&#x24BC;x
&#x24BD;x
&#x24BE;x
&#x24BF;x
&#x24C0;x
&#x24C1;x
&#x24C2;x
&#x24C3;x
&#x24C4;x
&#x24C5;x
&#x24C6;x
&#x24C7;x
&#x24C8;x
&#x24C9;x
&#x24CA;x
&#x24CB;x
&#x24CC;x
&#x24CD;x
&#x24CE;x
&#x24CF;x
&#x24D0;X<!-- circled Latin small letters - category So - not titlecased -->
&#x24D1;X
&#x24D2;X
&#x24D3;X
&#x24D4;X
&#x24D5;X
&#x24D6;X
&#x24D7;X
&#x24D8;X
&#x24D9;X
&#x24DA;X
&#x24DB;X
&#x24DC;X
&#x24DD;X
&#x24DE;X
&#x24DF;X
&#x24E0;X
&#x24E1;X
&#x24E2;X
&#x24E3;X
&#x24E4;X
&#x24E5;X
&#x24E6;X
&#x24E7;X
&#x24E8;X
&#x24E9;X<!-- end of circled Latin small letters -->
&#x2C00;x
&#x2C01;x
&#x2C02;x

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

@ -248,7 +248,7 @@
&#x028B;x
&#x028C;x
&#x0292;x
&#x0345;x
&#x0345;x<!-- combining Greek ypogegrammeni - category Mn, doesn't get titlecased -->
&#x0371;x
&#x0373;x
&#x0377;x
@ -735,7 +735,7 @@
&#x217E;x
&#x217F;x
&#x2184;x
&#x24D0;x
&#x24D0;x<!-- circled Latin small letters - category So - not titlecased -->
&#x24D1;x
&#x24D2;x
&#x24D3;x
@ -760,7 +760,7 @@
&#x24E6;x
&#x24E7;x
&#x24E8;x
&#x24E9;x
&#x24E9;x<!-- end of circled Latin small letters -->
&#x2C30;x
&#x2C31;x
&#x2C32;x