diff options
Diffstat (limited to 'src/servo/layout')
-rw-r--r-- | src/servo/layout/base.rs | 16 | ||||
-rw-r--r-- | src/servo/layout/display_list_builder.rs | 8 | ||||
-rw-r--r-- | src/servo/layout/layout_task.rs | 2 | ||||
-rw-r--r-- | src/servo/layout/style/apply.rs | 2 | ||||
-rw-r--r-- | src/servo/layout/style/matching.rs | 70 | ||||
-rw-r--r-- | src/servo/layout/style/style.rs | 2 | ||||
-rw-r--r-- | src/servo/layout/text.rs | 8 |
7 files changed, 54 insertions, 54 deletions
diff --git a/src/servo/layout/base.rs b/src/servo/layout/base.rs index 14ddedd16df..d9e7ba1d28c 100644 --- a/src/servo/layout/base.rs +++ b/src/servo/layout/base.rs @@ -94,9 +94,9 @@ impl BoxTreeWriteMethods of tree::WriteMethods<@Box> for BTree { impl layout_methods_priv for @Box { #[doc="Dumps the box tree, for debugging, with indentation."] fn dump_indent(indent: uint) { - let mut s = ""; + let mut s = ~""; for uint::range(0u, indent) |_i| { - s += " "; + s += ~" "; } s += #fmt("%?", self.kind); @@ -137,9 +137,9 @@ impl layout_methods for @Box { impl PrivateNodeMethods for Node { #[doc="Dumps the node tree, for debugging, with indentation."] fn dump_indent(indent: uint) { - let mut s = ""; + let mut s = ~""; for uint::range(0u, indent) |_i| { - s += " "; + s += ~" "; } s += #fmt("%?", self.read(|n| copy n.kind )); @@ -201,10 +201,10 @@ mod test { ~HTMLImageElement({mut size: size}) } - let n0 = s.new_node(Element(ElementData("img", mk_img(Size2D(au(10),au(10)))))); - let n1 = s.new_node(Element(ElementData("img", mk_img(Size2D(au(10),au(10)))))); - let n2 = s.new_node(Element(ElementData("img", mk_img(Size2D(au(10),au(20)))))); - let n3 = s.new_node(Element(ElementData("div", ~HTMLDivElement))); + let n0 = s.new_node(Element(ElementData(~"img", mk_img(Size2D(au(10),au(10)))))); + let n1 = s.new_node(Element(ElementData(~"img", mk_img(Size2D(au(10),au(10)))))); + let n2 = s.new_node(Element(ElementData(~"img", mk_img(Size2D(au(10),au(20)))))); + let n3 = s.new_node(Element(ElementData(~"div", ~HTMLDivElement))); tree::add_child(s, n3, n0); tree::add_child(s, n3, n1); diff --git a/src/servo/layout/display_list_builder.rs b/src/servo/layout/display_list_builder.rs index 6e28525be34..3c928068fc3 100644 --- a/src/servo/layout/display_list_builder.rs +++ b/src/servo/layout/display_list_builder.rs @@ -118,7 +118,7 @@ fn should_convert_text_boxes_to_solid_color_background_items() { #[ignore(reason = "crashy")]; let s = Scope(); - let n = s.new_node(Text("firecracker")); + let n = s.new_node(Text(~"firecracker")); let b = n.construct_boxes(); let subbox = alt check b.kind { TextBox(subbox) { subbox } }; b.reflow_text(px_to_au(800), subbox); @@ -136,7 +136,7 @@ fn should_convert_text_boxes_to_text_items() { #[ignore(reason = "crashy")]; let s = Scope(); - let n = s.new_node(Text("firecracker")); + let n = s.new_node(Text(~"firecracker")); let b = n.construct_boxes(); let subbox = alt check b.kind { TextBox(subbox) { subbox } }; b.reflow_text(px_to_au(800), subbox); @@ -153,7 +153,7 @@ fn should_calculate_the_bounds_of_the_text_box_background_color() { #[ignore]; let s = Scope(); - let n = s.new_node(Text("firecracker")); + let n = s.new_node(Text(~"firecracker")); let b = n.construct_boxes(); let subbox = alt check b.kind { TextBox(subbox) { subbox } }; b.reflow_text(px_to_au(800), subbox); @@ -172,7 +172,7 @@ fn should_calculate_the_bounds_of_the_text_items() { #[ignore]; let s = Scope(); - let n = s.new_node(Text("firecracker")); + let n = s.new_node(Text(~"firecracker")); let b = n.construct_boxes(); let subbox = alt check b.kind { TextBox(subbox) { subbox } }; b.reflow_text(px_to_au(800), subbox); diff --git a/src/servo/layout/layout_task.rs b/src/servo/layout/layout_task.rs index 45b64736309..08aa27e4a88 100644 --- a/src/servo/layout/layout_task.rs +++ b/src/servo/layout/layout_task.rs @@ -40,7 +40,7 @@ fn Layout(renderer: Renderer) -> Layout { #debug("layout: received layout request for:"); node.dump(); - do util::time::time("layout") { + do util::time::time(~"layout") { node.initialize_style_for_subtree(); node.recompute_style_for_subtree(arc(copy styles)); diff --git a/src/servo/layout/style/apply.rs b/src/servo/layout/style/apply.rs index ba05db2dfbf..f92d680782b 100644 --- a/src/servo/layout/style/apply.rs +++ b/src/servo/layout/style/apply.rs @@ -26,7 +26,7 @@ impl ApplyStyleBoxMethods for @Box { alt element.kind { ~HTMLImageElement(*) { - alt element.get_attr("src") { + alt element.get_attr(~"src") { some(url) { // FIXME: Some sort of BASE HREF support! // FIXME: Parse URLs! diff --git a/src/servo/layout/style/matching.rs b/src/servo/layout/style/matching.rs index bc02a41c632..766b9c040ff 100644 --- a/src/servo/layout/style/matching.rs +++ b/src/servo/layout/style/matching.rs @@ -29,7 +29,7 @@ fn attrs_match(attr: Attr, elmt: ElementData) -> bool { Includes(name, val) { // Comply with css spec, if the specified attribute is empty // it cannot match. - if val == "" { ret false; } + if val == ~"" { ret false; } alt elmt.get_attr(name) { some(value) { ret value.split_char(' ').contains(val); } @@ -41,11 +41,11 @@ fn attrs_match(attr: Attr, elmt: ElementData) -> bool { some(value) { //check that there is only one attribute value and it //starts with the perscribed value - if !value.starts_with(val) || value.contains(" ") { ret false; } + if !value.starts_with(val) || value.contains(~" ") { ret false; } // We match on either the exact value or value-foo if value.len() == val.len() { ret true; } - else { ret value.starts_with(val + "-"); } + else { ret value.starts_with(val + ~"-"); } } none { ret false; @@ -66,7 +66,7 @@ impl priv_matching_methods for Node { Element(tag, attrs) { alt self.read(|n| copy *n.kind) { base::Element(elmt) { - if !(tag == "*" || tag == elmt.tag_name) { + if !(tag == ~"*" || tag == elmt.tag_name) { ret false; } @@ -207,8 +207,8 @@ mod test { import io::println; #[warn(no_non_implicitly_copyable_typarams)] - fn new_node_from_attr(scope: NodeScope, -name: str, -val: str) -> Node { - let elmt = ElementData("div", ~HTMLDivElement); + fn new_node_from_attr(scope: NodeScope, -name: ~str, -val: ~str) -> Node { + let elmt = ElementData(~"div", ~HTMLDivElement); let attr = ~Attr(name, val); elmt.attrs.push(attr); ret scope.new_node(base::Element(elmt)); @@ -217,9 +217,9 @@ mod test { #[test] fn test_match_pipe1() { let scope = NodeScope(); - let node = new_node_from_attr(scope, "lang", "en-us"); + let node = new_node_from_attr(scope, ~"lang", ~"en-us"); - let sel = Element("*", ~[StartsWith("lang", "en")]); + let sel = Element(~"*", ~[StartsWith(~"lang", ~"en")]); assert node.matches_selector(~sel); } @@ -227,9 +227,9 @@ mod test { #[test] fn test_match_pipe2() { let scope = NodeScope(); - let node = new_node_from_attr(scope, "lang", "en"); + let node = new_node_from_attr(scope, ~"lang", ~"en"); - let sel = Element("*", ~[StartsWith("lang", "en")]); + let sel = Element(~"*", ~[StartsWith(~"lang", ~"en")]); assert node.matches_selector(~sel); } @@ -237,9 +237,9 @@ mod test { #[test] fn test_not_match_pipe() { let scope = NodeScope(); - let node = new_node_from_attr(scope, "lang", "english"); + let node = new_node_from_attr(scope, ~"lang", ~"english"); - let sel = Element("*", ~[StartsWith("lang", "en")]); + let sel = Element(~"*", ~[StartsWith(~"lang", ~"en")]); assert !node.matches_selector(~sel); } @@ -247,9 +247,9 @@ mod test { #[test] fn test_match_includes() { let scope = NodeScope(); - let node = new_node_from_attr(scope, "mad", "hatter cobler cooper"); + let node = new_node_from_attr(scope, ~"mad", ~"hatter cobler cooper"); - let sel = Element("div", ~[Includes("mad", "hatter")]); + let sel = Element(~"div", ~[Includes(~"mad", ~"hatter")]); assert node.matches_selector(~sel); } @@ -257,10 +257,10 @@ mod test { #[test] fn test_match_exists() { let scope = NodeScope(); - let node = new_node_from_attr(scope, "mad", "hatter cobler cooper"); + let node = new_node_from_attr(scope, ~"mad", ~"hatter cobler cooper"); - let sel1 = Element("div", ~[Exists("mad")]); - let sel2 = Element("div", ~[Exists("hatter")]); + let sel1 = Element(~"div", ~[Exists(~"mad")]); + let sel2 = Element(~"div", ~[Exists(~"hatter")]); assert node.matches_selector(~sel1); assert !node.matches_selector(~sel2); @@ -269,10 +269,10 @@ mod test { #[test] fn test_match_exact() { let scope = NodeScope(); - let node1 = new_node_from_attr(scope, "mad", "hatter cobler cooper"); - let node2 = new_node_from_attr(scope, "mad", "hatter"); + let node1 = new_node_from_attr(scope, ~"mad", ~"hatter cobler cooper"); + let node2 = new_node_from_attr(scope, ~"mad", ~"hatter"); - let sel = Element("div", ~[Exact("mad", "hatter")]); + let sel = Element(~"div", ~[Exact(~"mad", ~"hatter")]); assert !node1.matches_selector(~copy sel); assert node2.matches_selector(~sel); @@ -282,12 +282,12 @@ mod test { fn match_tree() { let scope = NodeScope(); - let root = new_node_from_attr(scope, "class", "blue"); - let child1 = new_node_from_attr(scope, "id", "green"); - let child2 = new_node_from_attr(scope, "flag", "black"); - let gchild = new_node_from_attr(scope, "flag", "grey"); - let ggchild = new_node_from_attr(scope, "flag", "white"); - let gggchild = new_node_from_attr(scope, "flag", "purple"); + let root = new_node_from_attr(scope, ~"class", ~"blue"); + let child1 = new_node_from_attr(scope, ~"id", ~"green"); + let child2 = new_node_from_attr(scope, ~"flag", ~"black"); + let gchild = new_node_from_attr(scope, ~"flag", ~"grey"); + let ggchild = new_node_from_attr(scope, ~"flag", ~"white"); + let gggchild = new_node_from_attr(scope, ~"flag", ~"purple"); scope.add_child(root, child1); scope.add_child(root, child2); @@ -295,8 +295,8 @@ mod test { scope.add_child(gchild, ggchild); scope.add_child(ggchild, gggchild); - let sel1 = Descendant(~Element("*", ~[Exact("class", "blue")]), - ~Element("*", ~[])); + let sel1 = Descendant(~Element(~"*", ~[Exact(~"class", ~"blue")]), + ~Element(~"*", ~[])); assert !root.matches_selector(~copy sel1); assert child1.matches_selector(~copy sel1); @@ -305,9 +305,9 @@ mod test { assert ggchild.matches_selector(~copy sel1); assert gggchild.matches_selector(~sel1); - let sel2 = Descendant(~Child(~Element("*", ~[Exact("class", "blue")]), - ~Element("*", ~[])), - ~Element("div", ~[Exists("flag")])); + let sel2 = Descendant(~Child(~Element(~"*", ~[Exact(~"class", ~"blue")]), + ~Element(~"*", ~[])), + ~Element(~"div", ~[Exists(~"flag")])); assert !root.matches_selector(~copy sel2); assert !child1.matches_selector(~copy sel2); @@ -316,7 +316,7 @@ mod test { assert ggchild.matches_selector(~copy sel2); assert gggchild.matches_selector(~sel2); - let sel3 = Sibling(~Element("*", ~[]), ~Element("*", ~[])); + let sel3 = Sibling(~Element(~"*", ~[]), ~Element(~"*", ~[])); assert !root.matches_selector(~copy sel3); assert child1.matches_selector(~copy sel3); @@ -325,9 +325,9 @@ mod test { assert !ggchild.matches_selector(~copy sel3); assert !gggchild.matches_selector(~sel3); - let sel4 = Descendant(~Child(~Element("*", ~[Exists("class")]), - ~Element("*", ~[])), - ~Element("*", ~[])); + let sel4 = Descendant(~Child(~Element(~"*", ~[Exists(~"class")]), + ~Element(~"*", ~[])), + ~Element(~"*", ~[])); assert !root.matches_selector(~copy sel4); assert !child1.matches_selector(~copy sel4); diff --git a/src/servo/layout/style/style.rs b/src/servo/layout/style/style.rs index 0d878d0ad7e..a9d7f2b1eee 100644 --- a/src/servo/layout/style/style.rs +++ b/src/servo/layout/style/style.rs @@ -68,7 +68,7 @@ impl style_methods for Node { "] fn get_computed_style() -> computed_style { if !self.has_aux() { - fail "get_computed_style() called on a node without a style!"; + fail ~"get_computed_style() called on a node without a style!"; } ret copy *self.aux(|x| copy x).computed_style; } diff --git a/src/servo/layout/text.rs b/src/servo/layout/text.rs index 6c473bbe921..ea3f90b4b00 100644 --- a/src/servo/layout/text.rs +++ b/src/servo/layout/text.rs @@ -7,10 +7,10 @@ import servo_text::font_library::FontLibrary; import base::{Box, TextBox}; class text_box { - let text: str; + let text: ~str; let mut run: option<TextRun>; - new(-text: str) { + new(-text: ~str) { self.text = text; self.run = none; } @@ -21,7 +21,7 @@ impl text_layout_methods for @Box { fn reflow_text(_available_width: au, subbox: @text_box) { alt self.kind { TextBox(*) { /* ok */ } - _ { fail "expected text box in reflow_text!" } + _ { fail ~"expected text box in reflow_text!" } }; // FIXME: The font library should not be initialized here @@ -44,7 +44,7 @@ fn should_calculate_the_size_of_the_text_box() { import gfx::geometry::px_to_au; let s = Scope(); - let n = s.new_node(Text("firecracker")); + let n = s.new_node(Text(~"firecracker")); let b = n.construct_boxes(); let subbox = alt check b.kind { TextBox(subbox) { subbox } }; |