use owner's width for resolving the margin and padding for node

Summary:
The margin and padding are resolved incorrectly for leaf nodes (nodes with measure function set) if margin and padding are used in percentages.
Here we were using node's width instead of container width to calculate the margin and padding.

Fixed this to use container's width.

## Changelog:

[General][Yoga] : Fixed an issue where margin and padding were resolved incorrectly for leaf nodes (nodes with measure function set) if margin and padding are used in percentages.

Reviewed By: alickbass

Differential Revision: D17130520

fbshipit-source-id: ac904d432f121973e7739debd9136909b5ca1427
This commit is contained in:
Sidharth Guglani
2019-11-15 05:10:33 -08:00
committed by Facebook Github Bot
parent 20fe53b254
commit b88cf7ff67
2 changed files with 7 additions and 7 deletions

View File

@@ -686,9 +686,9 @@ TEST(YogaTest, percent_with_text_node) {
ASSERT_FLOAT_EQ(0, YGNodeLayoutGetHeight(root_child0));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetLeft(root_child1));
ASSERT_FLOAT_EQ(15, YGNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(10, YGNodeLayoutGetTop(root_child1));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetWidth(root_child1));
ASSERT_FLOAT_EQ(50, YGNodeLayoutGetHeight(root_child1));
ASSERT_FLOAT_EQ(60, YGNodeLayoutGetHeight(root_child1));
YGNodeFreeRecursive(root);