Skip to content

Commit

Permalink
Update 0.3.x for 0.3.11 (#455)
Browse files Browse the repository at this point in the history
* Fix layout of direct flex children with `display:none` set (#380)

* Add test for toggling display:none

* Add test for toggling display:none on a flexbox child

* Fix layout direct flex children with `display:none` set

* Add test for toggling display:none on flexbox container

* Fix setting display:none on a grid child (#382)

* Prepare for 0.3.5 release (#381)

* Prepare for 0.3.5 release

* Add grid PR to release notes

* Ignore align_content in non-wrapping flexbox containers (#383)

* Add tests for bevyengine/bevy#7976

* Simplify code in compute_constants

* Ignore align_contents if flex_wrap is set to no_wrap

* Remove commented out code

* Prepare for v0.3.6 release (#384)

* Use mutable slice rather mutable vec parameter

* Reduce style accesses (#386)

* Use cached flex_grow and flex_shrink values when resolving flexible lengths

* Cache auto margins on FlexItem struct

* Use constants.is_wrap instead of re-resolving style

* Use cached align_content value rather than re-resolving style

* Cache justify_content style in AlgoConstants

* Add failing tests for borders flooring node size

* Add failing tests for padding flooring node size

* Fix divide by zero in main size determination

* Add seperate leaf and flexbox tests for padding/border flooring node size

* Fix padding/border flooring leaf node size

* Fix flexbox children being floored by padding/border

* Combine padding and border tests + make edge dimensions uneven

* Add padding/border floor absolute child size

* Add padding/border floor node size tests for grid

* Add grid container test for padding/border flooring node size

* Fix padding/border flooring size of absolutely positioned children

* Rename grid padding/border tests so that they are all located together

* Make padding/border floor node size for grid children

* Make padding/border floor node size for grid containers

* Apply aspect ratio to leaf nodes whose size is determined by padding/border sum

* Add test for padding/border not affecting flex basis

* Convert flex basis determination to use break from block

* Add test for flex-basis 0 with flex grow

* Floor flex-basis limits by preferred size style value when determining flex container main size

* Floor outer flex-basis by padding_border sum (floors inner flex-basis at 0)

* Remove commented out code

* Add missing 0

* Test cases for bevyengine/bevy#8017 and Taffy #387

* Prevent percentage sizes from contributing a flex item's min-content size

* Prepare for 0.3.7 release (#389)

* Prepare for 0.3.7 release

* Fix duplicate content in the changelog

* Fix markdown lint

* Upgrade to better Github Actions for faster and better maintained CI (#390)

* Use taiki-e/install-action for installing cargo-deny

* Update CI to use dtolnay/rust-toolchain action

* Enable CI for 0.3.x branch

* Fix documentation CI

* Dummy Cargo.toml change

* Add fully reduced test case for #387 (#391)

* Fix wrapping nodes generating an incorrect min-content size (#395)

* Add tests for bevyengine/bevy#8082

* Debug log parent size

* Pass correct cross-axis parent_size/available_space when computing a flex item's min-content contribution

* Prepare for 0.3.8 release (#396)

* Don't allow cached results to be used for sizings with greater available space (#397)

* Don't allow cached results to be used for sizings with greater available space

* Update caching tests to use tree 100 nodes deep (relax permitted measure count to 7)

* Prepare for 0.3.9 release (#398)

* Prepare for 0.3.9 release

* Add bevyengine/bevy#8124 to release notes

* Allow multiple syn versions

* Tree creation benchmarks (#401)

* Add tree creation benchmarks

* Rename allocation benchmark to tree_creation

* Update rstest requirement from 0.16.0 to 0.17.0 (#402)

Updates the requirements on [rstest](https://github.com/la10736/rstest) to permit the latest version.
- [Release notes](https://github.com/la10736/rstest/releases)
- [Changelog](https://github.com/la10736/rstest/blob/master/CHANGELOG.md)
- [Commits](la10736/rstest@0.16.0...0.17.0)

---
updated-dependencies:
- dependency-name: rstest
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update syn requirement from 1.0.7 to 2.0.4 (#403)

Updates the requirements on [syn](https://github.com/dtolnay/syn) to permit the latest version.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](dtolnay/syn@1.0.7...2.0.4)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix: available space in the presence of a min width (#407)

* Add `with_main` and `with_cross` methods to Size

* Add test for min_width > available_space

* Clamp available cross space by min/max height when computing flex basis

* Clamp available cross space by min/max size when computing hypothetical cross size

* Bump measure func call counts to 8

* Prepare for 0.3.10 release (#411)

* Fix import lints (#416)

(cherry picked from commit 5522573)

* Add caching to CI (#418)

* Optimise flexbox layouts with min/max sizes (#413)

* Remove 2-pass min/max code path + implement main size min/max clamping within determine_container_main_size method

* Fix typo in flex_grow_within_constrained_min_max_column test

* Implement cross-size min/max clamping inline in algorithm

* Remove debug log

* Remove commented code

* Prepare for 0.3.11 release (#419)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andreas Weibye <13300393+Weibye@users.noreply.github.com>
Co-authored-by: TimJentzsch <commits@timjen.net>
  • Loading branch information
5 people authored Apr 19, 2023
1 parent 1e4b80d commit 1cc9406
Show file tree
Hide file tree
Showing 71 changed files with 2,708 additions and 427 deletions.
133 changes: 33 additions & 100 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches:
- main
- 0.2.x
- 0.3.x

name: Continuous integration

Expand All @@ -13,163 +14,95 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: build
args: --no-default-features
- uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features
- uses: dtolnay/rust-toolchain@stable
- uses: Leafwing-Studios/cargo-cache@v1
- run: cargo build --no-default-features
- run: cargo test --no-default-features

test-features-default:
name: "Test Suite [Features: Default]"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: build
- uses: actions-rs/cargo@v1
with:
command: test
- uses: dtolnay/rust-toolchain@stable
- run: cargo build
- run: cargo test

test-features-default-with-serde:
name: "Test Suite [Features: Default + serde]"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: build
args: --features serde
- uses: actions-rs/cargo@v1
with:
command: test
args: --features serde
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --features serde
- run: cargo test --features serde

test-features-alloc:
name: "Test Suite [Features: alloc]"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: build
args: --no-default-features --features alloc,grid
- uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features --features alloc,grid
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --no-default-features --features alloc,grid
- run: cargo test --no-default-features --features alloc,grid

test-features-alloc-no-grid:
name: "Test Suite [Features: alloc (no grid)]"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: build
args: --no-default-features --features alloc
- uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features --features alloc
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --no-default-features --features alloc
- run: cargo test --no-default-features --features alloc

test-features-default-no-grid:
name: "Test Suite [Features: std (no grid)]"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- uses: actions-rs/cargo@v1
with:
command: build
args: --no-default-features --features std
- uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features --features std
- uses: dtolnay/rust-toolchain@stable
- uses: Leafwing-Studios/cargo-cache@v1
- run: cargo build --no-default-features --features std
- run: cargo test --no-default-features --features std

fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
components: rustfmt
- uses: Leafwing-Studios/cargo-cache@v1
- run: cargo fmt --all -- --check

clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: nightly
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: clippy
args: --workspace -- -D warnings
components: clippy
- uses: Leafwing-Studios/cargo-cache@v1
- run: cargo +nightly clippy --workspace -- -D warnings

doc:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@master
with:
profile: minimal
toolchain: stable
override: true
- run: rustup component add clippy
- uses: actions-rs/cargo@v1
with:
command: doc
components: clippy
- uses: Leafwing-Studios/cargo-cache@v1
- run: cargo doc
env:
RUSTDOCFLAGS: "-D warnings"


markdownlint:
name: Markdown Lint
runs-on: ubuntu-latest
Expand Down
28 changes: 4 additions & 24 deletions .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,50 +22,30 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install cargo-deny
run: cargo install cargo-deny
- uses: taiki-e/install-action@cargo-deny
- name: Check for security advisories and unmaintained crates
run: cargo deny check advisories

check-bans:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install cargo-deny
run: cargo install cargo-deny
- uses: taiki-e/install-action@cargo-deny
- name: Check for banned and duplicated dependencies
run: cargo deny check bans

check-licenses:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install cargo-deny
run: cargo install cargo-deny
- uses: taiki-e/install-action@cargo-deny
- name: Check for unauthorized licenses
run: cargo deny check licenses

check-sources:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install cargo-deny
run: cargo install cargo-deny
- uses: taiki-e/install-action@cargo-deny
- name: Checked for unauthorized crate sources
run: cargo deny check sources
11 changes: 8 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "taffy"
version = "0.3.4"
version = "0.3.11"
authors = [
"Alice Cecile <alice.i.cecile@gmail.com>",
"Johnathan Kelley <jkelleyrtp@gmail.com>",
]
edition = "2021"
include = ["src/**/*", "Cargo.toml", "README.md"]
description = "A flexible UI layout library"
description = "A flexible UI layout library "
repository = "https://github.com/DioxusLabs/taffy"
keywords = ["cross-platform", "layout", "flexbox", "css-grid", "grid"]
categories = ["gui"]
Expand All @@ -34,7 +34,7 @@ profile = []

[dev-dependencies]
criterion = "0.4"
rstest = "0.16.0"
rstest = "0.17.0"
rand = "0.8.5"
rand_chacha = "0.3.1"
yoga = "0.4.0"
Expand All @@ -48,6 +48,11 @@ taffy = { path = ".", features = ["random"] }
lto = true
panic = 'abort'

[[bench]]
name = "tree_creation"
path = "benches/tree_creation.rs"
harness = false

[[bench]]
name = "flexbox"
path = "benches/flexbox.rs"
Expand Down
44 changes: 44 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
# Release Notes

## 0.3.11

### Fixes

- Fix exponential blowup when laying out trees containing nodes with min and max sizes.

## 0.3.10

### Fixes

- Fix sizing of children when the available_space < min_size (#407)

## 0.3.9

### Fixes

- Fix caching bug where a cached result would sometimes be incorrectly used when the amount of available space increased (bevyengine/bevy#8111) and (bevyengine/bevy#8124)

## 0.3.8

### Fixes

- Fix incorrect min-content size for `flex-wrap: wrap` nodes (bevyengine/bevy#8082)

## 0.3.7

### Fixes

- Fix: Make `padding` and `border` floor node sizes (#372)
- Fix: Prevent percentages contributing to min-content sizes (#388) (also fixes bevyengine/bevy#8017)

## 0.3.6

### Fixes

- Fix: Ignore `align_content` when `flex_wrap` is set to `nowrap` (#383)

## 0.3.5

### Fixes

- Fix `display: none` when it is set on a flexbox child (#380)
- Fix `display: none` when it is set on a grid child (#381)

## 0.3.4

### Fixes
Expand Down
1 change: 1 addition & 0 deletions benches/helpers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pub mod yoga_helpers;

/// A helper function to recursively construct a deep tree
#[allow(dead_code)]
pub fn build_deep_tree<T, N>(
tree: &mut T,
max_nodes: u32,
Expand Down
12 changes: 12 additions & 0 deletions benches/helpers/yoga_helpers.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(dead_code)]
use slotmap::{DefaultKey, SlotMap};

pub mod yg {
Expand All @@ -12,6 +13,17 @@ mod tf {
pub use taffy::prelude::*;
}

pub fn new_default_style_with_children(
tree: &mut SlotMap<DefaultKey, yg::Node>,
children: Vec<DefaultKey>,
) -> DefaultKey {
let mut node = yg::Node::new();
for (i, child) in children.into_iter().enumerate() {
node.insert_child(&mut tree[child], i as u32);
}
tree.insert(node)
}

pub fn new_with_children(
tree: &mut SlotMap<DefaultKey, yg::Node>,
style: &tf::Style,
Expand Down
Loading

0 comments on commit 1cc9406

Please sign in to comment.