Skip to content

Commit

Permalink
Rename methods for Node
Browse files Browse the repository at this point in the history
  • Loading branch information
matthunz committed Sep 25, 2023
1 parent fb1eaaf commit 210e377
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl Context {
.collect();

let node = &mut self.tree[*key];
node.layout(&mut self.taffy);
node.build_layout(&mut self.taffy);

let layout_key = node.layout_key.unwrap();
let layout_children = self.taffy.children(layout_key).unwrap();
Expand Down Expand Up @@ -177,7 +177,7 @@ impl Context {
for key in &self.changes {
let node = &mut self.tree[*key];

let semantics_builder = node.semantics();
let semantics_builder = node.build_semantics();
let semantics = semantics_builder.build(&mut NodeClassSet::lock_global());

let id = if let Some(id) = self.unused_ids.pop() {
Expand Down
9 changes: 7 additions & 2 deletions src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,18 @@ impl Node {
}
}

/// Get the absolute layout of the node, relative to the window.
pub fn layout(&self) -> Option<Layout> {
self.layout
}

/// Build a semantics node.
pub fn semantics(&self) -> NodeBuilder {
pub fn build_semantics(&self) -> NodeBuilder {
NodeBuilder::default()
}

/// Setup the layout node.
pub fn layout(&mut self, taffy: &mut Taffy) {
pub fn build_layout(&mut self, taffy: &mut Taffy) {
let mut style = Style::default();
if let NodeData::Element(ref mut elem) = self.data {
if let Some(size) = elem.size() {
Expand Down

0 comments on commit 210e377

Please sign in to comment.