Add support for flex-grow, flex-shrink, and flex-basis

Summary: Add support for flex-grow, flex-shrink, and flex-basis properties. The flex property behavior is preserved for backwards compatibility.

Reviewed By: lucasr

Differential Revision: D3714520

fbshipit-source-id: 80d3a9a1e2b6f74b863bbe22357f2c9865fa290e
This commit is contained in:
Emil Sjolander
2016-08-15 09:15:05 -07:00
committed by Facebook Github Bot 6
parent fdd5c8ce82
commit f68521aa69
7 changed files with 221 additions and 160 deletions

View File

@@ -33,7 +33,7 @@ typedef struct CSSLayout {
float dimensions[2];
CSSDirection direction;
float flexBasis;
float computedFlexBasis;
// Instead of recomputing the entire layout every single time, we
// cache some information to break early when nothing changed
@@ -57,7 +57,9 @@ typedef struct CSSStyle {
CSSPositionType positionType;
CSSWrapType flexWrap;
CSSOverflow overflow;
float flex;
float flexGrow;
float flexShrink;
float flexBasis;
float margin[6];
float position[6];
/**

View File

@@ -23,8 +23,6 @@ __forceinline const float fmaxf(const float a, const float b) {
#endif
#endif
#define POSITIVE_FLEX_IS_AUTO 0
CSSNodeRef CSSNodeNew() {
CSSNodeRef node = calloc(1, sizeof(CSSNode));
CSS_ASSERT(node, "Could not allocate memory for node");
@@ -44,6 +42,10 @@ void CSSNodeInit(CSSNodeRef node) {
node->hasNewLayout = true;
node->isDirty = false;
node->style.flexGrow = 0;
node->style.flexShrink = 0;
node->style.flexBasis = CSSUndefined;
node->style.alignItems = CSSAlignStretch;
node->style.alignContent = CSSAlignFlexStart;
@@ -130,6 +132,32 @@ bool CSSNodeIsDirty(CSSNodeRef node) {
return node->isDirty;
}
void CSSNodeStyleSetFlex(CSSNodeRef node, float flex) {
if (CSSValueIsUndefined(flex) || flex == 0) {
CSSNodeStyleSetFlexGrow(node, 0);
CSSNodeStyleSetFlexShrink(node, 0);
CSSNodeStyleSetFlexBasis(node, CSSUndefined);
} else if (flex > 0) {
CSSNodeStyleSetFlexGrow(node, flex);
CSSNodeStyleSetFlexShrink(node, 0);
CSSNodeStyleSetFlexBasis(node, 0);
} else {
CSSNodeStyleSetFlexGrow(node, 0);
CSSNodeStyleSetFlexShrink(node, -flex);
CSSNodeStyleSetFlexBasis(node, CSSUndefined);
}
}
float CSSNodeStyleGetFlex(CSSNodeRef node) {
if (node->style.flexGrow > 0) {
return node->style.flexGrow;
} else if (node->style.flexShrink > 0) {
return -node->style.flexShrink;
}
return 0;
}
#define CSS_NODE_PROPERTY_IMPL(type, name, paramName, instanceName) \
void CSSNodeSet##name(CSSNodeRef node, type paramName) { \
node->instanceName = paramName; \
@@ -171,7 +199,9 @@ CSS_NODE_STYLE_PROPERTY_IMPL(CSSAlign, AlignSelf, alignSelf, alignSelf);
CSS_NODE_STYLE_PROPERTY_IMPL(CSSPositionType, PositionType, positionType, positionType);
CSS_NODE_STYLE_PROPERTY_IMPL(CSSWrapType, FlexWrap, flexWrap, flexWrap);
CSS_NODE_STYLE_PROPERTY_IMPL(CSSOverflow, Overflow, overflow, overflow);
CSS_NODE_STYLE_PROPERTY_IMPL(float, Flex, flex, flex);
CSS_NODE_STYLE_PROPERTY_IMPL(float, FlexGrow, flexGrow, flexGrow);
CSS_NODE_STYLE_PROPERTY_IMPL(float, FlexShrink, flexShrink, flexShrink);
CSS_NODE_STYLE_PROPERTY_IMPL(float, FlexBasis, flexBasis, flexBasis);
CSS_NODE_STYLE_PROPERTY_IMPL(float, PositionLeft, positionLeft, position[CSSPositionLeft]);
CSS_NODE_STYLE_PROPERTY_IMPL(float, PositionTop, positionTop, position[CSSPositionTop]);
@@ -324,7 +354,9 @@ static void print_css_node_rec(CSSNode *node, CSSPrintOptions options, uint32_t
printf("alignSelf: 'stretch', ");
}
print_number_nan("flex", node->style.flex);
print_number_nan("flexGrow", node->style.flexGrow);
print_number_nan("flexShrink", node->style.flexShrink);
print_number_nan("flexBasis", node->style.flexBasis);
if (node->style.overflow == CSSOverflowHidden) {
printf("overflow: 'hidden', ");
@@ -432,40 +464,6 @@ static bool isColumnDirection(CSSFlexDirection flexDirection) {
return flexDirection == CSSFlexDirectionColumn || flexDirection == CSSFlexDirectionColumnReverse;
}
static bool isFlexBasisAuto(CSSNode *node) {
#if POSITIVE_FLEX_IS_AUTO
// All flex values are auto.
(void) node;
return true;
#else
// A flex value > 0 implies a basis of zero.
return node->style.flex <= 0;
#endif
}
static float getFlexGrowFactor(CSSNode *node) {
// Flex grow is implied by positive values for flex.
if (node->style.flex > 0) {
return node->style.flex;
}
return 0;
}
static float getFlexShrinkFactor(CSSNode *node) {
#if POSITIVE_FLEX_IS_AUTO
// A flex shrink factor of 1 is implied by non-zero values for flex.
if (node->style.flex != 0) {
return 1;
}
#else
// A flex shrink factor of 1 is implied by negative values for flex.
if (node->style.flex < 0) {
return 1;
}
#endif
return 0;
}
static float getLeadingMargin(CSSNode *node, CSSFlexDirection axis) {
if (isRowDirection(axis) && !CSSValueIsUndefined(node->style.margin[CSSPositionStart])) {
return node->style.margin[CSSPositionStart];
@@ -592,12 +590,9 @@ static CSSFlexDirection getCrossFlexDirection(CSSFlexDirection flexDirection,
}
}
static float getFlex(CSSNode *node) {
return node->style.flex;
}
static bool isFlex(CSSNode *node) {
return (node->style.positionType == CSSPositionTypeRelative && getFlex(node) != 0);
return (node->style.positionType == CSSPositionTypeRelative &&
(node->style.flexGrow != 0 || node->style.flexShrink != 0));
}
static bool isFlexWrap(CSSNode *node) {
@@ -1022,15 +1017,18 @@ static void layoutNodeImpl(CSSNode *node,
} else {
if (isMainAxisRow && isStyleDimDefined(child, CSSFlexDirectionRow)) {
// The width is definite, so use that as the flex basis.
child->layout.flexBasis = fmaxf(child->style.dimensions[CSSDimensionWidth],
getPaddingAndBorderAxis(child, CSSFlexDirectionRow));
child->layout.computedFlexBasis =
fmaxf(child->style.dimensions[CSSDimensionWidth],
getPaddingAndBorderAxis(child, CSSFlexDirectionRow));
} else if (!isMainAxisRow && isStyleDimDefined(child, CSSFlexDirectionColumn)) {
// The height is definite, so use that as the flex basis.
child->layout.flexBasis = fmaxf(child->style.dimensions[CSSDimensionHeight],
getPaddingAndBorderAxis(child, CSSFlexDirectionColumn));
} else if (!isFlexBasisAuto(child) && !CSSValueIsUndefined(availableInnerMainDim)) {
// If the basis isn't 'auto', it is assumed to be zero.
child->layout.flexBasis = fmaxf(0, getPaddingAndBorderAxis(child, mainAxis));
child->layout.computedFlexBasis =
fmaxf(child->style.dimensions[CSSDimensionHeight],
getPaddingAndBorderAxis(child, CSSFlexDirectionColumn));
} else if (!CSSValueIsUndefined(child->style.flexBasis) &&
!CSSValueIsUndefined(availableInnerMainDim)) {
child->layout.computedFlexBasis =
fmaxf(child->style.flexBasis, getPaddingAndBorderAxis(child, mainAxis));
} else {
// Compute the flex basis and hypothetical main size (i.e. the clamped
// flex basis).
@@ -1098,7 +1096,7 @@ static void layoutNodeImpl(CSSNode *node,
false,
"measure");
child->layout.flexBasis =
child->layout.computedFlexBasis =
fmaxf(isMainAxisRow ? child->layout.measuredDimensions[CSSDimensionWidth]
: child->layout.measuredDimensions[CSSDimensionHeight],
getPaddingAndBorderAxis(child, mainAxis));
@@ -1149,7 +1147,7 @@ static void layoutNodeImpl(CSSNode *node,
child->lineIndex = lineCount;
if (child->style.positionType != CSSPositionTypeAbsolute) {
float outerFlexBasis = child->layout.flexBasis + getMarginAxis(child, mainAxis);
float outerFlexBasis = child->layout.computedFlexBasis + getMarginAxis(child, mainAxis);
// If this is a multi-line flow and this item pushes us over the
// available size, we've
@@ -1164,12 +1162,13 @@ static void layoutNodeImpl(CSSNode *node,
itemsOnLine++;
if (isFlex(child)) {
totalFlexGrowFactors += getFlexGrowFactor(child);
totalFlexGrowFactors += child->style.flexGrow;
// Unlike the grow factor, the shrink factor is scaled relative to the
// child
// dimension.
totalFlexShrinkScaledFactors += getFlexShrinkFactor(child) * child->layout.flexBasis;
totalFlexShrinkScaledFactors +=
-child->style.flexShrink * child->layout.computedFlexBasis;
}
// Store a private linked list of children that need to be layed out.
@@ -1252,10 +1251,10 @@ static void layoutNodeImpl(CSSNode *node,
float deltaFlexGrowFactors = 0;
currentRelativeChild = firstRelativeChild;
while (currentRelativeChild != NULL) {
childFlexBasis = currentRelativeChild->layout.flexBasis;
childFlexBasis = currentRelativeChild->layout.computedFlexBasis;
if (remainingFreeSpace < 0) {
flexShrinkScaledFactor = getFlexShrinkFactor(currentRelativeChild) * childFlexBasis;
flexShrinkScaledFactor = -currentRelativeChild->style.flexShrink * childFlexBasis;
// Is this child able to shrink?
if (flexShrinkScaledFactor != 0) {
@@ -1275,7 +1274,7 @@ static void layoutNodeImpl(CSSNode *node,
}
}
} else if (remainingFreeSpace > 0) {
flexGrowFactor = getFlexGrowFactor(currentRelativeChild);
flexGrowFactor = currentRelativeChild->style.flexGrow;
// Is this child able to grow?
if (flexGrowFactor != 0) {
@@ -1306,11 +1305,11 @@ static void layoutNodeImpl(CSSNode *node,
deltaFreeSpace = 0;
currentRelativeChild = firstRelativeChild;
while (currentRelativeChild != NULL) {
childFlexBasis = currentRelativeChild->layout.flexBasis;
childFlexBasis = currentRelativeChild->layout.computedFlexBasis;
float updatedMainSize = childFlexBasis;
if (remainingFreeSpace < 0) {
flexShrinkScaledFactor = getFlexShrinkFactor(currentRelativeChild) * childFlexBasis;
flexShrinkScaledFactor = -currentRelativeChild->style.flexShrink * childFlexBasis;
// Is this child able to shrink?
if (flexShrinkScaledFactor != 0) {
@@ -1321,7 +1320,7 @@ static void layoutNodeImpl(CSSNode *node,
flexShrinkScaledFactor);
}
} else if (remainingFreeSpace > 0) {
flexGrowFactor = getFlexGrowFactor(currentRelativeChild);
flexGrowFactor = currentRelativeChild->style.flexGrow;
// Is this child able to grow?
if (flexGrowFactor != 0) {
@@ -1463,7 +1462,8 @@ static void layoutNodeImpl(CSSNode *node,
// If we skipped the flex step, then we can't rely on the
// measuredDims because
// they weren't computed. This means we can't call getDimWithMargin.
mainDim += betweenMainDim + getMarginAxis(child, mainAxis) + child->layout.flexBasis;
mainDim +=
betweenMainDim + getMarginAxis(child, mainAxis) + child->layout.computedFlexBasis;
crossDim = availableInnerCrossDim;
} else {
// The main dimension is the sum of all the elements dimension plus

View File

@@ -174,6 +174,9 @@ CSS_NODE_STYLE_PROPERTY(CSSPositionType, PositionType, positionType);
CSS_NODE_STYLE_PROPERTY(CSSWrapType, FlexWrap, flexWrap);
CSS_NODE_STYLE_PROPERTY(CSSOverflow, Overflow, overflow);
CSS_NODE_STYLE_PROPERTY(float, Flex, flex);
CSS_NODE_STYLE_PROPERTY(float, FlexGrow, flexGrow);
CSS_NODE_STYLE_PROPERTY(float, FlexShrink, flexShrink);
CSS_NODE_STYLE_PROPERTY(float, FlexBasis, flexBasis);
CSS_NODE_STYLE_PROPERTY(float, PositionLeft, positionLeft);
CSS_NODE_STYLE_PROPERTY(float, PositionTop, positionTop);

View File

@@ -108,10 +108,14 @@ function setupTestTree(node, nodeName, parentName, index) {
overflowValue(node.style[style]) + ');');
break;
case 'flex-grow':
lines.push('CSSNodeStyleSetFlex(' + nodeName + ', ' + node.style[style] + ');');
lines.push('CSSNodeStyleSetFlexGrow(' + nodeName + ', ' + node.style[style] + ');');
break;
case 'flex-shrink':
lines.push('CSSNodeStyleSetFlex(' + nodeName + ', ' + -node.style[style] + ');');
lines.push('CSSNodeStyleSetFlexShrink(' + nodeName + ', ' + node.style[style] + ');');
break;
case 'flex-basis':
lines.push('CSSNodeStyleSetFlexBasis(' + nodeName + ', ' +
pixelValue(node.style[style]) + ');');
break;
case 'left':
lines.push('CSSNodeStyleSetPositionLeft(' + nodeName + ', ' +
@@ -328,6 +332,7 @@ function getCSSLayoutStyle(node) {
'overflow',
'flex-grow',
'flex-shrink',
'flex-basis',
'left',
'top',
'right',

View File

@@ -145,6 +145,9 @@ CSS_NODE_JNI_STYLE_PROP(jint, CSSPositionType, PositionType);
CSS_NODE_JNI_STYLE_PROP(jint, CSSWrapType, FlexWrap);
CSS_NODE_JNI_STYLE_PROP(jint, CSSOverflow, Overflow);
CSS_NODE_JNI_STYLE_PROP(jfloat, float, Flex);
CSS_NODE_JNI_STYLE_PROP(jfloat, float, FlexGrow);
CSS_NODE_JNI_STYLE_PROP(jfloat, float, FlexShrink);
CSS_NODE_JNI_STYLE_PROP(jfloat, float, FlexBasis);
CSS_NODE_JNI_STYLE_PROP(jfloat, float, MarginLeft);
CSS_NODE_JNI_STYLE_PROP(jfloat, float, MarginTop);

View File

@@ -0,0 +1,48 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#include <CSSLayout/CSSLayout-internal.h>
#include <CSSLayoutTestUtils/CSSLayoutTestUtils.h>
#include <gtest/gtest.h>
TEST(CSSLayoutTest, flex_basis) {
CSSNodeRef root = CSSNodeNew();
CSSNodeStyleSetFlexDirection(root, CSSFlexDirectionRow);
CSSNodeStyleSetWidth(root, 300);
CSSNodeStyleSetHeight(root, 100);
CSSNodeRef root_child0 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child0, 1);
CSSNodeStyleSetFlexBasis(root_child0, 100);
CSSNodeStyleSetWidth(root_child0, 200);
CSSNodeStyleSetHeight(root_child0, 100);
CSSNodeInsertChild(root, root_child0, 0);
CSSNodeRef root_child1 = CSSNodeNew();
CSSNodeStyleSetFlexGrow(root_child1, 1);
CSSNodeStyleSetWidth(root_child1, 100);
CSSNodeStyleSetHeight(root_child1, 100);
CSSNodeInsertChild(root, root_child1, 1);
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root));
ASSERT_EQ(300, CSSNodeLayoutGetWidth(root));
ASSERT_EQ(100, CSSNodeLayoutGetHeight(root));
ASSERT_EQ(0, CSSNodeLayoutGetLeft(root_child0));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child0));
ASSERT_EQ(200, CSSNodeLayoutGetWidth(root_child0));
ASSERT_EQ(100, CSSNodeLayoutGetHeight(root_child0));
ASSERT_EQ(200, CSSNodeLayoutGetLeft(root_child1));
ASSERT_EQ(0, CSSNodeLayoutGetTop(root_child1));
ASSERT_EQ(100, CSSNodeLayoutGetWidth(root_child1));
ASSERT_EQ(100, CSSNodeLayoutGetHeight(root_child1));
}

View File

@@ -691,7 +691,7 @@ TEST(CSSLayoutTest, test_layout_node_with_flex) {
node_1->style.dimensions[CSSDimensionWidth] = 100;
node_1->style.dimensions[CSSDimensionHeight] = 200;
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.dimensions[CSSDimensionWidth] = 100;
}
}
@@ -736,7 +736,7 @@ TEST(CSSLayoutTest, test_layout_node_with_flex_in_revese) {
node_1->style.dimensions[CSSDimensionWidth] = 100;
node_1->style.dimensions[CSSDimensionHeight] = 200;
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.dimensions[CSSDimensionWidth] = 100;
}
}
@@ -777,19 +777,19 @@ TEST(CSSLayoutTest, test_layout_node_with_flex_recursively) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.dimensions[CSSDimensionWidth] = 1000;
init_css_node_children(node_1, 1);
{
CSSNode *node_2;
node_2 = CSSNodeGetChild(node_1, 0);
node_2->style.flex = 1;
CSSNodeStyleSetFlex(node_2, 1);
node_2->style.dimensions[CSSDimensionWidth] = 1000;
init_css_node_children(node_2, 1);
{
CSSNode *node_3;
node_3 = CSSNodeGetChild(node_2, 0);
node_3->style.flex = 1;
CSSNodeStyleSetFlex(node_3, 1);
node_3->style.dimensions[CSSDimensionWidth] = 1000;
}
}
@@ -847,21 +847,21 @@ TEST(CSSLayoutTest, test_layout_node_with_flex_recursively_in_reverse) {
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flexDirection = CSSFlexDirectionColumnReverse;
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.dimensions[CSSDimensionWidth] = 1000;
init_css_node_children(node_1, 1);
{
CSSNode *node_2;
node_2 = CSSNodeGetChild(node_1, 0);
node_2->style.flexDirection = CSSFlexDirectionColumnReverse;
node_2->style.flex = 1;
CSSNodeStyleSetFlex(node_2, 1);
node_2->style.dimensions[CSSDimensionWidth] = 1000;
init_css_node_children(node_2, 1);
{
CSSNode *node_3;
node_3 = CSSNodeGetChild(node_2, 0);
node_3->style.flexDirection = CSSFlexDirectionColumnReverse;
node_3->style.flex = 1;
CSSNodeStyleSetFlex(node_3, 1);
node_3->style.dimensions[CSSDimensionWidth] = 1000;
}
}
@@ -1473,7 +1473,7 @@ TEST(CSSLayoutTest, test_layout_node_flex_with_override_height) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.dimensions[CSSDimensionWidth] = 100;
node_1->style.dimensions[CSSDimensionHeight] = 100;
}
@@ -2375,7 +2375,7 @@ TEST(CSSLayoutTest, test_layout_flex_inside_empty_node) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
}
}
@@ -2808,12 +2808,12 @@ TEST(CSSLayoutTest, test_layout_node_with_absolute_position) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.positionType = CSSPositionTypeAbsolute;
node_1->style.dimensions[CSSDimensionWidth] = 50;
node_1 = CSSNodeGetChild(node_0, 2);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
}
}
@@ -3296,7 +3296,7 @@ TEST(CSSLayoutTest, test_layout_node_with_flex_and_main_margin) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.margin[CSSPositionLeft] = 5;
}
}
@@ -3333,7 +3333,7 @@ TEST(CSSLayoutTest, test_layout_node_with_flex_and_main_margin_rtl) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.margin[CSSPositionRight] = 5;
}
}
@@ -3369,9 +3369,9 @@ TEST(CSSLayoutTest, test_layout_node_with_multiple_flex_and_padding) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.padding[CSSPositionRight] = 5;
}
}
@@ -3413,9 +3413,9 @@ TEST(CSSLayoutTest, test_layout_node_with_multiple_flex_and_padding_rtl) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.padding[CSSPositionLeft] = 5;
}
}
@@ -3456,9 +3456,9 @@ TEST(CSSLayoutTest, test_layout_node_with_multiple_flex_and_margin) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.margin[CSSPositionLeft] = 5;
}
}
@@ -3500,9 +3500,9 @@ TEST(CSSLayoutTest, test_layout_node_with_multiple_flex_and_margin_rtl) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.margin[CSSPositionRight] = 5;
}
}
@@ -3544,7 +3544,7 @@ TEST(CSSLayoutTest, test_layout_node_with_flex_and_overflow) {
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.dimensions[CSSDimensionHeight] = 600;
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
}
}
@@ -3585,7 +3585,7 @@ TEST(CSSLayoutTest, test_layout_absolute_node_with_flex) {
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.positionType = CSSPositionTypeAbsolute;
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
}
}
@@ -3622,7 +3622,7 @@ TEST(CSSLayoutTest, test_layout_absolute_node_with_flex_rtl) {
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.positionType = CSSPositionTypeAbsolute;
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
}
}
@@ -3656,10 +3656,10 @@ TEST(CSSLayoutTest, test_layout_absolute_node_with_double_flex) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.positionType = CSSPositionTypeAbsolute;
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
}
}
@@ -4211,7 +4211,7 @@ TEST(CSSLayoutTest, test_should_layout_node_with_text_and_flex) {
{
CSSNode *node_2;
node_2 = CSSNodeGetChild(node_1, 0);
node_2->style.flex = 1;
CSSNodeStyleSetFlex(node_2, 1);
node_2->measure = measure;
node_2->context = (char *) LONG_TEXT;
}
@@ -4263,7 +4263,7 @@ TEST(CSSLayoutTest, test_should_layout_node_text_and_flex_rtl) {
{
CSSNode *node_2;
node_2 = CSSNodeGetChild(node_1, 0);
node_2->style.flex = 1;
CSSNodeStyleSetFlex(node_2, 1);
node_2->measure = measure;
node_2->context = (char *) LONG_TEXT;
}
@@ -4878,10 +4878,10 @@ TEST(CSSLayoutTest, test_should_layout_with_arbitrary_flex) {
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.alignSelf = CSSAlignFlexStart;
node_1->style.flex = 2.5;
CSSNodeStyleSetFlex(node_1, 2.5);
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.alignSelf = CSSAlignFlexStart;
node_1->style.flex = 7.5;
CSSNodeStyleSetFlex(node_1, 7.5);
}
}
@@ -4924,10 +4924,10 @@ TEST(CSSLayoutTest, test_should_layout_with_arbitrary_flex_in_reverse) {
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.alignSelf = CSSAlignFlexStart;
node_1->style.flex = 2.5;
CSSNodeStyleSetFlex(node_1, 2.5);
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.alignSelf = CSSAlignFlexStart;
node_1->style.flex = 7.5;
CSSNodeStyleSetFlex(node_1, 7.5);
}
}
@@ -4970,10 +4970,10 @@ TEST(CSSLayoutTest, test_should_layout_with_negative_flex_in_reverse) {
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.alignSelf = CSSAlignFlexStart;
node_1->style.flex = -2.5;
CSSNodeStyleSetFlex(node_1, -2.5);
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.alignSelf = CSSAlignFlexStart;
node_1->style.flex = 0;
CSSNodeStyleSetFlex(node_1, 0);
}
}
@@ -5874,12 +5874,12 @@ TEST(CSSLayoutTest, test_should_layout_node_min_bounds_and_flex) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.minDimensions[CSSDimensionWidth] = 200;
node_1 = CSSNodeGetChild(node_0, 2);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
}
}
@@ -5926,12 +5926,12 @@ TEST(CSSLayoutTest, test_should_layout_node_min_bounds_and_flex_rtl) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.minDimensions[CSSDimensionWidth] = 200;
node_1 = CSSNodeGetChild(node_0, 2);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
}
}
@@ -5977,13 +5977,13 @@ TEST(CSSLayoutTest, test_should_layout_node_with_flex_size_within_bounds) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.maxDimensions[CSSDimensionWidth] = 110;
node_1->style.minDimensions[CSSDimensionWidth] = 90;
node_1 = CSSNodeGetChild(node_0, 2);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
}
}
@@ -6030,13 +6030,13 @@ TEST(CSSLayoutTest, test_should_layout_node_with_flex_size_within_bounds_rtl) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.maxDimensions[CSSDimensionWidth] = 110;
node_1->style.minDimensions[CSSDimensionWidth] = 90;
node_1 = CSSNodeGetChild(node_0, 2);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
}
}
@@ -6082,12 +6082,12 @@ TEST(CSSLayoutTest, test_should_layout_node_max_bounds_and_flex) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.maxDimensions[CSSDimensionWidth] = 60;
node_1 = CSSNodeGetChild(node_0, 2);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
}
}
@@ -6134,12 +6134,12 @@ TEST(CSSLayoutTest, test_should_layout_node_max_bounds_and_flex_rtl) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.maxDimensions[CSSDimensionWidth] = 60;
node_1 = CSSNodeGetChild(node_0, 2);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
}
}
@@ -6185,13 +6185,13 @@ TEST(CSSLayoutTest, test_should_layout_node_all_children_max_bounds_and_flex) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.maxDimensions[CSSDimensionWidth] = 60;
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.maxDimensions[CSSDimensionWidth] = 60;
node_1 = CSSNodeGetChild(node_0, 2);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.maxDimensions[CSSDimensionWidth] = 60;
}
}
@@ -6239,13 +6239,13 @@ TEST(CSSLayoutTest, test_should_layout_node_all_children_max_bounds_and_flex_rtl
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.maxDimensions[CSSDimensionWidth] = 60;
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.maxDimensions[CSSDimensionWidth] = 60;
node_1 = CSSNodeGetChild(node_0, 2);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.maxDimensions[CSSDimensionWidth] = 60;
}
}
@@ -6292,13 +6292,13 @@ TEST(CSSLayoutTest, test_should_layout_node_all_children_min_bounds_and_flex) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.minDimensions[CSSDimensionWidth] = 120;
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.minDimensions[CSSDimensionWidth] = 120;
node_1 = CSSNodeGetChild(node_0, 2);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.minDimensions[CSSDimensionWidth] = 120;
}
}
@@ -6346,13 +6346,13 @@ TEST(CSSLayoutTest, test_should_layout_node_all_children_min_bounds_and_flex_rtl
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.minDimensions[CSSDimensionWidth] = 120;
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.minDimensions[CSSDimensionWidth] = 120;
node_1 = CSSNodeGetChild(node_0, 2);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.minDimensions[CSSDimensionWidth] = 120;
}
}
@@ -6398,7 +6398,7 @@ TEST(CSSLayoutTest, test_should_prefill_child_size_within_bounds) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.maxDimensions[CSSDimensionWidth] = 310;
node_1->style.minDimensions[CSSDimensionWidth] = 290;
}
@@ -6435,7 +6435,7 @@ TEST(CSSLayoutTest, test_should_prefill_child_size_within_max_bounds) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.maxDimensions[CSSDimensionWidth] = 290;
}
}
@@ -6471,7 +6471,7 @@ TEST(CSSLayoutTest, test_should_prefill_child_size_within_min_bounds) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.minDimensions[CSSDimensionWidth] = 310;
}
}
@@ -6913,7 +6913,7 @@ TEST(CSSLayoutTest, test_should_center_flex_item_with_max_size) {
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.dimensions[CSSDimensionHeight] = 1000;
node_1->style.maxDimensions[CSSDimensionWidth] = 600;
}
@@ -6951,11 +6951,11 @@ TEST(CSSLayoutTest, test_should_correctly_size_flex_items_with_flexBasis_and_max
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.dimensions[CSSDimensionWidth] = 100;
node_1->style.dimensions[CSSDimensionHeight] = 1000;
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.dimensions[CSSDimensionWidth] = 100;
node_1->style.dimensions[CSSDimensionHeight] = 1000;
node_1->style.maxDimensions[CSSDimensionWidth] = 200;
@@ -7132,7 +7132,7 @@ TEST(CSSLayoutTest, test_should_layout_absolute_node_with_parent_with_padding_an
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.padding[CSSPositionLeft] = 10;
node_1->style.padding[CSSPositionTop] = 10;
node_1->style.padding[CSSPositionRight] = 10;
@@ -7737,13 +7737,13 @@ TEST(CSSLayoutTest, test_should_propagate_size_contraints_from_flex_parent) {
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flexDirection = CSSFlexDirectionColumn;
node_1->style.alignItems = CSSAlignFlexStart;
node_1->style.flex = 1;
CSSNodeStyleSetFlex(node_1, 1);
node_1->style.dimensions[CSSDimensionHeight] = 10;
init_css_node_children(node_1, 1);
{
CSSNode *node_2;
node_2 = CSSNodeGetChild(node_1, 0);
node_2->style.flex = 1;
CSSNodeStyleSetFlex(node_2, 1);
node_2->style.dimensions[CSSDimensionHeight] = 10;
node_2->measure = measure;
node_2->context = (char *) MEASURE_WITH_MATCH_PARENT;
@@ -8076,7 +8076,7 @@ TEST(CSSLayoutTest, test_should_not_shrink_column_node_when_there_is_space_left_
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = -1;
CSSNodeStyleSetFlex(node_1, -1);
node_1->style.dimensions[CSSDimensionWidth] = 100;
init_css_node_children(node_1, 1);
{
@@ -8128,7 +8128,7 @@ TEST(CSSLayoutTest, test_should_shrink_column_node_when_there_is_no_space_left_o
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = -1;
CSSNodeStyleSetFlex(node_1, -1);
node_1->style.dimensions[CSSDimensionWidth] = 100;
init_css_node_children(node_1, 1);
{
@@ -8184,7 +8184,7 @@ TEST(CSSLayoutTest,
node_1->style.dimensions[CSSDimensionWidth] = 100;
node_1->style.dimensions[CSSDimensionHeight] = 25;
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = -1;
CSSNodeStyleSetFlex(node_1, -1);
node_1->style.dimensions[CSSDimensionWidth] = 100;
init_css_node_children(node_1, 1);
{
@@ -8252,7 +8252,7 @@ TEST(CSSLayoutTest, test_should_shrink_column_node_with_siblings_when_there_is_n
node_1->style.dimensions[CSSDimensionWidth] = 100;
node_1->style.dimensions[CSSDimensionHeight] = 25;
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = -1;
CSSNodeStyleSetFlex(node_1, -1);
node_1->style.dimensions[CSSDimensionWidth] = 100;
init_css_node_children(node_1, 1);
{
@@ -8319,14 +8319,14 @@ TEST(
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = -1;
CSSNodeStyleSetFlex(node_1, -1);
node_1->style.dimensions[CSSDimensionWidth] = 100;
node_1->style.dimensions[CSSDimensionHeight] = 30;
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.dimensions[CSSDimensionWidth] = 100;
node_1->style.dimensions[CSSDimensionHeight] = 40;
node_1 = CSSNodeGetChild(node_0, 2);
node_1->style.flex = -1;
CSSNodeStyleSetFlex(node_1, -1);
node_1->style.dimensions[CSSDimensionWidth] = 100;
node_1->style.dimensions[CSSDimensionHeight] = 50;
}
@@ -8374,7 +8374,7 @@ TEST(CSSLayoutTest, test_should_not_shrink_visible_row_node_when_there_is_space_
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = -1;
CSSNodeStyleSetFlex(node_1, -1);
node_1->style.dimensions[CSSDimensionHeight] = 100;
init_css_node_children(node_1, 1);
{
@@ -8427,7 +8427,7 @@ TEST(CSSLayoutTest, test_should_shrink_visible_row_node_when_there_is_no_space_l
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = -1;
CSSNodeStyleSetFlex(node_1, -1);
node_1->style.dimensions[CSSDimensionHeight] = 100;
init_css_node_children(node_1, 1);
{
@@ -8484,7 +8484,7 @@ TEST(CSSLayoutTest,
node_1->style.dimensions[CSSDimensionWidth] = 25;
node_1->style.dimensions[CSSDimensionHeight] = 100;
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = -1;
CSSNodeStyleSetFlex(node_1, -1);
node_1->style.dimensions[CSSDimensionHeight] = 100;
init_css_node_children(node_1, 1);
{
@@ -8554,7 +8554,7 @@ TEST(CSSLayoutTest,
node_1->style.dimensions[CSSDimensionWidth] = 25;
node_1->style.dimensions[CSSDimensionHeight] = 100;
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flex = -1;
CSSNodeStyleSetFlex(node_1, -1);
node_1->style.dimensions[CSSDimensionHeight] = 100;
init_css_node_children(node_1, 1);
{
@@ -8620,14 +8620,14 @@ TEST(CSSLayoutTest, test_should_shrink_visible_row_nodes_when_there_is_no_space_
{
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.flex = -1;
CSSNodeStyleSetFlex(node_1, -1);
node_1->style.dimensions[CSSDimensionWidth] = 30;
node_1->style.dimensions[CSSDimensionHeight] = 100;
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.dimensions[CSSDimensionWidth] = 40;
node_1->style.dimensions[CSSDimensionHeight] = 100;
node_1 = CSSNodeGetChild(node_0, 2);
node_1->style.flex = -1;
CSSNodeStyleSetFlex(node_1, -1);
node_1->style.dimensions[CSSDimensionWidth] = 50;
node_1->style.dimensions[CSSDimensionHeight] = 100;
}
@@ -8676,7 +8676,7 @@ TEST(CSSLayoutTest, test_should_not_shrink_hidden_row_node_when_there_is_space_l
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.overflow = CSSOverflowHidden;
node_1->style.flex = -1;
CSSNodeStyleSetFlex(node_1, -1);
node_1->style.dimensions[CSSDimensionHeight] = 100;
init_css_node_children(node_1, 1);
{
@@ -8730,7 +8730,7 @@ TEST(CSSLayoutTest, test_should_shrink_hidden_row_node_when_there_is_no_space_le
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.overflow = CSSOverflowHidden;
node_1->style.flex = -1;
CSSNodeStyleSetFlex(node_1, -1);
node_1->style.dimensions[CSSDimensionHeight] = 100;
init_css_node_children(node_1, 1);
{
@@ -8788,7 +8788,7 @@ TEST(CSSLayoutTest,
node_1->style.dimensions[CSSDimensionHeight] = 100;
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.overflow = CSSOverflowHidden;
node_1->style.flex = -1;
CSSNodeStyleSetFlex(node_1, -1);
node_1->style.dimensions[CSSDimensionHeight] = 100;
init_css_node_children(node_1, 1);
{
@@ -8859,7 +8859,7 @@ TEST(CSSLayoutTest,
node_1->style.dimensions[CSSDimensionHeight] = 100;
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.overflow = CSSOverflowHidden;
node_1->style.flex = -1;
CSSNodeStyleSetFlex(node_1, -1);
node_1->style.dimensions[CSSDimensionHeight] = 100;
init_css_node_children(node_1, 1);
{
@@ -8927,7 +8927,7 @@ TEST(CSSLayoutTest,
CSSNode *node_1;
node_1 = CSSNodeGetChild(node_0, 0);
node_1->style.overflow = CSSOverflowHidden;
node_1->style.flex = -1;
CSSNodeStyleSetFlex(node_1, -1);
node_1->style.dimensions[CSSDimensionWidth] = 30;
node_1->style.dimensions[CSSDimensionHeight] = 100;
node_1 = CSSNodeGetChild(node_0, 1);
@@ -8935,7 +8935,7 @@ TEST(CSSLayoutTest,
node_1->style.dimensions[CSSDimensionHeight] = 100;
node_1 = CSSNodeGetChild(node_0, 2);
node_1->style.overflow = CSSOverflowHidden;
node_1->style.flex = -1;
CSSNodeStyleSetFlex(node_1, -1);
node_1->style.dimensions[CSSDimensionWidth] = 50;
node_1->style.dimensions[CSSDimensionHeight] = 100;
}
@@ -8988,7 +8988,7 @@ TEST(CSSLayoutTest, test_should_not_shrink_text_node_with_siblings_when_there_is
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flexDirection = CSSFlexDirectionRow;
node_1->style.alignItems = CSSAlignFlexStart;
node_1->style.flex = -1;
CSSNodeStyleSetFlex(node_1, -1);
node_1->style.dimensions[CSSDimensionHeight] = 100;
init_css_node_children(node_1, 1);
{
@@ -9059,13 +9059,13 @@ TEST(CSSLayoutTest, test_should_shrink_text_node_with_siblings_when_there_is_no_
node_1 = CSSNodeGetChild(node_0, 1);
node_1->style.flexDirection = CSSFlexDirectionRow;
node_1->style.alignItems = CSSAlignFlexStart;
node_1->style.flex = -1;
CSSNodeStyleSetFlex(node_1, -1);
node_1->style.dimensions[CSSDimensionHeight] = 100;
init_css_node_children(node_1, 1);
{
CSSNode *node_2;
node_2 = CSSNodeGetChild(node_1, 0);
node_2->style.flex = -1;
CSSNodeStyleSetFlex(node_2, -1);
node_2->measure = measure;
node_2->context = (char *) LONG_TEXT;
}