mirror of
https://github.com/servo/servo.git
synced 2025-06-18 05:14:28 +00:00
13894 Use Unicode Segmentation's graphemes
Add test with multi-character grapheme Run cargo update
This commit is contained in:
parent
bfd966f819
commit
06db231f5f
7 changed files with 32 additions and 1 deletions
7
components/servo/Cargo.lock
generated
7
components/servo/Cargo.lock
generated
|
@ -2300,6 +2300,7 @@ dependencies = [
|
|||
"string_cache 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style_traits 0.0.1",
|
||||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-segmentation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"walkdir 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2473,6 +2474,11 @@ dependencies = [
|
|||
"harfbuzz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.0.3"
|
||||
|
@ -2987,6 +2993,7 @@ dependencies = [
|
|||
"checksum unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c1f7ceb96afdfeedee42bade65a0d585a6a0106f681b6749c8ff4daa8df30b3f"
|
||||
"checksum unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "26643a2f83bac55f1976fb716c10234485f9202dcd65cfbdf9da49867b271172"
|
||||
"checksum unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e5430ae21ef212551680d0021fc7dbd936e8b268c5ea8fdae8814e0b2496d80f"
|
||||
"checksum unicode-segmentation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b905d0fc2a1f0befd86b0e72e31d1787944efef9d38b9358a9e92a69757f7e3b"
|
||||
"checksum unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "36dff09cafb4ec7c8cf0023eb0b686cb6ce65499116a12201c9e11840ca01beb"
|
||||
"checksum unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91"
|
||||
"checksum url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afe9ec54bc4db14bc8744b7fed060d785ac756791450959b2248443319d5b119"
|
||||
|
|
|
@ -53,6 +53,7 @@ smallvec = "0.1"
|
|||
string_cache = {version = "0.2.26", features = ["heap_size"], optional = true}
|
||||
style_traits = {path = "../style_traits"}
|
||||
time = "0.1"
|
||||
unicode-segmentation = "0.1.2"
|
||||
url = "1.2"
|
||||
util = {path = "../util"}
|
||||
plugins = {path = "../plugins", optional = true}
|
||||
|
|
|
@ -87,6 +87,8 @@ extern crate smallvec;
|
|||
#[macro_use]
|
||||
extern crate style_traits;
|
||||
extern crate time;
|
||||
#[allow(unused_extern_crates)]
|
||||
extern crate unicode_segmentation;
|
||||
extern crate url;
|
||||
extern crate util;
|
||||
|
||||
|
|
|
@ -741,6 +741,7 @@ ${helpers.single_keyword("text-align-last",
|
|||
use computed_values::writing_mode::T as writing_mode;
|
||||
use cssparser::ToCss;
|
||||
use std::fmt;
|
||||
use unicode_segmentation::UnicodeSegmentation;
|
||||
use values::LocalToCss;
|
||||
use values::NoViewportPercentage;
|
||||
|
||||
|
@ -889,7 +890,9 @@ ${helpers.single_keyword("text-align-last",
|
|||
},
|
||||
SpecifiedValue::None => computed_value::T::None,
|
||||
SpecifiedValue::String(ref s) => {
|
||||
let string = s.chars().next().as_ref().map(ToString::to_string).unwrap_or_default();
|
||||
// Passing `true` to iterate over extended grapheme clusters, following
|
||||
// recommendation at http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries
|
||||
let string = s.graphemes(true).next().unwrap_or("").to_string();
|
||||
computed_value::T::String(string)
|
||||
}
|
||||
}
|
||||
|
|
7
ports/cef/Cargo.lock
generated
7
ports/cef/Cargo.lock
generated
|
@ -2183,6 +2183,7 @@ dependencies = [
|
|||
"string_cache 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style_traits 0.0.1",
|
||||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-segmentation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"walkdir 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -2338,6 +2339,11 @@ dependencies = [
|
|||
"harfbuzz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.0.3"
|
||||
|
@ -2839,6 +2845,7 @@ dependencies = [
|
|||
"checksum unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c1f7ceb96afdfeedee42bade65a0d585a6a0106f681b6749c8ff4daa8df30b3f"
|
||||
"checksum unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "26643a2f83bac55f1976fb716c10234485f9202dcd65cfbdf9da49867b271172"
|
||||
"checksum unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e5430ae21ef212551680d0021fc7dbd936e8b268c5ea8fdae8814e0b2496d80f"
|
||||
"checksum unicode-segmentation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b905d0fc2a1f0befd86b0e72e31d1787944efef9d38b9358a9e92a69757f7e3b"
|
||||
"checksum unicode-xid 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "36dff09cafb4ec7c8cf0023eb0b686cb6ce65499116a12201c9e11840ca01beb"
|
||||
"checksum unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91"
|
||||
"checksum url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afe9ec54bc4db14bc8744b7fed060d785ac756791450959b2248443319d5b119"
|
||||
|
|
7
ports/geckolib/Cargo.lock
generated
7
ports/geckolib/Cargo.lock
generated
|
@ -394,6 +394,7 @@ dependencies = [
|
|||
"smallvec 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"style_traits 0.0.1",
|
||||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-segmentation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"walkdir 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -469,6 +470,11 @@ name = "unicode-normalization"
|
|||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "unreachable"
|
||||
version = "0.1.1"
|
||||
|
@ -587,6 +593,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
"checksum time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)" = "3c7ec6d62a20df54e07ab3b78b9a3932972f4b7981de295563686849eb3989af"
|
||||
"checksum unicode-bidi 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c1f7ceb96afdfeedee42bade65a0d585a6a0106f681b6749c8ff4daa8df30b3f"
|
||||
"checksum unicode-normalization 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "26643a2f83bac55f1976fb716c10234485f9202dcd65cfbdf9da49867b271172"
|
||||
"checksum unicode-segmentation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b905d0fc2a1f0befd86b0e72e31d1787944efef9d38b9358a9e92a69757f7e3b"
|
||||
"checksum unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f2ae5ddb18e1c92664717616dd9549dde73f539f01bd7b77c2edb2446bdff91"
|
||||
"checksum url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afe9ec54bc4db14bc8744b7fed060d785ac756791450959b2248443319d5b119"
|
||||
"checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f"
|
||||
|
|
|
@ -43,4 +43,8 @@ fn text_emphasis_style_longhand_should_parse_properly() {
|
|||
let unicode_string = parse_longhand!(text_emphasis_style, "\"\\25B2\"");
|
||||
let unicode_string_struct = SpecifiedValue::String("▲".to_string());
|
||||
assert_eq!(unicode_string, unicode_string_struct);
|
||||
|
||||
let devanagari_string = parse_longhand!(text_emphasis_style, "\"षि\"");
|
||||
let devanagari_string_struct = SpecifiedValue::String("षि".to_string());
|
||||
assert_eq!(devanagari_string, devanagari_string_struct);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue