зеркало из https://github.com/mozilla/gecko-dev.git
servo: Move DOM nodes into dom/base
Source-Repo: https://github.com/servo/servo Source-Revision: e089607ea0f84d4414002fb1e900ac8ecc0d273b
This commit is contained in:
Родитель
df726d641e
Коммит
deab83482c
|
@ -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,
|
||||
|
|
Загрузка…
Ссылка в новой задаче