mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Update for library changes (current Rust commit 57b4d10ff652d3beddae64782c882a07822bac3c)
This commit is contained in:
parent
cb1a25d69f
commit
cb356cbcc4
4 changed files with 7 additions and 8 deletions
|
@ -49,7 +49,7 @@ fn jsval_to_str(cx: *JSContext, v: jsval) -> Result<~str, ()> {
|
|||
Err(())
|
||||
} else {
|
||||
unsafe {
|
||||
let buf = vec::raw::from_buf(chars as *u8, len as uint);
|
||||
let buf = vec::raw::from_buf_raw(chars as *u8, len as uint);
|
||||
Ok(str::from_bytes(buf))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ use render_task::{RenderTask, RenderMsg};
|
|||
use task::spawn_listener;
|
||||
use comm::{Chan, Port};
|
||||
use cast::reinterpret_cast;
|
||||
use vec_from_buf = vec::raw::from_buf;
|
||||
use ptr::addr_of;
|
||||
use dom::event::Event;
|
||||
use dvec::DVec;
|
||||
|
|
|
@ -209,7 +209,7 @@ impl TextRunScanner {
|
|||
// TODO: use a rope, simply give ownership of nonzero strs to rope
|
||||
let mut run_str : ~str = ~"";
|
||||
for uint::range(0, transformed_strs.len()) |i| {
|
||||
str::push_str(&run_str, transformed_strs[i]);
|
||||
str::push_str(&mut run_str, transformed_strs[i]);
|
||||
}
|
||||
|
||||
// TODO: use actual font for corresponding DOM node to create text run.
|
||||
|
|
|
@ -28,7 +28,7 @@ impl CompressionMode : cmp::Eq {
|
|||
// * record skipped and kept chars for mapping original to new text
|
||||
// * various edge cases for bidi, CJK, combining char seqs, etc.
|
||||
pub fn transform_text(text: &str, mode: CompressionMode) -> ~str {
|
||||
let out_str: ~str = ~"";
|
||||
let mut out_str: ~str = ~"";
|
||||
match mode {
|
||||
CompressNone | DiscardNewline => {
|
||||
for str::each_char(text) |ch: char| {
|
||||
|
@ -39,7 +39,7 @@ pub fn transform_text(text: &str, mode: CompressionMode) -> ~str {
|
|||
if ch == '\t' {
|
||||
// TODO: set "has tab" flag
|
||||
}
|
||||
str::push_char(&out_str, ch);
|
||||
str::push_char(&mut out_str, ch);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -65,14 +65,14 @@ pub fn transform_text(text: &str, mode: CompressionMode) -> ~str {
|
|||
// TODO: record skipped char
|
||||
} else {
|
||||
// TODO: record kept char
|
||||
str::push_char(&out_str, ch);
|
||||
str::push_char(&mut out_str, ch);
|
||||
}
|
||||
} else { /* next_in_whitespace; possibly add a space char */
|
||||
if in_whitespace {
|
||||
// TODO: record skipped char
|
||||
} else {
|
||||
// TODO: record kept char
|
||||
str::push_char(&out_str, ' ');
|
||||
str::push_char(&mut out_str, ' ');
|
||||
}
|
||||
}
|
||||
// save whitespace context for next char
|
||||
|
@ -220,4 +220,4 @@ fn test_transform_compress_whitespace_newline() {
|
|||
for uint::range(0, test_strs.len()) |i| {
|
||||
assert transform_text(test_strs[i], mode) == oracle_strs[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue