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
3 changes: 3 additions & 0 deletions enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
# Absolute nodes will resolve percentages against the inner size of
# their containing node, not the padding box
("AbsolutePercentAgainstInnerSize", 1 << 2),
# Applies a FitContent constraint in the main axis during flex basis
# computation for non-measure container nodes
("FlexBasisFitContentInMainAxis", 1 << 3),
# Enable all incorrect behavior (preserve compatibility)
("All", 0x7FFFFFFF),
# Enable all errata except for "StretchFlexBasis" (Defaults behavior
Expand Down
68 changes: 68 additions & 0 deletions gentest/fixtures/YGFlexBasisFitContentInMainAxisTest.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<!-- Container child with content overflowing definite column parent.
Without FlexBasisFitContentInMainAxis errata (corrected behavior),
flex basis uses MaxContent: child height = content height (500),
not capped by parent's available height. -->
<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 errata (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 errata. -->
<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. Without errata, flex-basis is respected even
when the content container's main axis size is indefinite (NaN).
With errata, flex-basis would be ignored. -->
<div id="flex_basis_in_scroll_content_container"
style="width: 200px; height: 300px; overflow: scroll;">
<div>
<div style="flex-basis: 200px;"></div>
<div style="flex-basis: 300px;"></div>
</div>
</div>
2 changes: 2 additions & 0 deletions java/com/facebook/yoga/YogaErrata.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public enum YogaErrata {
STRETCH_FLEX_BASIS(1),
ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING(2),
ABSOLUTE_PERCENT_AGAINST_INNER_SIZE(4),
FLEX_BASIS_FIT_CONTENT_IN_MAIN_AXIS(8),
ALL(2147483647),
CLASSIC(2147483646);

Expand All @@ -33,6 +34,7 @@ public static YogaErrata fromInt(int value) {
case 1: return STRETCH_FLEX_BASIS;
case 2: return ABSOLUTE_POSITION_WITHOUT_INSETS_EXCLUDES_PADDING;
case 4: return ABSOLUTE_PERCENT_AGAINST_INNER_SIZE;
case 8: return FLEX_BASIS_FIT_CONTENT_IN_MAIN_AXIS;
case 2147483647: return ALL;
case 2147483646: return CLASSIC;
default: throw new IllegalArgumentException("Unknown enum value: " + value);
Expand Down
Loading
Loading