diff --git a/Cargo.lock b/Cargo.lock index e34e0ef63e..fb4ff00a19 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3292,9 +3292,8 @@ dependencies = [ [[package]] name = "fontique" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbf1df16263783918b7da396077521f92b729ef7c429444dfcf03581f1448b77" +version = "0.11.0" +source = "git+https://github.com/linebender/parley?rev=62790943af982ad3388a3ff96cef6f90ac80a8bb#62790943af982ad3388a3ff96cef6f90ac80a8bb" dependencies = [ "hashbrown 0.17.1", "linebender_resource_handle", @@ -6035,18 +6034,16 @@ dependencies = [ [[package]] name = "parlance" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73072a9470554c8e794778acece2312661218aaabb635600957d952cf01c716e" +version = "0.1.0" +source = "git+https://github.com/linebender/parley?rev=62790943af982ad3388a3ff96cef6f90ac80a8bb#62790943af982ad3388a3ff96cef6f90ac80a8bb" dependencies = [ "bytemuck", ] [[package]] name = "parley" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61bd0c0c1737f0b3d3726dc06b225083af213b61913e4fbae1670613a106c6ce" +version = "0.11.0" +source = "git+https://github.com/linebender/parley?rev=62790943af982ad3388a3ff96cef6f90ac80a8bb#62790943af982ad3388a3ff96cef6f90ac80a8bb" dependencies = [ "fontique", "hashbrown 0.17.1", @@ -6058,9 +6055,8 @@ dependencies = [ [[package]] name = "parley_data" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43b63f808f6cc8f4a3b07de0d62a977bddd2e0bb5c232bd9e93ba8ef92e5e4b" +version = "0.11.0" +source = "git+https://github.com/linebender/parley?rev=62790943af982ad3388a3ff96cef6f90ac80a8bb#62790943af982ad3388a3ff96cef6f90ac80a8bb" dependencies = [ "icu_collections", "icu_properties", @@ -6068,15 +6064,13 @@ dependencies = [ [[package]] name = "parley_emoji" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c4482d912d7671a7cd2089794f90ef3bb5f5f8c738230fb0fcd50fa020f0ed3" +version = "0.11.0" +source = "git+https://github.com/linebender/parley?rev=62790943af982ad3388a3ff96cef6f90ac80a8bb#62790943af982ad3388a3ff96cef6f90ac80a8bb" [[package]] name = "parley_engine" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b74c0d373e462e504ad4436710a39f099e18e848e1ee711f70cd2dcd5a69b290" +version = "0.11.0" +source = "git+https://github.com/linebender/parley?rev=62790943af982ad3388a3ff96cef6f90ac80a8bb#62790943af982ad3388a3ff96cef6f90ac80a8bb" dependencies = [ "fontique", "harfrust", @@ -7137,8 +7131,7 @@ dependencies = [ [[package]] name = "selectors" version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8322aebea94a6cc288ff884e8a49bdbceef60206c400c6c46d22e62fc4fd91a6" +source = "git+https://github.com/DioxusLabs/stylo?rev=ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345#ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" dependencies = [ "bitflags 2.13.2", "cssparser", @@ -7277,8 +7270,7 @@ dependencies = [ [[package]] name = "servo_arc" version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4eceb519ec34d8290aaf6e46f435102f2bfa63f22b05a144fb16ab266d3b198" +source = "git+https://github.com/DioxusLabs/stylo?rev=ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345#ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" dependencies = [ "serde", "stable_deref_trait", @@ -7738,8 +7730,7 @@ dependencies = [ [[package]] name = "stylo" version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a255e46af2478628c48daab3774090caabd7812b1dd3ca98801c2b9c53491ed" +source = "git+https://github.com/DioxusLabs/stylo?rev=ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345#ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" dependencies = [ "app_units", "arrayvec", @@ -7795,8 +7786,7 @@ dependencies = [ [[package]] name = "stylo_atoms" version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee1771588fd747ef16f8b1990061b6f37c7d3251a0f9b74f405a44c0c5fb8966" +source = "git+https://github.com/DioxusLabs/stylo?rev=ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345#ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" dependencies = [ "string_cache 0.11.0", "string_cache_codegen", @@ -7805,8 +7795,7 @@ dependencies = [ [[package]] name = "stylo_derive" version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ee5c550c2e00a0b3c046bef84a9ee217e04e7c014142eeb96f9e48781c5cfd3" +source = "git+https://github.com/DioxusLabs/stylo?rev=ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345#ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" dependencies = [ "darling 0.20.11", "proc-macro2", @@ -7818,8 +7807,7 @@ dependencies = [ [[package]] name = "stylo_dom" version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9febcb03f2b669ef06b3e8a5209e6280971ed55cecf83fbf3c0562fcf2aa2ec6" +source = "git+https://github.com/DioxusLabs/stylo?rev=ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345#ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" dependencies = [ "bitflags 2.13.2", "stylo_malloc_size_of", @@ -7828,8 +7816,7 @@ dependencies = [ [[package]] name = "stylo_malloc_size_of" version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83ed69d55ee907599f093221004a28371925236f09f20961963020abf38bab6a" +source = "git+https://github.com/DioxusLabs/stylo?rev=ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345#ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" dependencies = [ "app_units", "cssparser", @@ -7847,8 +7834,7 @@ dependencies = [ [[package]] name = "stylo_static_prefs" version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6767c48a1590461db79f8b434ccc5a2d65600a3b716751f7999b35ccead1e024" +source = "git+https://github.com/DioxusLabs/stylo?rev=ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345#ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" dependencies = [ "toml", ] @@ -7866,8 +7852,7 @@ dependencies = [ [[package]] name = "stylo_traits" version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645d6bfe40eb6e86ebe9f2d2adadcbced41bfa96175de7cb13d4d178d27bc83d" +source = "git+https://github.com/DioxusLabs/stylo?rev=ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345#ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" dependencies = [ "app_units", "bitflags 2.13.2", @@ -8010,7 +7995,7 @@ dependencies = [ [[package]] name = "taffy" version = "0.14.0" -source = "git+https://github.com/DioxusLabs/taffy?rev=7d33901cc383489d9945ae796a1ceed0a935ef66#7d33901cc383489d9945ae796a1ceed0a935ef66" +source = "git+https://github.com/DioxusLabs/taffy?rev=f1e93fe9#f1e93fe9be4642a503ac2a6d625f040c77ed494f" dependencies = [ "serde", "slotmap", @@ -8287,8 +8272,7 @@ checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" [[package]] name = "to_shmem" version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbf077da8dd01cc18453bd7d9bc3a945c262f5f344562e5f6deb3914b4dd6f14" +source = "git+https://github.com/DioxusLabs/stylo?rev=ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345#ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" dependencies = [ "cssparser", "servo_arc", @@ -8301,8 +8285,7 @@ dependencies = [ [[package]] name = "to_shmem_derive" version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f8e91a023810fd2019648410d00eea13a71f21d849e71d6d9ed936fb8061174" +source = "git+https://github.com/DioxusLabs/stylo?rev=ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345#ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" dependencies = [ "darling 0.20.11", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index 8f8da90204..adc173813e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -98,17 +98,18 @@ dioxus-cli-config = { version = "0.7.3" } dioxus-core-macro = { version = "0.7.3" } # Taffy + Parley + Fontations -taffy = { git = "https://github.com/DioxusLabs/taffy", rev = "7d33901cc383489d9945ae796a1ceed0a935ef66", default-features = false, features = [ +taffy = { git = "https://github.com/DioxusLabs/taffy", rev = "f1e93fe9", default-features = false, features = [ "std", "flexbox", "flexbox_balance", "grid", + "grid_lanes", "block_layout", "content_size", "calc", "detailed_layout_info", ] } -parley = { version = "0.12", default-features = false, features = ["std"] } +parley = { git = "https://github.com/linebender/parley", rev = "62790943af982ad3388a3ff96cef6f90ac80a8bb", default-features = false, features = ["std"] } skrifa = { version = "0.44", default-features = false, features = [ "std", ] } # Should match parley and vello versions @@ -326,3 +327,17 @@ rustc-hash = { workspace = true } # [patch."https://github.com/linebender/parley"] # parley = { path = "../parley/parley" } # fontique = { path = "../parley/fontique" } + +[patch.crates-io] +# Stylo with grid-lanes-direction and flow-tolerance (servo/stylo PR pending) +stylo = { git = "https://github.com/DioxusLabs/stylo", rev = "ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" } +stylo_traits = { git = "https://github.com/DioxusLabs/stylo", rev = "ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" } +stylo_atoms = { git = "https://github.com/DioxusLabs/stylo", rev = "ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" } +stylo_static_prefs = { git = "https://github.com/DioxusLabs/stylo", rev = "ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" } +stylo_dom = { git = "https://github.com/DioxusLabs/stylo", rev = "ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" } +stylo_derive = { git = "https://github.com/DioxusLabs/stylo", rev = "ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" } +stylo_malloc_size_of = { git = "https://github.com/DioxusLabs/stylo", rev = "ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" } +selectors = { git = "https://github.com/DioxusLabs/stylo", rev = "ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" } +servo_arc = { git = "https://github.com/DioxusLabs/stylo", rev = "ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" } +to_shmem = { git = "https://github.com/DioxusLabs/stylo", rev = "ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" } +to_shmem_derive = { git = "https://github.com/DioxusLabs/stylo", rev = "ee927b58c0ddb84c1f8eb7e4abe669d69ed3f345" } diff --git a/packages/blitz-dom/src/document.rs b/packages/blitz-dom/src/document.rs index 1be5835e4d..90eeed63ae 100644 --- a/packages/blitz-dom/src/document.rs +++ b/packages/blitz-dom/src/document.rs @@ -394,6 +394,7 @@ impl BaseDocument { // Make sure we turn on stylo features *before* creating the Stylist style_config::set_pref!("layout.grid.enabled", true); + style_config::set_pref!("layout.css.display-grid-lanes.enabled", true); style_config::set_pref!("layout.flexbox.balance", true); style_config::set_pref!("layout.unimplemented", true); style_config::set_pref!("layout.columns.enabled", true); diff --git a/packages/blitz-dom/src/layout/construct.rs b/packages/blitz-dom/src/layout/construct.rs index 63a1657c5f..a8dc80738a 100644 --- a/packages/blitz-dom/src/layout/construct.rs +++ b/packages/blitz-dom/src/layout/construct.rs @@ -531,7 +531,7 @@ fn collect_layout_children_with_wrap( // parent, recursing only through nested contents nodes. push_hoisted_children_and_pseudos(doc, container_node_id, out, wrap); } - DisplayInside::Flex | DisplayInside::Grid => { + DisplayInside::Flex | DisplayInside::Grid | DisplayInside::GridLanes => { // ::before/::after pseudos must be checked too: a pseudo with // display:contents hoists its text content into the container. let container = &doc.nodes[container_node_id]; diff --git a/packages/blitz-dom/src/layout/mod.rs b/packages/blitz-dom/src/layout/mod.rs index 0a5fbc1dc8..3606f5c3d0 100644 --- a/packages/blitz-dom/src/layout/mod.rs +++ b/packages/blitz-dom/src/layout/mod.rs @@ -18,8 +18,8 @@ use taffy::{ AxisStaticEdge, AxisStaticPosition, BlockContext, CoreStyle as _, DetailedLayoutInfo, FlexDirection, LayoutContainingBlock, LayoutPartialTree, MaybeMath as _, NodeId, OofCandidate, ResolveOrZero, RoundTree, RunMode, TraversePartialTree, TraverseTree, compute_block_layout, - compute_cached_layout, compute_flexbox_layout, compute_grid_layout, compute_leaf_layout, - compute_oof_layout, prelude::*, + compute_cached_layout, compute_flexbox_layout, compute_grid_lanes_layout, compute_grid_layout, + compute_leaf_layout, compute_oof_layout, prelude::*, }; pub(crate) mod construct; @@ -595,6 +595,7 @@ impl LayoutPassState<'_> { compute_flexbox_layout(self, node_id, inputs) } Display::Grid => compute_grid_layout(self, node_id, inputs), + Display::GridLanes => compute_grid_lanes_layout(self, node_id, inputs), Display::None => taffy::LayoutOutput::HIDDEN, } } @@ -926,6 +927,7 @@ impl PrintTree for TaffyDebugTree<'_> { FlexDirection::Column | FlexDirection::ColumnReverse => "FLEX COL", }, Display::Grid => "GRID", + Display::GridLanes => "GRID LANES", Display::Block => "BLOCK", Display::FlowRoot => "FLOW ROOT", Display::None => "NONE", diff --git a/packages/blitz-dom/src/layout/table.rs b/packages/blitz-dom/src/layout/table.rs index 8755c8b021..06e06c10c7 100644 --- a/packages/blitz-dom/src/layout/table.rs +++ b/packages/blitz-dom/src/layout/table.rs @@ -738,7 +738,8 @@ fn collect_table_cells( DisplayInside::Flow | DisplayInside::FlowRoot | DisplayInside::Flex - | DisplayInside::Grid => { + | DisplayInside::Grid + | DisplayInside::GridLanes => { node.remove_damage(CONSTRUCT_DESCENDENT | CONSTRUCT_FC | CONSTRUCT_BOX); // Probably a table caption: ignore // println!( diff --git a/packages/blitz-dom/src/resolved_style.rs b/packages/blitz-dom/src/resolved_style.rs index e5c50fb66c..2657147605 100644 --- a/packages/blitz-dom/src/resolved_style.rs +++ b/packages/blitz-dom/src/resolved_style.rs @@ -412,7 +412,10 @@ impl BaseDocument { } } "grid-template-columns" | "grid-template-rows" - if display.inside() == DisplayInside::Grid => + if matches!( + display.inside(), + DisplayInside::Grid | DisplayInside::GridLanes + ) => { if let Some(info) = node.element_data() @@ -431,7 +434,12 @@ impl BaseDocument { // Browsers serialize the `grid-template` shorthand from the computed // track lists, except that a `none` track list on a grid container // is replaced by the used (implicit) track sizes. - "grid-template" if display.inside() == DisplayInside::Grid => { + "grid-template" + if matches!( + display.inside(), + DisplayInside::Grid | DisplayInside::GridLanes + ) => + { let pos_styles = styles.get_position(); let rows_are_none = matches!(pos_styles.grid_template_rows, GridTemplateComponent::None); diff --git a/packages/blitz-paint/src/render.rs b/packages/blitz-paint/src/render.rs index f1ff10d36b..53fb4b5e3f 100644 --- a/packages/blitz-paint/src/render.rs +++ b/packages/blitz-paint/src/render.rs @@ -1215,7 +1215,9 @@ impl ElementCx<'_, '_> { Color::new([1.0, 0.0, 0.0, 1.0]) } taffy::Display::Flex => Color::new([0.0, 1.0, 0.0, 1.0]), - taffy::Display::Grid => Color::new([0.0, 0.0, 1.0, 1.0]), + taffy::Display::Grid | taffy::Display::GridLanes => { + Color::new([0.0, 0.0, 1.0, 1.0]) + } taffy::Display::None => Color::new([0.0, 0.0, 1.0, 1.0]), }; diff --git a/packages/stylo_taffy/Cargo.toml b/packages/stylo_taffy/Cargo.toml index 07e722862a..608180f7cf 100644 --- a/packages/stylo_taffy/Cargo.toml +++ b/packages/stylo_taffy/Cargo.toml @@ -18,11 +18,12 @@ style = { workspace = true } style_atoms = { workspace = true } [features] -default = ["std", "block", "flexbox", "grid"] +default = ["std", "block", "flexbox", "grid", "grid-lanes"] std = ["taffy/std"] block = ["taffy/block_layout"] flexbox = ["taffy/flexbox", "taffy/flexbox_balance"] grid = ["taffy/grid"] +grid-lanes = ["grid", "taffy/grid_lanes"] floats = ["taffy/float_layout"] # Frame-aware style getters for CSS vertical writing modes (transposes physical styles into Taffy's # inline/block axes). Off by default: every getter is the plain physical mapping. diff --git a/packages/stylo_taffy/src/convert.rs b/packages/stylo_taffy/src/convert.rs index 0e6ddfe622..d924d7393f 100644 --- a/packages/stylo_taffy/src/convert.rs +++ b/packages/stylo_taffy/src/convert.rs @@ -50,6 +50,8 @@ pub(crate) mod stylo { pub(crate) use style::values::computed::text::TextAlign; #[cfg(feature = "block")] pub(crate) use style::values::computed::{AlignmentBaseline, BaselineShift}; + #[cfg(feature = "grid-lanes")] + pub(crate) use style::values::computed::{GridLanesDirection, length::FitTolerance}; #[cfg(feature = "block")] pub(crate) use style::values::generics::box_::BaselineShiftKeyword; #[cfg(feature = "grid")] @@ -219,6 +221,8 @@ pub fn display(input: stylo::Display) -> taffy::Display { stylo::DisplayInside::Flex => taffy::Display::Flex, #[cfg(feature = "grid")] stylo::DisplayInside::Grid => taffy::Display::Grid, + #[cfg(feature = "grid-lanes")] + stylo::DisplayInside::GridLanes => taffy::Display::GridLanes, #[cfg(feature = "block")] stylo::DisplayInside::Flow => taffy::Display::Block, #[cfg(feature = "block")] @@ -732,6 +736,45 @@ pub fn clear(input: stylo::Clear) -> taffy::Clear { // CSS Grid styles // =============== +#[inline] +#[cfg(feature = "grid-lanes")] +/// Resolves `grid-lanes-direction`. `normal` establishes rows only when `grid-template-columns` +/// is `none` and `grid-template-rows` is not (css-grid-3 §2.3). +pub fn grid_lanes_direction( + position: &style::properties::style_structs::Position, +) -> taffy::GridLanesDirection { + match position.grid_lanes_direction { + stylo::GridLanesDirection::Row => taffy::GridLanesDirection::Row, + stylo::GridLanesDirection::Column => taffy::GridLanesDirection::Column, + stylo::GridLanesDirection::Normal => { + let columns_none = matches!( + position.grid_template_columns, + stylo::GenericGridTemplateComponent::None + ); + let rows_none = matches!( + position.grid_template_rows, + stylo::GenericGridTemplateComponent::None + ); + if columns_none && !rows_none { + taffy::GridLanesDirection::Row + } else { + taffy::GridLanesDirection::Column + } + } + } +} + +/// `normal` is 1em (css-grid-3 §4.2), so the container's font size is resolved here. +#[inline] +#[cfg(feature = "grid-lanes")] +pub fn fit_tolerance(input: &stylo::FitTolerance, font_size: f32) -> taffy::LengthPercentage { + match input { + stylo::FitTolerance::Normal => taffy::LengthPercentage::length(font_size), + stylo::FitTolerance::LengthPercentage(lp) => length_percentage(&lp.0), + stylo::FitTolerance::Infinite => taffy::LengthPercentage::length(f32::INFINITY), + } +} + #[inline] #[cfg(feature = "grid")] pub fn grid_auto_flow(input: stylo::GridAutoFlow) -> taffy::GridAutoFlow { @@ -799,9 +842,8 @@ pub fn grid_template_tracks( }) .collect(), - // TODO: Implement subgrid and masonry + // TODO: Implement subgrid stylo::GenericGridTemplateComponent::Subgrid(_) => Vec::new(), - stylo::GenericGridTemplateComponent::Masonry => Vec::new(), } } @@ -816,9 +858,8 @@ pub fn grid_template_line_names( Some(crate::wrapper::StyloLineNameIter::new(&list.line_names)) } - // TODO: Implement subgrid and masonry + // TODO: Implement subgrid stylo::GenericGridTemplateComponent::Subgrid(_) => None, - stylo::GenericGridTemplateComponent::Masonry => None, } } @@ -1060,6 +1101,13 @@ pub fn to_taffy_style(style: &stylo::ComputedValues) -> taffy::Style { // Grid #[cfg(feature = "grid")] grid_auto_flow: self::grid_auto_flow(pos.grid_auto_flow), + #[cfg(feature = "grid-lanes")] + grid_lanes_direction: grid_lanes_direction(pos), + #[cfg(feature = "grid-lanes")] + fit_tolerance: fit_tolerance( + &style.clone_fit_tolerance(), + style.clone_font_size().used_size().px(), + ), #[cfg(feature = "grid")] grid_template_rows: self::grid_template_tracks(&pos.grid_template_rows), #[cfg(feature = "grid")] diff --git a/packages/stylo_taffy/src/wrapper.rs b/packages/stylo_taffy/src/wrapper.rs index fe93789a62..4f3a92dd10 100644 --- a/packages/stylo_taffy/src/wrapper.rs +++ b/packages/stylo_taffy/src/wrapper.rs @@ -761,9 +761,8 @@ impl> taffy::GridContainerStyle for TaffyStylo })) } - // TODO: Implement subgrid and masonry + // TODO: Implement subgrid stylo::GenericGridTemplateComponent::Subgrid(_) => None, - stylo::GenericGridTemplateComponent::Masonry => None, } } @@ -782,9 +781,8 @@ impl> taffy::GridContainerStyle for TaffyStylo })) } - // TODO: Implement subgrid and masonry + // TODO: Implement subgrid stylo::GenericGridTemplateComponent::Subgrid(_) => None, - stylo::GenericGridTemplateComponent::Masonry => None, } } @@ -827,9 +825,8 @@ impl> taffy::GridContainerStyle for TaffyStylo stylo::GenericGridTemplateComponent::TrackList(list) => { Some(StyloLineNameIter::new(&list.line_names)) } - // TODO: Implement subgrid and masonry + // TODO: Implement subgrid stylo::GenericGridTemplateComponent::Subgrid(_) => None, - stylo::GenericGridTemplateComponent::Masonry => None, } } @@ -839,9 +836,8 @@ impl> taffy::GridContainerStyle for TaffyStylo stylo::GenericGridTemplateComponent::TrackList(list) => { Some(StyloLineNameIter::new(&list.line_names)) } - // TODO: Implement subgrid and masonry + // TODO: Implement subgrid stylo::GenericGridTemplateComponent::Subgrid(_) => None, - stylo::GenericGridTemplateComponent::Masonry => None, } } @@ -850,6 +846,19 @@ impl> taffy::GridContainerStyle for TaffyStylo convert::grid_auto_flow(self.style.get_position().grid_auto_flow) } + #[cfg(feature = "grid-lanes")] + #[inline] + fn grid_lanes_direction(&self) -> taffy::GridLanesDirection { + convert::grid_lanes_direction(self.style.get_position()) + } + + #[cfg(feature = "grid-lanes")] + #[inline] + fn fit_tolerance(&self) -> taffy::LengthPercentage { + let font_size = self.style.clone_font_size().used_size().px(); + convert::fit_tolerance(&self.style.get_position().fit_tolerance, font_size) + } + #[inline] fn gap(&self) -> taffy::Size { let position_styles = self.style.get_position();