mirror of
https://github.com/servo/servo.git
synced 2025-08-08 06:55:31 +01:00
gfx: to_string() -> into_string()
This commit is contained in:
parent
3af73e9962
commit
e973213606
9 changed files with 42 additions and 42 deletions
|
@ -160,7 +160,7 @@ impl Font {
|
||||||
|
|
||||||
let glyphs = Arc::new(glyphs);
|
let glyphs = Arc::new(glyphs);
|
||||||
self.shape_cache.insert(ShapeCacheEntry {
|
self.shape_cache.insert(ShapeCacheEntry {
|
||||||
text: text.to_string(),
|
text: text.into_string(),
|
||||||
options: *options,
|
options: *options,
|
||||||
}, glyphs.clone());
|
}, glyphs.clone());
|
||||||
glyphs
|
glyphs
|
||||||
|
|
|
@ -181,7 +181,7 @@ impl FontCache {
|
||||||
// TODO(Issue #188): look up localized font family names if canonical name not found
|
// TODO(Issue #188): look up localized font family names if canonical name not found
|
||||||
// look up canonical name
|
// look up canonical name
|
||||||
if self.local_families.contains_key(family_name) {
|
if self.local_families.contains_key(family_name) {
|
||||||
debug!("FontList: Found font family with name={:s}", family_name.to_string());
|
debug!("FontList: Found font family with name={:s}", family_name.as_slice());
|
||||||
let s = &mut self.local_families[*family_name];
|
let s = &mut self.local_families[*family_name];
|
||||||
|
|
||||||
if s.templates.len() == 0 {
|
if s.templates.len() == 0 {
|
||||||
|
@ -199,7 +199,7 @@ impl FontCache {
|
||||||
|
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
debug!("FontList: Couldn't find font family with name={:s}", family_name.to_string());
|
debug!("FontList: Couldn't find font family with name={:s}", family_name.as_slice());
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,7 @@ impl FontContext {
|
||||||
|
|
||||||
if !cache_hit {
|
if !cache_hit {
|
||||||
let font_template = self.font_cache_task.get_font_template(family.name()
|
let font_template = self.font_cache_task.get_font_template(family.name()
|
||||||
.to_string(),
|
.into_string(),
|
||||||
desc.clone());
|
desc.clone());
|
||||||
match font_template {
|
match font_template {
|
||||||
Some(font_template) => {
|
Some(font_template) => {
|
||||||
|
@ -177,14 +177,14 @@ impl FontContext {
|
||||||
style.font_variant);
|
style.font_variant);
|
||||||
let layout_font = Rc::new(RefCell::new(layout_font));
|
let layout_font = Rc::new(RefCell::new(layout_font));
|
||||||
self.layout_font_cache.push(LayoutFontCacheEntry {
|
self.layout_font_cache.push(LayoutFontCacheEntry {
|
||||||
family: family.name().to_string(),
|
family: family.name().into_string(),
|
||||||
font: Some(layout_font.clone()),
|
font: Some(layout_font.clone()),
|
||||||
});
|
});
|
||||||
fonts.push(layout_font);
|
fonts.push(layout_font);
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
self.layout_font_cache.push(LayoutFontCacheEntry {
|
self.layout_font_cache.push(LayoutFontCacheEntry {
|
||||||
family: family.name().to_string(),
|
family: family.name().into_string(),
|
||||||
font: None,
|
font: None,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ impl FontTemplate {
|
||||||
};
|
};
|
||||||
|
|
||||||
FontTemplate {
|
FontTemplate {
|
||||||
identifier: identifier.to_string(),
|
identifier: identifier.into_string(),
|
||||||
descriptor: None,
|
descriptor: None,
|
||||||
weak_ref: maybe_weak_ref,
|
weak_ref: maybe_weak_ref,
|
||||||
strong_ref: maybe_strong_ref,
|
strong_ref: maybe_strong_ref,
|
||||||
|
|
|
@ -127,13 +127,13 @@ pub fn get_system_default_family(generic_name: &str) -> Option<String> {
|
||||||
#[cfg(target_os="linux")]
|
#[cfg(target_os="linux")]
|
||||||
pub fn get_last_resort_font_families() -> Vec<String> {
|
pub fn get_last_resort_font_families() -> Vec<String> {
|
||||||
vec!(
|
vec!(
|
||||||
"Fira Sans".to_string(),
|
"Fira Sans".into_string(),
|
||||||
"DejaVu Sans".to_string(),
|
"DejaVu Sans".into_string(),
|
||||||
"Arial".to_string()
|
"Arial".into_string()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os="android")]
|
#[cfg(target_os="android")]
|
||||||
pub fn get_last_resort_font_families() -> Vec<String> {
|
pub fn get_last_resort_font_families() -> Vec<String> {
|
||||||
vec!("Roboto".to_string())
|
vec!("Roboto".into_string())
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ impl FontTemplateData {
|
||||||
|
|
||||||
FontTemplateData {
|
FontTemplateData {
|
||||||
bytes: bytes,
|
bytes: bytes,
|
||||||
identifier: identifier.to_string(),
|
identifier: identifier.into_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,5 +42,5 @@ pub fn get_system_default_family(_generic_name: &str) -> Option<String> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_last_resort_font_families() -> Vec<String> {
|
pub fn get_last_resort_font_families() -> Vec<String> {
|
||||||
vec!("Arial Unicode MS".to_string(), "Arial".to_string())
|
vec!("Arial Unicode MS".into_string(), "Arial".into_string())
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ impl FontTemplateData {
|
||||||
|
|
||||||
FontTemplateData {
|
FontTemplateData {
|
||||||
ctfont: ctfont,
|
ctfont: ctfont,
|
||||||
identifier: identifier.to_string(),
|
identifier: identifier.into_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,21 +199,21 @@ fn test_transform_discard_newline() {
|
||||||
/* FIXME: Fix and re-enable
|
/* FIXME: Fix and re-enable
|
||||||
#[test]
|
#[test]
|
||||||
fn test_transform_compress_whitespace() {
|
fn test_transform_compress_whitespace() {
|
||||||
let test_strs : ~[String] = ~[" foo bar".to_string(),
|
let test_strs : ~[String] = ~[" foo bar".into_string(),
|
||||||
"foo bar ".to_string(),
|
"foo bar ".into_string(),
|
||||||
"foo\n bar".to_string(),
|
"foo\n bar".into_string(),
|
||||||
"foo \nbar".to_string(),
|
"foo \nbar".into_string(),
|
||||||
" foo bar \nbaz".to_string(),
|
" foo bar \nbaz".into_string(),
|
||||||
"foo bar baz".to_string(),
|
"foo bar baz".into_string(),
|
||||||
"foobarbaz\n\n".to_string()];
|
"foobarbaz\n\n".into_string()];
|
||||||
|
|
||||||
let oracle_strs : ~[String] = ~[" foo bar".to_string(),
|
let oracle_strs : ~[String] = ~[" foo bar".into_string(),
|
||||||
"foo bar ".to_string(),
|
"foo bar ".into_string(),
|
||||||
"foo\n bar".to_string(),
|
"foo\n bar".into_string(),
|
||||||
"foo \nbar".to_string(),
|
"foo \nbar".into_string(),
|
||||||
" foo bar \nbaz".to_string(),
|
" foo bar \nbaz".into_string(),
|
||||||
"foo bar baz".to_string(),
|
"foo bar baz".into_string(),
|
||||||
"foobarbaz\n\n".to_string()];
|
"foobarbaz\n\n".into_string()];
|
||||||
|
|
||||||
assert_eq!(test_strs.len(), oracle_strs.len());
|
assert_eq!(test_strs.len(), oracle_strs.len());
|
||||||
let mode = CompressWhitespace;
|
let mode = CompressWhitespace;
|
||||||
|
@ -227,21 +227,21 @@ fn test_transform_compress_whitespace() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_transform_compress_whitespace_newline() {
|
fn test_transform_compress_whitespace_newline() {
|
||||||
let test_strs : ~[String] = ~[" foo bar".to_string(),
|
let test_strs : ~[String] = ~[" foo bar".into_string(),
|
||||||
"foo bar ".to_string(),
|
"foo bar ".into_string(),
|
||||||
"foo\n bar".to_string(),
|
"foo\n bar".into_string(),
|
||||||
"foo \nbar".to_string(),
|
"foo \nbar".into_string(),
|
||||||
" foo bar \nbaz".to_string(),
|
" foo bar \nbaz".into_string(),
|
||||||
"foo bar baz".to_string(),
|
"foo bar baz".into_string(),
|
||||||
"foobarbaz\n\n".to_string()];
|
"foobarbaz\n\n".into_string()];
|
||||||
|
|
||||||
let oracle_strs : ~[String] = ~["foo bar".to_string(),
|
let oracle_strs : ~[String] = ~["foo bar".into_string(),
|
||||||
"foo bar ".to_string(),
|
"foo bar ".into_string(),
|
||||||
"foo bar".to_string(),
|
"foo bar".into_string(),
|
||||||
"foo bar".to_string(),
|
"foo bar".into_string(),
|
||||||
" foo bar baz".to_string(),
|
" foo bar baz".into_string(),
|
||||||
"foo bar baz".to_string(),
|
"foo bar baz".into_string(),
|
||||||
"foobarbaz ".to_string()];
|
"foobarbaz ".into_string()];
|
||||||
|
|
||||||
assert_eq!(test_strs.len(), oracle_strs.len());
|
assert_eq!(test_strs.len(), oracle_strs.len());
|
||||||
let mode = CompressionMode::CompressWhitespaceNewline;
|
let mode = CompressionMode::CompressWhitespaceNewline;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue