mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 09:45:41 +00:00
servo: Capitalize more types
Source-Repo: https://github.com/servo/servo Source-Revision: 47e5d225c9bb3e1c3cb1ac0d86845eac5eee2fe6
This commit is contained in:
parent
1e5065e472
commit
4e3d93a612
@ -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<NodeData, layout_data>;
|
||||
type Node = rcu::Handle<NodeData, LayoutData>;
|
||||
|
||||
type NodeScope = rcu::Scope<NodeData, layout_data>;
|
||||
type NodeScope = rcu::Scope<NodeData, LayoutData>;
|
||||
|
||||
fn NodeScope() -> NodeScope {
|
||||
rcu::Scope()
|
||||
|
@ -24,7 +24,7 @@ enum BoxKind {
|
||||
TextBox(@text_box)
|
||||
}
|
||||
|
||||
class appearance {
|
||||
class Appearance {
|
||||
let mut background_image: option<@image>;
|
||||
let mut background_color: option<Color>;
|
||||
|
||||
@ -39,26 +39,26 @@ class Box {
|
||||
let node: Node;
|
||||
let kind: BoxKind;
|
||||
let mut bounds: Rect<au>;
|
||||
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<Node> for ntree {
|
||||
enum NTree { NTree }
|
||||
impl NodeTreeReadMethods of tree::ReadMethods<Node> 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<Node> 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<au>] {
|
||||
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);
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ fn build_display_list_from_origin(box: @Box, origin: Point2D<au>)
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -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));
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user