Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
34 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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})) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters