aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ports/cef/lib.rs1
-rw-r--r--ports/cef/window.rs2
-rw-r--r--ports/cef/wrappers.rs34
3 files changed, 3 insertions, 34 deletions
diff --git a/ports/cef/lib.rs b/ports/cef/lib.rs
index d8046f504fa..afd3289b1ee 100644
--- a/ports/cef/lib.rs
+++ b/ports/cef/lib.rs
@@ -23,6 +23,7 @@ extern crate js;
extern crate layers;
extern crate png;
extern crate script;
+extern crate unicode;
extern crate net;
extern crate msg;
diff --git a/ports/cef/window.rs b/ports/cef/window.rs
index 9e6acb473d2..b4185695dce 100644
--- a/ports/cef/window.rs
+++ b/ports/cef/window.rs
@@ -11,7 +11,7 @@ use eutil::Downcast;
use interfaces::CefBrowser;
use render_handler::CefRenderHandlerExtensions;
use types::{cef_cursor_handle_t, cef_rect_t};
-use wrappers::Utf16Encoder;
+use unicode::str::Utf16Encoder;
use compositing::compositor_task::{self, CompositorProxy, CompositorReceiver};
use compositing::windowing::{WindowEvent, WindowMethods};
diff --git a/ports/cef/wrappers.rs b/ports/cef/wrappers.rs
index cf3ebdd4b28..a93531c198f 100644
--- a/ports/cef/wrappers.rs
+++ b/ports/cef/wrappers.rs
@@ -29,6 +29,7 @@ use types::{cef_termination_status_t, cef_text_input_context_t, cef_thread_id_t}
use types::{cef_time_t, cef_transition_type_t, cef_urlrequest_status_t};
use types::{cef_v8_accesscontrol_t, cef_v8_propertyattribute_t, cef_value_type_t};
use types::{cef_window_info_t, cef_xml_encoding_type_t, cef_xml_node_type_t};
+use unicode::str::Utf16Encoder;
use libc::{self, c_char, c_int, c_ushort, c_void};
use std::collections::HashMap;
@@ -271,39 +272,6 @@ extern "C" fn free_utf16_buffer(buffer: *mut c_ushort) {
}
}
-// TODO(pcwalton): Post Rust-upgrade, remove this and use `collections::str::Utf16Encoder`.
-pub struct Utf16Encoder<I> {
- chars: I,
- extra: u16,
-}
-
-impl<I> Utf16Encoder<I> {
- pub fn new(chars: I) -> Utf16Encoder<I> where I: Iterator<Item=char> {
- Utf16Encoder {
- chars: chars,
- extra: 0,
- }
- }
-}
-
-impl<I> Iterator for Utf16Encoder<I> where I: Iterator<Item=char> {
- type Item = u16;
- fn next(&mut self) -> Option<u16> {
- if self.extra != 0 {
- return Some(mem::replace(&mut self.extra, 0))
- }
-
- let mut buf = [0u16; 2];
- self.chars.next().map(|ch| {
- let n = ch.encode_utf16(buf.as_mut_slice()).unwrap_or(0);
- if n == 2 {
- self.extra = buf[1]
- }
- buf[0]
- })
- }
-}
-
impl<'a> CefWrap<cef_string_t> for &'a mut String {
fn to_c(_: &'a mut String) -> cef_string_t {
panic!("unimplemented CEF type conversion: &'a mut String");