Baseline support #317

Closed
woehrl01 wants to merge 33 commits from baseline-support into master
20 changed files with 4241 additions and 7 deletions
Showing only changes of commit 315161743f - Show all commits

View File

@@ -296,6 +296,242 @@ namespace Facebook.Yoga
Assert.AreEqual(10f, root_child1_child0.LayoutHeight); Assert.AreEqual(10f, root_child1_child0.LayoutHeight);
} }
[Test]
public void Test_align_baseline_child_multiline()
{
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.Baseline;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
root_child0.Width = 50;
root_child0.Height = 60;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.FlexDirection = YogaFlexDirection.Row;
root_child1.Wrap = YogaWrap.Wrap;
root_child1.Width = 50;
root_child1.Height = 25;
root.Insert(1, root_child1);
YogaNode root_child1_child0 = new YogaNode();
root_child1_child0.Width = 25;
root_child1_child0.Height = 20;
root_child1.Insert(0, root_child1_child0);
YogaNode root_child1_child1 = new YogaNode();
root_child1_child1.Width = 25;
root_child1_child1.Height = 10;
root_child1.Insert(1, root_child1_child1);
YogaNode root_child1_child2 = new YogaNode();
root_child1_child2.Width = 25;
root_child1_child2.Height = 20;
root_child1.Insert(2, root_child1_child2);
YogaNode root_child1_child3 = new YogaNode();
root_child1_child3.Width = 25;
root_child1_child3.Height = 10;
root_child1.Insert(3, root_child1_child3);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(60f, root_child0.LayoutHeight);
Assert.AreEqual(50f, root_child1.LayoutX);
Assert.AreEqual(40f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(25f, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1_child0.LayoutX);
Assert.AreEqual(0f, root_child1_child0.LayoutY);
Assert.AreEqual(25f, root_child1_child0.LayoutWidth);
Assert.AreEqual(20f, root_child1_child0.LayoutHeight);
Assert.AreEqual(25f, root_child1_child1.LayoutX);
Assert.AreEqual(0f, root_child1_child1.LayoutY);
Assert.AreEqual(25f, root_child1_child1.LayoutWidth);
Assert.AreEqual(10f, root_child1_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1_child2.LayoutX);
Assert.AreEqual(20f, root_child1_child2.LayoutY);
Assert.AreEqual(25f, root_child1_child2.LayoutWidth);
Assert.AreEqual(20f, root_child1_child2.LayoutHeight);
Assert.AreEqual(25f, root_child1_child3.LayoutX);
Assert.AreEqual(20f, root_child1_child3.LayoutY);
Assert.AreEqual(25f, root_child1_child3.LayoutWidth);
Assert.AreEqual(10f, root_child1_child3.LayoutHeight);
root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(50f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(60f, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(40f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(25f, root_child1.LayoutHeight);
Assert.AreEqual(25f, root_child1_child0.LayoutX);
Assert.AreEqual(0f, root_child1_child0.LayoutY);
Assert.AreEqual(25f, root_child1_child0.LayoutWidth);
Assert.AreEqual(20f, root_child1_child0.LayoutHeight);
Assert.AreEqual(0f, root_child1_child1.LayoutX);
Assert.AreEqual(0f, root_child1_child1.LayoutY);
Assert.AreEqual(25f, root_child1_child1.LayoutWidth);
Assert.AreEqual(10f, root_child1_child1.LayoutHeight);
Assert.AreEqual(25f, root_child1_child2.LayoutX);
Assert.AreEqual(20f, root_child1_child2.LayoutY);
Assert.AreEqual(25f, root_child1_child2.LayoutWidth);
Assert.AreEqual(20f, root_child1_child2.LayoutHeight);
Assert.AreEqual(0f, root_child1_child3.LayoutX);
Assert.AreEqual(20f, root_child1_child3.LayoutY);
Assert.AreEqual(25f, root_child1_child3.LayoutWidth);
Assert.AreEqual(10f, root_child1_child3.LayoutHeight);
}
[Test]
public void Test_align_baseline_child_multiline_override()
{
YogaNode root = new YogaNode();
root.FlexDirection = YogaFlexDirection.Row;
root.AlignItems = YogaAlign.Baseline;
root.Width = 100;
root.Height = 100;
YogaNode root_child0 = new YogaNode();
root_child0.Width = 50;
root_child0.Height = 60;
root.Insert(0, root_child0);
YogaNode root_child1 = new YogaNode();
root_child1.FlexDirection = YogaFlexDirection.Row;
root_child1.Wrap = YogaWrap.Wrap;
root_child1.Width = 50;
root_child1.Height = 25;
root.Insert(1, root_child1);
YogaNode root_child1_child0 = new YogaNode();
root_child1_child0.Width = 25;
root_child1_child0.Height = 20;
root_child1.Insert(0, root_child1_child0);
YogaNode root_child1_child1 = new YogaNode();
root_child1_child1.AlignSelf = YogaAlign.Baseline;
root_child1_child1.Width = 25;
root_child1_child1.Height = 10;
root_child1.Insert(1, root_child1_child1);
YogaNode root_child1_child2 = new YogaNode();
root_child1_child2.Width = 25;
root_child1_child2.Height = 20;
root_child1.Insert(2, root_child1_child2);
YogaNode root_child1_child3 = new YogaNode();
root_child1_child3.AlignSelf = YogaAlign.Baseline;
root_child1_child3.Width = 25;
root_child1_child3.Height = 10;
root_child1.Insert(3, root_child1_child3);
root.StyleDirection = YogaDirection.LTR;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(0f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(60f, root_child0.LayoutHeight);
Assert.AreEqual(50f, root_child1.LayoutX);
Assert.AreEqual(50f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(25f, root_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1_child0.LayoutX);
Assert.AreEqual(0f, root_child1_child0.LayoutY);
Assert.AreEqual(25f, root_child1_child0.LayoutWidth);
Assert.AreEqual(20f, root_child1_child0.LayoutHeight);
Assert.AreEqual(25f, root_child1_child1.LayoutX);
Assert.AreEqual(0f, root_child1_child1.LayoutY);
Assert.AreEqual(25f, root_child1_child1.LayoutWidth);
Assert.AreEqual(10f, root_child1_child1.LayoutHeight);
Assert.AreEqual(0f, root_child1_child2.LayoutX);
Assert.AreEqual(20f, root_child1_child2.LayoutY);
Assert.AreEqual(25f, root_child1_child2.LayoutWidth);
Assert.AreEqual(20f, root_child1_child2.LayoutHeight);
Assert.AreEqual(25f, root_child1_child3.LayoutX);
Assert.AreEqual(20f, root_child1_child3.LayoutY);
Assert.AreEqual(25f, root_child1_child3.LayoutWidth);
Assert.AreEqual(10f, root_child1_child3.LayoutHeight);
root.StyleDirection = YogaDirection.RTL;
root.CalculateLayout();
Assert.AreEqual(0f, root.LayoutX);
Assert.AreEqual(0f, root.LayoutY);
Assert.AreEqual(100f, root.LayoutWidth);
Assert.AreEqual(100f, root.LayoutHeight);
Assert.AreEqual(50f, root_child0.LayoutX);
Assert.AreEqual(0f, root_child0.LayoutY);
Assert.AreEqual(50f, root_child0.LayoutWidth);
Assert.AreEqual(60f, root_child0.LayoutHeight);
Assert.AreEqual(0f, root_child1.LayoutX);
Assert.AreEqual(50f, root_child1.LayoutY);
Assert.AreEqual(50f, root_child1.LayoutWidth);
Assert.AreEqual(25f, root_child1.LayoutHeight);
Assert.AreEqual(25f, root_child1_child0.LayoutX);
Assert.AreEqual(0f, root_child1_child0.LayoutY);
Assert.AreEqual(25f, root_child1_child0.LayoutWidth);
Assert.AreEqual(20f, root_child1_child0.LayoutHeight);
Assert.AreEqual(0f, root_child1_child1.LayoutX);
Assert.AreEqual(0f, root_child1_child1.LayoutY);
Assert.AreEqual(25f, root_child1_child1.LayoutWidth);
Assert.AreEqual(10f, root_child1_child1.LayoutHeight);
Assert.AreEqual(25f, root_child1_child2.LayoutX);
Assert.AreEqual(20f, root_child1_child2.LayoutY);
Assert.AreEqual(25f, root_child1_child2.LayoutWidth);
Assert.AreEqual(20f, root_child1_child2.LayoutHeight);
Assert.AreEqual(0f, root_child1_child3.LayoutX);
Assert.AreEqual(20f, root_child1_child3.LayoutY);
Assert.AreEqual(25f, root_child1_child3.LayoutWidth);
Assert.AreEqual(10f, root_child1_child3.LayoutHeight);
}
[Test] [Test]
public void Test_align_baseline_child_top() public void Test_align_baseline_child_top()
{ {

View File

@@ -26,6 +26,27 @@
</div> </div>
</div> </div>
<div id="align_baseline_child_multiline" style="width: 100px; height: 100px; flex-direction:row; align-items: baseline;">
<div style="width: 50px; height: 60px;"></div>
<div style="width: 50px; height: 25px;flex-wrap:wrap;flex-direction:row;">
<div style="width: 25px; height: 20px;"></div>
<div style="width: 25px; height: 10px;"></div>
<div style="width: 25px; height: 20px;"></div>
<div style="width: 25px; height: 10px;"></div>
</div>
</div>
<div id="align_baseline_child_multiline_override" style="width: 100px; height: 100px; flex-direction:row; align-items: baseline;">
<div style="width: 50px; height: 60px;"></div>
<div style="width: 50px; height: 25px;flex-wrap:wrap;flex-direction:row;">
<div style="width: 25px; height: 20px;"></div>
<div style="width: 25px; height: 10px;align-self:baseline;"></div>
<div style="width: 25px; height: 20px;"></div>
<div style="width: 25px; height: 10px;align-self:baseline;"></div>
</div>
</div>
<div id="align_baseline_child_top" style="width: 100px; height: 100px; flex-direction:row; align-items: baseline;"> <div id="align_baseline_child_top" style="width: 100px; height: 100px; flex-direction:row; align-items: baseline;">
<div style="width: 50px; height: 50px;top:10px;"></div> <div style="width: 50px; height: 50px;top:10px;"></div>
<div style="width: 50px; height: 20px;"> <div style="width: 50px; height: 20px;">

View File

@@ -289,6 +289,240 @@ public class YGAlignItemsTest {
assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f); assertEquals(10f, root_child1_child0.getLayoutHeight(), 0.0f);
} }
@Test
public void test_align_baseline_child_multiline() {
final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW);
root.setAlignItems(YogaAlign.BASELINE);
root.setWidth(100f);
root.setHeight(100f);
final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(50f);
root_child0.setHeight(60f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = new YogaNode();
root_child1.setFlexDirection(YogaFlexDirection.ROW);
root_child1.setWrap(YogaWrap.WRAP);
root_child1.setWidth(50f);
root_child1.setHeight(25f);
root.addChildAt(root_child1, 1);
final YogaNode root_child1_child0 = new YogaNode();
root_child1_child0.setWidth(25f);
root_child1_child0.setHeight(20f);
root_child1.addChildAt(root_child1_child0, 0);
final YogaNode root_child1_child1 = new YogaNode();
root_child1_child1.setWidth(25f);
root_child1_child1.setHeight(10f);
root_child1.addChildAt(root_child1_child1, 1);
final YogaNode root_child1_child2 = new YogaNode();
root_child1_child2.setWidth(25f);
root_child1_child2.setHeight(20f);
root_child1.addChildAt(root_child1_child2, 2);
final YogaNode root_child1_child3 = new YogaNode();
root_child1_child3.setWidth(25f);
root_child1_child3.setHeight(10f);
root_child1.addChildAt(root_child1_child3, 3);
root.setDirection(YogaDirection.LTR);
root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
assertEquals(40f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
assertEquals(25f, root_child1_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1_child0.getLayoutHeight(), 0.0f);
assertEquals(25f, root_child1_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f);
assertEquals(25f, root_child1_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child1_child2.getLayoutY(), 0.0f);
assertEquals(25f, root_child1_child2.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1_child2.getLayoutHeight(), 0.0f);
assertEquals(25f, root_child1_child3.getLayoutX(), 0.0f);
assertEquals(20f, root_child1_child3.getLayoutY(), 0.0f);
assertEquals(25f, root_child1_child3.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1_child3.getLayoutHeight(), 0.0f);
root.setDirection(YogaDirection.RTL);
root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(40f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(25f, root_child1_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
assertEquals(25f, root_child1_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f);
assertEquals(25f, root_child1_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1_child1.getLayoutHeight(), 0.0f);
assertEquals(25f, root_child1_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child1_child2.getLayoutY(), 0.0f);
assertEquals(25f, root_child1_child2.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1_child3.getLayoutX(), 0.0f);
assertEquals(20f, root_child1_child3.getLayoutY(), 0.0f);
assertEquals(25f, root_child1_child3.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1_child3.getLayoutHeight(), 0.0f);
}
@Test
public void test_align_baseline_child_multiline_override() {
final YogaNode root = new YogaNode();
root.setFlexDirection(YogaFlexDirection.ROW);
root.setAlignItems(YogaAlign.BASELINE);
root.setWidth(100f);
root.setHeight(100f);
final YogaNode root_child0 = new YogaNode();
root_child0.setWidth(50f);
root_child0.setHeight(60f);
root.addChildAt(root_child0, 0);
final YogaNode root_child1 = new YogaNode();
root_child1.setFlexDirection(YogaFlexDirection.ROW);
root_child1.setWrap(YogaWrap.WRAP);
root_child1.setWidth(50f);
root_child1.setHeight(25f);
root.addChildAt(root_child1, 1);
final YogaNode root_child1_child0 = new YogaNode();
root_child1_child0.setWidth(25f);
root_child1_child0.setHeight(20f);
root_child1.addChildAt(root_child1_child0, 0);
final YogaNode root_child1_child1 = new YogaNode();
root_child1_child1.setAlignSelf(YogaAlign.BASELINE);
root_child1_child1.setWidth(25f);
root_child1_child1.setHeight(10f);
root_child1.addChildAt(root_child1_child1, 1);
final YogaNode root_child1_child2 = new YogaNode();
root_child1_child2.setWidth(25f);
root_child1_child2.setHeight(20f);
root_child1.addChildAt(root_child1_child2, 2);
final YogaNode root_child1_child3 = new YogaNode();
root_child1_child3.setAlignSelf(YogaAlign.BASELINE);
root_child1_child3.setWidth(25f);
root_child1_child3.setHeight(10f);
root_child1.addChildAt(root_child1_child3, 3);
root.setDirection(YogaDirection.LTR);
root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child1.getLayoutX(), 0.0f);
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
assertEquals(25f, root_child1_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1_child0.getLayoutHeight(), 0.0f);
assertEquals(25f, root_child1_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f);
assertEquals(25f, root_child1_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1_child1.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child1_child2.getLayoutY(), 0.0f);
assertEquals(25f, root_child1_child2.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1_child2.getLayoutHeight(), 0.0f);
assertEquals(25f, root_child1_child3.getLayoutX(), 0.0f);
assertEquals(20f, root_child1_child3.getLayoutY(), 0.0f);
assertEquals(25f, root_child1_child3.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1_child3.getLayoutHeight(), 0.0f);
root.setDirection(YogaDirection.RTL);
root.calculateLayout();
assertEquals(0f, root.getLayoutX(), 0.0f);
assertEquals(0f, root.getLayoutY(), 0.0f);
assertEquals(100f, root.getLayoutWidth(), 0.0f);
assertEquals(100f, root.getLayoutHeight(), 0.0f);
assertEquals(50f, root_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child0.getLayoutY(), 0.0f);
assertEquals(50f, root_child0.getLayoutWidth(), 0.0f);
assertEquals(60f, root_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1.getLayoutX(), 0.0f);
assertEquals(50f, root_child1.getLayoutY(), 0.0f);
assertEquals(50f, root_child1.getLayoutWidth(), 0.0f);
assertEquals(25f, root_child1.getLayoutHeight(), 0.0f);
assertEquals(25f, root_child1_child0.getLayoutX(), 0.0f);
assertEquals(0f, root_child1_child0.getLayoutY(), 0.0f);
assertEquals(25f, root_child1_child0.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1_child0.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1_child1.getLayoutX(), 0.0f);
assertEquals(0f, root_child1_child1.getLayoutY(), 0.0f);
assertEquals(25f, root_child1_child1.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1_child1.getLayoutHeight(), 0.0f);
assertEquals(25f, root_child1_child2.getLayoutX(), 0.0f);
assertEquals(20f, root_child1_child2.getLayoutY(), 0.0f);
assertEquals(25f, root_child1_child2.getLayoutWidth(), 0.0f);
assertEquals(20f, root_child1_child2.getLayoutHeight(), 0.0f);
assertEquals(0f, root_child1_child3.getLayoutX(), 0.0f);
assertEquals(20f, root_child1_child3.getLayoutY(), 0.0f);
assertEquals(25f, root_child1_child3.getLayoutWidth(), 0.0f);
assertEquals(10f, root_child1_child3.getLayoutHeight(), 0.0f);
}
@Test @Test
public void test_align_baseline_child_top() { public void test_align_baseline_child_top() {
final YogaNode root = new YogaNode(); final YogaNode root = new YogaNode();

View File

@@ -279,6 +279,238 @@ TEST(YogaTest, align_baseline_child) {
YGNodeFreeRecursive(root); YGNodeFreeRecursive(root);
} }
TEST(YogaTest, align_baseline_child_multiline) {
const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetAlignItems(root, YGAlignBaseline);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child0, 50);
YGNodeStyleSetHeight(root_child0, 60);
YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexDirection(root_child1, YGFlexDirectionRow);
YGNodeStyleSetFlexWrap(root_child1, YGWrapWrap);
YGNodeStyleSetWidth(root_child1, 50);
YGNodeStyleSetHeight(root_child1, 25);
YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child1_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child1_child0, 25);
YGNodeStyleSetHeight(root_child1_child0, 20);
YGNodeInsertChild(root_child1, root_child1_child0, 0);
const YGNodeRef root_child1_child1 = YGNodeNew();
YGNodeStyleSetWidth(root_child1_child1, 25);
YGNodeStyleSetHeight(root_child1_child1, 10);
YGNodeInsertChild(root_child1, root_child1_child1, 1);
const YGNodeRef root_child1_child2 = YGNodeNew();
YGNodeStyleSetWidth(root_child1_child2, 25);
YGNodeStyleSetHeight(root_child1_child2, 20);
YGNodeInsertChild(root_child1, root_child1_child2, 2);
const YGNodeRef root_child1_child3 = YGNodeNew();
YGNodeStyleSetWidth(root_child1_child3, 25);
YGNodeStyleSetHeight(root_child1_child3, 10);
YGNodeInsertChild(root_child1, root_child1_child3, 3);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child1_child0));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1_child0));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetLeft(root_child1_child1));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child1));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child1_child1));
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child1));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child2));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child1_child2));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child1_child2));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1_child2));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetLeft(root_child1_child3));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child1_child3));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child1_child3));
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child3));
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(40, YGNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetLeft(root_child1_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child1_child0));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child1));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child1));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child1_child1));
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child1));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetLeft(root_child1_child2));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child1_child2));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child1_child2));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1_child2));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child3));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child1_child3));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child1_child3));
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child3));
YGNodeFreeRecursive(root);
}
TEST(YogaTest, align_baseline_child_multiline_override) {
const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetAlignItems(root, YGAlignBaseline);
YGNodeStyleSetWidth(root, 100);
YGNodeStyleSetHeight(root, 100);
const YGNodeRef root_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child0, 50);
YGNodeStyleSetHeight(root_child0, 60);
YGNodeInsertChild(root, root_child0, 0);
const YGNodeRef root_child1 = YGNodeNew();
YGNodeStyleSetFlexDirection(root_child1, YGFlexDirectionRow);
YGNodeStyleSetFlexWrap(root_child1, YGWrapWrap);
YGNodeStyleSetWidth(root_child1, 50);
YGNodeStyleSetHeight(root_child1, 25);
YGNodeInsertChild(root, root_child1, 1);
const YGNodeRef root_child1_child0 = YGNodeNew();
YGNodeStyleSetWidth(root_child1_child0, 25);
YGNodeStyleSetHeight(root_child1_child0, 20);
YGNodeInsertChild(root_child1, root_child1_child0, 0);
const YGNodeRef root_child1_child1 = YGNodeNew();
YGNodeStyleSetAlignSelf(root_child1_child1, YGAlignBaseline);
YGNodeStyleSetWidth(root_child1_child1, 25);
YGNodeStyleSetHeight(root_child1_child1, 10);
YGNodeInsertChild(root_child1, root_child1_child1, 1);
const YGNodeRef root_child1_child2 = YGNodeNew();
YGNodeStyleSetWidth(root_child1_child2, 25);
YGNodeStyleSetHeight(root_child1_child2, 20);
YGNodeInsertChild(root_child1, root_child1_child2, 2);
const YGNodeRef root_child1_child3 = YGNodeNew();
YGNodeStyleSetAlignSelf(root_child1_child3, YGAlignBaseline);
YGNodeStyleSetWidth(root_child1_child3, 25);
YGNodeStyleSetHeight(root_child1_child3, 10);
YGNodeInsertChild(root_child1, root_child1_child3, 3);
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child1_child0));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1_child0));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetLeft(root_child1_child1));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child1));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child1_child1));
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child1));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child2));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child1_child2));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child1_child2));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1_child2));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetLeft(root_child1_child3));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child1_child3));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child1_child3));
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child3));
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionRTL);
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetWidth(root));
ASSERT_FLOAT_EQ(100, YGNodeLayoutGetHeight(root));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child0));
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetLeft(root_child1_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child0));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child1_child0));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1_child0));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child1));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetTop(root_child1_child1));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child1_child1));
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child1));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetLeft(root_child1_child2));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child1_child2));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child1_child2));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetHeight(root_child1_child2));
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetLeft(root_child1_child3));
ASSERT_FLOAT_EQ(20, YGNodeLayoutGetTop(root_child1_child3));
ASSERT_FLOAT_EQ(25, YGNodeLayoutGetWidth(root_child1_child3));
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetHeight(root_child1_child3));
YGNodeFreeRecursive(root);
}
TEST(YogaTest, align_baseline_child_top) { TEST(YogaTest, align_baseline_child_top) {
const YGNodeRef root = YGNodeNew(); const YGNodeRef root = YGNodeNew();
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow); YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);

