mirror of
https://github.com/servo/servo.git
synced 2025-06-24 09:04:33 +01:00
Use Vec for the remaining ~[T]s in script.
This commit is contained in:
parent
6e617d8eba
commit
55ed05f2c7
5 changed files with 12 additions and 13 deletions
|
@ -386,10 +386,9 @@ impl Document {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
let v: ~[&str] = title.words().collect();
|
let v: Vec<&str> = title.words().collect();
|
||||||
title = v.connect(" ");
|
let title = v.connect(" ");
|
||||||
title = title.trim().to_owned();
|
title.trim().to_owned()
|
||||||
title
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// http://www.whatwg.org/specs/web-apps/current-work/#document.title
|
// http://www.whatwg.org/specs/web-apps/current-work/#document.title
|
||||||
|
|
|
@ -651,8 +651,8 @@ pub fn get_attribute_parts(name: DOMString) -> (Option<~str>, ~str) {
|
||||||
//FIXME: Throw for XML-invalid names
|
//FIXME: Throw for XML-invalid names
|
||||||
//FIXME: Throw for XMLNS-invalid names
|
//FIXME: Throw for XMLNS-invalid names
|
||||||
let (prefix, local_name) = if name.contains(":") {
|
let (prefix, local_name) = if name.contains(":") {
|
||||||
let parts: ~[&str] = name.splitn(':', 1).collect();
|
let mut parts = name.splitn(':', 1);
|
||||||
(Some(parts[0].to_owned()), parts[1].to_owned())
|
(Some(parts.next().unwrap().to_owned()), parts.next().unwrap().to_owned())
|
||||||
} else {
|
} else {
|
||||||
(None, name)
|
(None, name)
|
||||||
};
|
};
|
||||||
|
|
|
@ -94,7 +94,7 @@ impl HTMLCollection {
|
||||||
pub fn by_class_name(window: &JS<Window>, root: &JS<Node>, classes: DOMString)
|
pub fn by_class_name(window: &JS<Window>, root: &JS<Node>, classes: DOMString)
|
||||||
-> JS<HTMLCollection> {
|
-> JS<HTMLCollection> {
|
||||||
struct ClassNameFilter {
|
struct ClassNameFilter {
|
||||||
classes: ~[DOMString]
|
classes: Vec<DOMString>
|
||||||
}
|
}
|
||||||
impl CollectionFilter for ClassNameFilter {
|
impl CollectionFilter for ClassNameFilter {
|
||||||
fn filter(&self, elem: &JS<Element>, _root: &JS<Node>) -> bool {
|
fn filter(&self, elem: &JS<Element>, _root: &JS<Node>) -> bool {
|
||||||
|
|
|
@ -50,7 +50,7 @@ pub struct JSFile {
|
||||||
pub url: Url
|
pub url: Url
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type JSResult = ~[JSFile];
|
pub type JSResult = Vec<JSFile>;
|
||||||
|
|
||||||
enum CSSMessage {
|
enum CSSMessage {
|
||||||
CSSTaskNewFile(StylesheetProvenance),
|
CSSTaskNewFile(StylesheetProvenance),
|
||||||
|
@ -105,7 +105,7 @@ spawned, collates them, and sends them to the given result channel.
|
||||||
*/
|
*/
|
||||||
fn css_link_listener(to_parent: Sender<HtmlDiscoveryMessage>,
|
fn css_link_listener(to_parent: Sender<HtmlDiscoveryMessage>,
|
||||||
from_parent: Receiver<CSSMessage>) {
|
from_parent: Receiver<CSSMessage>) {
|
||||||
let mut result_vec = ~[];
|
let mut result_vec = vec!();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
match from_parent.recv_opt() {
|
match from_parent.recv_opt() {
|
||||||
|
@ -128,7 +128,7 @@ fn css_link_listener(to_parent: Sender<HtmlDiscoveryMessage>,
|
||||||
fn js_script_listener(to_parent: Sender<HtmlDiscoveryMessage>,
|
fn js_script_listener(to_parent: Sender<HtmlDiscoveryMessage>,
|
||||||
from_parent: Receiver<JSMessage>,
|
from_parent: Receiver<JSMessage>,
|
||||||
resource_task: ResourceTask) {
|
resource_task: ResourceTask) {
|
||||||
let mut result_vec = ~[];
|
let mut result_vec = vec!();
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
match from_parent.recv_opt() {
|
match from_parent.recv_opt() {
|
||||||
|
@ -465,7 +465,7 @@ pub fn parse_html(page: &Page,
|
||||||
js_chan2.send(JSTaskNewFile(new_url));
|
js_chan2.send(JSTaskNewFile(new_url));
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
let mut data = ~[];
|
let mut data = vec!();
|
||||||
let scriptnode: JS<Node> = NodeCast::from(&script);
|
let scriptnode: JS<Node> = NodeCast::from(&script);
|
||||||
debug!("iterating over children {:?}", scriptnode.first_child());
|
debug!("iterating over children {:?}", scriptnode.first_child());
|
||||||
for child in scriptnode.children() {
|
for child in scriptnode.children() {
|
||||||
|
|
|
@ -647,7 +647,7 @@ impl ScriptTask {
|
||||||
fn handle_msgs(&self) -> bool {
|
fn handle_msgs(&self) -> bool {
|
||||||
// Handle pending resize events.
|
// Handle pending resize events.
|
||||||
// Gather them first to avoid a double mut borrow on self.
|
// Gather them first to avoid a double mut borrow on self.
|
||||||
let mut resizes = ~[];
|
let mut resizes = vec!();
|
||||||
|
|
||||||
{
|
{
|
||||||
let mut page_tree = self.page_tree.borrow_mut();
|
let mut page_tree = self.page_tree.borrow_mut();
|
||||||
|
@ -669,7 +669,7 @@ impl ScriptTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store new resizes, and gather all other events.
|
// Store new resizes, and gather all other events.
|
||||||
let mut sequential = ~[];
|
let mut sequential = vec!();
|
||||||
|
|
||||||
// Receive at least one message so we don't spinloop.
|
// Receive at least one message so we don't spinloop.
|
||||||
let mut event = self.port.recv();
|
let mut event = self.port.recv();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue