Move configuration to new YGConfig and pass them down to CalculateLayout
Summary: Move configuration to new ```YGConfig``` and pass them down to CalculateLayout. See #418 . Adds ```YGConfigNew()``` + ```YGConfigFree```, and changed ```YGSetExperimentalFeatureEnabled``` to use the config. New function for calculation is ```YGNodeCalculateLayoutWithConfig```. Closes https://github.com/facebook/yoga/pull/432 Reviewed By: astreet Differential Revision: D4611359 Pulled By: emilsjolander fbshipit-source-id: a1332f0e1b21cec02129dd021ee57408449e10b0
This commit is contained in:
committed by
Facebook Github Bot
parent
8668e43f6d
commit
37c48257ae
@@ -13,11 +13,11 @@ var Yoga = Yoga || require("../../sources/entry-" + process.env.TEST_ENTRY);
|
||||
|
||||
it("absolute_layout_width_height_start_top", function () {
|
||||
try {
|
||||
var root = Yoga.Node.create();
|
||||
var root = Yoga.Node.create(config);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
var root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
||||
root_child0.setPosition(Yoga.EDGE_START, 10);
|
||||
root_child0.setPosition(Yoga.EDGE_TOP, 10);
|
||||
@@ -55,11 +55,11 @@ it("absolute_layout_width_height_start_top", function () {
|
||||
});
|
||||
it("absolute_layout_width_height_end_bottom", function () {
|
||||
try {
|
||||
var root = Yoga.Node.create();
|
||||
var root = Yoga.Node.create(config);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
var root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
||||
root_child0.setPosition(Yoga.EDGE_END, 10);
|
||||
root_child0.setPosition(Yoga.EDGE_BOTTOM, 10);
|
||||
@@ -97,11 +97,11 @@ it("absolute_layout_width_height_end_bottom", function () {
|
||||
});
|
||||
it("absolute_layout_start_top_end_bottom", function () {
|
||||
try {
|
||||
var root = Yoga.Node.create();
|
||||
var root = Yoga.Node.create(config);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
var root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
||||
root_child0.setPosition(Yoga.EDGE_START, 10);
|
||||
root_child0.setPosition(Yoga.EDGE_TOP, 10);
|
||||
@@ -139,11 +139,11 @@ it("absolute_layout_start_top_end_bottom", function () {
|
||||
});
|
||||
it("absolute_layout_width_height_start_top_end_bottom", function () {
|
||||
try {
|
||||
var root = Yoga.Node.create();
|
||||
var root = Yoga.Node.create(config);
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
var root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
||||
root_child0.setPosition(Yoga.EDGE_START, 10);
|
||||
root_child0.setPosition(Yoga.EDGE_TOP, 10);
|
||||
@@ -183,19 +183,19 @@ it("absolute_layout_width_height_start_top_end_bottom", function () {
|
||||
});
|
||||
it("do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent", function () {
|
||||
try {
|
||||
var root = Yoga.Node.create();
|
||||
var root = Yoga.Node.create(config);
|
||||
root.setFlexDirection(Yoga.FLEX_DIRECTION_ROW);
|
||||
root.setOverflow(Yoga.OVERFLOW_HIDDEN);
|
||||
root.setWidth(50);
|
||||
root.setHeight(50);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
var root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
||||
root_child0.setPosition(Yoga.EDGE_START, 0);
|
||||
root_child0.setPosition(Yoga.EDGE_TOP, 0);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
var root_child0_child0 = Yoga.Node.create();
|
||||
var root_child0_child0 = Yoga.Node.create(config);
|
||||
root_child0_child0.setWidth(100);
|
||||
root_child0_child0.setHeight(100);
|
||||
root_child0.insertChild(root_child0_child0, 0);
|
||||
@@ -240,7 +240,7 @@ it("do_not_clamp_height_of_absolute_node_to_height_of_its_overflow_hidden_parent
|
||||
});
|
||||
it("absolute_layout_within_border", function () {
|
||||
try {
|
||||
var root = Yoga.Node.create();
|
||||
var root = Yoga.Node.create(config);
|
||||
root.setMargin(Yoga.EDGE_LEFT, 10);
|
||||
root.setMargin(Yoga.EDGE_TOP, 10);
|
||||
root.setMargin(Yoga.EDGE_RIGHT, 10);
|
||||
@@ -256,7 +256,7 @@ it("absolute_layout_within_border", function () {
|
||||
root.setWidth(100);
|
||||
root.setHeight(100);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
var root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
||||
root_child0.setPosition(Yoga.EDGE_LEFT, 0);
|
||||
root_child0.setPosition(Yoga.EDGE_TOP, 0);
|
||||
@@ -264,7 +264,7 @@ it("absolute_layout_within_border", function () {
|
||||
root_child0.setHeight(50);
|
||||
root.insertChild(root_child0, 0);
|
||||
|
||||
var root_child1 = Yoga.Node.create();
|
||||
var root_child1 = Yoga.Node.create(config);
|
||||
root_child1.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
||||
root_child1.setPosition(Yoga.EDGE_RIGHT, 0);
|
||||
root_child1.setPosition(Yoga.EDGE_BOTTOM, 0);
|
||||
@@ -312,14 +312,14 @@ it("absolute_layout_within_border", function () {
|
||||
});
|
||||
it("absolute_layout_align_items_and_justify_content_center", function () {
|
||||
try {
|
||||
var root = Yoga.Node.create();
|
||||
var root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||
root.setAlignItems(Yoga.ALIGN_CENTER);
|
||||
root.setFlexGrow(1);
|
||||
root.setWidth(110);
|
||||
root.setHeight(100);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
var root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
||||
root_child0.setWidth(60);
|
||||
root_child0.setHeight(40);
|
||||
@@ -355,14 +355,14 @@ it("absolute_layout_align_items_and_justify_content_center", function () {
|
||||
});
|
||||
it("absolute_layout_align_items_and_justify_content_flex_end", function () {
|
||||
try {
|
||||
var root = Yoga.Node.create();
|
||||
var root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_FLEX_END);
|
||||
root.setAlignItems(Yoga.ALIGN_FLEX_END);
|
||||
root.setFlexGrow(1);
|
||||
root.setWidth(110);
|
||||
root.setHeight(100);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
var root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
||||
root_child0.setWidth(60);
|
||||
root_child0.setHeight(40);
|
||||
@@ -398,13 +398,13 @@ it("absolute_layout_align_items_and_justify_content_flex_end", function () {
|
||||
});
|
||||
it("absolute_layout_justify_content_center", function () {
|
||||
try {
|
||||
var root = Yoga.Node.create();
|
||||
var root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||
root.setFlexGrow(1);
|
||||
root.setWidth(110);
|
||||
root.setHeight(100);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
var root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
||||
root_child0.setWidth(60);
|
||||
root_child0.setHeight(40);
|
||||
@@ -440,13 +440,13 @@ it("absolute_layout_justify_content_center", function () {
|
||||
});
|
||||
it("absolute_layout_align_items_center", function () {
|
||||
try {
|
||||
var root = Yoga.Node.create();
|
||||
var root = Yoga.Node.create(config);
|
||||
root.setAlignItems(Yoga.ALIGN_CENTER);
|
||||
root.setFlexGrow(1);
|
||||
root.setWidth(110);
|
||||
root.setHeight(100);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
var root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
||||
root_child0.setWidth(60);
|
||||
root_child0.setHeight(40);
|
||||
@@ -482,12 +482,12 @@ it("absolute_layout_align_items_center", function () {
|
||||
});
|
||||
it("absolute_layout_align_items_center_on_child_only", function () {
|
||||
try {
|
||||
var root = Yoga.Node.create();
|
||||
var root = Yoga.Node.create(config);
|
||||
root.setFlexGrow(1);
|
||||
root.setWidth(110);
|
||||
root.setHeight(100);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
var root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setAlignSelf(Yoga.ALIGN_CENTER);
|
||||
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
||||
root_child0.setWidth(60);
|
||||
@@ -524,14 +524,14 @@ it("absolute_layout_align_items_center_on_child_only", function () {
|
||||
});
|
||||
it("absolute_layout_align_items_and_justify_content_center_and_top_position", function () {
|
||||
try {
|
||||
var root = Yoga.Node.create();
|
||||
var root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||
root.setAlignItems(Yoga.ALIGN_CENTER);
|
||||
root.setFlexGrow(1);
|
||||
root.setWidth(110);
|
||||
root.setHeight(100);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
var root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
||||
root_child0.setPosition(Yoga.EDGE_TOP, 10);
|
||||
root_child0.setWidth(60);
|
||||
@@ -568,14 +568,14 @@ it("absolute_layout_align_items_and_justify_content_center_and_top_position", fu
|
||||
});
|
||||
it("absolute_layout_align_items_and_justify_content_center_and_bottom_position", function () {
|
||||
try {
|
||||
var root = Yoga.Node.create();
|
||||
var root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||
root.setAlignItems(Yoga.ALIGN_CENTER);
|
||||
root.setFlexGrow(1);
|
||||
root.setWidth(110);
|
||||
root.setHeight(100);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
var root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
||||
root_child0.setPosition(Yoga.EDGE_BOTTOM, 10);
|
||||
root_child0.setWidth(60);
|
||||
@@ -612,14 +612,14 @@ it("absolute_layout_align_items_and_justify_content_center_and_bottom_position",
|
||||
});
|
||||
it("absolute_layout_align_items_and_justify_content_center_and_left_position", function () {
|
||||
try {
|
||||
var root = Yoga.Node.create();
|
||||
var root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||
root.setAlignItems(Yoga.ALIGN_CENTER);
|
||||
root.setFlexGrow(1);
|
||||
root.setWidth(110);
|
||||
root.setHeight(100);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
var root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
||||
root_child0.setPosition(Yoga.EDGE_LEFT, 5);
|
||||
root_child0.setWidth(60);
|
||||
@@ -656,14 +656,14 @@ it("absolute_layout_align_items_and_justify_content_center_and_left_position", f
|
||||
});
|
||||
it("absolute_layout_align_items_and_justify_content_center_and_right_position", function () {
|
||||
try {
|
||||
var root = Yoga.Node.create();
|
||||
var root = Yoga.Node.create(config);
|
||||
root.setJustifyContent(Yoga.JUSTIFY_CENTER);
|
||||
root.setAlignItems(Yoga.ALIGN_CENTER);
|
||||
root.setFlexGrow(1);
|
||||
root.setWidth(110);
|
||||
root.setHeight(100);
|
||||
|
||||
var root_child0 = Yoga.Node.create();
|
||||
var root_child0 = Yoga.Node.create(config);
|
||||
root_child0.setPositionType(Yoga.POSITION_TYPE_ABSOLUTE);
|
||||
root_child0.setPosition(Yoga.EDGE_RIGHT, 5);
|
||||
root_child0.setWidth(60);
|
||||
|
Reference in New Issue
Block a user