mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Remove the pointless TextEncoder::encoding field.
This commit is contained in:
parent
e8914cd829
commit
48c232f72b
1 changed files with 5 additions and 7 deletions
|
@ -22,22 +22,20 @@ use util::str::DOMString;
|
||||||
#[dom_struct]
|
#[dom_struct]
|
||||||
pub struct TextEncoder {
|
pub struct TextEncoder {
|
||||||
reflector_: Reflector,
|
reflector_: Reflector,
|
||||||
encoding: DOMString,
|
|
||||||
#[ignore_heap_size_of = "Defined in rust-encoding"]
|
#[ignore_heap_size_of = "Defined in rust-encoding"]
|
||||||
encoder: EncodingRef,
|
encoder: EncodingRef,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TextEncoder {
|
impl TextEncoder {
|
||||||
fn new_inherited(encoding: DOMString, encoder: EncodingRef) -> TextEncoder {
|
fn new_inherited(encoder: EncodingRef) -> TextEncoder {
|
||||||
TextEncoder {
|
TextEncoder {
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
encoding: encoding,
|
|
||||||
encoder: encoder,
|
encoder: encoder,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(global: GlobalRef, encoding: DOMString, encoder: EncodingRef) -> Root<TextEncoder> {
|
pub fn new(global: GlobalRef, encoder: EncodingRef) -> Root<TextEncoder> {
|
||||||
reflect_dom_object(box TextEncoder::new_inherited(encoding, encoder),
|
reflect_dom_object(box TextEncoder::new_inherited(encoder),
|
||||||
global,
|
global,
|
||||||
TextEncoderBinding::Wrap)
|
TextEncoderBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
@ -55,7 +53,7 @@ impl TextEncoder {
|
||||||
|
|
||||||
match encoding.name() {
|
match encoding.name() {
|
||||||
"utf-8" | "utf-16be" | "utf-16le" => {
|
"utf-8" | "utf-16be" | "utf-16le" => {
|
||||||
Ok(TextEncoder::new(global, encoding.name().to_owned(), encoding))
|
Ok(TextEncoder::new(global, encoding))
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
debug!("Encoding Not UTF");
|
debug!("Encoding Not UTF");
|
||||||
|
@ -68,7 +66,7 @@ impl TextEncoder {
|
||||||
impl TextEncoderMethods for TextEncoder {
|
impl TextEncoderMethods for TextEncoder {
|
||||||
// https://encoding.spec.whatwg.org/#dom-textencoder-encoding
|
// https://encoding.spec.whatwg.org/#dom-textencoder-encoding
|
||||||
fn Encoding(&self) -> DOMString {
|
fn Encoding(&self) -> DOMString {
|
||||||
self.encoding.clone()
|
self.encoder.name().to_owned()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue