Compare commits

...

4 Commits

Author SHA1 Message Date
dependabot[bot]
26232c33d7 Bump http-proxy-middleware from 2.0.6 to 2.0.7
Bumps [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware) from 2.0.6 to 2.0.7.
- [Release notes](https://github.com/chimurai/http-proxy-middleware/releases)
- [Changelog](https://github.com/chimurai/http-proxy-middleware/blob/v2.0.7/CHANGELOG.md)
- [Commits](https://github.com/chimurai/http-proxy-middleware/compare/v2.0.6...v2.0.7)

---
updated-dependencies:
- dependency-name: http-proxy-middleware
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-21 19:14:09 +00:00
Eric Rozell
0b25796676 Update docusaurus to 3.6.0 (#1749)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1749

Resolves a few NPM security vulnerabilities in webpack and cookie dependencies.

Reviewed By: NickGerleman

Differential Revision: D66299077

fbshipit-source-id: 805eff24486ab120bc5658c0c5d0de1e4db81ba0
2024-11-21 11:09:17 -08:00
Jakub Piasecki
262f868ce0 Fix the nodes' owners not being updated when display: contents is used (#1743)
Summary:
X-link: https://github.com/facebook/react-native/pull/47733

In https://github.com/facebook/yoga/pull/1729 I moved the cleanup of `display: contents` nodes to happen before all the early returns, but that change also made it be called **before** `cloneChildrenIfNeeded`. It actually needs to be called after `cloneChildrenIfNeeded` to make sure that children of `display: contents` nodes are properly owned.

It also needs to be called in every short-path, so it's being called in four places in this PR. Please let me know whether it's ok or not.

Pull Request resolved: https://github.com/facebook/yoga/pull/1743

Reviewed By: NickGerleman

Differential Revision: D65953902

Pulled By: zeyap

fbshipit-source-id: 0b18a5651f19c23564f5b3aa2a50833426e9ca5f
2024-11-20 20:01:50 -08:00
phuccvx12
77c9987012 Fix: Correct Layout Behavior for Combined align-content and align-items (#1742)
Summary:
X-link: https://github.com/facebook/react-native/pull/47732

This pull request addresses the issue where combining align-content and align-items properties resulted in incorrect layout behavior in Yoga version 3.1.0, as reported in [Issue https://github.com/facebook/yoga/issues/1739](https://github.com/facebook/yoga/issues/1739).

# Changes Made:

Alignment Logic Update: Modified the alignment calculations to ensure that the combination of align-content and align-items properties produces the expected layout, consistent with CSS Flexbox standards and previous Yoga versions.

Test Cases Added: Introduced new test cases to cover scenarios involving various combinations of align-content and align-items properties to prevent future regressions.

# Testing:

All existing tests pass successfully.

New test cases confirm that the layout behaves as expected when align-content and align-items are used together.

# Impact:

This fix ensures that layouts using both align-content and align-items properties render correctly, aligning with the behavior observed in Yoga version 1.19.0 and standard web browsers.

Pull Request resolved: https://github.com/facebook/yoga/pull/1742

Reviewed By: joevilches

Differential Revision: D65953882

Pulled By: zeyap

fbshipit-source-id: 7e12a21b1d442b35c3f3536cad32dc4b82130d15
2024-11-20 19:59:42 -08:00
7 changed files with 2227 additions and 1362 deletions

View File

@@ -448,3 +448,32 @@
</div>
<div style="height: 50px; width: 50px; margin-left: 20px;"></div>
</div>
<div id="align_content_stretch_and_align_items_flex_end_with_flex_wrap"
style="width: 300px; height: 300px; flex-direction: row; flex-wrap: wrap; align-content: stretch;align-items: flex-end;">
<div style="height: 50px; width: 150px; align-self: flex-start;"></div>
<div style="height: 100px; width: 120px;"></div>
<div style="height: 50px; width: 120px;"></div>
</div>
<div id="align_content_stretch_and_align_items_flex_start_with_flex_wrap"
style="width: 300px; height: 300px; flex-direction: row; flex-wrap: wrap; align-content: stretch;align-items: flex-start;">
<div style="height: 50px; width: 150px; align-self: flex-end;"></div>
<div style="height: 100px; width: 120px;"></div>
<div style="height: 50px; width: 120px;"></div>
</div>
<div id="align_content_stretch_and_align_items_center_with_flex_wrap"
style="width: 300px; height: 300px; flex-direction: row; flex-wrap: wrap; align-content: stretch;align-items: center;">
<div style="height: 50px; width: 150px; align-self: flex-end;"></div>
<div style="height: 100px; width: 120px;"></div>
<div style="height: 50px; width: 120px;"></div>
</div>
<div id="align_content_stretch_and_align_items_stretch_with_flex_wrap"
style="width: 300px; height: 300px; flex-direction: row; flex-wrap: wrap; align-content: stretch;align-items: stretch;">
<div style="height: 50px; width: 150px; align-self: flex-end;"></div>
<div style="height: 100px; width: 120px;"></div>
<div style="height: 50px; width: 120px;"></div>
</div>

View File

@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<c85d60ce23aa6d921d52316d3ff35f17>>
* @generated SignedSource<<cafd5a49032616243a68af66ae440904>>
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignContentTest.html
*/
@@ -5207,6 +5207,305 @@ public class YGAlignContentTest {
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_align_content_stretch_and_align_items_flex_end_with_flex_wrap() {
YogaConfig config = YogaConfigFactory.create();
final YogaNode root = createNode(config);
root.setFlexDirection(YogaFlexDirection.ROW);
root.setAlignContent(YogaAlign.STRETCH);
root.setAlignItems(YogaAlign.FLEX_END);
root.setPositionType(YogaPositionType.ABSOLUTE);
root.setWrap(YogaWrap.WRAP);
root.setWidth(300f);
root.setHeight(300f);
final YogaNode root_child0 = createNode(config);
root_child0.setAlignSelf(YogaAlign.FLEX_START);
root_child0.setWidth(150f);
root_child0.setHeight(50f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = createNode(config);
root_child1.setWidth(120f);
root_child1.setHeight(100f);
root.addChildAt(root_child1, 1);
final YogaNode root_child2 = createNode(config);
root_child2.setWidth(120f);
root_child2.setHeight(50f);
root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR);
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(300f, root.getLayoutWidth(), 0.0f);
assertEquals(300f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(150f, root_child1.getLayoutX(), 0.0f);
assertEquals(75f, root_child1.getLayoutY(), 0.0f);
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(250f, root_child2.getLayoutY(), 0.0f);
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(YogaDirection.RTL);
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(300f, root.getLayoutWidth(), 0.0f);
assertEquals(300f, root.getLayoutHeight(), 0.0f);
assertEquals(150f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
assertEquals(75f, root_child1.getLayoutY(), 0.0f);
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(180f, root_child2.getLayoutX(), 0.0f);
assertEquals(250f, root_child2.getLayoutY(), 0.0f);
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_align_content_stretch_and_align_items_flex_start_with_flex_wrap() {
YogaConfig config = YogaConfigFactory.create();
final YogaNode root = createNode(config);
root.setFlexDirection(YogaFlexDirection.ROW);
root.setAlignContent(YogaAlign.STRETCH);
root.setAlignItems(YogaAlign.FLEX_START);
root.setPositionType(YogaPositionType.ABSOLUTE);
root.setWrap(YogaWrap.WRAP);
root.setWidth(300f);
root.setHeight(300f);
final YogaNode root_child0 = createNode(config);
root_child0.setAlignSelf(YogaAlign.FLEX_END);
root_child0.setWidth(150f);
root_child0.setHeight(50f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = createNode(config);
root_child1.setWidth(120f);
root_child1.setHeight(100f);
root.addChildAt(root_child1, 1);
final YogaNode root_child2 = createNode(config);
root_child2.setWidth(120f);
root_child2.setHeight(50f);
root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR);
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(300f, root.getLayoutWidth(), 0.0f);
assertEquals(300f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(125f, root_child0.getLayoutY(), 0.0f);
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(150f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(175f, root_child2.getLayoutY(), 0.0f);
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(YogaDirection.RTL);
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(300f, root.getLayoutWidth(), 0.0f);
assertEquals(300f, root.getLayoutHeight(), 0.0f);
assertEquals(150f, root_child0.getLayoutX(), 0.0f);
assertEquals(125f, root_child0.getLayoutY(), 0.0f);
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(180f, root_child2.getLayoutX(), 0.0f);
assertEquals(175f, root_child2.getLayoutY(), 0.0f);
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_align_content_stretch_and_align_items_center_with_flex_wrap() {
YogaConfig config = YogaConfigFactory.create();
final YogaNode root = createNode(config);
root.setFlexDirection(YogaFlexDirection.ROW);
root.setAlignContent(YogaAlign.STRETCH);
root.setAlignItems(YogaAlign.CENTER);
root.setPositionType(YogaPositionType.ABSOLUTE);
root.setWrap(YogaWrap.WRAP);
root.setWidth(300f);
root.setHeight(300f);
final YogaNode root_child0 = createNode(config);
root_child0.setAlignSelf(YogaAlign.FLEX_END);
root_child0.setWidth(150f);
root_child0.setHeight(50f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = createNode(config);
root_child1.setWidth(120f);
root_child1.setHeight(100f);
root.addChildAt(root_child1, 1);
final YogaNode root_child2 = createNode(config);
root_child2.setWidth(120f);
root_child2.setHeight(50f);
root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR);
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(300f, root.getLayoutWidth(), 0.0f);
assertEquals(300f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(125f, root_child0.getLayoutY(), 0.0f);
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(150f, root_child1.getLayoutX(), 0.0f);
assertEquals(38f, root_child1.getLayoutY(), 0.0f);
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(213f, root_child2.getLayoutY(), 0.0f);
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(YogaDirection.RTL);
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(300f, root.getLayoutWidth(), 0.0f);
assertEquals(300f, root.getLayoutHeight(), 0.0f);
assertEquals(150f, root_child0.getLayoutX(), 0.0f);
assertEquals(125f, root_child0.getLayoutY(), 0.0f);
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
assertEquals(38f, root_child1.getLayoutY(), 0.0f);
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(180f, root_child2.getLayoutX(), 0.0f);
assertEquals(213f, root_child2.getLayoutY(), 0.0f);
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
}
@Test
public void test_align_content_stretch_and_align_items_stretch_with_flex_wrap() {
YogaConfig config = YogaConfigFactory.create();
final YogaNode root = createNode(config);
root.setFlexDirection(YogaFlexDirection.ROW);
root.setAlignContent(YogaAlign.STRETCH);
root.setPositionType(YogaPositionType.ABSOLUTE);
root.setWrap(YogaWrap.WRAP);
root.setWidth(300f);
root.setHeight(300f);
final YogaNode root_child0 = createNode(config);
root_child0.setAlignSelf(YogaAlign.FLEX_END);
root_child0.setWidth(150f);
root_child0.setHeight(50f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = createNode(config);
root_child1.setWidth(120f);
root_child1.setHeight(100f);
root.addChildAt(root_child1, 1);
final YogaNode root_child2 = createNode(config);
root_child2.setWidth(120f);
root_child2.setHeight(50f);
root.addChildAt(root_child2, 2);
root.setDirection(YogaDirection.LTR);
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(300f, root.getLayoutWidth(), 0.0f);
assertEquals(300f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(125f, root_child0.getLayoutY(), 0.0f);
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(150f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child2.getLayoutX(), 0.0f);
assertEquals(175f, root_child2.getLayoutY(), 0.0f);
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
root.setDirection(YogaDirection.RTL);
root.calculateLayout(YogaConstants.UNDEFINED, YogaConstants.UNDEFINED);
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(300f, root.getLayoutWidth(), 0.0f);
assertEquals(300f, root.getLayoutHeight(), 0.0f);
assertEquals(150f, root_child0.getLayoutX(), 0.0f);
assertEquals(125f, root_child0.getLayoutY(), 0.0f);
assertEquals(150f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(30f, root_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1.getLayoutY(), 0.0f);
assertEquals(120f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(100f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(180f, root_child2.getLayoutX(), 0.0f);
assertEquals(175f, root_child2.getLayoutY(), 0.0f);
assertEquals(120f, root_child2.getLayoutWidth(), 0.0f);
assertEquals(50f, root_child2.getLayoutHeight(), 0.0f);
}
private YogaNode createNode(YogaConfig config) {
return mNodeFactory.create(config);
}

View File

@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<25f4cf395ff39619966d6f0ff993e99d>>
* @generated SignedSource<<ae2a56d91c60e30ea10b12d6d143ff73>>
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignContentTest.html
*/
@@ -5508,3 +5508,322 @@ test('align_content_space_evenly_stretch_does_influence_line_box_dim', () => {
config.free();
}
});
test('align_content_stretch_and_align_items_flex_end_with_flex_wrap', () => {
const config = Yoga.Config.create();
let root;
try {
root = Yoga.Node.create(config);
root.setFlexDirection(FlexDirection.Row);
root.setAlignContent(Align.Stretch);
root.setAlignItems(Align.FlexEnd);
root.setPositionType(PositionType.Absolute);
root.setFlexWrap(Wrap.Wrap);
root.setWidth(300);
root.setHeight(300);
const root_child0 = Yoga.Node.create(config);
root_child0.setAlignSelf(Align.FlexStart);
root_child0.setWidth(150);
root_child0.setHeight(50);
root.insertChild(root_child0, 0);
const root_child1 = Yoga.Node.create(config);
root_child1.setWidth(120);
root_child1.setHeight(100);
root.insertChild(root_child1, 1);
const root_child2 = Yoga.Node.create(config);
root_child2.setWidth(120);
root_child2.setHeight(50);
root.insertChild(root_child2, 2);
root.calculateLayout(undefined, undefined, Direction.LTR);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(300);
expect(root.getComputedHeight()).toBe(300);
expect(root_child0.getComputedLeft()).toBe(0);
expect(root_child0.getComputedTop()).toBe(0);
expect(root_child0.getComputedWidth()).toBe(150);
expect(root_child0.getComputedHeight()).toBe(50);
expect(root_child1.getComputedLeft()).toBe(150);
expect(root_child1.getComputedTop()).toBe(75);
expect(root_child1.getComputedWidth()).toBe(120);
expect(root_child1.getComputedHeight()).toBe(100);
expect(root_child2.getComputedLeft()).toBe(0);
expect(root_child2.getComputedTop()).toBe(250);
expect(root_child2.getComputedWidth()).toBe(120);
expect(root_child2.getComputedHeight()).toBe(50);
root.calculateLayout(undefined, undefined, Direction.RTL);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(300);
expect(root.getComputedHeight()).toBe(300);
expect(root_child0.getComputedLeft()).toBe(150);
expect(root_child0.getComputedTop()).toBe(0);
expect(root_child0.getComputedWidth()).toBe(150);
expect(root_child0.getComputedHeight()).toBe(50);
expect(root_child1.getComputedLeft()).toBe(30);
expect(root_child1.getComputedTop()).toBe(75);
expect(root_child1.getComputedWidth()).toBe(120);
expect(root_child1.getComputedHeight()).toBe(100);
expect(root_child2.getComputedLeft()).toBe(180);
expect(root_child2.getComputedTop()).toBe(250);
expect(root_child2.getComputedWidth()).toBe(120);
expect(root_child2.getComputedHeight()).toBe(50);
} finally {
if (typeof root !== 'undefined') {
root.freeRecursive();
}
config.free();
}
});
test('align_content_stretch_and_align_items_flex_start_with_flex_wrap', () => {
const config = Yoga.Config.create();
let root;
try {
root = Yoga.Node.create(config);
root.setFlexDirection(FlexDirection.Row);
root.setAlignContent(Align.Stretch);
root.setAlignItems(Align.FlexStart);
root.setPositionType(PositionType.Absolute);
root.setFlexWrap(Wrap.Wrap);
root.setWidth(300);
root.setHeight(300);
const root_child0 = Yoga.Node.create(config);
root_child0.setAlignSelf(Align.FlexEnd);
root_child0.setWidth(150);
root_child0.setHeight(50);
root.insertChild(root_child0, 0);
const root_child1 = Yoga.Node.create(config);
root_child1.setWidth(120);
root_child1.setHeight(100);
root.insertChild(root_child1, 1);
const root_child2 = Yoga.Node.create(config);
root_child2.setWidth(120);
root_child2.setHeight(50);
root.insertChild(root_child2, 2);
root.calculateLayout(undefined, undefined, Direction.LTR);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(300);
expect(root.getComputedHeight()).toBe(300);
expect(root_child0.getComputedLeft()).toBe(0);
expect(root_child0.getComputedTop()).toBe(125);
expect(root_child0.getComputedWidth()).toBe(150);
expect(root_child0.getComputedHeight()).toBe(50);
expect(root_child1.getComputedLeft()).toBe(150);
expect(root_child1.getComputedTop()).toBe(0);
expect(root_child1.getComputedWidth()).toBe(120);
expect(root_child1.getComputedHeight()).toBe(100);
expect(root_child2.getComputedLeft()).toBe(0);
expect(root_child2.getComputedTop()).toBe(175);
expect(root_child2.getComputedWidth()).toBe(120);
expect(root_child2.getComputedHeight()).toBe(50);
root.calculateLayout(undefined, undefined, Direction.RTL);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(300);
expect(root.getComputedHeight()).toBe(300);
expect(root_child0.getComputedLeft()).toBe(150);
expect(root_child0.getComputedTop()).toBe(125);
expect(root_child0.getComputedWidth()).toBe(150);
expect(root_child0.getComputedHeight()).toBe(50);
expect(root_child1.getComputedLeft()).toBe(30);
expect(root_child1.getComputedTop()).toBe(0);
expect(root_child1.getComputedWidth()).toBe(120);
expect(root_child1.getComputedHeight()).toBe(100);
expect(root_child2.getComputedLeft()).toBe(180);
expect(root_child2.getComputedTop()).toBe(175);
expect(root_child2.getComputedWidth()).toBe(120);
expect(root_child2.getComputedHeight()).toBe(50);
} finally {
if (typeof root !== 'undefined') {
root.freeRecursive();
}
config.free();
}
});
test('align_content_stretch_and_align_items_center_with_flex_wrap', () => {
const config = Yoga.Config.create();
let root;
try {
root = Yoga.Node.create(config);
root.setFlexDirection(FlexDirection.Row);
root.setAlignContent(Align.Stretch);
root.setAlignItems(Align.Center);
root.setPositionType(PositionType.Absolute);
root.setFlexWrap(Wrap.Wrap);
root.setWidth(300);
root.setHeight(300);
const root_child0 = Yoga.Node.create(config);
root_child0.setAlignSelf(Align.FlexEnd);
root_child0.setWidth(150);
root_child0.setHeight(50);
root.insertChild(root_child0, 0);
const root_child1 = Yoga.Node.create(config);
root_child1.setWidth(120);
root_child1.setHeight(100);
root.insertChild(root_child1, 1);
const root_child2 = Yoga.Node.create(config);
root_child2.setWidth(120);
root_child2.setHeight(50);
root.insertChild(root_child2, 2);
root.calculateLayout(undefined, undefined, Direction.LTR);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(300);
expect(root.getComputedHeight()).toBe(300);
expect(root_child0.getComputedLeft()).toBe(0);
expect(root_child0.getComputedTop()).toBe(125);
expect(root_child0.getComputedWidth()).toBe(150);
expect(root_child0.getComputedHeight()).toBe(50);
expect(root_child1.getComputedLeft()).toBe(150);
expect(root_child1.getComputedTop()).toBe(38);
expect(root_child1.getComputedWidth()).toBe(120);
expect(root_child1.getComputedHeight()).toBe(100);
expect(root_child2.getComputedLeft()).toBe(0);
expect(root_child2.getComputedTop()).toBe(213);
expect(root_child2.getComputedWidth()).toBe(120);
expect(root_child2.getComputedHeight()).toBe(50);
root.calculateLayout(undefined, undefined, Direction.RTL);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(300);
expect(root.getComputedHeight()).toBe(300);
expect(root_child0.getComputedLeft()).toBe(150);
expect(root_child0.getComputedTop()).toBe(125);
expect(root_child0.getComputedWidth()).toBe(150);
expect(root_child0.getComputedHeight()).toBe(50);
expect(root_child1.getComputedLeft()).toBe(30);
expect(root_child1.getComputedTop()).toBe(38);
expect(root_child1.getComputedWidth()).toBe(120);
expect(root_child1.getComputedHeight()).toBe(100);
expect(root_child2.getComputedLeft()).toBe(180);
expect(root_child2.getComputedTop()).toBe(213);
expect(root_child2.getComputedWidth()).toBe(120);
expect(root_child2.getComputedHeight()).toBe(50);
} finally {
if (typeof root !== 'undefined') {
root.freeRecursive();
}
config.free();
}
});
test('align_content_stretch_and_align_items_stretch_with_flex_wrap', () => {
const config = Yoga.Config.create();
let root;
try {
root = Yoga.Node.create(config);
root.setFlexDirection(FlexDirection.Row);
root.setAlignContent(Align.Stretch);
root.setPositionType(PositionType.Absolute);
root.setFlexWrap(Wrap.Wrap);
root.setWidth(300);
root.setHeight(300);
const root_child0 = Yoga.Node.create(config);
root_child0.setAlignSelf(Align.FlexEnd);
root_child0.setWidth(150);
root_child0.setHeight(50);
root.insertChild(root_child0, 0);
const root_child1 = Yoga.Node.create(config);
root_child1.setWidth(120);
root_child1.setHeight(100);
root.insertChild(root_child1, 1);
const root_child2 = Yoga.Node.create(config);
root_child2.setWidth(120);
root_child2.setHeight(50);
root.insertChild(root_child2, 2);
root.calculateLayout(undefined, undefined, Direction.LTR);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(300);
expect(root.getComputedHeight()).toBe(300);
expect(root_child0.getComputedLeft()).toBe(0);
expect(root_child0.getComputedTop()).toBe(125);
expect(root_child0.getComputedWidth()).toBe(150);
expect(root_child0.getComputedHeight()).toBe(50);
expect(root_child1.getComputedLeft()).toBe(150);
expect(root_child1.getComputedTop()).toBe(0);
expect(root_child1.getComputedWidth()).toBe(120);
expect(root_child1.getComputedHeight()).toBe(100);
expect(root_child2.getComputedLeft()).toBe(0);
expect(root_child2.getComputedTop()).toBe(175);
expect(root_child2.getComputedWidth()).toBe(120);
expect(root_child2.getComputedHeight()).toBe(50);
root.calculateLayout(undefined, undefined, Direction.RTL);
expect(root.getComputedLeft()).toBe(0);
expect(root.getComputedTop()).toBe(0);
expect(root.getComputedWidth()).toBe(300);
expect(root.getComputedHeight()).toBe(300);
expect(root_child0.getComputedLeft()).toBe(150);
expect(root_child0.getComputedTop()).toBe(125);
expect(root_child0.getComputedWidth()).toBe(150);
expect(root_child0.getComputedHeight()).toBe(50);
expect(root_child1.getComputedLeft()).toBe(30);
expect(root_child1.getComputedTop()).toBe(0);
expect(root_child1.getComputedWidth()).toBe(120);
expect(root_child1.getComputedHeight()).toBe(100);
expect(root_child2.getComputedLeft()).toBe(180);
expect(root_child2.getComputedTop()).toBe(175);
expect(root_child2.getComputedWidth()).toBe(120);
expect(root_child2.getComputedHeight()).toBe(50);
} finally {
if (typeof root !== 'undefined') {
root.freeRecursive();
}
config.free();
}
});

View File

@@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*
* clang-format off
* @generated SignedSource<<37e5721da82615c5e6543420f2bfc792>>
* @generated SignedSource<<a0af76959fbfcb6b0a0f5ac394ceafe9>>
* generated by gentest/gentest-driver.ts from gentest/fixtures/YGAlignContentTest.html
*/
@@ -5252,3 +5252,306 @@ TEST(YogaTest, align_content_space_evenly_stretch_does_influence_line_box_dim) {
YGConfigFree(config);
}
TEST(YogaTest, align_content_stretch_and_align_items_flex_end_with_flex_wrap) {
YGConfigRef config = YGConfigNew();
YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetAlignContent(root, YGAlignStretch);
YGNodeStyleSetAlignItems(root, YGAlignFlexEnd);
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
YGNodeStyleSetFlexWrap(root, YGWrapWrap);
YGNodeStyleSetWidth(root, 300);
YGNodeStyleSetHeight(root, 300);
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
YGNodeStyleSetAlignSelf(root_child0, YGAlignFlexStart);
YGNodeStyleSetWidth(root_child0, 150);
YGNodeStyleSetHeight(root_child0, 50);
YGNodeInsertChild(root, root_child0, 0);
YGNodeRef root_child1 = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(root_child1, 120);
YGNodeStyleSetHeight(root_child1, 100);
YGNodeInsertChild(root, root_child1, 1);
YGNodeRef root_child2 = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(root_child2, 120);
YGNodeStyleSetHeight(root_child2, 50);
YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(75, YGNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
ASSERT_FLOAT_EQ(250, YGNodeLayoutGetTop(root_child2));
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(75, YGNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(180, YGNodeLayoutGetLeft(root_child2));
ASSERT_FLOAT_EQ(250, YGNodeLayoutGetTop(root_child2));
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
YGNodeFreeRecursive(root);
YGConfigFree(config);
}
TEST(YogaTest, align_content_stretch_and_align_items_flex_start_with_flex_wrap) {
YGConfigRef config = YGConfigNew();
YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetAlignContent(root, YGAlignStretch);
YGNodeStyleSetAlignItems(root, YGAlignFlexStart);
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
YGNodeStyleSetFlexWrap(root, YGWrapWrap);
YGNodeStyleSetWidth(root, 300);
YGNodeStyleSetHeight(root, 300);
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
YGNodeStyleSetAlignSelf(root_child0, YGAlignFlexEnd);
YGNodeStyleSetWidth(root_child0, 150);
YGNodeStyleSetHeight(root_child0, 50);
YGNodeInsertChild(root, root_child0, 0);
YGNodeRef root_child1 = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(root_child1, 120);
YGNodeStyleSetHeight(root_child1, 100);
YGNodeInsertChild(root, root_child1, 1);
YGNodeRef root_child2 = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(root_child2, 120);
YGNodeStyleSetHeight(root_child2, 50);
YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(125, YGNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
ASSERT_FLOAT_EQ(175, YGNodeLayoutGetTop(root_child2));
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(125, YGNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(180, YGNodeLayoutGetLeft(root_child2));
ASSERT_FLOAT_EQ(175, YGNodeLayoutGetTop(root_child2));
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
YGNodeFreeRecursive(root);
YGConfigFree(config);
}
TEST(YogaTest, align_content_stretch_and_align_items_center_with_flex_wrap) {
YGConfigRef config = YGConfigNew();
YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetAlignContent(root, YGAlignStretch);
YGNodeStyleSetAlignItems(root, YGAlignCenter);
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
YGNodeStyleSetFlexWrap(root, YGWrapWrap);
YGNodeStyleSetWidth(root, 300);
YGNodeStyleSetHeight(root, 300);
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
YGNodeStyleSetAlignSelf(root_child0, YGAlignFlexEnd);
YGNodeStyleSetWidth(root_child0, 150);
YGNodeStyleSetHeight(root_child0, 50);
YGNodeInsertChild(root, root_child0, 0);
YGNodeRef root_child1 = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(root_child1, 120);
YGNodeStyleSetHeight(root_child1, 100);
YGNodeInsertChild(root, root_child1, 1);
YGNodeRef root_child2 = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(root_child2, 120);
YGNodeStyleSetHeight(root_child2, 50);
YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(125, YGNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(38, YGNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
ASSERT_FLOAT_EQ(213, YGNodeLayoutGetTop(root_child2));
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(125, YGNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(38, YGNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(180, YGNodeLayoutGetLeft(root_child2));
ASSERT_FLOAT_EQ(213, YGNodeLayoutGetTop(root_child2));
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
YGNodeFreeRecursive(root);
YGConfigFree(config);
}
TEST(YogaTest, align_content_stretch_and_align_items_stretch_with_flex_wrap) {
YGConfigRef config = YGConfigNew();
YGNodeRef root = YGNodeNewWithConfig(config);
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetAlignContent(root, YGAlignStretch);
YGNodeStyleSetPositionType(root, YGPositionTypeAbsolute);
YGNodeStyleSetFlexWrap(root, YGWrapWrap);
YGNodeStyleSetWidth(root, 300);
YGNodeStyleSetHeight(root, 300);
YGNodeRef root_child0 = YGNodeNewWithConfig(config);
YGNodeStyleSetAlignSelf(root_child0, YGAlignFlexEnd);
YGNodeStyleSetWidth(root_child0, 150);
YGNodeStyleSetHeight(root_child0, 50);
YGNodeInsertChild(root, root_child0, 0);
YGNodeRef root_child1 = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(root_child1, 120);
YGNodeStyleSetHeight(root_child1, 100);
YGNodeInsertChild(root, root_child1, 1);
YGNodeRef root_child2 = YGNodeNewWithConfig(config);
YGNodeStyleSetWidth(root_child2, 120);
YGNodeStyleSetHeight(root_child2, 50);
YGNodeInsertChild(root, root_child2, 2);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(125, YGNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child2));
ASSERT_FLOAT_EQ(175, YGNodeLayoutGetTop(root_child2));
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(300, YGNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(125, YGNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(150, YGNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(30, YGNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(180, YGNodeLayoutGetLeft(root_child2));
ASSERT_FLOAT_EQ(175, YGNodeLayoutGetTop(root_child2));
ASSERT_FLOAT_EQ(120, YGNodeLayoutGetWidth(root_child2));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child2));
YGNodeFreeRecursive(root);
YGConfigFree(config);
}

View File

@@ -17,8 +17,8 @@
"lint:fix": "eslint . --fix"
},
"dependencies": {
"@docusaurus/core": "3.4.0",
"@docusaurus/preset-classic": "3.4.0",
"@docusaurus/core": "3.6.0",
"@docusaurus/preset-classic": "3.6.0",
"@mdx-js/react": "^3.0.0",
"clsx": "^2.0.0",
"lz-string": "^1.5.0",
@@ -30,9 +30,9 @@
"yoga-layout": "0.0.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.4.0",
"@docusaurus/tsconfig": "3.4.0",
"@docusaurus/types": "3.4.0",
"@docusaurus/module-type-aliases": "3.6.0",
"@docusaurus/tsconfig": "3.6.0",
"@docusaurus/types": "3.6.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0"
},

2599
yarn.lock

File diff suppressed because it is too large Load Diff

View File

@@ -1294,10 +1294,6 @@ static void calculateLayoutImpl(
flexColumnDirection, direction, ownerWidth),
PhysicalEdge::Bottom);
// Clean and update all display: contents nodes with a direct path to the
// current node as they will not be traversed
cleanupContentsNodesRecursively(node);
if (node->hasMeasureFunc()) {
measureNodeWithMeasureFunc(
node,
@@ -1310,6 +1306,10 @@ static void calculateLayoutImpl(
ownerHeight,
layoutMarkerData,
reason);
// Clean and update all display: contents nodes with a direct path to the
// current node as they will not be traversed
cleanupContentsNodesRecursively(node);
return;
}
@@ -1324,6 +1324,10 @@ static void calculateLayoutImpl(
heightSizingMode,
ownerWidth,
ownerHeight);
// Clean and update all display: contents nodes with a direct path to the
// current node as they will not be traversed
cleanupContentsNodesRecursively(node);
return;
}
@@ -1339,6 +1343,9 @@ static void calculateLayoutImpl(
heightSizingMode,
ownerWidth,
ownerHeight)) {
// Clean and update all display: contents nodes with a direct path to the
// current node as they will not be traversed
cleanupContentsNodesRecursively(node);
return;
}
@@ -1348,6 +1355,10 @@ static void calculateLayoutImpl(
// Reset layout flags, as they could have changed.
node->setLayoutHadOverflow(false);
// Clean and update all display: contents nodes with a direct path to the
// current node as they will not be traversed
cleanupContentsNodesRecursively(node);
// STEP 1: CALCULATE VALUES FOR REMAINDER OF ALGORITHM
const FlexDirection mainAxis =
resolveDirection(node->style().flexDirection(), direction);
@@ -1751,6 +1762,7 @@ static void calculateLayoutImpl(
if (performLayout && (isNodeFlexWrap || isBaselineLayout(node))) {
float leadPerLine = 0;
float currentLead = leadingPaddingAndBorderCross;
float extraSpacePerLine = 0;
const float unclampedCrossDim = sizingModeCrossDim == SizingMode::StretchFit
? availableInnerCrossDim + paddingAndBorderAxisCross
@@ -1786,7 +1798,8 @@ static void calculateLayoutImpl(
currentLead += remainingAlignContentDim / 2;
break;
case Align::Stretch:
leadPerLine = remainingAlignContentDim / static_cast<float>(lineCount);
extraSpacePerLine =
remainingAlignContentDim / static_cast<float>(lineCount);
break;
case Align::SpaceAround:
currentLead +=
@@ -1856,6 +1869,7 @@ static void calculateLayoutImpl(
}
endIterator = iterator;
currentLead += i != 0 ? crossAxisGap : 0;
lineHeight += extraSpacePerLine;
for (iterator = startIterator; iterator != endIterator; iterator++) {
const auto child = *iterator;