Bug 1827604 - Special-case the apostrophe characters in text-transform:capitalize heuristics. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D175248
This commit is contained in:
Jonathan Kew 2023-04-12 20:07:18 +00:00
Родитель b02bbc7d96
Коммит 9404d81ceb
3 изменённых файлов: 17 добавлений и 2 удалений

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

@ -68,9 +68,7 @@ static void SetupCapitalization(const char16_t* aWord, uint32_t aLength,
case GeneralCategory::Line_Separator:
case GeneralCategory::Paragraph_Separator:
case GeneralCategory::Dash_Punctuation:
case GeneralCategory::Other_Punctuation:
case GeneralCategory::Initial_Punctuation:
case GeneralCategory::Final_Punctuation:
/* These punctuation categories are excluded, for examples like
* "what colo[u]r" -> "What Colo[u]r?" (rather than "What Colo[U]R?")
* and
@ -81,6 +79,19 @@ static void SetupCapitalization(const char16_t* aWord, uint32_t aLength,
*/
capitalizeNextChar = true;
break;
case GeneralCategory::Final_Punctuation:
/* Special-case: exclude Unicode single-close-quote/apostrophe,
for examples like "Lowes" etc. */
if (ch != 0x2019) {
capitalizeNextChar = true;
}
break;
case GeneralCategory::Other_Punctuation:
/* Special-case: exclude ASCII apostrophe, for "Lowe's" etc. */
if (ch != '\'') {
capitalizeNextChar = true;
}
break;
default:
break;
}

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

@ -7,3 +7,5 @@ Snake_case
Kebab-Case
Colo[u]r
Pass/Fail
Lowe's
Blacks

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

@ -7,3 +7,5 @@ snake_case
kebab-case
colo[u]r
pass/fail
lowe's
blacks