gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 5544Rust 87Markdown 12TOML 91924 Definitions

better `direction` field comments for consistency

3a5be40f9eea71e39665bd412a5a28234551bfd9 · by Kane Wang · (9 months ago) · parent 2519aebad · browse the tree at this commit

Semantic delta · 1

src/compute/grid/alignment.rs

3 files · +8 −11

diff --git a/src/compute/block.rs b/src/compute/block.rs
index b0ea3b460..3f6f5fa2f 100644
--- a/src/compute/block.rs
+++ b/src/compute/block.rs
@@ -207,7 +207,7 @@ struct BlockItem {
     #[cfg(feature = "float_layout")]
     /// The `clear` style of the node
     clear: Clear,
-    /// Direction (LTR or RTL)
+    /// The item's direction
     direction: Direction,
 
     /// The base size of this item
diff --git a/src/compute/flexbox.rs b/src/compute/flexbox.rs
index eba3802df..5eea0cd2e 100644
--- a/src/compute/flexbox.rs
+++ b/src/compute/flexbox.rs
@@ -27,7 +27,7 @@ struct FlexItem {
     /// The order of the node relative to it's siblings
     order: u32,
 
-    /// Direction (LTR or RTL)
+    /// The item's direction
     direction: Direction,
 
     /// The base size of this item
diff --git a/src/compute/grid/alignment.rs b/src/compute/grid/alignment.rs
index a0d840eb3..30eda6747 100644
--- a/src/compute/grid/alignment.rs
+++ b/src/compute/grid/alignment.rs
@@ -274,15 +274,12 @@ pub(super) fn align_and_position_item(
     );
 
     #[cfg(feature = "content_size")]
-    let contribution = {
-        let content_box_origin = Point { x: grid_area.left, y: grid_area.top };
-        compute_content_size_contribution(
-            Point { x, y } - content_box_origin,
-            Size { width, height },
-            layout_output.content_size,
-            overflow,
-        )
-    };
+    let contribution = compute_content_size_contribution(
+        Point { x: x - grid_area.left, y: y - grid_area.top },
+        Size { width, height },
+        layout_output.content_size,
+        overflow,
+    );
     #[cfg(not(feature = "content_size"))]
     let contribution = Size::ZERO;