From 47e5d225c9bb3e1c3cb1ac0d86845eac5eee2fe6 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Thu, 28 Jun 2012 15:38:03 -0700 Subject: [PATCH] Capitalize more types --- src/servo/dom/base.rs | 6 ++--- src/servo/layout/base.rs | 30 ++++++++++++------------ src/servo/layout/block.rs | 2 +- src/servo/layout/box_builder.rs | 16 ++++++------- src/servo/layout/display_list_builder.rs | 2 +- src/servo/layout/inline.rs | 2 +- src/servo/layout/style/apply.rs | 2 +- src/servo/layout/style/matching.rs | 2 +- src/servo/layout/style/style.rs | 6 ++--- 9 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/servo/dom/base.rs b/src/servo/dom/base.rs index 88fb9ed6749..36cf783d0ac 100644 --- a/src/servo/dom/base.rs +++ b/src/servo/dom/base.rs @@ -3,7 +3,7 @@ import dom::rcu::WriterMethods; import gfx::geometry::au; import geom::size::Size2D; -import layout::base::layout_data; +import layout::base::LayoutData; import util::tree; import dvec::{dvec, extensions}; @@ -64,9 +64,9 @@ enum ElementKind { the primary box. Note that there may be multiple boxes per DOM node. "] -type Node = rcu::Handle; +type Node = rcu::Handle; -type NodeScope = rcu::Scope; +type NodeScope = rcu::Scope; fn NodeScope() -> NodeScope { rcu::Scope() diff --git a/src/servo/layout/base.rs b/src/servo/layout/base.rs index cb3a6e881bf..5410aaa043a 100644 --- a/src/servo/layout/base.rs +++ b/src/servo/layout/base.rs @@ -24,7 +24,7 @@ enum BoxKind { TextBox(@text_box) } -class appearance { +class Appearance { let mut background_image: option<@image>; let mut background_color: option; @@ -39,26 +39,26 @@ class Box { let node: Node; let kind: BoxKind; let mut bounds: Rect; - let appearance: appearance; + let appearance: Appearance; new(node: Node, kind: BoxKind) { self.tree = tree::empty(); self.node = node; self.kind = kind; self.bounds = geometry::zero_rect_au(); - self.appearance = appearance(); + self.appearance = Appearance(); } } -enum layout_data = { +enum LayoutData = { mut computed_style: ~computed_style, mut box: option<@Box> }; // FIXME: This is way too complex! Why do these have to have dummy receivers? --pcw -enum ntree { ntree } -impl NodeTreeReadMethods of tree::ReadMethods for ntree { +enum NTree { NTree } +impl NodeTreeReadMethods of tree::ReadMethods for NTree { fn each_child(node: Node, f: fn(Node) -> bool) { tree::each_child(self, node, f) } @@ -68,8 +68,8 @@ impl NodeTreeReadMethods of tree::ReadMethods for ntree { } } -enum btree { btree } -impl BoxTreeReadMethods of tree::ReadMethods<@Box> for btree { +enum BTree { BTree } +impl BoxTreeReadMethods of tree::ReadMethods<@Box> for BTree { fn each_child(node: @Box, f: fn(&&@Box) -> bool) { tree::each_child(self, node, f) } @@ -79,7 +79,7 @@ impl BoxTreeReadMethods of tree::ReadMethods<@Box> for btree { } } -impl BoxTreeWriteMethods of tree::WriteMethods<@Box> for btree { +impl BoxTreeWriteMethods of tree::WriteMethods<@Box> for BTree { fn add_child(node: @Box, child: @Box) { tree::add_child(self, node, child) } @@ -101,7 +101,7 @@ impl layout_methods_priv for @Box { s += #fmt("%?", self.kind); #debug["%s", s]; - for btree.each_child(self) { |kid| kid.dump_indent(indent + 1u) } + for BTree.each_child(self) { |kid| kid.dump_indent(indent + 1u) } } } @@ -143,7 +143,7 @@ impl PrivateNodeMethods for Node { s += #fmt("%?", self.read({ |n| copy n.kind })); #debug["%s", s]; - for ntree.each_child(self) { |kid| kid.dump_indent(indent + 1u) } + for NTree.each_child(self) { |kid| kid.dump_indent(indent + 1u) } } } @@ -179,7 +179,7 @@ mod test { fn flat_bounds(root: @Box) -> [Rect] { let mut r = []; - for tree::each_child(btree, root) {|c| + for tree::each_child(BTree, root) {|c| r += flat_bounds(c); } ret r + [copy root.bounds]; @@ -208,9 +208,9 @@ mod test { let b2 = n2.construct_boxes(); let b3 = n3.construct_boxes(); - tree::add_child(btree, b3, b0); - tree::add_child(btree, b3, b1); - tree::add_child(btree, b3, b2); + tree::add_child(BTree, b3, b0); + tree::add_child(BTree, b3, b1); + tree::add_child(BTree, b3, b2); b3.reflow_block(au(100)); let fb = flat_bounds(b3); diff --git a/src/servo/layout/block.rs b/src/servo/layout/block.rs index d722e403190..21e85db39cf 100644 --- a/src/servo/layout/block.rs +++ b/src/servo/layout/block.rs @@ -23,7 +23,7 @@ impl block_layout_methods for @Box { // - and recursively computes the bounds for each child let mut current_height = 0; - for tree::each_child(btree, self) {|c| + for tree::each_child(BTree, self) {|c| let mut blk_available_width = available_width; // FIXME subtract borders, margins, etc c.bounds.origin = Point2D(au(0), au(current_height)); diff --git a/src/servo/layout/box_builder.rs b/src/servo/layout/box_builder.rs index e495cfd1e36..aa0393a4ada 100644 --- a/src/servo/layout/box_builder.rs +++ b/src/servo/layout/box_builder.rs @@ -6,7 +6,7 @@ import dom::rcu::ReaderMethods; import gfx::geometry; import layout::base::{BlockBox, Box, BoxKind, BoxTreeReadMethods, BoxTreeWriteMethods, InlineBox}; import layout::base::{IntrinsicBox, NodeMethods, NodeTreeReadMethods, TextBox}; -import layout::base::{appearance, btree, ntree}; +import layout::base::{Appearance, BTree, NTree}; import layout::style::style::{style_methods}; import layout::text::text_box; import util::tree; @@ -43,7 +43,7 @@ impl methods for ctxt { attribute is 'block'. "] fn construct_boxes_for_block_children() { - for ntree.each_child(self.parent_node) { + for NTree.each_child(self.parent_node) { |kid| // Create boxes for the child. Get its primary box. @@ -58,7 +58,7 @@ impl methods for ctxt { // Add the child's box to the current enclosing box or the current anonymous box. alt kid.get_computed_style().display { di_block { - btree.add_child(self.parent_box, kid_box); + BTree.add_child(self.parent_box, kid_box); } di_inline { let anon_box = alt self.anon_box { @@ -77,7 +77,7 @@ impl methods for ctxt { } some(b) { b } }; - btree.add_child(anon_box, kid_box); + BTree.add_child(anon_box, kid_box); } di_none { // Nothing to do. @@ -91,7 +91,7 @@ impl methods for ctxt { attribute is 'inline'. "] fn construct_boxes_for_inline_children() { - for ntree.each_child(self.parent_node) { + for NTree.each_child(self.parent_node) { |kid| // Construct boxes for the child. Get its primary box. @@ -108,10 +108,10 @@ impl methods for ctxt { di_block { // TODO #warn("TODO: non-inline display found inside inline box"); - btree.add_child(self.parent_box, kid_box); + BTree.add_child(self.parent_box, kid_box); } di_inline { - btree.add_child(self.parent_box, kid_box); + BTree.add_child(self.parent_box, kid_box); } di_none { // Nothing to do. @@ -142,7 +142,7 @@ impl methods for ctxt { fn finish_anonymous_box_if_necessary() { alt copy self.anon_box { none { /* Nothing to do. */ } - some(b) { btree.add_child(self.parent_box, b); } + some(b) { BTree.add_child(self.parent_box, b); } } self.anon_box = none; } diff --git a/src/servo/layout/display_list_builder.rs b/src/servo/layout/display_list_builder.rs index c59f1be38d8..7cfe47a42b1 100644 --- a/src/servo/layout/display_list_builder.rs +++ b/src/servo/layout/display_list_builder.rs @@ -43,7 +43,7 @@ fn build_display_list_from_origin(box: @Box, origin: Point2D) let mut list = box_to_display_items(box, box_origin); - for btree.each_child(box) {|c| + for BTree.each_child(box) {|c| #debug("Recursively building display list with origin %?", box_origin); list += build_display_list_from_origin(c, box_origin); } diff --git a/src/servo/layout/inline.rs b/src/servo/layout/inline.rs index b384ab21f27..4ac49310c67 100644 --- a/src/servo/layout/inline.rs +++ b/src/servo/layout/inline.rs @@ -21,7 +21,7 @@ impl inline_layout_methods for @Box { let y = 0; let mut x = 0, inline_available_width = *available_width; let mut current_height = 0; - for tree::each_child(btree, self) { + for tree::each_child(BTree, self) { |kid| kid.bounds.origin = Point2D(au(x), au(y)); kid.reflow(au(inline_available_width)); diff --git a/src/servo/layout/style/apply.rs b/src/servo/layout/style/apply.rs index be6a2c8f10b..d856a493782 100644 --- a/src/servo/layout/style/apply.rs +++ b/src/servo/layout/style/apply.rs @@ -9,7 +9,7 @@ import style::style_methods; impl ApplyStyleBoxMethods for @Box { fn apply_style_for_subtree() { self.apply_style(); - for btree.each_child(self) { + for BTree.each_child(self) { |child| child.apply_style_for_subtree(); } diff --git a/src/servo/layout/style/matching.rs b/src/servo/layout/style/matching.rs index d60cddf6660..38e086b1983 100644 --- a/src/servo/layout/style/matching.rs +++ b/src/servo/layout/style/matching.rs @@ -1,6 +1,6 @@ #[doc="Performs CSS selector matching."] -import base::{layout_data}; +import base::{LayoutData}; import dom::base::{Element, ElementData, Node, Text}; import dom::style::{selector, style_decl, font_size, display, text_color, background_color, stylesheet, element, child, descendant, sibling, attr, exact, exists, includes, diff --git a/src/servo/layout/style/style.rs b/src/servo/layout/style/style.rs index c9f05a4c7df..c83fbae12cc 100644 --- a/src/servo/layout/style/style.rs +++ b/src/servo/layout/style/style.rs @@ -41,7 +41,7 @@ impl style_priv for Node { "] fn initialize_style() { let node_kind = self.read { |n| copy *n.kind }; - let the_layout_data = @layout_data({ + let the_layout_data = @LayoutData({ mut computed_style : ~default_style_for_node_kind(node_kind), mut box : none }); @@ -55,7 +55,7 @@ impl style_methods for Node { fn initialize_style_for_subtree() { self.initialize_style(); - for ntree.each_child(self) { |kid| + for NTree.each_child(self) { |kid| kid.initialize_style_for_subtree(); } } @@ -84,7 +84,7 @@ impl style_methods for Node { let mut i = 0u; // Compute the styles of each of our children in parallel - for ntree.each_child(self) { |kid| + for NTree.each_child(self) { |kid| i = i + 1u; let new_styles = clone(&styles);