mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Correctly handle length-changing mappings in text-transform
This commit is contained in:
parent
e74825f9fd
commit
bb3d3db333
5 changed files with 27 additions and 9 deletions
|
@ -503,8 +503,9 @@ impl RunMapping {
|
|||
|
||||
/// Accounts for `text-transform`.
|
||||
///
|
||||
/// FIXME(#4311, pcwalton): Case mapping can change length of the string; case mapping should
|
||||
/// be language-specific; `full-width`; use graphemes instead of characters.
|
||||
/// FIXME(#4311, pcwalton): Title-case mapping can change length of the string;
|
||||
/// case mapping should be language-specific; `full-width`;
|
||||
/// use graphemes instead of characters.
|
||||
fn apply_style_transform_if_necessary(string: &mut String,
|
||||
first_character_position: usize,
|
||||
text_transform: text_transform::T)
|
||||
|
@ -515,8 +516,8 @@ fn apply_style_transform_if_necessary(string: &mut String,
|
|||
let original = string[first_character_position..].to_owned();
|
||||
string.truncate(first_character_position);
|
||||
let mut count = 0;
|
||||
for character in original.chars() {
|
||||
string.push(character.to_uppercase().next().unwrap());
|
||||
for ch in original.chars().flat_map(|ch| ch.to_uppercase()) {
|
||||
string.push(ch);
|
||||
count += 1;
|
||||
}
|
||||
count
|
||||
|
@ -525,8 +526,8 @@ fn apply_style_transform_if_necessary(string: &mut String,
|
|||
let original = string[first_character_position..].to_owned();
|
||||
string.truncate(first_character_position);
|
||||
let mut count = 0;
|
||||
for character in original.chars() {
|
||||
string.push(character.to_lowercase().next().unwrap());
|
||||
for ch in original.chars().flat_map(|ch| ch.to_lowercase()) {
|
||||
string.push(ch);
|
||||
count += 1;
|
||||
}
|
||||
count
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html><head></head><body>
|
||||
<span style="font-size:32px">i̇i</span>
|
||||
</body></html>
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||
<html><head><title>CSS Test: text-transform: LATIN CAPITAL LETTER I WITH DOT ABOVE</title>
|
||||
<link rel="match" href="reference/text-transform-lowercase-002-ref.htm">
|
||||
</head><body>
|
||||
<span style="font-size:32px;text-transform:lowercase">İI</span>
|
||||
</body></html>
|
|
@ -180052,6 +180052,16 @@
|
|||
],
|
||||
"url": "/css21_dev/html4/text-transform-lowercase-001.htm"
|
||||
},
|
||||
{
|
||||
"path": "css21_dev/html4/text-transform-lowercase-002.htm",
|
||||
"references": [
|
||||
[
|
||||
"/css21_dev/html4/reference/text-transform-lowercase-002-ref.htm",
|
||||
"=="
|
||||
]
|
||||
],
|
||||
"url": "/css21_dev/html4/text-transform-lowercase-002.htm"
|
||||
},
|
||||
{
|
||||
"path": "css21_dev/html4/text-transform-uppercase-001.htm",
|
||||
"references": [
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
[text-transform-uppercase-002.htm]
|
||||
type: reftest
|
||||
expected: FAIL
|
Loading…
Add table
Add a link
Reference in a new issue