rename deprecated utf16_units to encode_utf16

This commit is contained in:
Arpad Borsos 2016-03-07 16:10:42 +01:00
parent 743e0c9c87
commit c880c97b1b
7 changed files with 8 additions and 10 deletions

View file

@ -78,7 +78,7 @@ impl CharacterDataMethods for CharacterData {
// https://dom.spec.whatwg.org/#dom-characterdata-data
fn SetData(&self, data: DOMString) {
let old_length = self.Length();
let new_length = data.utf16_units().count() as u32;
let new_length = data.encode_utf16().count() as u32;
*self.data.borrow_mut() = data;
self.content_changed();
let node = self.upcast::<Node>();
@ -87,7 +87,7 @@ impl CharacterDataMethods for CharacterData {
// https://dom.spec.whatwg.org/#dom-characterdata-length
fn Length(&self) -> u32 {
self.data.borrow().utf16_units().count() as u32
self.data.borrow().encode_utf16().count() as u32
}
// https://dom.spec.whatwg.org/#dom-characterdata-substringdata
@ -151,7 +151,7 @@ impl CharacterDataMethods for CharacterData {
// Steps 8-11.
let node = self.upcast::<Node>();
node.ranges().replace_code_units(
node, offset, count, arg.utf16_units().count() as u32);
node, offset, count, arg.encode_utf16().count() as u32);
Ok(())
}

View file

@ -390,7 +390,7 @@ impl EventTarget {
// TODO step 1.2 (browsing context/scripting enabled)
// Step 1.3
let body: Vec<u16> = handler.source.utf16_units().collect();
let body: Vec<u16> = handler.source.encode_utf16().collect();
// TODO step 1.5 (form owner)

View file

@ -820,7 +820,7 @@ impl<'a, T: Reflectable> ScriptHelpers for &'a T {
let cx = global.r().get_cx();
let _ar = JSAutoRequest::new(cx);
let globalhandle = global.r().reflector().get_jsobject();
let code: Vec<u16> = code.utf16_units().collect();
let code: Vec<u16> = code.encode_utf16().collect();
let filename = CString::new(filename).unwrap();
let _ac = JSAutoCompartment::new(cx, globalhandle.get());

View file

@ -1172,7 +1172,7 @@ impl XMLHttpRequest {
}
// Step 4
let json_text = UTF_8.decode(&bytes, DecoderTrap::Replace).unwrap();
let json_text: Vec<u16> = json_text.utf16_units().collect();
let json_text: Vec<u16> = json_text.encode_utf16().collect();
// Step 5
let mut rval = RootedValue::new(cx, UndefinedValue());
unsafe {

View file

@ -18,7 +18,6 @@
#![feature(peekable_is_empty)]
#![feature(plugin)]
#![feature(slice_patterns)]
#![feature(str_utf16)]
#![deny(unsafe_code)]
#![allow(non_snake_case)]

View file

@ -10,7 +10,6 @@
#![feature(iter_arith)]
#![feature(link_args)]
#![feature(plugin)]
#![feature(str_utf16)]
#![feature(unicode)]
#![feature(unsafe_no_drop_flag)]

View file

@ -124,7 +124,7 @@ pub extern "C" fn cef_string_utf8_cmp(a: *const cef_string_utf8_t, b: *const cef
#[no_mangle]
pub extern "C" fn cef_string_utf8_to_utf16(src: *const u8, src_len: size_t, output: *mut cef_string_utf16_t) -> c_int {
slice_to_str(src, src_len as usize, |result| {
let conv = result.utf16_units().collect::<Vec<u16>>();
let conv = result.encode_utf16().collect::<Vec<u16>>();
cef_string_utf16_set(conv.as_ptr(), conv.len() as size_t, output, 1);
1
})
@ -286,7 +286,7 @@ pub extern "C" fn cef_string_wide_to_utf8(src: *const wchar_t, src_len: size_t,
#[no_mangle]
pub extern "C" fn cef_string_ascii_to_utf16(src: *const u8, src_len: size_t, output: *mut cef_string_utf16_t) -> c_int {
slice_to_str(src, src_len as usize, |result| {
let conv = result.utf16_units().collect::<Vec<u16>>();
let conv = result.encode_utf16().collect::<Vec<u16>>();
cef_string_utf16_set(conv.as_ptr(), conv.len() as size_t, output, 1)
})
}