mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Use DOMString::new() somewhat consistently.
This commit is contained in:
parent
dab3926622
commit
e6aa976462
24 changed files with 67 additions and 68 deletions
|
@ -56,7 +56,6 @@ use js::rust::{ToInt64, ToUint64};
|
|||
use libc;
|
||||
use num::Float;
|
||||
use num::traits::{Bounded, Zero};
|
||||
use std::borrow::ToOwned;
|
||||
use std::rc::Rc;
|
||||
use std::{char, ptr, slice};
|
||||
use util::str::DOMString;
|
||||
|
@ -517,7 +516,7 @@ impl FromJSValConvertible for DOMString {
|
|||
-> Result<DOMString, ()> {
|
||||
if null_behavior == StringificationBehavior::Empty &&
|
||||
value.get().is_null() {
|
||||
Ok("".to_owned())
|
||||
Ok(DOMString::new())
|
||||
} else {
|
||||
let jsstr = unsafe { ToString(cx, value) };
|
||||
if jsstr.is_null() {
|
||||
|
|
|
@ -113,13 +113,13 @@ impl BlobMethods for Blob {
|
|||
}
|
||||
};
|
||||
let relativeContentType = match contentType {
|
||||
None => "".to_owned(),
|
||||
None => DOMString::new(),
|
||||
Some(mut str) => {
|
||||
if is_ascii_printable(&str) {
|
||||
str.make_ascii_lowercase();
|
||||
str
|
||||
} else {
|
||||
"".to_owned()
|
||||
DOMString::new()
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -80,7 +80,7 @@ impl CharacterDataMethods for CharacterData {
|
|||
|
||||
// https://dom.spec.whatwg.org/#dom-characterdata-deletedataoffset-count
|
||||
fn DeleteData(&self, offset: u32, count: u32) -> ErrorResult {
|
||||
self.ReplaceData(offset, count, "".to_owned())
|
||||
self.ReplaceData(offset, count, DOMString::new())
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-characterdata-replacedata
|
||||
|
|
|
@ -126,7 +126,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
|
|||
|
||||
if self.readonly {
|
||||
// Readonly style declarations are used for getComputedStyle.
|
||||
return self.get_computed_style(&property).unwrap_or("".to_owned());
|
||||
return self.get_computed_style(&property).unwrap_or(DOMString::new());
|
||||
}
|
||||
|
||||
// Step 2
|
||||
|
@ -143,7 +143,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
|
|||
// Step 2.2.2 & 2.2.3
|
||||
match declaration {
|
||||
Some(declaration) => list.push(declaration),
|
||||
None => return "".to_owned(),
|
||||
None => return DOMString::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
|
|||
// Step 3 & 4
|
||||
let result = match owner.get_inline_style_declaration(&property) {
|
||||
Some(declaration) => declaration.value(),
|
||||
None => "".to_owned(),
|
||||
None => DOMString::new(),
|
||||
};
|
||||
result
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
|
|||
}
|
||||
|
||||
// Step 4
|
||||
"".to_owned()
|
||||
DOMString::new()
|
||||
}
|
||||
|
||||
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-setproperty
|
||||
|
@ -274,7 +274,7 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
|
|||
|
||||
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-setpropertyvalue
|
||||
fn SetPropertyValue(&self, property: DOMString, value: DOMString) -> ErrorResult {
|
||||
self.SetProperty(property, value, "".to_owned())
|
||||
self.SetProperty(property, value, DOMString::new())
|
||||
}
|
||||
|
||||
// https://dev.w3.org/csswg/cssom/#dom-cssstyledeclaration-removeproperty
|
||||
|
|
|
@ -942,7 +942,7 @@ impl Document {
|
|||
Some(ref body) => {
|
||||
body.upcast::<Element>().get_string_attribute(local_name)
|
||||
},
|
||||
None => "".to_owned()
|
||||
None => DOMString::new()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1543,7 +1543,7 @@ impl DocumentMethods for Document {
|
|||
let name = Atom::from_slice(&local_name);
|
||||
// repetition used because string_cache::atom::Atom is non-copyable
|
||||
let l_name = Atom::from_slice(&local_name);
|
||||
let value = AttrValue::String("".to_owned());
|
||||
let value = AttrValue::String(DOMString::new());
|
||||
|
||||
Ok(Attr::new(&self.window, name, value, l_name, ns!(""), None, None))
|
||||
}
|
||||
|
@ -1553,7 +1553,7 @@ impl DocumentMethods for Document {
|
|||
-> Fallible<Root<Attr>> {
|
||||
let (namespace, prefix, local_name) =
|
||||
try!(validate_and_extract(namespace, &qualified_name));
|
||||
let value = AttrValue::String("".to_owned());
|
||||
let value = AttrValue::String(DOMString::new());
|
||||
let qualified_name = Atom::from_slice(&qualified_name);
|
||||
Ok(Attr::new(&self.window, local_name, value, qualified_name,
|
||||
namespace, prefix, None))
|
||||
|
|
|
@ -10,7 +10,6 @@ use dom::bindings::inheritance::Castable;
|
|||
use dom::bindings::js::Root;
|
||||
use dom::document::Document;
|
||||
use dom::node::Node;
|
||||
use std::borrow::ToOwned;
|
||||
use util::str::DOMString;
|
||||
|
||||
// https://dom.spec.whatwg.org/#documenttype
|
||||
|
@ -32,8 +31,8 @@ impl DocumentType {
|
|||
DocumentType {
|
||||
node: Node::new_inherited(document),
|
||||
name: name,
|
||||
public_id: public_id.unwrap_or("".to_owned()),
|
||||
system_id: system_id.unwrap_or("".to_owned())
|
||||
public_id: public_id.unwrap_or(DOMString::new()),
|
||||
system_id: system_id.unwrap_or(DOMString::new())
|
||||
}
|
||||
}
|
||||
#[allow(unrooted_must_root)]
|
||||
|
|
|
@ -54,7 +54,7 @@ impl DOMStringMapMethods for DOMStringMap {
|
|||
},
|
||||
None => {
|
||||
*found = false;
|
||||
String::new()
|
||||
DOMString::new()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1014,7 +1014,7 @@ impl Element {
|
|||
pub fn set_bool_attribute(&self, local_name: &Atom, value: bool) {
|
||||
if self.has_attribute(local_name) == value { return; }
|
||||
if value {
|
||||
self.set_string_attribute(local_name, String::new());
|
||||
self.set_string_attribute(local_name, DOMString::new());
|
||||
} else {
|
||||
self.remove_attribute(&ns!(""), local_name);
|
||||
}
|
||||
|
@ -1023,7 +1023,7 @@ impl Element {
|
|||
pub fn get_url_attribute(&self, local_name: &Atom) -> DOMString {
|
||||
assert!(&**local_name == local_name.to_ascii_lowercase());
|
||||
if !self.has_attribute(local_name) {
|
||||
return "".to_owned();
|
||||
return DOMString::new();
|
||||
}
|
||||
let url = self.get_string_attribute(local_name);
|
||||
let doc = document_from_node(self);
|
||||
|
@ -1042,7 +1042,7 @@ impl Element {
|
|||
pub fn get_string_attribute(&self, local_name: &Atom) -> DOMString {
|
||||
match self.get_attribute(&ns!(""), local_name) {
|
||||
Some(x) => x.Value(),
|
||||
None => "".to_owned()
|
||||
None => DOMString::new()
|
||||
}
|
||||
}
|
||||
pub fn set_string_attribute(&self, local_name: &Atom, value: DOMString) {
|
||||
|
|
|
@ -15,7 +15,6 @@ use dom::bindings::trace::JSTraceable;
|
|||
use dom::event::{Event, EventBubbles, EventCancelable};
|
||||
use js::jsapi::{RootedValue, HandleValue, JSContext};
|
||||
use js::jsval::JSVal;
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::Cell;
|
||||
use util::str::DOMString;
|
||||
|
||||
|
@ -34,8 +33,8 @@ impl ErrorEvent {
|
|||
fn new_inherited() -> ErrorEvent {
|
||||
ErrorEvent {
|
||||
event: Event::new_inherited(),
|
||||
message: DOMRefCell::new("".to_owned()),
|
||||
filename: DOMRefCell::new("".to_owned()),
|
||||
message: DOMRefCell::new(DOMString::new()),
|
||||
filename: DOMRefCell::new(DOMString::new()),
|
||||
lineno: Cell::new(0),
|
||||
colno: Cell::new(0),
|
||||
error: MutHeapJSVal::new()
|
||||
|
@ -76,12 +75,12 @@ impl ErrorEvent {
|
|||
init: &ErrorEventBinding::ErrorEventInit) -> Fallible<Root<ErrorEvent>>{
|
||||
let msg = match init.message.as_ref() {
|
||||
Some(message) => message.clone(),
|
||||
None => "".to_owned(),
|
||||
None => DOMString::new(),
|
||||
};
|
||||
|
||||
let file_name = match init.filename.as_ref() {
|
||||
None => "".to_owned(),
|
||||
Some(filename) => filename.clone(),
|
||||
None => DOMString::new(),
|
||||
};
|
||||
|
||||
let line_num = init.lineno.unwrap_or(0);
|
||||
|
|
|
@ -9,7 +9,6 @@ use dom::bindings::js::Root;
|
|||
use dom::document::Document;
|
||||
use dom::htmlelement::HTMLElement;
|
||||
use dom::node::Node;
|
||||
use std::borrow::ToOwned;
|
||||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -25,7 +24,7 @@ impl HTMLDialogElement {
|
|||
HTMLDialogElement {
|
||||
htmlelement:
|
||||
HTMLElement::new_inherited(localName, prefix, document),
|
||||
return_value: DOMRefCell::new("".to_owned()),
|
||||
return_value: DOMRefCell::new(DOMString::new()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -491,7 +491,7 @@ pub trait FormControl: DerivedFrom<Element> + Reflectable {
|
|||
if self.to_element().has_attribute(attr) {
|
||||
input(self)
|
||||
} else {
|
||||
self.form_owner().map_or("".to_owned(), |t| owner(t.r()))
|
||||
self.form_owner().map_or(DOMString::new(), |t| owner(t.r()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -111,11 +111,11 @@ impl HTMLInputElement {
|
|||
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE,
|
||||
localName, prefix, document),
|
||||
input_type: Cell::new(InputType::InputText),
|
||||
placeholder: DOMRefCell::new("".to_owned()),
|
||||
placeholder: DOMRefCell::new(DOMString::new()),
|
||||
checked_changed: Cell::new(false),
|
||||
value_changed: Cell::new(false),
|
||||
size: Cell::new(DEFAULT_INPUT_SIZE),
|
||||
textinput: DOMRefCell::new(TextInput::new(Single, "".to_owned(), chan)),
|
||||
textinput: DOMRefCell::new(TextInput::new(Single, DOMString::new(), chan)),
|
||||
activation_state: DOMRefCell::new(InputActivationState::new())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ impl HTMLOptionElementMethods for HTMLOptionElement {
|
|||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-option-text
|
||||
fn Text(&self) -> DOMString {
|
||||
let mut content = String::new();
|
||||
let mut content = DOMString::new();
|
||||
collect_text(self.upcast(), &mut content);
|
||||
str_join(split_html_space_chars(&content), " ")
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ impl HTMLTextAreaElement {
|
|||
htmlelement:
|
||||
HTMLElement::new_inherited_with_state(IN_ENABLED_STATE,
|
||||
localName, prefix, document),
|
||||
textinput: DOMRefCell::new(TextInput::new(Lines::Multiple, "".to_owned(), chan)),
|
||||
textinput: DOMRefCell::new(TextInput::new(Lines::Multiple, DOMString::new(), chan)),
|
||||
cols: Cell::new(DEFAULT_COLS),
|
||||
rows: Cell::new(DEFAULT_ROWS),
|
||||
value_changed: Cell::new(false),
|
||||
|
|
|
@ -17,7 +17,6 @@ use dom::window::Window;
|
|||
use msg::constellation_msg;
|
||||
use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER};
|
||||
use msg::constellation_msg::{Key, KeyModifiers};
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::Cell;
|
||||
use util::str::DOMString;
|
||||
|
||||
|
@ -45,8 +44,8 @@ impl KeyboardEvent {
|
|||
KeyboardEvent {
|
||||
uievent: UIEvent::new_inherited(),
|
||||
key: Cell::new(None),
|
||||
key_string: DOMRefCell::new("".to_owned()),
|
||||
code: DOMRefCell::new("".to_owned()),
|
||||
key_string: DOMRefCell::new(DOMString::new()),
|
||||
code: DOMRefCell::new(DOMString::new()),
|
||||
location: Cell::new(0),
|
||||
ctrl: Cell::new(false),
|
||||
alt: Cell::new(false),
|
||||
|
@ -85,7 +84,7 @@ impl KeyboardEvent {
|
|||
key_code: u32) -> Root<KeyboardEvent> {
|
||||
let ev = KeyboardEvent::new_uninitialized(window);
|
||||
ev.InitKeyboardEvent(type_, canBubble, cancelable, view, key_string, location,
|
||||
"".to_owned(), repeat, "".to_owned());
|
||||
DOMString::new(), repeat, DOMString::new());
|
||||
// FIXME(https://github.com/rust-lang/rust/issues/23338)
|
||||
{
|
||||
let ev = ev.r();
|
||||
|
|
|
@ -28,7 +28,10 @@ pub struct MessageEvent {
|
|||
|
||||
impl MessageEvent {
|
||||
pub fn new_uninitialized(global: GlobalRef) -> Root<MessageEvent> {
|
||||
MessageEvent::new_initialized(global, HandleValue::undefined(), "".to_owned(), "".to_owned())
|
||||
MessageEvent::new_initialized(global,
|
||||
HandleValue::undefined(),
|
||||
DOMString::new(),
|
||||
DOMString::new())
|
||||
}
|
||||
|
||||
pub fn new_initialized(global: GlobalRef,
|
||||
|
@ -77,7 +80,7 @@ impl MessageEvent {
|
|||
message: HandleValue) {
|
||||
let messageevent = MessageEvent::new(
|
||||
scope, "message".to_owned(), false, false, message,
|
||||
"".to_owned(), "".to_owned());
|
||||
DOMString::new(), DOMString::new());
|
||||
messageevent.upcast::<Event>().fire(target);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -784,14 +784,14 @@ impl Node {
|
|||
baseURI: self.BaseURI(),
|
||||
parent: self.GetParentNode().map(|node| node.get_unique_id()).unwrap_or("".to_owned()),
|
||||
nodeType: self.NodeType(),
|
||||
namespaceURI: "".to_owned(), //FIXME
|
||||
namespaceURI: DOMString::new(), //FIXME
|
||||
nodeName: self.NodeName(),
|
||||
numChildren: self.ChildNodes().Length() as usize,
|
||||
|
||||
//FIXME doctype nodes only
|
||||
name: "".to_owned(),
|
||||
publicId: "".to_owned(),
|
||||
systemId: "".to_owned(),
|
||||
name: DOMString::new(),
|
||||
publicId: DOMString::new(),
|
||||
systemId: DOMString::new(),
|
||||
attrs: self.downcast().map(Element::summarize).unwrap_or(vec![]),
|
||||
|
||||
isDocumentElement:
|
||||
|
@ -800,7 +800,7 @@ impl Node {
|
|||
.map(|elem| elem.upcast::<Node>() == self)
|
||||
.unwrap_or(false),
|
||||
|
||||
shortValue: self.GetNodeValue().unwrap_or("".to_owned()), //FIXME: truncate
|
||||
shortValue: self.GetNodeValue().unwrap_or(DOMString::new()), //FIXME: truncate
|
||||
incompleteValue: false, //FIXME: reflect truncation
|
||||
}
|
||||
}
|
||||
|
@ -1903,7 +1903,7 @@ impl NodeMethods for Node {
|
|||
|
||||
// https://dom.spec.whatwg.org/#dom-node-textcontent
|
||||
fn SetTextContent(&self, value: Option<DOMString>) {
|
||||
let value = value.unwrap_or(String::new());
|
||||
let value = value.unwrap_or(DOMString::new());
|
||||
match self.type_id() {
|
||||
NodeTypeId::DocumentFragment |
|
||||
NodeTypeId::Element(..) => {
|
||||
|
|
|
@ -23,6 +23,7 @@ use dom::node::Node;
|
|||
use dom::text::Text;
|
||||
use std::cell::Cell;
|
||||
use std::cmp::{Ord, Ordering, PartialEq, PartialOrd};
|
||||
use util::str::DOMString;
|
||||
|
||||
#[dom_struct]
|
||||
pub struct Range {
|
||||
|
@ -524,7 +525,7 @@ impl RangeMethods for Range {
|
|||
// Step 4.4.
|
||||
try!(end_data.ReplaceData(start_offset,
|
||||
end_offset - start_offset,
|
||||
"".to_owned()));
|
||||
DOMString::new()));
|
||||
// Step 4.5.
|
||||
return Ok(fragment);
|
||||
}
|
||||
|
@ -560,7 +561,7 @@ impl RangeMethods for Range {
|
|||
// Step 15.4.
|
||||
try!(start_data.ReplaceData(start_offset,
|
||||
start_node.len() - start_offset,
|
||||
"".to_owned()));
|
||||
DOMString::new()));
|
||||
} else {
|
||||
// Step 16.1.
|
||||
let clone = child.CloneNode(false);
|
||||
|
@ -595,7 +596,7 @@ impl RangeMethods for Range {
|
|||
// Step 18.3.
|
||||
try!(fragment.upcast::<Node>().AppendChild(&clone));
|
||||
// Step 18.4.
|
||||
try!(end_data.ReplaceData(0, end_offset, "".to_owned()));
|
||||
try!(end_data.ReplaceData(0, end_offset, DOMString::new()));
|
||||
} else {
|
||||
// Step 19.1.
|
||||
let clone = child.CloneNode(false);
|
||||
|
|
|
@ -62,7 +62,7 @@ impl TestBindingMethods for TestBinding {
|
|||
fn SetUnrestrictedDoubleAttribute(&self, _: f64) {}
|
||||
fn DoubleAttribute(&self) -> Finite<f64> { Finite::wrap(0.) }
|
||||
fn SetDoubleAttribute(&self, _: Finite<f64>) {}
|
||||
fn StringAttribute(&self) -> DOMString { "".to_owned() }
|
||||
fn StringAttribute(&self) -> DOMString { DOMString::new() }
|
||||
fn SetStringAttribute(&self, _: DOMString) {}
|
||||
fn UsvstringAttribute(&self) -> USVString { USVString("".to_owned()) }
|
||||
fn SetUsvstringAttribute(&self, _: USVString) {}
|
||||
|
@ -77,7 +77,7 @@ impl TestBindingMethods for TestBinding {
|
|||
fn SetInterfaceAttribute(&self, _: &Blob) {}
|
||||
fn UnionAttribute(&self) -> HTMLElementOrLong { eLong(0) }
|
||||
fn SetUnionAttribute(&self, _: HTMLElementOrLong) {}
|
||||
fn Union2Attribute(&self) -> EventOrString { eString("".to_owned()) }
|
||||
fn Union2Attribute(&self) -> EventOrString { eString(DOMString::new()) }
|
||||
fn SetUnion2Attribute(&self, _: EventOrString) {}
|
||||
fn Union3Attribute(&self) -> EventOrUSVString { eUSVString(USVString("".to_owned())) }
|
||||
fn SetUnion3Attribute(&self, _: EventOrUSVString) {}
|
||||
|
@ -115,16 +115,16 @@ impl TestBindingMethods for TestBinding {
|
|||
fn SetDoubleAttributeNullable(&self, _: Option<Finite<f64>>) {}
|
||||
fn GetByteStringAttributeNullable(&self) -> Option<ByteString> { Some(ByteString::new(vec!())) }
|
||||
fn SetByteStringAttributeNullable(&self, _: Option<ByteString>) {}
|
||||
fn GetStringAttributeNullable(&self) -> Option<DOMString> { Some("".to_owned()) }
|
||||
fn GetStringAttributeNullable(&self) -> Option<DOMString> { Some(DOMString::new()) }
|
||||
fn SetStringAttributeNullable(&self, _: Option<DOMString>) {}
|
||||
fn GetUsvstringAttributeNullable(&self) -> Option<USVString> { Some(USVString("".to_owned())) }
|
||||
fn SetUsvstringAttributeNullable(&self, _: Option<USVString>) {}
|
||||
fn SetBinaryRenamedAttribute(&self, _: DOMString) {}
|
||||
fn ForwardedAttribute(&self) -> Root<TestBinding> { Root::from_ref(self) }
|
||||
fn BinaryRenamedAttribute(&self) -> DOMString { "".to_owned() }
|
||||
fn BinaryRenamedAttribute(&self) -> DOMString { DOMString::new() }
|
||||
fn SetBinaryRenamedAttribute2(&self, _: DOMString) {}
|
||||
fn BinaryRenamedAttribute2(&self) -> DOMString { "".to_owned() }
|
||||
fn Attr_to_automatically_rename(&self) -> DOMString { "".to_owned() }
|
||||
fn BinaryRenamedAttribute2(&self) -> DOMString { DOMString::new() }
|
||||
fn Attr_to_automatically_rename(&self) -> DOMString { DOMString::new() }
|
||||
fn SetAttr_to_automatically_rename(&self, _: DOMString) {}
|
||||
fn GetEnumAttributeNullable(&self) -> Option<TestEnum> { Some(_empty) }
|
||||
fn GetInterfaceAttributeNullable(&self) -> Option<Root<Blob>> {
|
||||
|
@ -136,7 +136,7 @@ impl TestBindingMethods for TestBinding {
|
|||
fn SetObjectAttributeNullable(&self, _: *mut JSContext, _: *mut JSObject) {}
|
||||
fn GetUnionAttributeNullable(&self) -> Option<HTMLElementOrLong> { Some(eLong(0)) }
|
||||
fn SetUnionAttributeNullable(&self, _: Option<HTMLElementOrLong>) {}
|
||||
fn GetUnion2AttributeNullable(&self) -> Option<EventOrString> { Some(eString("".to_owned())) }
|
||||
fn GetUnion2AttributeNullable(&self) -> Option<EventOrString> { Some(eString(DOMString::new())) }
|
||||
fn SetUnion2AttributeNullable(&self, _: Option<EventOrString>) {}
|
||||
fn BinaryRenamedMethod(&self) -> () {}
|
||||
fn ReceiveVoid(&self) -> () {}
|
||||
|
@ -153,7 +153,7 @@ impl TestBindingMethods for TestBinding {
|
|||
fn ReceiveFloat(&self) -> Finite<f32> { Finite::wrap(0.) }
|
||||
fn ReceiveUnrestrictedDouble(&self) -> f64 { 0. }
|
||||
fn ReceiveDouble(&self) -> Finite<f64> { Finite::wrap(0.) }
|
||||
fn ReceiveString(&self) -> DOMString { "".to_owned() }
|
||||
fn ReceiveString(&self) -> DOMString { DOMString::new() }
|
||||
fn ReceiveUsvstring(&self) -> USVString { USVString("".to_owned()) }
|
||||
fn ReceiveByteString(&self) -> ByteString { ByteString::new(vec!()) }
|
||||
fn ReceiveEnum(&self) -> TestEnum { _empty }
|
||||
|
@ -164,7 +164,7 @@ impl TestBindingMethods for TestBinding {
|
|||
fn ReceiveAny(&self, _: *mut JSContext) -> JSVal { NullValue() }
|
||||
fn ReceiveObject(&self, _: *mut JSContext) -> *mut JSObject { panic!() }
|
||||
fn ReceiveUnion(&self) -> HTMLElementOrLong { eLong(0) }
|
||||
fn ReceiveUnion2(&self) -> EventOrString { eString("".to_owned()) }
|
||||
fn ReceiveUnion2(&self) -> EventOrString { eString(DOMString::new()) }
|
||||
|
||||
fn ReceiveNullableBoolean(&self) -> Option<bool> { Some(false) }
|
||||
fn ReceiveNullableByte(&self) -> Option<i8> { Some(0) }
|
||||
|
@ -179,7 +179,7 @@ impl TestBindingMethods for TestBinding {
|
|||
fn ReceiveNullableFloat(&self) -> Option<Finite<f32>> { Some(Finite::wrap(0.)) }
|
||||
fn ReceiveNullableUnrestrictedDouble(&self) -> Option<f64> { Some(0.) }
|
||||
fn ReceiveNullableDouble(&self) -> Option<Finite<f64>> { Some(Finite::wrap(0.)) }
|
||||
fn ReceiveNullableString(&self) -> Option<DOMString> { Some("".to_owned()) }
|
||||
fn ReceiveNullableString(&self) -> Option<DOMString> { Some(DOMString::new()) }
|
||||
fn ReceiveNullableUsvstring(&self) -> Option<USVString> { Some(USVString("".to_owned())) }
|
||||
fn ReceiveNullableByteString(&self) -> Option<ByteString> { Some(ByteString::new(vec!())) }
|
||||
fn ReceiveNullableEnum(&self) -> Option<TestEnum> { Some(_empty) }
|
||||
|
@ -189,7 +189,7 @@ impl TestBindingMethods for TestBinding {
|
|||
}
|
||||
fn ReceiveNullableObject(&self, _: *mut JSContext) -> *mut JSObject { ptr::null_mut() }
|
||||
fn ReceiveNullableUnion(&self) -> Option<HTMLElementOrLong> { Some(eLong(0)) }
|
||||
fn ReceiveNullableUnion2(&self) -> Option<EventOrString> { Some(eString("".to_owned())) }
|
||||
fn ReceiveNullableUnion2(&self) -> Option<EventOrString> { Some(eString(DOMString::new())) }
|
||||
|
||||
fn PassBoolean(&self, _: bool) {}
|
||||
fn PassByte(&self, _: i8) {}
|
||||
|
|
|
@ -17,16 +17,16 @@ pub struct TestBindingProxy {
|
|||
impl TestBindingProxyMethods for TestBindingProxy {
|
||||
fn Length(&self) -> u32 { 0 }
|
||||
fn SupportedPropertyNames(&self) -> Vec<DOMString> { vec![] }
|
||||
fn GetNamedItem(&self, _: DOMString) -> DOMString { "".to_owned() }
|
||||
fn GetNamedItem(&self, _: DOMString) -> DOMString { DOMString::new() }
|
||||
fn SetNamedItem(&self, _: DOMString, _: DOMString) -> () {}
|
||||
fn GetItem(&self, _: u32) -> DOMString { "".to_owned() }
|
||||
fn GetItem(&self, _: u32) -> DOMString { DOMString::new() }
|
||||
fn SetItem(&self, _: u32, _: DOMString) -> () {}
|
||||
fn RemoveItem(&self, _: DOMString) -> () {}
|
||||
fn Stringifier(&self) -> DOMString { "".to_owned() }
|
||||
fn IndexedGetter(&self, _: u32, _: &mut bool) -> DOMString { "".to_owned() }
|
||||
fn Stringifier(&self) -> DOMString { DOMString::new() }
|
||||
fn IndexedGetter(&self, _: u32, _: &mut bool) -> DOMString { DOMString::new() }
|
||||
fn NamedDeleter(&self, _: DOMString) -> () {}
|
||||
fn IndexedSetter(&self, _: u32, _: DOMString) -> () {}
|
||||
fn NamedSetter(&self, _: DOMString, _: DOMString) -> () {}
|
||||
fn NamedGetter(&self, _: DOMString, _: &mut bool) -> DOMString { "".to_owned() }
|
||||
fn NamedGetter(&self, _: DOMString, _: &mut bool) -> DOMString { DOMString::new() }
|
||||
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ impl WebGLContextEvent {
|
|||
init: &WebGLContextEventInit) -> Fallible<Root<WebGLContextEvent>> {
|
||||
let status_message = match init.statusMessage.as_ref() {
|
||||
Some(message) => message.clone(),
|
||||
None => "".to_owned(),
|
||||
None => DOMString::new(),
|
||||
};
|
||||
|
||||
let bubbles = if init.parent.bubbles {
|
||||
|
|
|
@ -151,7 +151,7 @@ impl XMLHttpRequest {
|
|||
timeout: Cell::new(0u32),
|
||||
with_credentials: Cell::new(false),
|
||||
upload: JS::from_rooted(&XMLHttpRequestUpload::new(global)),
|
||||
response_url: "".to_owned(),
|
||||
response_url: DOMString::new(),
|
||||
status: Cell::new(0),
|
||||
status_text: DOMRefCell::new(ByteString::new(vec!())),
|
||||
response: DOMRefCell::new(ByteString::new(vec!())),
|
||||
|
|
|
@ -1642,9 +1642,9 @@ impl ScriptTask {
|
|||
window.evaluate_js_on_global_with_result(evalstr, jsval.handle_mut());
|
||||
let strval = FromJSValConvertible::from_jsval(self.get_cx(), jsval.handle(),
|
||||
StringificationBehavior::Empty);
|
||||
strval.unwrap_or("".to_owned())
|
||||
strval.unwrap_or(DOMString::new())
|
||||
} else {
|
||||
"".to_owned()
|
||||
DOMString::new()
|
||||
};
|
||||
|
||||
parse_html(document.r(), parse_input, final_url,
|
||||
|
|
|
@ -124,7 +124,7 @@ impl<T: ClipboardProvider> TextInput<T> {
|
|||
if self.selection_begin.is_none() {
|
||||
self.adjust_horizontal_by_one(dir, Selection::Selected);
|
||||
}
|
||||
self.replace_selection("".to_owned());
|
||||
self.replace_selection(DOMString::new());
|
||||
}
|
||||
|
||||
/// Insert a character at the current editing point
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue