Skip to content

Commit

Permalink
Import "Fix percent absolute position and size calcuate different wit…
Browse files Browse the repository at this point in the history
…h web" behind experimental feature (#1028) (#1201)

Summary:
Fixes #850

#850 describes a conformance issue where positioning of an absolute child using percentages is not calculated against the correct box size.

This takes the fix for that in #1028, regenerates tests, and fixes tests so that the experimental feature can be enabled. Goal is to run this as an experiment internally to see if we can enable by default.

Changelog:
[Internal]

Pull Request resolved: #1201

Reviewed By: yungsters

Differential Revision: D42282358

Pulled By: NickGerleman

fbshipit-source-id: 57c0dd9b0f1c47cb9335ff6e13d44b4646e5fa58
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Jan 8, 2023
1 parent 627255c commit 7e96b65
Show file tree
Hide file tree
Showing 88 changed files with 3,077 additions and 67 deletions.
2 changes: 2 additions & 0 deletions csharp/Facebook.Yoga/YogaExperimentalFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ namespace Facebook.Yoga
public enum YogaExperimentalFeature
{
WebFlexBasis,
AbsolutePercentageAgainstPaddingEdge,
FixAbsoluteTrailingColumnMargin,
}
}
192 changes: 192 additions & 0 deletions csharp/tests/Facebook.Yoga/YGAbsolutePositionTest.cs

Large diffs are not rendered by default.

38 changes: 38 additions & 0 deletions csharp/tests/Facebook.Yoga/YGAlignContentTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public class YGAlignContentTest
public void Test_align_content_flex_start()
{
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);

YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
Expand Down Expand Up @@ -121,6 +123,8 @@ public void Test_align_content_flex_start()
public void Test_align_content_flex_start_without_height_on_children()
{
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);

YogaNode root = new YogaNode(config);
root.Wrap = YogaWrap.Wrap;
Expand Down Expand Up @@ -219,6 +223,8 @@ public void Test_align_content_flex_start_without_height_on_children()
public void Test_align_content_flex_start_with_flex()
{
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);

YogaNode root = new YogaNode(config);
root.Wrap = YogaWrap.Wrap;
Expand Down Expand Up @@ -323,6 +329,8 @@ public void Test_align_content_flex_start_with_flex()
public void Test_align_content_flex_end()
{
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);

YogaNode root = new YogaNode(config);
root.AlignContent = YogaAlign.FlexEnd;
Expand Down Expand Up @@ -425,6 +433,8 @@ public void Test_align_content_flex_end()
public void Test_align_content_stretch()
{
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);

YogaNode root = new YogaNode(config);
root.AlignContent = YogaAlign.Stretch;
Expand Down Expand Up @@ -522,6 +532,8 @@ public void Test_align_content_stretch()
public void Test_align_content_spacebetween()
{
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);

YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
Expand Down Expand Up @@ -625,6 +637,8 @@ public void Test_align_content_spacebetween()
public void Test_align_content_spacearound()
{
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);

YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
Expand Down Expand Up @@ -728,6 +742,8 @@ public void Test_align_content_spacearound()
public void Test_align_content_stretch_row()
{
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);

YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
Expand Down Expand Up @@ -826,6 +842,8 @@ public void Test_align_content_stretch_row()
public void Test_align_content_stretch_row_with_children()
{
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);

YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
Expand Down Expand Up @@ -940,6 +958,8 @@ public void Test_align_content_stretch_row_with_children()
public void Test_align_content_stretch_row_with_flex()
{
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);

YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
Expand Down Expand Up @@ -1044,6 +1064,8 @@ public void Test_align_content_stretch_row_with_flex()
public void Test_align_content_stretch_row_with_flex_no_shrink()
{
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);

YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
Expand Down Expand Up @@ -1147,6 +1169,8 @@ public void Test_align_content_stretch_row_with_flex_no_shrink()
public void Test_align_content_stretch_row_with_margin()
{
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);

YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
Expand Down Expand Up @@ -1253,6 +1277,8 @@ public void Test_align_content_stretch_row_with_margin()
public void Test_align_content_stretch_row_with_padding()
{
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);

YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
Expand Down Expand Up @@ -1359,6 +1385,8 @@ public void Test_align_content_stretch_row_with_padding()
public void Test_align_content_stretch_row_with_single_row()
{
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);

YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
Expand Down Expand Up @@ -1415,6 +1443,8 @@ public void Test_align_content_stretch_row_with_single_row()
public void Test_align_content_stretch_row_with_fixed_height()
{
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);

YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
Expand Down Expand Up @@ -1514,6 +1544,8 @@ public void Test_align_content_stretch_row_with_fixed_height()
public void Test_align_content_stretch_row_with_max_height()
{
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);

YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
Expand Down Expand Up @@ -1613,6 +1645,8 @@ public void Test_align_content_stretch_row_with_max_height()
public void Test_align_content_stretch_row_with_min_height()
{
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);

YogaNode root = new YogaNode(config);
root.FlexDirection = YogaFlexDirection.Row;
Expand Down Expand Up @@ -1712,6 +1746,8 @@ public void Test_align_content_stretch_row_with_min_height()
public void Test_align_content_stretch_column()
{
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);

YogaNode root = new YogaNode(config);
root.AlignContent = YogaAlign.Stretch;
Expand Down Expand Up @@ -1828,6 +1864,8 @@ public void Test_align_content_stretch_column()
public void Test_align_content_stretch_is_not_overriding_align_items()
{
YogaConfig config = new YogaConfig();
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.AbsolutePercentageAgainstPaddingEdge, true);
config.SetExperimentalFeatureEnabled(YogaExperimentalFeature.FixAbsoluteTrailingColumnMargin, true);

YogaNode root = new YogaNode(config);
root.AlignContent = YogaAlign.Stretch;
Expand Down
Loading

0 comments on commit 7e96b65

Please sign in to comment.