Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion enums.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/bin/env fbpython
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
Expand Down Expand Up @@ -66,6 +66,9 @@
"ExperimentalFeature": [
# Mimic web flex-basis behavior (experiment may be broken)
"WebFlexBasis",
# Fix flex basis computation to not apply FitContent constraint in the
# main axis for non-measure container nodes
"FixFlexBasisFitContent",
],
"Gutter": ["Column", "Row", "All"],
"GridTrackType": ["Auto", "Points", "Percent", "Fr", "Minmax"],
Expand Down
68 changes: 68 additions & 0 deletions gentest/fixtures/YGFlexBasisFitContentTest.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<!-- Container child with content overflowing definite column parent.
Flex basis uses content size regardless of ExperimentalFeature state,
because FitContent and MaxContent produce the same result for containers. -->
<div id="container_child_overflows_definite_parent_column"
style="width: 200px; height: 300px;">
<div>
<div style="height: 500px; width: 50px;"></div>
</div>
</div>

<!-- Row variant: container child overflows definite row parent. -->
<div id="container_child_overflows_definite_parent_row"
style="width: 300px; height: 200px; flex-direction: row;">
<div>
<div style="width: 500px; height: 50px;"></div>
</div>
</div>

<!-- Container child content fits within parent bounds.
Same behavior with and without feature (no capping needed). -->
<div id="container_child_within_bounds_column"
style="width: 200px; height: 300px;">
<div>
<div style="height: 100px; width: 50px;"></div>
</div>
</div>

<!-- Multiple container children, both overflowing definite column parent. -->
<div id="multiple_container_children_overflow_column"
style="width: 200px; height: 300px;">
<div>
<div style="height: 400px;"></div>
</div>
<div>
<div style="height: 500px;"></div>
</div>
</div>

<!-- Scroll container: children always use MaxContent in main axis.
Same behavior with and without feature. -->
<div id="scroll_container_column"
style="width: 200px; height: 300px; overflow: scroll;">
<div>
<div style="height: 500px;"></div>
</div>
</div>

<!-- Mix of explicit-height child and overflowing container child. -->
<div id="explicit_and_container_children_column"
style="width: 200px; height: 300px;">
<div style="height: 100px;"></div>
<div>
<div style="height: 500px;"></div>
</div>
</div>

<!-- Items with flex-basis inside a scroll container's auto-height
content container. With FixFlexBasisFitContent, flex-basis is
respected even when the content container's main axis size is
indefinite (NaN). Without the feature, flex-basis would be ignored. -->
<div id="flex_basis_in_scroll_content_container"
data-experiments="FixFlexBasisFitContent"
style="width: 200px; height: 300px; overflow: scroll;">
<div>
<div style="flex-basis: 200px;"></div>
<div style="flex-basis: 300px;"></div>
</div>
</div>
4 changes: 3 additions & 1 deletion java/com/facebook/yoga/YogaExperimentalFeature.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
package com.facebook.yoga;

public enum YogaExperimentalFeature {
WEB_FLEX_BASIS(0);
WEB_FLEX_BASIS(0),
FIX_FLEX_BASIS_FIT_CONTENT(1);

private final int mIntValue;

Expand All @@ -25,6 +26,7 @@ public int intValue() {
public static YogaExperimentalFeature fromInt(int value) {
switch (value) {
case 0: return WEB_FLEX_BASIS;
case 1: return FIX_FLEX_BASIS_FIT_CONTENT;
default: throw new IllegalArgumentException("Unknown enum value: " + value);
}
}
Expand Down
Loading
Loading