servo: Move DOM nodes into dom/base

Source-Repo: https://github.com/servo/servo
Source-Revision: e089607ea0f84d4414002fb1e900ac8ecc0d273b
This commit is contained in:
Patrick Walton 2012-05-03 16:33:14 -07:00
Родитель df726d641e
Коммит deab83482c
2 изменённых файлов: 34 добавлений и 28 удалений

Просмотреть файл

@ -0,0 +1,33 @@
import dom::rcu::methods;
import gfx::geom::{au, size};
import layout::base::box;
import util::tree;
enum node_data = {
tree: tree::fields<node>,
kind: node_kind,
// Points to the primary box. Note that there may be multiple
// boxes per DOM node.
mut box: option<box>,
};
enum node_kind {
nk_div,
nk_img(size<au>)
}
type node = rcu::handle<node_data>;
impl of tree::tree for node {
fn tree_fields() -> tree::fields<node> {
ret self.get().tree;
}
}
fn new_node(+k: node_kind) -> node {
rcu::handle(node_data({tree: tree::empty(),
kind: k,
mut box: none}))
}

Просмотреть файл

@ -1,3 +1,4 @@
import dom::base::{nk_img, node_data, node_kind, node, new_node};
import dom::rcu;
import dom::rcu::methods;
import gfx::geom;
@ -10,40 +11,12 @@ enum box = @{
mut bounds: geom::rect<au>
};
enum node_data = {
tree: tree::fields<node>,
kind: node_kind,
// Points to the primary box. Note that there may be multiple
// boxes per DOM node.
mut box: option<box>,
};
enum node_kind {
nk_div,
nk_img(size<au>)
}
type node = rcu::handle<node_data>;
impl of tree::tree for box {
fn tree_fields() -> tree::fields<box> {
ret self.tree;
}
}
impl of tree::tree for node {
fn tree_fields() -> tree::fields<node> {
ret self.get().tree;
}
}
fn new_node(+k: node_kind) -> node {
rcu::handle(node_data({tree: tree::empty(),
kind: k,
mut box: none}))
}
fn new_box(n: node) -> box {
box(@{tree: tree::empty(),
node: n,