View File

@@ -938,7 +938,7 @@ static inline float YGNodePaddingAndBorderForAxis(const YGNodeRef node,
} }
emilsjolander commented 2017-01-05 11:03:20 -08:00 (Migrated from github.com)
Review

const

const
static inline YGAlign YGNodeAlignItem(const YGNodeRef node, const YGNodeRef child) { static inline YGAlign YGNodeAlignItem(const YGNodeRef node, const YGNodeRef child) {
YGAlign align = const YGAlign align =
child->style.alignSelf == YGAlignAuto ? node->style.alignItems : child->style.alignSelf; child->style.alignSelf == YGAlignAuto ? node->style.alignItems : child->style.alignSelf;
if (align == YGAlignBaseline && YGFlexDirectionIsColumn(node->style.flexDirection)) { if (align == YGAlignBaseline && YGFlexDirectionIsColumn(node->style.flexDirection)) {
return YGAlignFlexStart; return YGAlignFlexStart;
@@ -955,12 +955,11 @@ static inline YGDirection YGNodeResolveDirection(const YGNodeRef node,
} }
emilsjolander commented 2017-01-05 11:06:20 -08:00 (Migrated from github.com)
Review

This will always be height as baseline is undefined for column flex direction. right? in that case I think it is better to be clear and use YGDimensionHeight instead of dim[crossAxis]

This will always be height as baseline is undefined for column flex direction. right? in that case I think it is better to be clear and use `YGDimensionHeight` instead of `dim[crossAxis]`
emilsjolander commented 2017-01-05 11:07:40 -08:00 (Migrated from github.com)
Review

Is there a good reason to allow undefined return value for baseline? I would prefer asserting and crashing as it would probably indicate a bug. What do you think?

Is there a good reason to allow undefined return value for baseline? I would prefer asserting and crashing as it would probably indicate a bug. What do you think?
emilsjolander commented 2017-01-05 11:11:39 -08:00 (Migrated from github.com)
Review

Why child->lineIndex > 0? I understand that it skips multiline children but i'm not sure why.

Why `child->lineIndex > 0`? I understand that it skips multiline children but i'm not sure why.
emilsjolander commented 2017-01-05 11:12:21 -08:00 (Migrated from github.com)
Review

same as above regarding dim[crossAxis]

same as above regarding `dim[crossAxis]`
emilsjolander commented 2017-01-05 11:14:02 -08:00 (Migrated from github.com)
Review

The baseline of a container is defined by its first baseline aligned child, but when there is no baseline aligned child then the container's baseline is defined by it's last child. This seems odd. Are you sure we have test cases covering edge cases here to make sure this is how it works on the web?

The baseline of a container is defined by its first baseline aligned child, but when there is no baseline aligned child then the container's baseline is defined by it's last child. This seems odd. Are you sure we have test cases covering edge cases here to make sure this is how it works on the web?
emilsjolander commented 2017-01-05 11:14:19 -08:00 (Migrated from github.com)
Review

same as above regarding pos[crossAxis]

same as above regarding `pos[crossAxis]`
woehrl01 commented 2017-01-05 11:25:14 -08:00 (Migrated from github.com)
Review

I'm not sure my self about this. I thought this could be a kind of "feature", so if you return undefined, you simply use the nodes height. But crashing would be fine too for me. What I'm not sure about is if we explicitly add the padding-top here or if the implementation of the custom function needs to consider this.

I'm not sure my self about this. I thought this could be a kind of "feature", so if you return undefined, you simply use the nodes height. But crashing would be fine too for me. What I'm not sure about is if we explicitly add the padding-top here or if the implementation of the custom function needs to consider this.
woehrl01 commented 2017-01-05 11:26:59 -08:00 (Migrated from github.com)
Review

we use only the first line of the children for base layout alignment. At least this is how chrome handles it.

we use only the first line of the children for base layout alignment. At least this is how chrome handles it.
woehrl01 commented 2017-01-05 11:27:56 -08:00 (Migrated from github.com)
Review

no it's defined by its first child on the first line or the first baseline aligned child if there is one (one the first line). I'll add a test for this.

no it's defined by its first child on the first line or the first baseline aligned child if there is one (one the first line). I'll add a test for this.
emilsjolander commented 2017-01-05 11:40:10 -08:00 (Migrated from github.com)
Review

The custom function should not take padding into account. We don't expect this for the measure function so I would like to preserve that here if possible.

Let's crash for now. If we find a valid reason to have this feature we can implement it later.

The custom function should not take padding into account. We don't expect this for the measure function so I would like to preserve that here if possible. Let's crash for now. If we find a valid reason to have this feature we can implement it later.
emilsjolander commented 2017-01-05 11:41:06 -08:00 (Migrated from github.com)
Review

yes, but this looks like we are skipping over children with multiple lines instead of just looking at their first line?

yes, but this looks like we are skipping over children with multiple lines instead of just looking at their first line?
emilsjolander commented 2017-01-05 11:43:16 -08:00 (Migrated from github.com)
Review

So the current code is wrong i think. Right? As it will pick the last child in the case no child is baseline aligned?

So the current code is wrong i think. Right? As it will pick the last child in the case no child is baseline aligned?
woehrl01 commented 2017-01-05 11:46:36 -08:00 (Migrated from github.com)
Review

oh, yep. We should break instead of continue here!

oh, yep. We should break instead of continue here!
woehrl01 commented 2017-01-05 11:47:30 -08:00 (Migrated from github.com)
Review

no as we only use the child if baselineChild is still NULL. Which is false as seen as we find the first one. We still need to iterate to take any baseline aligned child into account.

no as we only use the child if ```baselineChild``` is still ```NULL```. Which is false as seen as we find the first one. We still need to iterate to take any baseline aligned child into account.
} }
emilsjolander commented 2017-01-05 02:26:21 -08:00 (Migrated from github.com)
Review

uint32_t

uint32_t
emilsjolander commented 2017-01-05 02:26:32 -08:00 (Migrated from github.com)
Review

i++

i++
static float YGBaseline(const YGNodeRef node, static float YGBaseline(const YGNodeRef node) {
const YGFlexDirection crossAxis) {
if (node->baseline != NULL) { if (node->baseline != NULL) {
const float baseline = node->baseline(node); const float baseline = node->baseline(node);
if (YGFloatIsUndefined(baseline)) { if (YGFloatIsUndefined(baseline)) {
return node->layout.measuredDimensions[dim[crossAxis]]; return node->layout.measuredDimensions[YGDimensionHeight];
} }
return baseline; return baseline;
} }
@@ -983,11 +982,11 @@ static float YGBaseline(const YGNodeRef node,
} }
if (baselineChild == NULL) { if (baselineChild == NULL) {
return node->layout.measuredDimensions[dim[crossAxis]]; return node->layout.measuredDimensions[YGDimensionHeight];
} }
const float baseline = YGBaseline(baselineChild, crossAxis); const float baseline = YGBaseline(baselineChild);
return baseline + baselineChild->layout.position[pos[crossAxis]]; return baseline + baselineChild->layout.position[YGEdgeTop];
} }
static inline YGFlexDirection YGFlexDirectionResolve(const YGFlexDirection flexDirection, static inline YGFlexDirection YGFlexDirectionResolve(const YGFlexDirection flexDirection,
@@ -1019,7 +1018,6 @@ static bool YGIsBaselineLayout(const YGNodeRef node) {
if (node->style.alignItems == YGAlignBaseline) { if (node->style.alignItems == YGAlignBaseline) {
return true; return true;
} }
for (uint32_t i = 0; i < YGNodeGetChildCount(node); i++) { for (uint32_t i = 0; i < YGNodeGetChildCount(node); i++) {
const YGNodeRef child = YGNodeGetChild(node, i); const YGNodeRef child = YGNodeGetChild(node, i);
if (child->style.positionType == YGPositionTypeRelative && if (child->style.positionType == YGPositionTypeRelative &&
@@ -2531,7 +2529,7 @@ static void YGNodelayoutImpl(const YGNodeRef node,
YGNodeMarginForAxis(child, crossAxis, availableInnerWidth)); YGNodeMarginForAxis(child, crossAxis, availableInnerWidth));
} }
if (YGNodeAlignItem(node, child) == YGAlignBaseline) { if (YGNodeAlignItem(node, child) == YGAlignBaseline) {
const float ascent = YGBaseline(child, crossAxis) + const float ascent = YGBaseline(child) +
YGNodeLeadingMargin(child, crossAxis, availableInnerWidth); YGNodeLeadingMargin(child, crossAxis, availableInnerWidth);
const float descent = child->layout.measuredDimensions[dim[crossAxis]] + const float descent = child->layout.measuredDimensions[dim[crossAxis]] +
YGNodeMarginForAxis(child, crossAxis, availableInnerWidth) - YGNodeMarginForAxis(child, crossAxis, availableInnerWidth) -
@@ -2578,7 +2576,7 @@ static void YGNodelayoutImpl(const YGNodeRef node,
} }
case YGAlignBaseline: { case YGAlignBaseline: {
child->layout.position[pos[crossAxis]] = child->layout.position[pos[crossAxis]] =
currentLead + maxAscentForCurrentLine - YGBaseline(child, crossAxis) + currentLead + maxAscentForCurrentLine - YGBaseline(child) +
YGNodeLeadingPosition(child, crossAxis, availableInnerCrossDim); YGNodeLeadingPosition(child, crossAxis, availableInnerCrossDim);
break; break;
} }

View File

@@ -49,7 +49,6 @@ typedef YGSize (*YGMeasureFunc)(YGNodeRef node,
YGMeasureMode widthMode, YGMeasureMode widthMode,
emilsjolander commented 2017-01-05 11:18:02 -08:00 (Migrated from github.com)
Review

nit: remove added empty lines

nit: remove added empty lines
emilsjolander commented 2017-01-05 12:05:26 -08:00 (Migrated from github.com)
Review

nit: remove added empty line

nit: remove added empty line
float height, float height,
YGMeasureMode heightMode); YGMeasureMode heightMode);
typedef float (*YGBaselineFunc)(YGNodeRef node); typedef float (*YGBaselineFunc)(YGNodeRef node);
typedef void (*YGPrintFunc)(YGNodeRef node); typedef void (*YGPrintFunc)(YGNodeRef node);