From 425345aa8d3c7938fc4085a8f9796f457d803cd2 Mon Sep 17 00:00:00 2001 From: Alex Bogomazov Date: Thu, 15 Oct 2015 01:30:33 +0300 Subject: [PATCH] Redo layout of 'stretch' aligned items for correct positioning of nested items Fixes facebook/css-layout#83, facebook/css-layout#100, facebook/css-layout#127. --- dist/css-layout.h | 73 ++++--- dist/css-layout.jar | Bin 14260 -> 14883 bytes dist/css-layout.js | 74 ++++--- dist/css-layout.min.js | 2 +- dist/css-layout.min.js.map | 2 +- src/Layout.c | 26 ++- src/Layout.js | 26 ++- src/__tests__/Layout-test.c | 196 +++++++++++++++++ src/__tests__/Layout-test.js | 58 +++++ .../LayoutCachingTest.cs | 10 +- .../LayoutEngineTest.cs | 202 ++++++++++++++++++ src/csharp/Facebook.CSSLayout/LayoutEngine.cs | 26 ++- .../com/facebook/csslayout/LayoutEngine.java | 26 ++- .../facebook/csslayout/LayoutCachingTest.java | 8 +- .../facebook/csslayout/LayoutEngineTest.java | 202 ++++++++++++++++++ 15 files changed, 847 insertions(+), 84 deletions(-) diff --git a/dist/css-layout.h b/dist/css-layout.h index bc5909a8..e7a64287 100644 --- a/dist/css-layout.h +++ b/dist/css-layout.h @@ -613,11 +613,16 @@ static float getDimWithMargin(css_node_t *node, css_flex_direction_t axis) { getTrailingMargin(node, axis); } -static bool isDimDefined(css_node_t *node, css_flex_direction_t axis) { +static bool isStyleDimDefined(css_node_t *node, css_flex_direction_t axis) { float value = node->style.dimensions[dim[axis]]; return !isUndefined(value) && value >= 0.0; } +static bool isLayoutDimDefined(css_node_t *node, css_flex_direction_t axis) { + float value = node->layout.dimensions[dim[axis]]; + return !isUndefined(value) && value >= 0.0; +} + static bool isPosDefined(css_node_t *node, css_position_t position) { return !isUndefined(node->style.position[position]); } @@ -661,11 +666,11 @@ static float boundAxis(css_node_t *node, css_flex_direction_t axis, float value) // When the user specifically sets a value for width or height static void setDimensionFromStyle(css_node_t *node, css_flex_direction_t axis) { // The parent already computed us a width or height. We just skip it - if (!isUndefined(node->layout.dimensions[dim[axis]])) { + if (isLayoutDimDefined(node, axis)) { return; } // We only run if there's a width or height defined - if (!isDimDefined(node, axis)) { + if (!isStyleDimDefined(node, axis)) { return; } @@ -723,10 +728,10 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM float paddingAndBorderAxisColumn = getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_COLUMN); if (isMeasureDefined(node)) { - bool isResolvedRowDimDefined = !isUndefined(node->layout.dimensions[dim[resolvedRowAxis]]); + bool isResolvedRowDimDefined = isLayoutDimDefined(node, resolvedRowAxis); float width = CSS_UNDEFINED; - if (isDimDefined(node, resolvedRowAxis)) { + if (isStyleDimDefined(node, resolvedRowAxis)) { width = node->style.dimensions[CSS_WIDTH]; } else if (isResolvedRowDimDefined) { width = node->layout.dimensions[dim[resolvedRowAxis]]; @@ -737,9 +742,9 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM width -= paddingAndBorderAxisResolvedRow; float height = CSS_UNDEFINED; - if (isDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { + if (isStyleDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { height = node->style.dimensions[CSS_HEIGHT]; - } else if (!isUndefined(node->layout.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]])) { + } else if (isLayoutDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { height = node->layout.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]]; } else { height = parentMaxHeight - @@ -750,8 +755,8 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM // We only need to give a dimension for the text if we haven't got any // for it computed yet. It can either be from the style attribute or because // the element is flexible. - bool isRowUndefined = !isDimDefined(node, resolvedRowAxis) && !isResolvedRowDimDefined; - bool isColumnUndefined = !isDimDefined(node, CSS_FLEX_DIRECTION_COLUMN) && + bool isRowUndefined = !isStyleDimDefined(node, resolvedRowAxis) && !isResolvedRowDimDefined; + bool isColumnUndefined = !isStyleDimDefined(node, CSS_FLEX_DIRECTION_COLUMN) && isUndefined(node->layout.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]]); // Let's not measure the text if we already know both dimensions @@ -785,8 +790,8 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM float paddingAndBorderAxisMain = getPaddingAndBorderAxis(node, mainAxis); float paddingAndBorderAxisCross = getPaddingAndBorderAxis(node, crossAxis); - bool isMainDimDefined = !isUndefined(node->layout.dimensions[dim[mainAxis]]); - bool isCrossDimDefined = !isUndefined(node->layout.dimensions[dim[crossAxis]]); + bool isMainDimDefined = isLayoutDimDefined(node, mainAxis); + bool isCrossDimDefined = isLayoutDimDefined(node, crossAxis); bool isMainRowDirection = isRowDirection(mainAxis); int i; @@ -848,8 +853,8 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM float mainDim = leadingPaddingAndBorderMain; float crossDim = 0; - float maxWidth; - float maxHeight; + float maxWidth = CSS_UNDEFINED; + float maxHeight = CSS_UNDEFINED; for (i = startLine; i < childCount; ++i) { child = node->get_child(node->context, i); child->line_index = linesCount; @@ -864,7 +869,7 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM if (alignItem == CSS_ALIGN_STRETCH && child->style.position_type == CSS_POSITION_RELATIVE && isCrossDimDefined && - !isDimDefined(child, crossAxis)) { + !isStyleDimDefined(child, crossAxis)) { child->layout.dimensions[dim[crossAxis]] = fmaxf( boundAxis(child, crossAxis, node->layout.dimensions[dim[crossAxis]] - paddingAndBorderAxisCross - getMarginAxis(child, crossAxis)), @@ -886,8 +891,8 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM // left and right or top and bottom). for (ii = 0; ii < 2; ii++) { axis = (ii != 0) ? CSS_FLEX_DIRECTION_ROW : CSS_FLEX_DIRECTION_COLUMN; - if (!isUndefined(node->layout.dimensions[dim[axis]]) && - !isDimDefined(child, axis) && + if (isLayoutDimDefined(node, axis) && + !isStyleDimDefined(child, axis) && isPosDefined(child, leading[axis]) && isPosDefined(child, trailing[axis])) { child->layout.dimensions[dim[axis]] = fmaxf( @@ -933,7 +938,7 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM maxHeight = CSS_UNDEFINED; if (!isMainRowDirection) { - if (isDimDefined(node, resolvedRowAxis)) { + if (isLayoutDimDefined(node, resolvedRowAxis)) { maxWidth = node->layout.dimensions[dim[resolvedRowAxis]] - paddingAndBorderAxisResolvedRow; } else { @@ -942,7 +947,7 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM paddingAndBorderAxisResolvedRow; } } else { - if (isDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { + if (isLayoutDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { maxHeight = node->layout.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]] - paddingAndBorderAxisColumn; } else { @@ -993,7 +998,7 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM if (isSimpleStackCross && (child->style.position_type != CSS_POSITION_RELATIVE || (alignItem != CSS_ALIGN_STRETCH && alignItem != CSS_ALIGN_FLEX_START) || - isUndefined(child->layout.dimensions[dim[crossAxis]]))) { + (alignItem == CSS_ALIGN_STRETCH && !isCrossDimDefined))) { isSimpleStackCross = false; firstComplexCross = i; } @@ -1076,7 +1081,7 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM ); maxWidth = CSS_UNDEFINED; - if (isDimDefined(node, resolvedRowAxis)) { + if (isLayoutDimDefined(node, resolvedRowAxis)) { maxWidth = node->layout.dimensions[dim[resolvedRowAxis]] - paddingAndBorderAxisResolvedRow; } else if (!isMainRowDirection) { @@ -1085,7 +1090,7 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM paddingAndBorderAxisResolvedRow; } maxHeight = CSS_UNDEFINED; - if (isDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { + if (isLayoutDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { maxHeight = node->layout.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]] - paddingAndBorderAxisColumn; } else if (isMainRowDirection) { @@ -1203,15 +1208,31 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM css_align_t alignItem = getAlignItem(node, child); /*eslint-enable */ if (alignItem == CSS_ALIGN_STRETCH) { - // You can only stretch if the dimension has not already been set + // You can only stretch if the dimension has not already been defined // previously. - if (isUndefined(child->layout.dimensions[dim[crossAxis]])) { + if (!isStyleDimDefined(child, crossAxis)) { + float dimCrossAxis = child->layout.dimensions[dim[crossAxis]]; child->layout.dimensions[dim[crossAxis]] = fmaxf( boundAxis(child, crossAxis, containerCrossAxis - paddingAndBorderAxisCross - getMarginAxis(child, crossAxis)), // You never want to go smaller than padding getPaddingAndBorderAxis(child, crossAxis) ); + + // If the size has changed, and this child has children we need to re-layout this child + if (dimCrossAxis != child->layout.dimensions[dim[crossAxis]] && child->children_count > 0) { + // Reset child margins before re-layout as they are added back in layoutNode and would be doubled + child->layout.position[leading[mainAxis]] -= getLeadingMargin(child, mainAxis) + + getRelativePosition(child, mainAxis); + child->layout.position[trailing[mainAxis]] -= getTrailingMargin(child, mainAxis) + + getRelativePosition(child, mainAxis); + child->layout.position[leading[crossAxis]] -= getLeadingMargin(child, crossAxis) + + getRelativePosition(child, crossAxis); + child->layout.position[trailing[crossAxis]] -= getTrailingMargin(child, crossAxis) + + getRelativePosition(child, crossAxis); + + layoutNode(child, maxWidth, maxHeight, direction); + } } } else if (alignItem != CSS_ALIGN_FLEX_START) { // The remaining space between the parent dimensions+padding and child @@ -1289,7 +1310,7 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM if (child->line_index != i) { break; } - if (!isUndefined(child->layout.dimensions[dim[crossAxis]])) { + if (isLayoutDimDefined(child, crossAxis)) { lineHeight = fmaxf( lineHeight, child->layout.dimensions[dim[crossAxis]] + getMarginAxis(child, crossAxis) @@ -1382,8 +1403,8 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM for (ii = 0; ii < 2; ii++) { axis = (ii != 0) ? CSS_FLEX_DIRECTION_ROW : CSS_FLEX_DIRECTION_COLUMN; - if (!isUndefined(node->layout.dimensions[dim[axis]]) && - !isDimDefined(currentAbsoluteChild, axis) && + if (isLayoutDimDefined(node, axis) && + !isStyleDimDefined(currentAbsoluteChild, axis) && isPosDefined(currentAbsoluteChild, leading[axis]) && isPosDefined(currentAbsoluteChild, trailing[axis])) { currentAbsoluteChild->layout.dimensions[dim[axis]] = fmaxf( diff --git a/dist/css-layout.jar b/dist/css-layout.jar index 5d2d133407ef349f833ff3057f47f87acfa2805c..c9a83c89cf72db72d7f67d6136451e10597a7be5 100644 GIT binary patch delta 13656 zcmY+L18^VF*Y|(1ZQHhO+qN2;8#GR1Cyi~VX^h5f?8dg$zU}jW=6RlXKePAVnLV>} zclOM=ch8=0i*vCDvZ?|EBqj(J78c|its|R+%m?{jy@Db*0Yg$25&k-NcDe)z1d{xF z{;#b|ucmC{tR^_5EJ#Z>g%&~?*mPc#MFo!PGi8$9;-fE_bShIr@#(14zAPMl5nAzQ z?Cja(!qj@d;yFt&MMwNht%QL^m$> zIg~ATwt(h5&M0rdN6Ze_o@2dJ#zP!8+#jJdX#K72WI)iNlrgty1&a5M+RCeI7Pmj0 zz8R+$JHJ%kK$ZXT_Y`G2u!XDSxUFmL3kzjeG&Uf9Qn}2Ls&MudeNRsfnZ|ll21!I1 zmbu&|%>Z{aQ^637Vp&041Xeor5=$3~gPW?CLuqVk6^ZrLM6U5OE|vYb1Y|5^DF+!^ zaZv!Kj+eqguqvyCyhb24wc+qI+Vh+}SV{Jb9M~jQLhu1`0^LnMkcGEXlxU|R45=P; z<1cSFSfPBbS$DW7NLDJEFFyCHHx6!oi}`S+yTs{mf4?YAp%b!|Z!vw)|C;6aC_hw4 zdR^sP)T^e|F3otScbc5-ZBXQkyva;kNAqP%jsE3TkhQg<3c{RmHhlb?s+~<`H`A-( zlRmj<>V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.js index a29d2eda..edb20968 100644 --- a/dist/css-layout.js +++ b/dist/css-layout.js @@ -2,7 +2,7 @@ // See https://github.com/umdjs/umd for reference // // This file uses the following specific UMD implementation: -// https://github.com/umdjs/umd/blob/master/returnExports.js +// https://github.com/umdjs/umd/blob/master/templates/returnExports.js (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. @@ -380,10 +380,14 @@ var computeLayout = (function() { return node.layout[dim[axis]] + getMarginAxis(node, axis); } - function isDimDefined(node, axis) { + function isStyleDimDefined(node, axis) { return node.style[dim[axis]] !== undefined && node.style[dim[axis]] >= 0; } + function isLayoutDimDefined(node, axis) { + return node.layout[dim[axis]] !== undefined && node.layout[dim[axis]] >= 0; + } + function isPosDefined(node, pos) { return node.style[pos] !== undefined; } @@ -434,11 +438,11 @@ var computeLayout = (function() { // When the user specifically sets a value for width or height function setDimensionFromStyle(node, axis) { // The parent already computed us a width or height. We just skip it - if (node.layout[dim[axis]] !== undefined) { + if (isLayoutDimDefined(node, axis)) { return; } // We only run if there's a width or height defined - if (!isDimDefined(node, axis)) { + if (!isStyleDimDefined(node, axis)) { return; } @@ -494,10 +498,10 @@ var computeLayout = (function() { var/*float*/ paddingAndBorderAxisColumn = getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_COLUMN); if (isMeasureDefined(node)) { - var/*bool*/ isResolvedRowDimDefined = !isUndefined(node.layout[dim[resolvedRowAxis]]); + var/*bool*/ isResolvedRowDimDefined = isLayoutDimDefined(node, resolvedRowAxis); var/*float*/ width = CSS_UNDEFINED; - if (isDimDefined(node, resolvedRowAxis)) { + if (isStyleDimDefined(node, resolvedRowAxis)) { width = node.style.width; } else if (isResolvedRowDimDefined) { width = node.layout[dim[resolvedRowAxis]]; @@ -508,9 +512,9 @@ var computeLayout = (function() { width -= paddingAndBorderAxisResolvedRow; var/*float*/ height = CSS_UNDEFINED; - if (isDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { + if (isStyleDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { height = node.style.height; - } else if (!isUndefined(node.layout[dim[CSS_FLEX_DIRECTION_COLUMN]])) { + } else if (isLayoutDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { height = node.layout[dim[CSS_FLEX_DIRECTION_COLUMN]]; } else { height = parentMaxHeight - @@ -521,8 +525,8 @@ var computeLayout = (function() { // We only need to give a dimension for the text if we haven't got any // for it computed yet. It can either be from the style attribute or because // the element is flexible. - var/*bool*/ isRowUndefined = !isDimDefined(node, resolvedRowAxis) && !isResolvedRowDimDefined; - var/*bool*/ isColumnUndefined = !isDimDefined(node, CSS_FLEX_DIRECTION_COLUMN) && + var/*bool*/ isRowUndefined = !isStyleDimDefined(node, resolvedRowAxis) && !isResolvedRowDimDefined; + var/*bool*/ isColumnUndefined = !isStyleDimDefined(node, CSS_FLEX_DIRECTION_COLUMN) && isUndefined(node.layout[dim[CSS_FLEX_DIRECTION_COLUMN]]); // Let's not measure the text if we already know both dimensions @@ -556,8 +560,8 @@ var computeLayout = (function() { var/*float*/ paddingAndBorderAxisMain = getPaddingAndBorderAxis(node, mainAxis); var/*float*/ paddingAndBorderAxisCross = getPaddingAndBorderAxis(node, crossAxis); - var/*bool*/ isMainDimDefined = !isUndefined(node.layout[dim[mainAxis]]); - var/*bool*/ isCrossDimDefined = !isUndefined(node.layout[dim[crossAxis]]); + var/*bool*/ isMainDimDefined = isLayoutDimDefined(node, mainAxis); + var/*bool*/ isCrossDimDefined = isLayoutDimDefined(node, crossAxis); var/*bool*/ isMainRowDirection = isRowDirection(mainAxis); var/*int*/ i; @@ -619,8 +623,8 @@ var computeLayout = (function() { var/*float*/ mainDim = leadingPaddingAndBorderMain; var/*float*/ crossDim = 0; - var/*float*/ maxWidth; - var/*float*/ maxHeight; + var/*float*/ maxWidth = CSS_UNDEFINED; + var/*float*/ maxHeight = CSS_UNDEFINED; for (i = startLine; i < childCount; ++i) { child = node.children[i]; child.lineIndex = linesCount; @@ -635,7 +639,7 @@ var computeLayout = (function() { if (alignItem === CSS_ALIGN_STRETCH && getPositionType(child) === CSS_POSITION_RELATIVE && isCrossDimDefined && - !isDimDefined(child, crossAxis)) { + !isStyleDimDefined(child, crossAxis)) { child.layout[dim[crossAxis]] = fmaxf( boundAxis(child, crossAxis, node.layout[dim[crossAxis]] - paddingAndBorderAxisCross - getMarginAxis(child, crossAxis)), @@ -657,8 +661,8 @@ var computeLayout = (function() { // left and right or top and bottom). for (ii = 0; ii < 2; ii++) { axis = (ii !== 0) ? CSS_FLEX_DIRECTION_ROW : CSS_FLEX_DIRECTION_COLUMN; - if (!isUndefined(node.layout[dim[axis]]) && - !isDimDefined(child, axis) && + if (isLayoutDimDefined(node, axis) && + !isStyleDimDefined(child, axis) && isPosDefined(child, leading[axis]) && isPosDefined(child, trailing[axis])) { child.layout[dim[axis]] = fmaxf( @@ -704,7 +708,7 @@ var computeLayout = (function() { maxHeight = CSS_UNDEFINED; if (!isMainRowDirection) { - if (isDimDefined(node, resolvedRowAxis)) { + if (isLayoutDimDefined(node, resolvedRowAxis)) { maxWidth = node.layout[dim[resolvedRowAxis]] - paddingAndBorderAxisResolvedRow; } else { @@ -713,7 +717,7 @@ var computeLayout = (function() { paddingAndBorderAxisResolvedRow; } } else { - if (isDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { + if (isLayoutDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { maxHeight = node.layout[dim[CSS_FLEX_DIRECTION_COLUMN]] - paddingAndBorderAxisColumn; } else { @@ -764,7 +768,7 @@ var computeLayout = (function() { if (isSimpleStackCross && (getPositionType(child) !== CSS_POSITION_RELATIVE || (alignItem !== CSS_ALIGN_STRETCH && alignItem !== CSS_ALIGN_FLEX_START) || - isUndefined(child.layout[dim[crossAxis]]))) { + (alignItem == CSS_ALIGN_STRETCH && !isCrossDimDefined))) { isSimpleStackCross = false; firstComplexCross = i; } @@ -847,7 +851,7 @@ var computeLayout = (function() { ); maxWidth = CSS_UNDEFINED; - if (isDimDefined(node, resolvedRowAxis)) { + if (isLayoutDimDefined(node, resolvedRowAxis)) { maxWidth = node.layout[dim[resolvedRowAxis]] - paddingAndBorderAxisResolvedRow; } else if (!isMainRowDirection) { @@ -856,7 +860,7 @@ var computeLayout = (function() { paddingAndBorderAxisResolvedRow; } maxHeight = CSS_UNDEFINED; - if (isDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { + if (isLayoutDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { maxHeight = node.layout[dim[CSS_FLEX_DIRECTION_COLUMN]] - paddingAndBorderAxisColumn; } else if (isMainRowDirection) { @@ -974,15 +978,31 @@ var computeLayout = (function() { var/*css_align_t*/ alignItem = getAlignItem(node, child); /*eslint-enable */ if (alignItem === CSS_ALIGN_STRETCH) { - // You can only stretch if the dimension has not already been set + // You can only stretch if the dimension has not already been defined // previously. - if (isUndefined(child.layout[dim[crossAxis]])) { + if (!isStyleDimDefined(child, crossAxis)) { + var/*float*/ dimCrossAxis = child.layout[dim[crossAxis]]; child.layout[dim[crossAxis]] = fmaxf( boundAxis(child, crossAxis, containerCrossAxis - paddingAndBorderAxisCross - getMarginAxis(child, crossAxis)), // You never want to go smaller than padding getPaddingAndBorderAxis(child, crossAxis) ); + + // If the size has changed, and this child has children we need to re-layout this child + if (dimCrossAxis != child.layout[dim[crossAxis]] && child.children.length > 0) { + // Reset child margins before re-layout as they are added back in layoutNode and would be doubled + child.layout[leading[mainAxis]] -= getLeadingMargin(child, mainAxis) + + getRelativePosition(child, mainAxis); + child.layout[trailing[mainAxis]] -= getTrailingMargin(child, mainAxis) + + getRelativePosition(child, mainAxis); + child.layout[leading[crossAxis]] -= getLeadingMargin(child, crossAxis) + + getRelativePosition(child, crossAxis); + child.layout[trailing[crossAxis]] -= getTrailingMargin(child, crossAxis) + + getRelativePosition(child, crossAxis); + + layoutNode(/*(java)!layoutContext, */child, maxWidth, maxHeight, direction); + } } } else if (alignItem !== CSS_ALIGN_FLEX_START) { // The remaining space between the parent dimensions+padding and child @@ -1060,7 +1080,7 @@ var computeLayout = (function() { if (child.lineIndex !== i) { break; } - if (!isUndefined(child.layout[dim[crossAxis]])) { + if (isLayoutDimDefined(child, crossAxis)) { lineHeight = fmaxf( lineHeight, child.layout[dim[crossAxis]] + getMarginAxis(child, crossAxis) @@ -1153,8 +1173,8 @@ var computeLayout = (function() { for (ii = 0; ii < 2; ii++) { axis = (ii !== 0) ? CSS_FLEX_DIRECTION_ROW : CSS_FLEX_DIRECTION_COLUMN; - if (!isUndefined(node.layout[dim[axis]]) && - !isDimDefined(currentAbsoluteChild, axis) && + if (isLayoutDimDefined(node, axis) && + !isStyleDimDefined(currentAbsoluteChild, axis) && isPosDefined(currentAbsoluteChild, leading[axis]) && isPosDefined(currentAbsoluteChild, trailing[axis])) { currentAbsoluteChild.layout[dim[axis]] = fmaxf( diff --git a/dist/css-layout.min.js b/dist/css-layout.min.js index 8a227ceb..3d1afcd8 100644 --- a/dist/css-layout.min.js +++ b/dist/css-layout.min.js @@ -1,2 +1,2 @@ -!function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?module.exports=b():a.computeLayout=b()}(this,function(){var a=function(){function a(b){if((!b.layout||b.isDirty)&&(b.layout={width:void 0,height:void 0,top:0,left:0,right:0,bottom:0}),b.style||(b.style={}),b.children||(b.children=[]),b.style.measure&&b.children&&b.children.length)throw new Error("Using custom measure function is supported only for leaf nodes.");return b.children.forEach(a),b}function b(a){return void 0===a}function c(a){return a===P||a===Q}function d(a){return a===R||a===S}function e(a,b){if(void 0!==a.style.marginStart&&c(b))return a.style.marginStart;var d=null;switch(b){case"row":d=a.style.marginLeft;break;case"row-reverse":d=a.style.marginRight;break;case"column":d=a.style.marginTop;break;case"column-reverse":d=a.style.marginBottom}return void 0!==d?d:void 0!==a.style.margin?a.style.margin:0}function f(a,b){if(void 0!==a.style.marginEnd&&c(b))return a.style.marginEnd;var d=null;switch(b){case"row":d=a.style.marginRight;break;case"row-reverse":d=a.style.marginLeft;break;case"column":d=a.style.marginBottom;break;case"column-reverse":d=a.style.marginTop}return null!=d?d:void 0!==a.style.margin?a.style.margin:0}function g(a,b){if(void 0!==a.style.paddingStart&&a.style.paddingStart>=0&&c(b))return a.style.paddingStart;var d=null;switch(b){case"row":d=a.style.paddingLeft;break;case"row-reverse":d=a.style.paddingRight;break;case"column":d=a.style.paddingTop;break;case"column-reverse":d=a.style.paddingBottom}return null!=d&&d>=0?d:void 0!==a.style.padding&&a.style.padding>=0?a.style.padding:0}function h(a,b){if(void 0!==a.style.paddingEnd&&a.style.paddingEnd>=0&&c(b))return a.style.paddingEnd;var d=null;switch(b){case"row":d=a.style.paddingRight;break;case"row-reverse":d=a.style.paddingLeft;break;case"column":d=a.style.paddingBottom;break;case"column-reverse":d=a.style.paddingTop}return null!=d&&d>=0?d:void 0!==a.style.padding&&a.style.padding>=0?a.style.padding:0}function i(a,b){if(void 0!==a.style.borderStartWidth&&a.style.borderStartWidth>=0&&c(b))return a.style.borderStartWidth;var d=null;switch(b){case"row":d=a.style.borderLeftWidth;break;case"row-reverse":d=a.style.borderRightWidth;break;case"column":d=a.style.borderTopWidth;break;case"column-reverse":d=a.style.borderBottomWidth}return null!=d&&d>=0?d:void 0!==a.style.borderWidth&&a.style.borderWidth>=0?a.style.borderWidth:0}function j(a,b){if(void 0!==a.style.borderEndWidth&&a.style.borderEndWidth>=0&&c(b))return a.style.borderEndWidth;var d=null;switch(b){case"row":d=a.style.borderRightWidth;break;case"row-reverse":d=a.style.borderLeftWidth;break;case"column":d=a.style.borderBottomWidth;break;case"column-reverse":d=a.style.borderTopWidth}return null!=d&&d>=0?d:void 0!==a.style.borderWidth&&a.style.borderWidth>=0?a.style.borderWidth:0}function k(a,b){return g(a,b)+i(a,b)}function l(a,b){return h(a,b)+j(a,b)}function m(a,b){return i(a,b)+j(a,b)}function n(a,b){return e(a,b)+f(a,b)}function o(a,b){return k(a,b)+l(a,b)}function p(a){return a.style.justifyContent?a.style.justifyContent:"flex-start"}function q(a){return a.style.alignContent?a.style.alignContent:"flex-start"}function r(a,b){return b.style.alignSelf?b.style.alignSelf:a.style.alignItems?a.style.alignItems:"stretch"}function s(a,b){if(b===O){if(a===P)return Q;if(a===Q)return P}return a}function t(a,b){var c;return c=a.style.direction?a.style.direction:M,c===M&&(c=void 0===b?N:b),c}function u(a){return a.style.flexDirection?a.style.flexDirection:R}function v(a,b){return d(a)?s(P,b):R}function w(a){return a.style.position?a.style.position:"relative"}function x(a){return w(a)===aa&&a.style.flex>0}function y(a){return"wrap"===a.style.flexWrap}function z(a,b){return a.layout[fa[b]]+n(a,b)}function A(a,b){return void 0!==a.style[fa[b]]&&a.style[fa[b]]>=0}function B(a,b){return void 0!==a.style[b]}function C(a){return void 0!==a.style.measure}function D(a,b){return void 0!==a.style[b]?a.style[b]:0}function E(a,b,c){var d={row:a.style.minWidth,"row-reverse":a.style.minWidth,column:a.style.minHeight,"column-reverse":a.style.minHeight}[b],e={row:a.style.maxWidth,"row-reverse":a.style.maxWidth,column:a.style.maxHeight,"column-reverse":a.style.maxHeight}[b],f=c;return void 0!==e&&e>=0&&f>e&&(f=e),void 0!==d&&d>=0&&d>f&&(f=d),f}function F(a,b){return a>b?a:b}function G(a,b){void 0===a.layout[fa[b]]&&A(a,b)&&(a.layout[fa[b]]=F(E(a,b,a.style[fa[b]]),o(a,b)))}function H(a,b,c){b.layout[da[c]]=a.layout[fa[c]]-b.layout[fa[c]]-b.layout[ea[c]]}function I(a,b){return void 0!==a.style[ca[b]]?D(a,ca[b]):-D(a,da[b])}function J(a,d,g,h){var j=t(a,h),J=s(u(a),j),M=v(J,j),N=s(P,j);G(a,J),G(a,M),a.layout.direction=j,a.layout[ca[J]]+=e(a,J)+I(a,J),a.layout[da[J]]+=f(a,J)+I(a,J),a.layout[ca[M]]+=e(a,M)+I(a,M),a.layout[da[M]]+=f(a,M)+I(a,M);var O=a.children.length,ga=o(a,N),ha=o(a,R);if(C(a)){var ia=!b(a.layout[fa[N]]),ja=L;ja=A(a,N)?a.style.width:ia?a.layout[fa[N]]:d-n(a,N),ja-=ga;var ka=L;ka=A(a,R)?a.style.height:b(a.layout[fa[R]])?g-n(a,N):a.layout[fa[R]],ka-=o(a,R);var la=!A(a,N)&&!ia,ma=!A(a,R)&&b(a.layout[fa[R]]);if(la||ma){var na=a.style.measure(ja,ka);la&&(a.layout.width=na.width+ga),ma&&(a.layout.height=na.height+ha)}if(0===O)return}var oa,pa,qa,ra,sa=y(a),ta=p(a),ua=k(a,J),va=k(a,M),wa=o(a,J),xa=o(a,M),ya=!b(a.layout[fa[J]]),za=!b(a.layout[fa[M]]),Aa=c(J),Ba=null,Ca=null,Da=L;ya&&(Da=a.layout[fa[J]]-wa);for(var Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0;O>Fa;){var Ka,La,Ma=0,Na=0,Oa=0,Pa=0,Qa=ya&&ta===T||!ya&&ta!==U,Ra=Qa?O:Ea,Sa=!0,Ta=O,Ua=null,Va=null,Wa=ua,Xa=0;for(oa=Ea;O>oa;++oa){qa=a.children[oa],qa.lineIndex=Ja,qa.nextAbsoluteChild=null,qa.nextFlexChild=null;var Ya=r(a,qa);if(Ya===_&&w(qa)===aa&&za&&!A(qa,M))qa.layout[fa[M]]=F(E(qa,M,a.layout[fa[M]]-xa-n(qa,M)),o(qa,M));else if(w(qa)===ba)for(null===Ba&&(Ba=qa),null!==Ca&&(Ca.nextAbsoluteChild=qa),Ca=qa,pa=0;2>pa;pa++)ra=0!==pa?P:R,!b(a.layout[fa[ra]])&&!A(qa,ra)&&B(qa,ca[ra])&&B(qa,da[ra])&&(qa.layout[fa[ra]]=F(E(qa,ra,a.layout[fa[ra]]-o(a,ra)-n(qa,ra)-D(qa,ca[ra])-D(qa,da[ra])),o(qa,ra)));var Za=0;if(ya&&x(qa)?(Na++,Oa+=qa.style.flex,null===Ua&&(Ua=qa),null!==Va&&(Va.nextFlexChild=qa),Va=qa,Za=o(qa,J)+n(qa,J)):(Ka=L,La=L,Aa?La=A(a,R)?a.layout[fa[R]]-ha:g-n(a,R)-ha:Ka=A(a,N)?a.layout[fa[N]]-ga:d-n(a,N)-ga,0===Ga&&K(qa,Ka,La,j),w(qa)===aa&&(Pa++,Za=z(qa,J))),sa&&ya&&Ma+Za>Da&&oa!==Ea){Pa--,Ga=1;break}Qa&&(w(qa)!==aa||x(qa))&&(Qa=!1,Ra=oa),Sa&&(w(qa)!==aa||Ya!==_&&Ya!==Y||b(qa.layout[fa[M]]))&&(Sa=!1,Ta=oa),Qa&&(qa.layout[ea[J]]+=Wa,ya&&H(a,qa,J),Wa+=z(qa,J),Xa=F(Xa,E(qa,M,z(qa,M)))),Sa&&(qa.layout[ea[M]]+=Ha+va,za&&H(a,qa,M)),Ga=0,Ma+=Za,Fa=oa+1}var $a=0,_a=0,ab=0;if(ab=ya?Da-Ma:F(Ma,0)-Ma,0!==Na){var bb,cb,db=ab/Oa;for(Va=Ua;null!==Va;)bb=db*Va.style.flex+o(Va,J),cb=E(Va,J,bb),bb!==cb&&(ab-=cb,Oa-=Va.style.flex),Va=Va.nextFlexChild;for(db=ab/Oa,0>db&&(db=0),Va=Ua;null!==Va;)Va.layout[fa[J]]=E(Va,J,db*Va.style.flex+o(Va,J)),Ka=L,A(a,N)?Ka=a.layout[fa[N]]-ga:Aa||(Ka=d-n(a,N)-ga),La=L,A(a,R)?La=a.layout[fa[R]]-ha:Aa&&(La=g-n(a,R)-ha),K(Va,Ka,La,j),qa=Va,Va=Va.nextFlexChild,qa.nextFlexChild=null}else ta!==T&&(ta===U?$a=ab/2:ta===V?$a=ab:ta===W?(ab=F(ab,0),_a=Na+Pa-1!==0?ab/(Na+Pa-1):0):ta===X&&(_a=ab/(Na+Pa),$a=_a/2));for(Wa+=$a,oa=Ra;Fa>oa;++oa)qa=a.children[oa],w(qa)===ba&&B(qa,ca[J])?qa.layout[ea[J]]=D(qa,ca[J])+i(a,J)+e(qa,J):(qa.layout[ea[J]]+=Wa,ya&&H(a,qa,J),w(qa)===aa&&(Wa+=_a+z(qa,J),Xa=F(Xa,E(qa,M,z(qa,M)))));var eb=a.layout[fa[M]];for(za||(eb=F(E(a,M,Xa+xa),xa)),oa=Ta;Fa>oa;++oa)if(qa=a.children[oa],w(qa)===ba&&B(qa,ca[M]))qa.layout[ea[M]]=D(qa,ca[M])+i(a,M)+e(qa,M);else{var fb=va;if(w(qa)===aa){var Ya=r(a,qa);if(Ya===_)b(qa.layout[fa[M]])&&(qa.layout[fa[M]]=F(E(qa,M,eb-xa-n(qa,M)),o(qa,M)));else if(Ya!==Y){var gb=eb-xa-z(qa,M);fb+=Ya===Z?gb/2:gb}}qa.layout[ea[M]]+=Ha+fb,za&&H(a,qa,M)}Ha+=Xa,Ia=F(Ia,Wa),Ja+=1,Ea=Fa}if(Ja>1&&za){var hb=a.layout[fa[M]]-xa,ib=hb-Ha,jb=0,kb=va,lb=q(a);lb===$?kb+=ib:lb===Z?kb+=ib/2:lb===_&&hb>Ha&&(jb=ib/Ja);var mb=0;for(oa=0;Ja>oa;++oa){var nb=mb,ob=0;for(pa=nb;O>pa;++pa)if(qa=a.children[pa],w(qa)===aa){if(qa.lineIndex!==oa)break;b(qa.layout[fa[M]])||(ob=F(ob,qa.layout[fa[M]]+n(qa,M)))}for(mb=pa,ob+=jb,pa=nb;mb>pa;++pa)if(qa=a.children[pa],w(qa)===aa){var pb=r(a,qa);if(pb===Y)qa.layout[ea[M]]=kb+e(qa,M);else if(pb===$)qa.layout[ea[M]]=kb+ob-f(qa,M)-qa.layout[fa[M]];else if(pb===Z){var qb=qa.layout[fa[M]];qa.layout[ea[M]]=kb+(ob-qb)/2}else pb===_&&(qa.layout[ea[M]]=kb+e(qa,M))}kb+=ob}}var rb=!1,sb=!1;if(ya||(a.layout[fa[J]]=F(E(a,J,Ia+l(a,J)),wa),(J===Q||J===S)&&(rb=!0)),za||(a.layout[fa[M]]=F(E(a,M,Ha+xa),xa),(M===Q||M===S)&&(sb=!0)),rb||sb)for(oa=0;O>oa;++oa)qa=a.children[oa],rb&&H(a,qa,J),sb&&H(a,qa,M);for(Ca=Ba;null!==Ca;){for(pa=0;2>pa;pa++)ra=0!==pa?P:R,!b(a.layout[fa[ra]])&&!A(Ca,ra)&&B(Ca,ca[ra])&&B(Ca,da[ra])&&(Ca.layout[fa[ra]]=F(E(Ca,ra,a.layout[fa[ra]]-m(a,ra)-n(Ca,ra)-D(Ca,ca[ra])-D(Ca,da[ra])),o(Ca,ra))),B(Ca,da[ra])&&!B(Ca,ca[ra])&&(Ca.layout[ca[ra]]=a.layout[fa[ra]]-Ca.layout[fa[ra]]-D(Ca,da[ra]));qa=Ca,Ca=Ca.nextAbsoluteChild,qa.nextAbsoluteChild=null}}function K(a,b,c,d){a.shouldUpdate=!0;var e=a.style.direction||N,f=!a.isDirty&&a.lastLayout&&a.lastLayout.requestedHeight===a.layout.height&&a.lastLayout.requestedWidth===a.layout.width&&a.lastLayout.parentMaxWidth===b&&a.lastLayout.parentMaxHeight===c&&a.lastLayout.direction===e;f?(a.layout.width=a.lastLayout.width,a.layout.height=a.lastLayout.height,a.layout.top=a.lastLayout.top,a.layout.left=a.lastLayout.left):(a.lastLayout||(a.lastLayout={}),a.lastLayout.requestedWidth=a.layout.width,a.lastLayout.requestedHeight=a.layout.height,a.lastLayout.parentMaxWidth=b,a.lastLayout.parentMaxHeight=c,a.lastLayout.direction=e,a.children.forEach(function(a){a.layout.width=void 0,a.layout.height=void 0,a.layout.top=0,a.layout.left=0}),J(a,b,c,d),a.lastLayout.width=a.layout.width,a.lastLayout.height=a.layout.height,a.lastLayout.top=a.layout.top,a.lastLayout.left=a.layout.left)}var L,M="inherit",N="ltr",O="rtl",P="row",Q="row-reverse",R="column",S="column-reverse",T="flex-start",U="center",V="flex-end",W="space-between",X="space-around",Y="flex-start",Z="center",$="flex-end",_="stretch",aa="relative",ba="absolute",ca={row:"left","row-reverse":"right",column:"top","column-reverse":"bottom"},da={row:"right","row-reverse":"left",column:"bottom","column-reverse":"top"},ea={row:"left","row-reverse":"right",column:"top","column-reverse":"bottom"},fa={row:"width","row-reverse":"width",column:"height","column-reverse":"height"};return{layoutNodeImpl:J,computeLayout:K,fillNodes:a}}();return"object"==typeof exports&&(module.exports=a),function(b){a.fillNodes(b),a.computeLayout(b)}}); +!function(a,b){"function"==typeof define&&define.amd?define([],b):"object"==typeof exports?module.exports=b():a.computeLayout=b()}(this,function(){var a=function(){function a(b){if(b.layout&&!b.isDirty||(b.layout={width:void 0,height:void 0,top:0,left:0,right:0,bottom:0}),b.style||(b.style={}),b.children||(b.children=[]),b.style.measure&&b.children&&b.children.length)throw new Error("Using custom measure function is supported only for leaf nodes.");return b.children.forEach(a),b}function b(a){return void 0===a}function c(a){return a===Q||a===R}function d(a){return a===S||a===T}function e(a,b){if(void 0!==a.style.marginStart&&c(b))return a.style.marginStart;var d=null;switch(b){case"row":d=a.style.marginLeft;break;case"row-reverse":d=a.style.marginRight;break;case"column":d=a.style.marginTop;break;case"column-reverse":d=a.style.marginBottom}return void 0!==d?d:void 0!==a.style.margin?a.style.margin:0}function f(a,b){if(void 0!==a.style.marginEnd&&c(b))return a.style.marginEnd;var d=null;switch(b){case"row":d=a.style.marginRight;break;case"row-reverse":d=a.style.marginLeft;break;case"column":d=a.style.marginBottom;break;case"column-reverse":d=a.style.marginTop}return null!=d?d:void 0!==a.style.margin?a.style.margin:0}function g(a,b){if(void 0!==a.style.paddingStart&&a.style.paddingStart>=0&&c(b))return a.style.paddingStart;var d=null;switch(b){case"row":d=a.style.paddingLeft;break;case"row-reverse":d=a.style.paddingRight;break;case"column":d=a.style.paddingTop;break;case"column-reverse":d=a.style.paddingBottom}return null!=d&&d>=0?d:void 0!==a.style.padding&&a.style.padding>=0?a.style.padding:0}function h(a,b){if(void 0!==a.style.paddingEnd&&a.style.paddingEnd>=0&&c(b))return a.style.paddingEnd;var d=null;switch(b){case"row":d=a.style.paddingRight;break;case"row-reverse":d=a.style.paddingLeft;break;case"column":d=a.style.paddingBottom;break;case"column-reverse":d=a.style.paddingTop}return null!=d&&d>=0?d:void 0!==a.style.padding&&a.style.padding>=0?a.style.padding:0}function i(a,b){if(void 0!==a.style.borderStartWidth&&a.style.borderStartWidth>=0&&c(b))return a.style.borderStartWidth;var d=null;switch(b){case"row":d=a.style.borderLeftWidth;break;case"row-reverse":d=a.style.borderRightWidth;break;case"column":d=a.style.borderTopWidth;break;case"column-reverse":d=a.style.borderBottomWidth}return null!=d&&d>=0?d:void 0!==a.style.borderWidth&&a.style.borderWidth>=0?a.style.borderWidth:0}function j(a,b){if(void 0!==a.style.borderEndWidth&&a.style.borderEndWidth>=0&&c(b))return a.style.borderEndWidth;var d=null;switch(b){case"row":d=a.style.borderRightWidth;break;case"row-reverse":d=a.style.borderLeftWidth;break;case"column":d=a.style.borderBottomWidth;break;case"column-reverse":d=a.style.borderTopWidth}return null!=d&&d>=0?d:void 0!==a.style.borderWidth&&a.style.borderWidth>=0?a.style.borderWidth:0}function k(a,b){return g(a,b)+i(a,b)}function l(a,b){return h(a,b)+j(a,b)}function m(a,b){return i(a,b)+j(a,b)}function n(a,b){return e(a,b)+f(a,b)}function o(a,b){return k(a,b)+l(a,b)}function p(a){return a.style.justifyContent?a.style.justifyContent:"flex-start"}function q(a){return a.style.alignContent?a.style.alignContent:"flex-start"}function r(a,b){return b.style.alignSelf?b.style.alignSelf:a.style.alignItems?a.style.alignItems:"stretch"}function s(a,b){if(b===P){if(a===Q)return R;if(a===R)return Q}return a}function t(a,b){var c;return c=a.style.direction?a.style.direction:N,c===N&&(c=void 0===b?O:b),c}function u(a){return a.style.flexDirection?a.style.flexDirection:S}function v(a,b){return d(a)?s(Q,b):S}function w(a){return a.style.position?a.style.position:"relative"}function x(a){return w(a)===ba&&a.style.flex>0}function y(a){return"wrap"===a.style.flexWrap}function z(a,b){return a.layout[ga[b]]+n(a,b)}function A(a,b){return void 0!==a.style[ga[b]]&&a.style[ga[b]]>=0}function B(a,b){return void 0!==a.layout[ga[b]]&&a.layout[ga[b]]>=0}function C(a,b){return void 0!==a.style[b]}function D(a){return void 0!==a.style.measure}function E(a,b){return void 0!==a.style[b]?a.style[b]:0}function F(a,b,c){var d={row:a.style.minWidth,"row-reverse":a.style.minWidth,column:a.style.minHeight,"column-reverse":a.style.minHeight}[b],e={row:a.style.maxWidth,"row-reverse":a.style.maxWidth,column:a.style.maxHeight,"column-reverse":a.style.maxHeight}[b],f=c;return void 0!==e&&e>=0&&f>e&&(f=e),void 0!==d&&d>=0&&d>f&&(f=d),f}function G(a,b){return a>b?a:b}function H(a,b){B(a,b)||A(a,b)&&(a.layout[ga[b]]=G(F(a,b,a.style[ga[b]]),o(a,b)))}function I(a,b,c){b.layout[ea[c]]=a.layout[ga[c]]-b.layout[ga[c]]-b.layout[fa[c]]}function J(a,b){return void 0!==a.style[da[b]]?E(a,da[b]):-E(a,ea[b])}function K(a,d,g,h){var j=t(a,h),K=s(u(a),j),N=v(K,j),O=s(Q,j);H(a,K),H(a,N),a.layout.direction=j,a.layout[da[K]]+=e(a,K)+J(a,K),a.layout[ea[K]]+=f(a,K)+J(a,K),a.layout[da[N]]+=e(a,N)+J(a,N),a.layout[ea[N]]+=f(a,N)+J(a,N);var P=a.children.length,ha=o(a,O),ia=o(a,S);if(D(a)){var ja=B(a,O),ka=M;ka=A(a,O)?a.style.width:ja?a.layout[ga[O]]:d-n(a,O),ka-=ha;var la=M;la=A(a,S)?a.style.height:B(a,S)?a.layout[ga[S]]:g-n(a,O),la-=o(a,S);var ma=!A(a,O)&&!ja,na=!A(a,S)&&b(a.layout[ga[S]]);if(ma||na){var oa=a.style.measure(ka,la);ma&&(a.layout.width=oa.width+ha),na&&(a.layout.height=oa.height+ia)}if(0===P)return}var pa,qa,ra,sa,ta=y(a),ua=p(a),va=k(a,K),wa=k(a,N),xa=o(a,K),ya=o(a,N),za=B(a,K),Aa=B(a,N),Ba=c(K),Ca=null,Da=null,Ea=M;za&&(Ea=a.layout[ga[K]]-xa);for(var Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0;P>Ga;){var La=0,Ma=0,Na=0,Oa=0,Pa=za&&ua===U||!za&&ua!==V,Qa=Pa?P:Fa,Ra=!0,Sa=P,Ta=null,Ua=null,Va=va,Wa=0,Xa=M,Ya=M;for(pa=Fa;P>pa;++pa){ra=a.children[pa],ra.lineIndex=Ka,ra.nextAbsoluteChild=null,ra.nextFlexChild=null;var Za=r(a,ra);if(Za===aa&&w(ra)===ba&&Aa&&!A(ra,N))ra.layout[ga[N]]=G(F(ra,N,a.layout[ga[N]]-ya-n(ra,N)),o(ra,N));else if(w(ra)===ca)for(null===Ca&&(Ca=ra),null!==Da&&(Da.nextAbsoluteChild=ra),Da=ra,qa=0;2>qa;qa++)sa=0!==qa?Q:S,B(a,sa)&&!A(ra,sa)&&C(ra,da[sa])&&C(ra,ea[sa])&&(ra.layout[ga[sa]]=G(F(ra,sa,a.layout[ga[sa]]-o(a,sa)-n(ra,sa)-E(ra,da[sa])-E(ra,ea[sa])),o(ra,sa)));var $a=0;if(za&&x(ra)?(Ma++,Na+=ra.style.flex,null===Ta&&(Ta=ra),null!==Ua&&(Ua.nextFlexChild=ra),Ua=ra,$a=o(ra,K)+n(ra,K)):(Xa=M,Ya=M,Ba?Ya=B(a,S)?a.layout[ga[S]]-ia:g-n(a,S)-ia:Xa=B(a,O)?a.layout[ga[O]]-ha:d-n(a,O)-ha,0===Ha&&L(ra,Xa,Ya,j),w(ra)===ba&&(Oa++,$a=z(ra,K))),ta&&za&&La+$a>Ea&&pa!==Fa){Oa--,Ha=1;break}Pa&&(w(ra)!==ba||x(ra))&&(Pa=!1,Qa=pa),Ra&&(w(ra)!==ba||Za!==aa&&Za!==Z||Za==aa&&!Aa)&&(Ra=!1,Sa=pa),Pa&&(ra.layout[fa[K]]+=Va,za&&I(a,ra,K),Va+=z(ra,K),Wa=G(Wa,F(ra,N,z(ra,N)))),Ra&&(ra.layout[fa[N]]+=Ia+wa,Aa&&I(a,ra,N)),Ha=0,La+=$a,Ga=pa+1}var _a=0,ab=0,bb=0;if(bb=za?Ea-La:G(La,0)-La,0!==Ma){var cb,db,eb=bb/Na;for(Ua=Ta;null!==Ua;)cb=eb*Ua.style.flex+o(Ua,K),db=F(Ua,K,cb),cb!==db&&(bb-=db,Na-=Ua.style.flex),Ua=Ua.nextFlexChild;for(eb=bb/Na,0>eb&&(eb=0),Ua=Ta;null!==Ua;)Ua.layout[ga[K]]=F(Ua,K,eb*Ua.style.flex+o(Ua,K)),Xa=M,B(a,O)?Xa=a.layout[ga[O]]-ha:Ba||(Xa=d-n(a,O)-ha),Ya=M,B(a,S)?Ya=a.layout[ga[S]]-ia:Ba&&(Ya=g-n(a,S)-ia),L(Ua,Xa,Ya,j),ra=Ua,Ua=Ua.nextFlexChild,ra.nextFlexChild=null}else ua!==U&&(ua===V?_a=bb/2:ua===W?_a=bb:ua===X?(bb=G(bb,0),ab=Ma+Oa-1!==0?bb/(Ma+Oa-1):0):ua===Y&&(ab=bb/(Ma+Oa),_a=ab/2));for(Va+=_a,pa=Qa;Ga>pa;++pa)ra=a.children[pa],w(ra)===ca&&C(ra,da[K])?ra.layout[fa[K]]=E(ra,da[K])+i(a,K)+e(ra,K):(ra.layout[fa[K]]+=Va,za&&I(a,ra,K),w(ra)===ba&&(Va+=ab+z(ra,K),Wa=G(Wa,F(ra,N,z(ra,N)))));var fb=a.layout[ga[N]];for(Aa||(fb=G(F(a,N,Wa+ya),ya)),pa=Sa;Ga>pa;++pa)if(ra=a.children[pa],w(ra)===ca&&C(ra,da[N]))ra.layout[fa[N]]=E(ra,da[N])+i(a,N)+e(ra,N);else{var gb=wa;if(w(ra)===ba){var Za=r(a,ra);if(Za===aa){if(!A(ra,N)){var hb=ra.layout[ga[N]];ra.layout[ga[N]]=G(F(ra,N,fb-ya-n(ra,N)),o(ra,N)),hb!=ra.layout[ga[N]]&&ra.children.length>0&&(ra.layout[da[K]]-=e(ra,K)+J(ra,K),ra.layout[ea[K]]-=f(ra,K)+J(ra,K),ra.layout[da[N]]-=e(ra,N)+J(ra,N),ra.layout[ea[N]]-=f(ra,N)+J(ra,N),L(ra,Xa,Ya,j))}}else if(Za!==Z){var ib=fb-ya-z(ra,N);gb+=Za===$?ib/2:ib}}ra.layout[fa[N]]+=Ia+gb,Aa&&I(a,ra,N)}Ia+=Wa,Ja=G(Ja,Va),Ka+=1,Fa=Ga}if(Ka>1&&Aa){var jb=a.layout[ga[N]]-ya,kb=jb-Ia,lb=0,mb=wa,nb=q(a);nb===_?mb+=kb:nb===$?mb+=kb/2:nb===aa&&jb>Ia&&(lb=kb/Ka);var ob=0;for(pa=0;Ka>pa;++pa){var pb=ob,qb=0;for(qa=pb;P>qa;++qa)if(ra=a.children[qa],w(ra)===ba){if(ra.lineIndex!==pa)break;B(ra,N)&&(qb=G(qb,ra.layout[ga[N]]+n(ra,N)))}for(ob=qa,qb+=lb,qa=pb;ob>qa;++qa)if(ra=a.children[qa],w(ra)===ba){var rb=r(a,ra);if(rb===Z)ra.layout[fa[N]]=mb+e(ra,N);else if(rb===_)ra.layout[fa[N]]=mb+qb-f(ra,N)-ra.layout[ga[N]];else if(rb===$){var sb=ra.layout[ga[N]];ra.layout[fa[N]]=mb+(qb-sb)/2}else rb===aa&&(ra.layout[fa[N]]=mb+e(ra,N))}mb+=qb}}var tb=!1,ub=!1;if(za||(a.layout[ga[K]]=G(F(a,K,Ja+l(a,K)),xa),K!==R&&K!==T||(tb=!0)),Aa||(a.layout[ga[N]]=G(F(a,N,Ia+ya),ya),N!==R&&N!==T||(ub=!0)),tb||ub)for(pa=0;P>pa;++pa)ra=a.children[pa],tb&&I(a,ra,K),ub&&I(a,ra,N);for(Da=Ca;null!==Da;){for(qa=0;2>qa;qa++)sa=0!==qa?Q:S,B(a,sa)&&!A(Da,sa)&&C(Da,da[sa])&&C(Da,ea[sa])&&(Da.layout[ga[sa]]=G(F(Da,sa,a.layout[ga[sa]]-m(a,sa)-n(Da,sa)-E(Da,da[sa])-E(Da,ea[sa])),o(Da,sa))),C(Da,ea[sa])&&!C(Da,da[sa])&&(Da.layout[da[sa]]=a.layout[ga[sa]]-Da.layout[ga[sa]]-E(Da,ea[sa]));ra=Da,Da=Da.nextAbsoluteChild,ra.nextAbsoluteChild=null}}function L(a,b,c,d){a.shouldUpdate=!0;var e=a.style.direction||O,f=!a.isDirty&&a.lastLayout&&a.lastLayout.requestedHeight===a.layout.height&&a.lastLayout.requestedWidth===a.layout.width&&a.lastLayout.parentMaxWidth===b&&a.lastLayout.parentMaxHeight===c&&a.lastLayout.direction===e;f?(a.layout.width=a.lastLayout.width,a.layout.height=a.lastLayout.height,a.layout.top=a.lastLayout.top,a.layout.left=a.lastLayout.left):(a.lastLayout||(a.lastLayout={}),a.lastLayout.requestedWidth=a.layout.width,a.lastLayout.requestedHeight=a.layout.height,a.lastLayout.parentMaxWidth=b,a.lastLayout.parentMaxHeight=c,a.lastLayout.direction=e,a.children.forEach(function(a){a.layout.width=void 0,a.layout.height=void 0,a.layout.top=0,a.layout.left=0}),K(a,b,c,d),a.lastLayout.width=a.layout.width,a.lastLayout.height=a.layout.height,a.lastLayout.top=a.layout.top,a.lastLayout.left=a.layout.left)}var M,N="inherit",O="ltr",P="rtl",Q="row",R="row-reverse",S="column",T="column-reverse",U="flex-start",V="center",W="flex-end",X="space-between",Y="space-around",Z="flex-start",$="center",_="flex-end",aa="stretch",ba="relative",ca="absolute",da={row:"left","row-reverse":"right",column:"top","column-reverse":"bottom"},ea={row:"right","row-reverse":"left",column:"bottom","column-reverse":"top"},fa={row:"left","row-reverse":"right",column:"top","column-reverse":"bottom"},ga={row:"width","row-reverse":"width",column:"height","column-reverse":"height"};return{layoutNodeImpl:K,computeLayout:L,fillNodes:a}}();return"object"==typeof exports&&(module.exports=a),function(b){a.fillNodes(b),a.computeLayout(b)}}); //# sourceMappingURL=css-layout.min.js.map \ No newline at end of file diff --git a/dist/css-layout.min.js.map b/dist/css-layout.min.js.map index e231ca75..b037ac65 100644 --- a/dist/css-layout.min.js.map +++ b/dist/css-layout.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["css-layout.js"],"names":["root","factory","define","amd","exports","module","computeLayout","this","fillNodes","node","layout","isDirty","width","undefined","height","top","left","right","bottom","style","children","measure","length","Error","forEach","isUndefined","value","isRowDirection","flexDirection","CSS_FLEX_DIRECTION_ROW","CSS_FLEX_DIRECTION_ROW_REVERSE","isColumnDirection","CSS_FLEX_DIRECTION_COLUMN","CSS_FLEX_DIRECTION_COLUMN_REVERSE","getLeadingMargin","axis","marginStart","marginLeft","marginRight","marginTop","marginBottom","margin","getTrailingMargin","marginEnd","getLeadingPadding","paddingStart","paddingLeft","paddingRight","paddingTop","paddingBottom","padding","getTrailingPadding","paddingEnd","getLeadingBorder","borderStartWidth","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth","borderWidth","getTrailingBorder","borderEndWidth","getLeadingPaddingAndBorder","getTrailingPaddingAndBorder","getBorderAxis","getMarginAxis","getPaddingAndBorderAxis","getJustifyContent","justifyContent","getAlignContent","alignContent","getAlignItem","child","alignSelf","alignItems","resolveAxis","direction","CSS_DIRECTION_RTL","resolveDirection","parentDirection","CSS_DIRECTION_INHERIT","CSS_DIRECTION_LTR","getFlexDirection","getCrossFlexDirection","getPositionType","position","isFlex","CSS_POSITION_RELATIVE","flex","isFlexWrap","flexWrap","getDimWithMargin","dim","isDimDefined","isPosDefined","pos","isMeasureDefined","getPosition","boundAxis","min","row","minWidth","row-reverse","column","minHeight","column-reverse","max","maxWidth","maxHeight","boundValue","fmaxf","a","b","setDimensionFromStyle","setTrailingPosition","trailing","getRelativePosition","leading","layoutNodeImpl","parentMaxWidth","parentMaxHeight","mainAxis","crossAxis","resolvedRowAxis","childCount","paddingAndBorderAxisResolvedRow","paddingAndBorderAxisColumn","isResolvedRowDimDefined","CSS_UNDEFINED","isRowUndefined","isColumnUndefined","measureDim","i","ii","isNodeFlexWrap","leadingPaddingAndBorderMain","leadingPaddingAndBorderCross","paddingAndBorderAxisMain","paddingAndBorderAxisCross","isMainDimDefined","isCrossDimDefined","isMainRowDirection","firstAbsoluteChild","currentAbsoluteChild","definedMainDim","startLine","endLine","alreadyComputedNextLayout","linesCrossDim","linesMainDim","linesCount","mainContentDim","flexibleChildrenCount","totalFlexible","nonFlexibleChildrenCount","isSimpleStackMain","CSS_JUSTIFY_FLEX_START","CSS_JUSTIFY_CENTER","firstComplexMain","isSimpleStackCross","firstComplexCross","firstFlexChild","currentFlexChild","mainDim","crossDim","lineIndex","nextAbsoluteChild","nextFlexChild","alignItem","CSS_ALIGN_STRETCH","CSS_POSITION_ABSOLUTE","nextContentDim","layoutNode","CSS_ALIGN_FLEX_START","leadingMainDim","betweenMainDim","remainingMainDim","baseMainDim","boundMainDim","flexibleMainDim","CSS_JUSTIFY_FLEX_END","CSS_JUSTIFY_SPACE_BETWEEN","CSS_JUSTIFY_SPACE_AROUND","containerCrossAxis","leadingCrossDim","remainingCrossDim","CSS_ALIGN_CENTER","nodeCrossAxisInnerSize","remainingAlignContentDim","crossDimLead","currentLead","CSS_ALIGN_FLEX_END","endIndex","startIndex","lineHeight","alignContentAlignItem","childHeight","needsMainTrailingPos","needsCrossTrailingPos","shouldUpdate","skipLayout","lastLayout","requestedHeight","requestedWidth"],"mappings":"CAKC,SAASA,EAAMC,GACQ,kBAAXC,SAAyBA,OAAOC,IAEzCD,UAAWD,GACiB,gBAAZG,SAIhBC,OAAOD,QAAUH,IAGjBD,EAAKM,cAAgBL,KAEvBM,KAAM,WAUR,GAAID,GAAgB,WAuDlB,QAASE,GAAUC,GAoBjB,KAnBKA,EAAKC,QAAUD,EAAKE,WACvBF,EAAKC,QACHE,MAAOC,OACPC,OAAQD,OACRE,IAAK,EACLC,KAAM,EACNC,MAAO,EACPC,OAAQ,IAIPT,EAAKU,QACRV,EAAKU,UAGFV,EAAKW,WACRX,EAAKW,aAGHX,EAAKU,MAAME,SAAWZ,EAAKW,UAAYX,EAAKW,SAASE,OACvD,KAAM,IAAIC,OAAM,kEAIlB,OADAd,GAAKW,SAASI,QAAQhB,GACfC,EAGT,QAASgB,GAAYC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ACrB2D,EAAM9D,OAAOI,OAASD,OACtB2D,EAAM9D,OAAOK,IAAM,EACnByD,EAAM9D,OAAOM,KAAO,IAGtBsG,EAAe7G,EAAM8G,EAAgBC,EAAiBzC,GAEtDtE,EAAKgM,WAAW7L,MAAQH,EAAKC,OAAOE,MACpCH,EAAKgM,WAAW3L,OAASL,EAAKC,OAAOI,OACrCL,EAAKgM,WAAW1L,IAAMN,EAAKC,OAAOK,IAClCN,EAAKgM,WAAWzL,KAAOP,EAAKC,OAAOM,MA9qCvC,GAAIgH,GAEAhD,EAAwB,UACxBC,EAAoB,MACpBJ,EAAoB,MAEpBhD,EAAyB,MACzBC,EAAiC,cACjCE,EAA4B,SAC5BC,EAAoC,iBAEpC2H,EAAyB,aACzBC,EAAqB,SACrBuB,EAAuB,WACvBC,EAA4B,gBAC5BC,EAA2B,eAE3BT,EAAuB,aACvBa,EAAmB,SACnBK,EAAqB,WACrBtB,EAAoB,UAEpBlF,GAAwB,WACxBmF,GAAwB,WAExBrD,IACFjB,IAAO,OACPE,cAAe,QACfC,OAAU,MACVE,iBAAkB,UAEhBU,IACFf,IAAO,QACPE,cAAe,OACfC,OAAU,SACVE,iBAAkB,OAEhBV,IACFK,IAAO,OACPE,cAAe,QACfC,OAAU,MACVE,iBAAkB,UAEhBb,IACFQ,IAAO,QACPE,cAAe,QACfC,OAAU,SACVE,iBAAkB,SAmoCpB,QACEa,eAAgBA,EAChBhH,cAAesK,EACfpK,UAAWA,KAYb,OALqB,gBAAZJ,WACTC,OAAOD,QAAUE,GAIV,SAASG,GAGdH,EAAcE,UAAUC,GACxBH,EAAcA,cAAcG","file":"css-layout.min.js","sourcesContent":["// UMD (Universal Module Definition)\n// See https://github.com/umdjs/umd for reference\n//\n// This file uses the following specific UMD implementation:\n// https://github.com/umdjs/umd/blob/master/returnExports.js\n(function(root, factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define([], factory);\n } else if (typeof exports === 'object') {\n // Node. Does not work with strict CommonJS, but\n // only CommonJS-like environments that support module.exports,\n // like Node.\n module.exports = factory();\n } else {\n // Browser globals (root is window)\n root.computeLayout = factory();\n }\n}(this, function() {\n /**\n * Copyright (c) 2014, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\nvar computeLayout = (function() {\n\n var CSS_UNDEFINED;\n\n var CSS_DIRECTION_INHERIT = 'inherit';\n var CSS_DIRECTION_LTR = 'ltr';\n var CSS_DIRECTION_RTL = 'rtl';\n\n var CSS_FLEX_DIRECTION_ROW = 'row';\n var CSS_FLEX_DIRECTION_ROW_REVERSE = 'row-reverse';\n var CSS_FLEX_DIRECTION_COLUMN = 'column';\n var CSS_FLEX_DIRECTION_COLUMN_REVERSE = 'column-reverse';\n\n var CSS_JUSTIFY_FLEX_START = 'flex-start';\n var CSS_JUSTIFY_CENTER = 'center';\n var CSS_JUSTIFY_FLEX_END = 'flex-end';\n var CSS_JUSTIFY_SPACE_BETWEEN = 'space-between';\n var CSS_JUSTIFY_SPACE_AROUND = 'space-around';\n\n var CSS_ALIGN_FLEX_START = 'flex-start';\n var CSS_ALIGN_CENTER = 'center';\n var CSS_ALIGN_FLEX_END = 'flex-end';\n var CSS_ALIGN_STRETCH = 'stretch';\n\n var CSS_POSITION_RELATIVE = 'relative';\n var CSS_POSITION_ABSOLUTE = 'absolute';\n\n var leading = {\n 'row': 'left',\n 'row-reverse': 'right',\n 'column': 'top',\n 'column-reverse': 'bottom'\n };\n var trailing = {\n 'row': 'right',\n 'row-reverse': 'left',\n 'column': 'bottom',\n 'column-reverse': 'top'\n };\n var pos = {\n 'row': 'left',\n 'row-reverse': 'right',\n 'column': 'top',\n 'column-reverse': 'bottom'\n };\n var dim = {\n 'row': 'width',\n 'row-reverse': 'width',\n 'column': 'height',\n 'column-reverse': 'height'\n };\n\n // When transpiled to Java / C the node type has layout, children and style\n // properties. For the JavaScript version this function adds these properties\n // if they don't already exist.\n function fillNodes(node) {\n if (!node.layout || node.isDirty) {\n node.layout = {\n width: undefined,\n height: undefined,\n top: 0,\n left: 0,\n right: 0,\n bottom: 0\n };\n }\n\n if (!node.style) {\n node.style = {};\n }\n\n if (!node.children) {\n node.children = [];\n }\n\n if (node.style.measure && node.children && node.children.length) {\n throw new Error('Using custom measure function is supported only for leaf nodes.');\n }\n\n node.children.forEach(fillNodes);\n return node;\n }\n\n function isUndefined(value) {\n return value === undefined;\n }\n\n function isRowDirection(flexDirection) {\n return flexDirection === CSS_FLEX_DIRECTION_ROW ||\n flexDirection === CSS_FLEX_DIRECTION_ROW_REVERSE;\n }\n\n function isColumnDirection(flexDirection) {\n return flexDirection === CSS_FLEX_DIRECTION_COLUMN ||\n flexDirection === CSS_FLEX_DIRECTION_COLUMN_REVERSE;\n }\n\n function getLeadingMargin(node, axis) {\n if (node.style.marginStart !== undefined && isRowDirection(axis)) {\n return node.style.marginStart;\n }\n\n var value = null;\n switch (axis) {\n case 'row': value = node.style.marginLeft; break;\n case 'row-reverse': value = node.style.marginRight; break;\n case 'column': value = node.style.marginTop; break;\n case 'column-reverse': value = node.style.marginBottom; break;\n }\n\n if (value !== undefined) {\n return value;\n }\n\n if (node.style.margin !== undefined) {\n return node.style.margin;\n }\n\n return 0;\n }\n\n function getTrailingMargin(node, axis) {\n if (node.style.marginEnd !== undefined && isRowDirection(axis)) {\n return node.style.marginEnd;\n }\n\n var value = null;\n switch (axis) {\n case 'row': value = node.style.marginRight; break;\n case 'row-reverse': value = node.style.marginLeft; break;\n case 'column': value = node.style.marginBottom; break;\n case 'column-reverse': value = node.style.marginTop; break;\n }\n\n if (value != null) {\n return value;\n }\n\n if (node.style.margin !== undefined) {\n return node.style.margin;\n }\n\n return 0;\n }\n\n function getLeadingPadding(node, axis) {\n if (node.style.paddingStart !== undefined && node.style.paddingStart >= 0\n && isRowDirection(axis)) {\n return node.style.paddingStart;\n }\n\n var value = null;\n switch (axis) {\n case 'row': value = node.style.paddingLeft; break;\n case 'row-reverse': value = node.style.paddingRight; break;\n case 'column': value = node.style.paddingTop; break;\n case 'column-reverse': value = node.style.paddingBottom; break;\n }\n\n if (value != null && value >= 0) {\n return value;\n }\n\n if (node.style.padding !== undefined && node.style.padding >= 0) {\n return node.style.padding;\n }\n\n return 0;\n }\n\n function getTrailingPadding(node, axis) {\n if (node.style.paddingEnd !== undefined && node.style.paddingEnd >= 0\n && isRowDirection(axis)) {\n return node.style.paddingEnd;\n }\n\n var value = null;\n switch (axis) {\n case 'row': value = node.style.paddingRight; break;\n case 'row-reverse': value = node.style.paddingLeft; break;\n case 'column': value = node.style.paddingBottom; break;\n case 'column-reverse': value = node.style.paddingTop; break;\n }\n\n if (value != null && value >= 0) {\n return value;\n }\n\n if (node.style.padding !== undefined && node.style.padding >= 0) {\n return node.style.padding;\n }\n\n return 0;\n }\n\n function getLeadingBorder(node, axis) {\n if (node.style.borderStartWidth !== undefined && node.style.borderStartWidth >= 0\n && isRowDirection(axis)) {\n return node.style.borderStartWidth;\n }\n\n var value = null;\n switch (axis) {\n case 'row': value = node.style.borderLeftWidth; break;\n case 'row-reverse': value = node.style.borderRightWidth; break;\n case 'column': value = node.style.borderTopWidth; break;\n case 'column-reverse': value = node.style.borderBottomWidth; break;\n }\n\n if (value != null && value >= 0) {\n return value;\n }\n\n if (node.style.borderWidth !== undefined && node.style.borderWidth >= 0) {\n return node.style.borderWidth;\n }\n\n return 0;\n }\n\n function getTrailingBorder(node, axis) {\n if (node.style.borderEndWidth !== undefined && node.style.borderEndWidth >= 0\n && isRowDirection(axis)) {\n return node.style.borderEndWidth;\n }\n\n var value = null;\n switch (axis) {\n case 'row': value = node.style.borderRightWidth; break;\n case 'row-reverse': value = node.style.borderLeftWidth; break;\n case 'column': value = node.style.borderBottomWidth; break;\n case 'column-reverse': value = node.style.borderTopWidth; break;\n }\n\n if (value != null && value >= 0) {\n return value;\n }\n\n if (node.style.borderWidth !== undefined && node.style.borderWidth >= 0) {\n return node.style.borderWidth;\n }\n\n return 0;\n }\n\n function getLeadingPaddingAndBorder(node, axis) {\n return getLeadingPadding(node, axis) + getLeadingBorder(node, axis);\n }\n\n function getTrailingPaddingAndBorder(node, axis) {\n return getTrailingPadding(node, axis) + getTrailingBorder(node, axis);\n }\n\n function getBorderAxis(node, axis) {\n return getLeadingBorder(node, axis) + getTrailingBorder(node, axis);\n }\n\n function getMarginAxis(node, axis) {\n return getLeadingMargin(node, axis) + getTrailingMargin(node, axis);\n }\n\n function getPaddingAndBorderAxis(node, axis) {\n return getLeadingPaddingAndBorder(node, axis) +\n getTrailingPaddingAndBorder(node, axis);\n }\n\n function getJustifyContent(node) {\n if (node.style.justifyContent) {\n return node.style.justifyContent;\n }\n return 'flex-start';\n }\n\n function getAlignContent(node) {\n if (node.style.alignContent) {\n return node.style.alignContent;\n }\n return 'flex-start';\n }\n\n function getAlignItem(node, child) {\n if (child.style.alignSelf) {\n return child.style.alignSelf;\n }\n if (node.style.alignItems) {\n return node.style.alignItems;\n }\n return 'stretch';\n }\n\n function resolveAxis(axis, direction) {\n if (direction === CSS_DIRECTION_RTL) {\n if (axis === CSS_FLEX_DIRECTION_ROW) {\n return CSS_FLEX_DIRECTION_ROW_REVERSE;\n } else if (axis === CSS_FLEX_DIRECTION_ROW_REVERSE) {\n return CSS_FLEX_DIRECTION_ROW;\n }\n }\n\n return axis;\n }\n\n function resolveDirection(node, parentDirection) {\n var direction;\n if (node.style.direction) {\n direction = node.style.direction;\n } else {\n direction = CSS_DIRECTION_INHERIT;\n }\n\n if (direction === CSS_DIRECTION_INHERIT) {\n direction = (parentDirection === undefined ? CSS_DIRECTION_LTR : parentDirection);\n }\n\n return direction;\n }\n\n function getFlexDirection(node) {\n if (node.style.flexDirection) {\n return node.style.flexDirection;\n }\n return CSS_FLEX_DIRECTION_COLUMN;\n }\n\n function getCrossFlexDirection(flexDirection, direction) {\n if (isColumnDirection(flexDirection)) {\n return resolveAxis(CSS_FLEX_DIRECTION_ROW, direction);\n } else {\n return CSS_FLEX_DIRECTION_COLUMN;\n }\n }\n\n function getPositionType(node) {\n if (node.style.position) {\n return node.style.position;\n }\n return 'relative';\n }\n\n function isFlex(node) {\n return (\n getPositionType(node) === CSS_POSITION_RELATIVE &&\n node.style.flex > 0\n );\n }\n\n function isFlexWrap(node) {\n return node.style.flexWrap === 'wrap';\n }\n\n function getDimWithMargin(node, axis) {\n return node.layout[dim[axis]] + getMarginAxis(node, axis);\n }\n\n function isDimDefined(node, axis) {\n return node.style[dim[axis]] !== undefined && node.style[dim[axis]] >= 0;\n }\n\n function isPosDefined(node, pos) {\n return node.style[pos] !== undefined;\n }\n\n function isMeasureDefined(node) {\n return node.style.measure !== undefined;\n }\n\n function getPosition(node, pos) {\n if (node.style[pos] !== undefined) {\n return node.style[pos];\n }\n return 0;\n }\n\n function boundAxis(node, axis, value) {\n var min = {\n 'row': node.style.minWidth,\n 'row-reverse': node.style.minWidth,\n 'column': node.style.minHeight,\n 'column-reverse': node.style.minHeight\n }[axis];\n\n var max = {\n 'row': node.style.maxWidth,\n 'row-reverse': node.style.maxWidth,\n 'column': node.style.maxHeight,\n 'column-reverse': node.style.maxHeight\n }[axis];\n\n var boundValue = value;\n if (max !== undefined && max >= 0 && boundValue > max) {\n boundValue = max;\n }\n if (min !== undefined && min >= 0 && boundValue < min) {\n boundValue = min;\n }\n return boundValue;\n }\n\n function fmaxf(a, b) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n // When the user specifically sets a value for width or height\n function setDimensionFromStyle(node, axis) {\n // The parent already computed us a width or height. We just skip it\n if (node.layout[dim[axis]] !== undefined) {\n return;\n }\n // We only run if there's a width or height defined\n if (!isDimDefined(node, axis)) {\n return;\n }\n\n // The dimensions can never be smaller than the padding and border\n node.layout[dim[axis]] = fmaxf(\n boundAxis(node, axis, node.style[dim[axis]]),\n getPaddingAndBorderAxis(node, axis)\n );\n }\n\n function setTrailingPosition(node, child, axis) {\n child.layout[trailing[axis]] = node.layout[dim[axis]] -\n child.layout[dim[axis]] - child.layout[pos[axis]];\n }\n\n // If both left and right are defined, then use left. Otherwise return\n // +left or -right depending on which is defined.\n function getRelativePosition(node, axis) {\n if (node.style[leading[axis]] !== undefined) {\n return getPosition(node, leading[axis]);\n }\n return -getPosition(node, trailing[axis]);\n }\n\n function layoutNodeImpl(node, parentMaxWidth, parentMaxHeight, /*css_direction_t*/parentDirection) {\n var/*css_direction_t*/ direction = resolveDirection(node, parentDirection);\n var/*(c)!css_flex_direction_t*//*(java)!int*/ mainAxis = resolveAxis(getFlexDirection(node), direction);\n var/*(c)!css_flex_direction_t*//*(java)!int*/ crossAxis = getCrossFlexDirection(mainAxis, direction);\n var/*(c)!css_flex_direction_t*//*(java)!int*/ resolvedRowAxis = resolveAxis(CSS_FLEX_DIRECTION_ROW, direction);\n\n // Handle width and height style attributes\n setDimensionFromStyle(node, mainAxis);\n setDimensionFromStyle(node, crossAxis);\n\n // Set the resolved resolution in the node's layout\n node.layout.direction = direction;\n\n // The position is set by the parent, but we need to complete it with a\n // delta composed of the margin and left/top/right/bottom\n node.layout[leading[mainAxis]] += getLeadingMargin(node, mainAxis) +\n getRelativePosition(node, mainAxis);\n node.layout[trailing[mainAxis]] += getTrailingMargin(node, mainAxis) +\n getRelativePosition(node, mainAxis);\n node.layout[leading[crossAxis]] += getLeadingMargin(node, crossAxis) +\n getRelativePosition(node, crossAxis);\n node.layout[trailing[crossAxis]] += getTrailingMargin(node, crossAxis) +\n getRelativePosition(node, crossAxis);\n\n // Inline immutable values from the target node to avoid excessive method\n // invocations during the layout calculation.\n var/*int*/ childCount = node.children.length;\n var/*float*/ paddingAndBorderAxisResolvedRow = getPaddingAndBorderAxis(node, resolvedRowAxis);\n var/*float*/ paddingAndBorderAxisColumn = getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_COLUMN);\n\n if (isMeasureDefined(node)) {\n var/*bool*/ isResolvedRowDimDefined = !isUndefined(node.layout[dim[resolvedRowAxis]]);\n\n var/*float*/ width = CSS_UNDEFINED;\n if (isDimDefined(node, resolvedRowAxis)) {\n width = node.style.width;\n } else if (isResolvedRowDimDefined) {\n width = node.layout[dim[resolvedRowAxis]];\n } else {\n width = parentMaxWidth -\n getMarginAxis(node, resolvedRowAxis);\n }\n width -= paddingAndBorderAxisResolvedRow;\n\n var/*float*/ height = CSS_UNDEFINED;\n if (isDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) {\n height = node.style.height;\n } else if (!isUndefined(node.layout[dim[CSS_FLEX_DIRECTION_COLUMN]])) {\n height = node.layout[dim[CSS_FLEX_DIRECTION_COLUMN]];\n } else {\n height = parentMaxHeight -\n getMarginAxis(node, resolvedRowAxis);\n }\n height -= getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_COLUMN);\n\n // We only need to give a dimension for the text if we haven't got any\n // for it computed yet. It can either be from the style attribute or because\n // the element is flexible.\n var/*bool*/ isRowUndefined = !isDimDefined(node, resolvedRowAxis) && !isResolvedRowDimDefined;\n var/*bool*/ isColumnUndefined = !isDimDefined(node, CSS_FLEX_DIRECTION_COLUMN) &&\n isUndefined(node.layout[dim[CSS_FLEX_DIRECTION_COLUMN]]);\n\n // Let's not measure the text if we already know both dimensions\n if (isRowUndefined || isColumnUndefined) {\n var/*css_dim_t*/ measureDim = node.style.measure(\n /*(c)!node->context,*/\n /*(java)!layoutContext.measureOutput,*/\n width,\n height\n );\n if (isRowUndefined) {\n node.layout.width = measureDim.width +\n paddingAndBorderAxisResolvedRow;\n }\n if (isColumnUndefined) {\n node.layout.height = measureDim.height +\n paddingAndBorderAxisColumn;\n }\n }\n if (childCount === 0) {\n return;\n }\n }\n\n var/*bool*/ isNodeFlexWrap = isFlexWrap(node);\n\n var/*css_justify_t*/ justifyContent = getJustifyContent(node);\n\n var/*float*/ leadingPaddingAndBorderMain = getLeadingPaddingAndBorder(node, mainAxis);\n var/*float*/ leadingPaddingAndBorderCross = getLeadingPaddingAndBorder(node, crossAxis);\n var/*float*/ paddingAndBorderAxisMain = getPaddingAndBorderAxis(node, mainAxis);\n var/*float*/ paddingAndBorderAxisCross = getPaddingAndBorderAxis(node, crossAxis);\n\n var/*bool*/ isMainDimDefined = !isUndefined(node.layout[dim[mainAxis]]);\n var/*bool*/ isCrossDimDefined = !isUndefined(node.layout[dim[crossAxis]]);\n var/*bool*/ isMainRowDirection = isRowDirection(mainAxis);\n\n var/*int*/ i;\n var/*int*/ ii;\n var/*css_node_t**/ child;\n var/*(c)!css_flex_direction_t*//*(java)!int*/ axis;\n\n var/*css_node_t**/ firstAbsoluteChild = null;\n var/*css_node_t**/ currentAbsoluteChild = null;\n\n var/*float*/ definedMainDim = CSS_UNDEFINED;\n if (isMainDimDefined) {\n definedMainDim = node.layout[dim[mainAxis]] - paddingAndBorderAxisMain;\n }\n\n // We want to execute the next two loops one per line with flex-wrap\n var/*int*/ startLine = 0;\n var/*int*/ endLine = 0;\n // var/*int*/ nextOffset = 0;\n var/*int*/ alreadyComputedNextLayout = 0;\n // We aggregate the total dimensions of the container in those two variables\n var/*float*/ linesCrossDim = 0;\n var/*float*/ linesMainDim = 0;\n var/*int*/ linesCount = 0;\n while (endLine < childCount) {\n // Layout non flexible children and count children by type\n\n // mainContentDim is accumulation of the dimensions and margin of all the\n // non flexible children. This will be used in order to either set the\n // dimensions of the node if none already exist, or to compute the\n // remaining space left for the flexible children.\n var/*float*/ mainContentDim = 0;\n\n // There are three kind of children, non flexible, flexible and absolute.\n // We need to know how many there are in order to distribute the space.\n var/*int*/ flexibleChildrenCount = 0;\n var/*float*/ totalFlexible = 0;\n var/*int*/ nonFlexibleChildrenCount = 0;\n\n // Use the line loop to position children in the main axis for as long\n // as they are using a simple stacking behaviour. Children that are\n // immediately stacked in the initial loop will not be touched again\n // in .\n var/*bool*/ isSimpleStackMain =\n (isMainDimDefined && justifyContent === CSS_JUSTIFY_FLEX_START) ||\n (!isMainDimDefined && justifyContent !== CSS_JUSTIFY_CENTER);\n var/*int*/ firstComplexMain = (isSimpleStackMain ? childCount : startLine);\n\n // Use the initial line loop to position children in the cross axis for\n // as long as they are relatively positioned with alignment STRETCH or\n // FLEX_START. Children that are immediately stacked in the initial loop\n // will not be touched again in .\n var/*bool*/ isSimpleStackCross = true;\n var/*int*/ firstComplexCross = childCount;\n\n var/*css_node_t**/ firstFlexChild = null;\n var/*css_node_t**/ currentFlexChild = null;\n\n var/*float*/ mainDim = leadingPaddingAndBorderMain;\n var/*float*/ crossDim = 0;\n\n var/*float*/ maxWidth;\n var/*float*/ maxHeight;\n for (i = startLine; i < childCount; ++i) {\n child = node.children[i];\n child.lineIndex = linesCount;\n\n child.nextAbsoluteChild = null;\n child.nextFlexChild = null;\n\n var/*css_align_t*/ alignItem = getAlignItem(node, child);\n\n // Pre-fill cross axis dimensions when the child is using stretch before\n // we call the recursive layout pass\n if (alignItem === CSS_ALIGN_STRETCH &&\n getPositionType(child) === CSS_POSITION_RELATIVE &&\n isCrossDimDefined &&\n !isDimDefined(child, crossAxis)) {\n child.layout[dim[crossAxis]] = fmaxf(\n boundAxis(child, crossAxis, node.layout[dim[crossAxis]] -\n paddingAndBorderAxisCross - getMarginAxis(child, crossAxis)),\n // You never want to go smaller than padding\n getPaddingAndBorderAxis(child, crossAxis)\n );\n } else if (getPositionType(child) === CSS_POSITION_ABSOLUTE) {\n // Store a private linked list of absolutely positioned children\n // so that we can efficiently traverse them later.\n if (firstAbsoluteChild === null) {\n firstAbsoluteChild = child;\n }\n if (currentAbsoluteChild !== null) {\n currentAbsoluteChild.nextAbsoluteChild = child;\n }\n currentAbsoluteChild = child;\n\n // Pre-fill dimensions when using absolute position and both offsets for the axis are defined (either both\n // left and right or top and bottom).\n for (ii = 0; ii < 2; ii++) {\n axis = (ii !== 0) ? CSS_FLEX_DIRECTION_ROW : CSS_FLEX_DIRECTION_COLUMN;\n if (!isUndefined(node.layout[dim[axis]]) &&\n !isDimDefined(child, axis) &&\n isPosDefined(child, leading[axis]) &&\n isPosDefined(child, trailing[axis])) {\n child.layout[dim[axis]] = fmaxf(\n boundAxis(child, axis, node.layout[dim[axis]] -\n getPaddingAndBorderAxis(node, axis) -\n getMarginAxis(child, axis) -\n getPosition(child, leading[axis]) -\n getPosition(child, trailing[axis])),\n // You never want to go smaller than padding\n getPaddingAndBorderAxis(child, axis)\n );\n }\n }\n }\n\n var/*float*/ nextContentDim = 0;\n\n // It only makes sense to consider a child flexible if we have a computed\n // dimension for the node.\n if (isMainDimDefined && isFlex(child)) {\n flexibleChildrenCount++;\n totalFlexible += child.style.flex;\n\n // Store a private linked list of flexible children so that we can\n // efficiently traverse them later.\n if (firstFlexChild === null) {\n firstFlexChild = child;\n }\n if (currentFlexChild !== null) {\n currentFlexChild.nextFlexChild = child;\n }\n currentFlexChild = child;\n\n // Even if we don't know its exact size yet, we already know the padding,\n // border and margin. We'll use this partial information, which represents\n // the smallest possible size for the child, to compute the remaining\n // available space.\n nextContentDim = getPaddingAndBorderAxis(child, mainAxis) +\n getMarginAxis(child, mainAxis);\n\n } else {\n maxWidth = CSS_UNDEFINED;\n maxHeight = CSS_UNDEFINED;\n\n if (!isMainRowDirection) {\n if (isDimDefined(node, resolvedRowAxis)) {\n maxWidth = node.layout[dim[resolvedRowAxis]] -\n paddingAndBorderAxisResolvedRow;\n } else {\n maxWidth = parentMaxWidth -\n getMarginAxis(node, resolvedRowAxis) -\n paddingAndBorderAxisResolvedRow;\n }\n } else {\n if (isDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) {\n maxHeight = node.layout[dim[CSS_FLEX_DIRECTION_COLUMN]] -\n paddingAndBorderAxisColumn;\n } else {\n maxHeight = parentMaxHeight -\n getMarginAxis(node, CSS_FLEX_DIRECTION_COLUMN) -\n paddingAndBorderAxisColumn;\n }\n }\n\n // This is the main recursive call. We layout non flexible children.\n if (alreadyComputedNextLayout === 0) {\n layoutNode(/*(java)!layoutContext, */child, maxWidth, maxHeight, direction);\n }\n\n // Absolute positioned elements do not take part of the layout, so we\n // don't use them to compute mainContentDim\n if (getPositionType(child) === CSS_POSITION_RELATIVE) {\n nonFlexibleChildrenCount++;\n // At this point we know the final size and margin of the element.\n nextContentDim = getDimWithMargin(child, mainAxis);\n }\n }\n\n // The element we are about to add would make us go to the next line\n if (isNodeFlexWrap &&\n isMainDimDefined &&\n mainContentDim + nextContentDim > definedMainDim &&\n // If there's only one element, then it's bigger than the content\n // and needs its own line\n i !== startLine) {\n nonFlexibleChildrenCount--;\n alreadyComputedNextLayout = 1;\n break;\n }\n\n // Disable simple stacking in the main axis for the current line as\n // we found a non-trivial child. The remaining children will be laid out\n // in .\n if (isSimpleStackMain &&\n (getPositionType(child) !== CSS_POSITION_RELATIVE || isFlex(child))) {\n isSimpleStackMain = false;\n firstComplexMain = i;\n }\n\n // Disable simple stacking in the cross axis for the current line as\n // we found a non-trivial child. The remaining children will be laid out\n // in .\n if (isSimpleStackCross &&\n (getPositionType(child) !== CSS_POSITION_RELATIVE ||\n (alignItem !== CSS_ALIGN_STRETCH && alignItem !== CSS_ALIGN_FLEX_START) ||\n isUndefined(child.layout[dim[crossAxis]]))) {\n isSimpleStackCross = false;\n firstComplexCross = i;\n }\n\n if (isSimpleStackMain) {\n child.layout[pos[mainAxis]] += mainDim;\n if (isMainDimDefined) {\n setTrailingPosition(node, child, mainAxis);\n }\n\n mainDim += getDimWithMargin(child, mainAxis);\n crossDim = fmaxf(crossDim, boundAxis(child, crossAxis, getDimWithMargin(child, crossAxis)));\n }\n\n if (isSimpleStackCross) {\n child.layout[pos[crossAxis]] += linesCrossDim + leadingPaddingAndBorderCross;\n if (isCrossDimDefined) {\n setTrailingPosition(node, child, crossAxis);\n }\n }\n\n alreadyComputedNextLayout = 0;\n mainContentDim += nextContentDim;\n endLine = i + 1;\n }\n\n // Layout flexible children and allocate empty space\n\n // In order to position the elements in the main axis, we have two\n // controls. The space between the beginning and the first element\n // and the space between each two elements.\n var/*float*/ leadingMainDim = 0;\n var/*float*/ betweenMainDim = 0;\n\n // The remaining available space that needs to be allocated\n var/*float*/ remainingMainDim = 0;\n if (isMainDimDefined) {\n remainingMainDim = definedMainDim - mainContentDim;\n } else {\n remainingMainDim = fmaxf(mainContentDim, 0) - mainContentDim;\n }\n\n // If there are flexible children in the mix, they are going to fill the\n // remaining space\n if (flexibleChildrenCount !== 0) {\n var/*float*/ flexibleMainDim = remainingMainDim / totalFlexible;\n var/*float*/ baseMainDim;\n var/*float*/ boundMainDim;\n\n // If the flex share of remaining space doesn't meet min/max bounds,\n // remove this child from flex calculations.\n currentFlexChild = firstFlexChild;\n while (currentFlexChild !== null) {\n baseMainDim = flexibleMainDim * currentFlexChild.style.flex +\n getPaddingAndBorderAxis(currentFlexChild, mainAxis);\n boundMainDim = boundAxis(currentFlexChild, mainAxis, baseMainDim);\n\n if (baseMainDim !== boundMainDim) {\n remainingMainDim -= boundMainDim;\n totalFlexible -= currentFlexChild.style.flex;\n }\n\n currentFlexChild = currentFlexChild.nextFlexChild;\n }\n flexibleMainDim = remainingMainDim / totalFlexible;\n\n // The non flexible children can overflow the container, in this case\n // we should just assume that there is no space available.\n if (flexibleMainDim < 0) {\n flexibleMainDim = 0;\n }\n\n currentFlexChild = firstFlexChild;\n while (currentFlexChild !== null) {\n // At this point we know the final size of the element in the main\n // dimension\n currentFlexChild.layout[dim[mainAxis]] = boundAxis(currentFlexChild, mainAxis,\n flexibleMainDim * currentFlexChild.style.flex +\n getPaddingAndBorderAxis(currentFlexChild, mainAxis)\n );\n\n maxWidth = CSS_UNDEFINED;\n if (isDimDefined(node, resolvedRowAxis)) {\n maxWidth = node.layout[dim[resolvedRowAxis]] -\n paddingAndBorderAxisResolvedRow;\n } else if (!isMainRowDirection) {\n maxWidth = parentMaxWidth -\n getMarginAxis(node, resolvedRowAxis) -\n paddingAndBorderAxisResolvedRow;\n }\n maxHeight = CSS_UNDEFINED;\n if (isDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) {\n maxHeight = node.layout[dim[CSS_FLEX_DIRECTION_COLUMN]] -\n paddingAndBorderAxisColumn;\n } else if (isMainRowDirection) {\n maxHeight = parentMaxHeight -\n getMarginAxis(node, CSS_FLEX_DIRECTION_COLUMN) -\n paddingAndBorderAxisColumn;\n }\n\n // And we recursively call the layout algorithm for this child\n layoutNode(/*(java)!layoutContext, */currentFlexChild, maxWidth, maxHeight, direction);\n\n child = currentFlexChild;\n currentFlexChild = currentFlexChild.nextFlexChild;\n child.nextFlexChild = null;\n }\n\n // We use justifyContent to figure out how to allocate the remaining\n // space available\n } else if (justifyContent !== CSS_JUSTIFY_FLEX_START) {\n if (justifyContent === CSS_JUSTIFY_CENTER) {\n leadingMainDim = remainingMainDim / 2;\n } else if (justifyContent === CSS_JUSTIFY_FLEX_END) {\n leadingMainDim = remainingMainDim;\n } else if (justifyContent === CSS_JUSTIFY_SPACE_BETWEEN) {\n remainingMainDim = fmaxf(remainingMainDim, 0);\n if (flexibleChildrenCount + nonFlexibleChildrenCount - 1 !== 0) {\n betweenMainDim = remainingMainDim /\n (flexibleChildrenCount + nonFlexibleChildrenCount - 1);\n } else {\n betweenMainDim = 0;\n }\n } else if (justifyContent === CSS_JUSTIFY_SPACE_AROUND) {\n // Space on the edges is half of the space between elements\n betweenMainDim = remainingMainDim /\n (flexibleChildrenCount + nonFlexibleChildrenCount);\n leadingMainDim = betweenMainDim / 2;\n }\n }\n\n // Position elements in the main axis and compute dimensions\n\n // At this point, all the children have their dimensions set. We need to\n // find their position. In order to do that, we accumulate data in\n // variables that are also useful to compute the total dimensions of the\n // container!\n mainDim += leadingMainDim;\n\n for (i = firstComplexMain; i < endLine; ++i) {\n child = node.children[i];\n\n if (getPositionType(child) === CSS_POSITION_ABSOLUTE &&\n isPosDefined(child, leading[mainAxis])) {\n // In case the child is position absolute and has left/top being\n // defined, we override the position to whatever the user said\n // (and margin/border).\n child.layout[pos[mainAxis]] = getPosition(child, leading[mainAxis]) +\n getLeadingBorder(node, mainAxis) +\n getLeadingMargin(child, mainAxis);\n } else {\n // If the child is position absolute (without top/left) or relative,\n // we put it at the current accumulated offset.\n child.layout[pos[mainAxis]] += mainDim;\n\n // Define the trailing position accordingly.\n if (isMainDimDefined) {\n setTrailingPosition(node, child, mainAxis);\n }\n\n // Now that we placed the element, we need to update the variables\n // We only need to do that for relative elements. Absolute elements\n // do not take part in that phase.\n if (getPositionType(child) === CSS_POSITION_RELATIVE) {\n // The main dimension is the sum of all the elements dimension plus\n // the spacing.\n mainDim += betweenMainDim + getDimWithMargin(child, mainAxis);\n // The cross dimension is the max of the elements dimension since there\n // can only be one element in that cross dimension.\n crossDim = fmaxf(crossDim, boundAxis(child, crossAxis, getDimWithMargin(child, crossAxis)));\n }\n }\n }\n\n var/*float*/ containerCrossAxis = node.layout[dim[crossAxis]];\n if (!isCrossDimDefined) {\n containerCrossAxis = fmaxf(\n // For the cross dim, we add both sides at the end because the value\n // is aggregate via a max function. Intermediate negative values\n // can mess this computation otherwise\n boundAxis(node, crossAxis, crossDim + paddingAndBorderAxisCross),\n paddingAndBorderAxisCross\n );\n }\n\n // Position elements in the cross axis\n for (i = firstComplexCross; i < endLine; ++i) {\n child = node.children[i];\n\n if (getPositionType(child) === CSS_POSITION_ABSOLUTE &&\n isPosDefined(child, leading[crossAxis])) {\n // In case the child is absolutely positionned and has a\n // top/left/bottom/right being set, we override all the previously\n // computed positions to set it correctly.\n child.layout[pos[crossAxis]] = getPosition(child, leading[crossAxis]) +\n getLeadingBorder(node, crossAxis) +\n getLeadingMargin(child, crossAxis);\n\n } else {\n var/*float*/ leadingCrossDim = leadingPaddingAndBorderCross;\n\n // For a relative children, we're either using alignItems (parent) or\n // alignSelf (child) in order to determine the position in the cross axis\n if (getPositionType(child) === CSS_POSITION_RELATIVE) {\n /*eslint-disable */\n // This variable is intentionally re-defined as the code is transpiled to a block scope language\n var/*css_align_t*/ alignItem = getAlignItem(node, child);\n /*eslint-enable */\n if (alignItem === CSS_ALIGN_STRETCH) {\n // You can only stretch if the dimension has not already been set\n // previously.\n if (isUndefined(child.layout[dim[crossAxis]])) {\n child.layout[dim[crossAxis]] = fmaxf(\n boundAxis(child, crossAxis, containerCrossAxis -\n paddingAndBorderAxisCross - getMarginAxis(child, crossAxis)),\n // You never want to go smaller than padding\n getPaddingAndBorderAxis(child, crossAxis)\n );\n }\n } else if (alignItem !== CSS_ALIGN_FLEX_START) {\n // The remaining space between the parent dimensions+padding and child\n // dimensions+margin.\n var/*float*/ remainingCrossDim = containerCrossAxis -\n paddingAndBorderAxisCross - getDimWithMargin(child, crossAxis);\n\n if (alignItem === CSS_ALIGN_CENTER) {\n leadingCrossDim += remainingCrossDim / 2;\n } else { // CSS_ALIGN_FLEX_END\n leadingCrossDim += remainingCrossDim;\n }\n }\n }\n\n // And we apply the position\n child.layout[pos[crossAxis]] += linesCrossDim + leadingCrossDim;\n\n // Define the trailing position accordingly.\n if (isCrossDimDefined) {\n setTrailingPosition(node, child, crossAxis);\n }\n }\n }\n\n linesCrossDim += crossDim;\n linesMainDim = fmaxf(linesMainDim, mainDim);\n linesCount += 1;\n startLine = endLine;\n }\n\n // \n //\n // Note(prenaux): More than one line, we need to layout the crossAxis\n // according to alignContent.\n //\n // Note that we could probably remove and handle the one line case\n // here too, but for the moment this is safer since it won't interfere with\n // previously working code.\n //\n // See specs:\n // http://www.w3.org/TR/2012/CR-css3-flexbox-20120918/#layout-algorithm\n // section 9.4\n //\n if (linesCount > 1 && isCrossDimDefined) {\n var/*float*/ nodeCrossAxisInnerSize = node.layout[dim[crossAxis]] -\n paddingAndBorderAxisCross;\n var/*float*/ remainingAlignContentDim = nodeCrossAxisInnerSize - linesCrossDim;\n\n var/*float*/ crossDimLead = 0;\n var/*float*/ currentLead = leadingPaddingAndBorderCross;\n\n var/*css_align_t*/ alignContent = getAlignContent(node);\n if (alignContent === CSS_ALIGN_FLEX_END) {\n currentLead += remainingAlignContentDim;\n } else if (alignContent === CSS_ALIGN_CENTER) {\n currentLead += remainingAlignContentDim / 2;\n } else if (alignContent === CSS_ALIGN_STRETCH) {\n if (nodeCrossAxisInnerSize > linesCrossDim) {\n crossDimLead = (remainingAlignContentDim / linesCount);\n }\n }\n\n var/*int*/ endIndex = 0;\n for (i = 0; i < linesCount; ++i) {\n var/*int*/ startIndex = endIndex;\n\n // compute the line's height and find the endIndex\n var/*float*/ lineHeight = 0;\n for (ii = startIndex; ii < childCount; ++ii) {\n child = node.children[ii];\n if (getPositionType(child) !== CSS_POSITION_RELATIVE) {\n continue;\n }\n if (child.lineIndex !== i) {\n break;\n }\n if (!isUndefined(child.layout[dim[crossAxis]])) {\n lineHeight = fmaxf(\n lineHeight,\n child.layout[dim[crossAxis]] + getMarginAxis(child, crossAxis)\n );\n }\n }\n endIndex = ii;\n lineHeight += crossDimLead;\n\n for (ii = startIndex; ii < endIndex; ++ii) {\n child = node.children[ii];\n if (getPositionType(child) !== CSS_POSITION_RELATIVE) {\n continue;\n }\n\n var/*css_align_t*/ alignContentAlignItem = getAlignItem(node, child);\n if (alignContentAlignItem === CSS_ALIGN_FLEX_START) {\n child.layout[pos[crossAxis]] = currentLead + getLeadingMargin(child, crossAxis);\n } else if (alignContentAlignItem === CSS_ALIGN_FLEX_END) {\n child.layout[pos[crossAxis]] = currentLead + lineHeight - getTrailingMargin(child, crossAxis) - child.layout[dim[crossAxis]];\n } else if (alignContentAlignItem === CSS_ALIGN_CENTER) {\n var/*float*/ childHeight = child.layout[dim[crossAxis]];\n child.layout[pos[crossAxis]] = currentLead + (lineHeight - childHeight) / 2;\n } else if (alignContentAlignItem === CSS_ALIGN_STRETCH) {\n child.layout[pos[crossAxis]] = currentLead + getLeadingMargin(child, crossAxis);\n // TODO(prenaux): Correctly set the height of items with undefined\n // (auto) crossAxis dimension.\n }\n }\n\n currentLead += lineHeight;\n }\n }\n\n var/*bool*/ needsMainTrailingPos = false;\n var/*bool*/ needsCrossTrailingPos = false;\n\n // If the user didn't specify a width or height, and it has not been set\n // by the container, then we set it via the children.\n if (!isMainDimDefined) {\n node.layout[dim[mainAxis]] = fmaxf(\n // We're missing the last padding at this point to get the final\n // dimension\n boundAxis(node, mainAxis, linesMainDim + getTrailingPaddingAndBorder(node, mainAxis)),\n // We can never assign a width smaller than the padding and borders\n paddingAndBorderAxisMain\n );\n\n if (mainAxis === CSS_FLEX_DIRECTION_ROW_REVERSE ||\n mainAxis === CSS_FLEX_DIRECTION_COLUMN_REVERSE) {\n needsMainTrailingPos = true;\n }\n }\n\n if (!isCrossDimDefined) {\n node.layout[dim[crossAxis]] = fmaxf(\n // For the cross dim, we add both sides at the end because the value\n // is aggregate via a max function. Intermediate negative values\n // can mess this computation otherwise\n boundAxis(node, crossAxis, linesCrossDim + paddingAndBorderAxisCross),\n paddingAndBorderAxisCross\n );\n\n if (crossAxis === CSS_FLEX_DIRECTION_ROW_REVERSE ||\n crossAxis === CSS_FLEX_DIRECTION_COLUMN_REVERSE) {\n needsCrossTrailingPos = true;\n }\n }\n\n // Set trailing position if necessary\n if (needsMainTrailingPos || needsCrossTrailingPos) {\n for (i = 0; i < childCount; ++i) {\n child = node.children[i];\n\n if (needsMainTrailingPos) {\n setTrailingPosition(node, child, mainAxis);\n }\n\n if (needsCrossTrailingPos) {\n setTrailingPosition(node, child, crossAxis);\n }\n }\n }\n\n // Calculate dimensions for absolutely positioned elements\n currentAbsoluteChild = firstAbsoluteChild;\n while (currentAbsoluteChild !== null) {\n // Pre-fill dimensions when using absolute position and both offsets for\n // the axis are defined (either both left and right or top and bottom).\n for (ii = 0; ii < 2; ii++) {\n axis = (ii !== 0) ? CSS_FLEX_DIRECTION_ROW : CSS_FLEX_DIRECTION_COLUMN;\n\n if (!isUndefined(node.layout[dim[axis]]) &&\n !isDimDefined(currentAbsoluteChild, axis) &&\n isPosDefined(currentAbsoluteChild, leading[axis]) &&\n isPosDefined(currentAbsoluteChild, trailing[axis])) {\n currentAbsoluteChild.layout[dim[axis]] = fmaxf(\n boundAxis(currentAbsoluteChild, axis, node.layout[dim[axis]] -\n getBorderAxis(node, axis) -\n getMarginAxis(currentAbsoluteChild, axis) -\n getPosition(currentAbsoluteChild, leading[axis]) -\n getPosition(currentAbsoluteChild, trailing[axis])\n ),\n // You never want to go smaller than padding\n getPaddingAndBorderAxis(currentAbsoluteChild, axis)\n );\n }\n\n if (isPosDefined(currentAbsoluteChild, trailing[axis]) &&\n !isPosDefined(currentAbsoluteChild, leading[axis])) {\n currentAbsoluteChild.layout[leading[axis]] =\n node.layout[dim[axis]] -\n currentAbsoluteChild.layout[dim[axis]] -\n getPosition(currentAbsoluteChild, trailing[axis]);\n }\n }\n\n child = currentAbsoluteChild;\n currentAbsoluteChild = currentAbsoluteChild.nextAbsoluteChild;\n child.nextAbsoluteChild = null;\n }\n }\n\n function layoutNode(node, parentMaxWidth, parentMaxHeight, parentDirection) {\n node.shouldUpdate = true;\n\n var direction = node.style.direction || CSS_DIRECTION_LTR;\n var skipLayout =\n !node.isDirty &&\n node.lastLayout &&\n node.lastLayout.requestedHeight === node.layout.height &&\n node.lastLayout.requestedWidth === node.layout.width &&\n node.lastLayout.parentMaxWidth === parentMaxWidth &&\n node.lastLayout.parentMaxHeight === parentMaxHeight &&\n node.lastLayout.direction === direction;\n\n if (skipLayout) {\n node.layout.width = node.lastLayout.width;\n node.layout.height = node.lastLayout.height;\n node.layout.top = node.lastLayout.top;\n node.layout.left = node.lastLayout.left;\n } else {\n if (!node.lastLayout) {\n node.lastLayout = {};\n }\n\n node.lastLayout.requestedWidth = node.layout.width;\n node.lastLayout.requestedHeight = node.layout.height;\n node.lastLayout.parentMaxWidth = parentMaxWidth;\n node.lastLayout.parentMaxHeight = parentMaxHeight;\n node.lastLayout.direction = direction;\n\n // Reset child layouts\n node.children.forEach(function(child) {\n child.layout.width = undefined;\n child.layout.height = undefined;\n child.layout.top = 0;\n child.layout.left = 0;\n });\n\n layoutNodeImpl(node, parentMaxWidth, parentMaxHeight, parentDirection);\n\n node.lastLayout.width = node.layout.width;\n node.lastLayout.height = node.layout.height;\n node.lastLayout.top = node.layout.top;\n node.lastLayout.left = node.layout.left;\n }\n }\n\n return {\n layoutNodeImpl: layoutNodeImpl,\n computeLayout: layoutNode,\n fillNodes: fillNodes\n };\n})();\n\n// This module export is only used for the purposes of unit testing this file. When\n// the library is packaged this file is included within css-layout.js which forms\n// the public API.\nif (typeof exports === 'object') {\n module.exports = computeLayout;\n}\n\n\n return function(node) {\n /*eslint-disable */\n // disabling ESLint because this code relies on the above include\n computeLayout.fillNodes(node);\n computeLayout.computeLayout(node);\n /*eslint-enable */\n };\n}));\n"]} \ No newline at end of file +{"version":3,"sources":["css-layout.js"],"names":["root","factory","define","amd","exports","module","computeLayout","this","fillNodes","node","layout","isDirty","width","undefined","height","top","left","right","bottom","style","children","measure","length","Error","forEach","isUndefined","value","isRowDirection","flexDirection","CSS_FLEX_DIRECTION_ROW","CSS_FLEX_DIRECTION_ROW_REVERSE","isColumnDirection","CSS_FLEX_DIRECTION_COLUMN","CSS_FLEX_DIRECTION_COLUMN_REVERSE","getLeadingMargin","axis","marginStart","marginLeft","marginRight","marginTop","marginBottom","margin","getTrailingMargin","marginEnd","getLeadingPadding","paddingStart","paddingLeft","paddingRight","paddingTop","paddingBottom","padding","getTrailingPadding","paddingEnd","getLeadingBorder","borderStartWidth","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth","borderWidth","getTrailingBorder","borderEndWidth","getLeadingPaddingAndBorder","getTrailingPaddingAndBorder","getBorderAxis","getMarginAxis","getPaddingAndBorderAxis","getJustifyContent","justifyContent","getAlignContent","alignContent","getAlignItem","child","alignSelf","alignItems","resolveAxis","direction","CSS_DIRECTION_RTL","resolveDirection","parentDirection","CSS_DIRECTION_INHERIT","CSS_DIRECTION_LTR","getFlexDirection","getCrossFlexDirection","getPositionType","position","isFlex","CSS_POSITION_RELATIVE","flex","isFlexWrap","flexWrap","getDimWithMargin","dim","isStyleDimDefined","isLayoutDimDefined","isPosDefined","pos","isMeasureDefined","getPosition","boundAxis","min","row","minWidth","row-reverse","column","minHeight","column-reverse","max","maxWidth","maxHeight","boundValue","fmaxf","a","b","setDimensionFromStyle","setTrailingPosition","trailing","getRelativePosition","leading","layoutNodeImpl","parentMaxWidth","parentMaxHeight","mainAxis","crossAxis","resolvedRowAxis","childCount","paddingAndBorderAxisResolvedRow","paddingAndBorderAxisColumn","isResolvedRowDimDefined","CSS_UNDEFINED","isRowUndefined","isColumnUndefined","measureDim","i","ii","isNodeFlexWrap","leadingPaddingAndBorderMain","leadingPaddingAndBorderCross","paddingAndBorderAxisMain","paddingAndBorderAxisCross","isMainDimDefined","isCrossDimDefined","isMainRowDirection","firstAbsoluteChild","currentAbsoluteChild","definedMainDim","startLine","endLine","alreadyComputedNextLayout","linesCrossDim","linesMainDim","linesCount","mainContentDim","flexibleChildrenCount","totalFlexible","nonFlexibleChildrenCount","isSimpleStackMain","CSS_JUSTIFY_FLEX_START","CSS_JUSTIFY_CENTER","firstComplexMain","isSimpleStackCross","firstComplexCross","firstFlexChild","currentFlexChild","mainDim","crossDim","lineIndex","nextAbsoluteChild","nextFlexChild","alignItem","CSS_ALIGN_STRETCH","CSS_POSITION_ABSOLUTE","nextContentDim","layoutNode","CSS_ALIGN_FLEX_START","leadingMainDim","betweenMainDim","remainingMainDim","baseMainDim","boundMainDim","flexibleMainDim","CSS_JUSTIFY_FLEX_END","CSS_JUSTIFY_SPACE_BETWEEN","CSS_JUSTIFY_SPACE_AROUND","containerCrossAxis","leadingCrossDim","dimCrossAxis","remainingCrossDim","CSS_ALIGN_CENTER","nodeCrossAxisInnerSize","remainingAlignContentDim","crossDimLead","currentLead","CSS_ALIGN_FLEX_END","endIndex","startIndex","lineHeight","alignContentAlignItem","childHeight","needsMainTrailingPos","needsCrossTrailingPos","shouldUpdate","skipLayout","lastLayout","requestedHeight","requestedWidth"],"mappings":"CAKC,SAASA,EAAMC,GACQ,kBAAXC,SAAyBA,OAAOC,IAEzCD,UAAWD,GACiB,gBAAZG,SAIhBC,OAAOD,QAAUH,IAGjBD,EAAKM,cAAgBL,KAEvBM,KAAM,WAUR,GAAID,GAAgB,WAuDlB,QAASE,GAAUC,GAoBjB,GAnBKA,EAAKC,SAAUD,EAAK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,MACzBC,EAAiC,cACjCE,EAA4B,SAC5BC,EAAoC,iBAEpC4H,EAAyB,aACzBC,EAAqB,SACrBuB,EAAuB,WACvBC,EAA4B,gBAC5BC,EAA2B,eAE3BT,EAAuB,aACvBc,EAAmB,SACnBK,EAAqB,WACrBvB,GAAoB,UAEpBnF,GAAwB,WACxBoF,GAAwB,WAExBrD,IACFjB,IAAO,OACPE,cAAe,QACfC,OAAU,MACVE,iBAAkB,UAEhBU,IACFf,IAAO,QACPE,cAAe,OACfC,OAAU,SACVE,iBAAkB,OAEhBV,IACFK,IAAO,OACPE,cAAe,QACfC,OAAU,MACVE,iBAAkB,UAEhBd,IACFS,IAAO,QACPE,cAAe,QACfC,OAAU,SACVE,iBAAkB,SAupCpB,QACEa,eAAgBA,EAChBjH,cAAeuK,EACfrK,UAAWA,KAYb,OALqB,gBAAZJ,WACTC,OAAOD,QAAUE,GAIV,SAASG,GAGdH,EAAcE,UAAUC,GACxBH,EAAcA,cAAcG","file":"css-layout.min.js","sourcesContent":["// UMD (Universal Module Definition)\n// See https://github.com/umdjs/umd for reference\n//\n// This file uses the following specific UMD implementation:\n// https://github.com/umdjs/umd/blob/master/templates/returnExports.js\n(function(root, factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module.\n define([], factory);\n } else if (typeof exports === 'object') {\n // Node. Does not work with strict CommonJS, but\n // only CommonJS-like environments that support module.exports,\n // like Node.\n module.exports = factory();\n } else {\n // Browser globals (root is window)\n root.computeLayout = factory();\n }\n}(this, function() {\n /**\n * Copyright (c) 2014, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n */\n\nvar computeLayout = (function() {\n\n var CSS_UNDEFINED;\n\n var CSS_DIRECTION_INHERIT = 'inherit';\n var CSS_DIRECTION_LTR = 'ltr';\n var CSS_DIRECTION_RTL = 'rtl';\n\n var CSS_FLEX_DIRECTION_ROW = 'row';\n var CSS_FLEX_DIRECTION_ROW_REVERSE = 'row-reverse';\n var CSS_FLEX_DIRECTION_COLUMN = 'column';\n var CSS_FLEX_DIRECTION_COLUMN_REVERSE = 'column-reverse';\n\n var CSS_JUSTIFY_FLEX_START = 'flex-start';\n var CSS_JUSTIFY_CENTER = 'center';\n var CSS_JUSTIFY_FLEX_END = 'flex-end';\n var CSS_JUSTIFY_SPACE_BETWEEN = 'space-between';\n var CSS_JUSTIFY_SPACE_AROUND = 'space-around';\n\n var CSS_ALIGN_FLEX_START = 'flex-start';\n var CSS_ALIGN_CENTER = 'center';\n var CSS_ALIGN_FLEX_END = 'flex-end';\n var CSS_ALIGN_STRETCH = 'stretch';\n\n var CSS_POSITION_RELATIVE = 'relative';\n var CSS_POSITION_ABSOLUTE = 'absolute';\n\n var leading = {\n 'row': 'left',\n 'row-reverse': 'right',\n 'column': 'top',\n 'column-reverse': 'bottom'\n };\n var trailing = {\n 'row': 'right',\n 'row-reverse': 'left',\n 'column': 'bottom',\n 'column-reverse': 'top'\n };\n var pos = {\n 'row': 'left',\n 'row-reverse': 'right',\n 'column': 'top',\n 'column-reverse': 'bottom'\n };\n var dim = {\n 'row': 'width',\n 'row-reverse': 'width',\n 'column': 'height',\n 'column-reverse': 'height'\n };\n\n // When transpiled to Java / C the node type has layout, children and style\n // properties. For the JavaScript version this function adds these properties\n // if they don't already exist.\n function fillNodes(node) {\n if (!node.layout || node.isDirty) {\n node.layout = {\n width: undefined,\n height: undefined,\n top: 0,\n left: 0,\n right: 0,\n bottom: 0\n };\n }\n\n if (!node.style) {\n node.style = {};\n }\n\n if (!node.children) {\n node.children = [];\n }\n\n if (node.style.measure && node.children && node.children.length) {\n throw new Error('Using custom measure function is supported only for leaf nodes.');\n }\n\n node.children.forEach(fillNodes);\n return node;\n }\n\n function isUndefined(value) {\n return value === undefined;\n }\n\n function isRowDirection(flexDirection) {\n return flexDirection === CSS_FLEX_DIRECTION_ROW ||\n flexDirection === CSS_FLEX_DIRECTION_ROW_REVERSE;\n }\n\n function isColumnDirection(flexDirection) {\n return flexDirection === CSS_FLEX_DIRECTION_COLUMN ||\n flexDirection === CSS_FLEX_DIRECTION_COLUMN_REVERSE;\n }\n\n function getLeadingMargin(node, axis) {\n if (node.style.marginStart !== undefined && isRowDirection(axis)) {\n return node.style.marginStart;\n }\n\n var value = null;\n switch (axis) {\n case 'row': value = node.style.marginLeft; break;\n case 'row-reverse': value = node.style.marginRight; break;\n case 'column': value = node.style.marginTop; break;\n case 'column-reverse': value = node.style.marginBottom; break;\n }\n\n if (value !== undefined) {\n return value;\n }\n\n if (node.style.margin !== undefined) {\n return node.style.margin;\n }\n\n return 0;\n }\n\n function getTrailingMargin(node, axis) {\n if (node.style.marginEnd !== undefined && isRowDirection(axis)) {\n return node.style.marginEnd;\n }\n\n var value = null;\n switch (axis) {\n case 'row': value = node.style.marginRight; break;\n case 'row-reverse': value = node.style.marginLeft; break;\n case 'column': value = node.style.marginBottom; break;\n case 'column-reverse': value = node.style.marginTop; break;\n }\n\n if (value != null) {\n return value;\n }\n\n if (node.style.margin !== undefined) {\n return node.style.margin;\n }\n\n return 0;\n }\n\n function getLeadingPadding(node, axis) {\n if (node.style.paddingStart !== undefined && node.style.paddingStart >= 0\n && isRowDirection(axis)) {\n return node.style.paddingStart;\n }\n\n var value = null;\n switch (axis) {\n case 'row': value = node.style.paddingLeft; break;\n case 'row-reverse': value = node.style.paddingRight; break;\n case 'column': value = node.style.paddingTop; break;\n case 'column-reverse': value = node.style.paddingBottom; break;\n }\n\n if (value != null && value >= 0) {\n return value;\n }\n\n if (node.style.padding !== undefined && node.style.padding >= 0) {\n return node.style.padding;\n }\n\n return 0;\n }\n\n function getTrailingPadding(node, axis) {\n if (node.style.paddingEnd !== undefined && node.style.paddingEnd >= 0\n && isRowDirection(axis)) {\n return node.style.paddingEnd;\n }\n\n var value = null;\n switch (axis) {\n case 'row': value = node.style.paddingRight; break;\n case 'row-reverse': value = node.style.paddingLeft; break;\n case 'column': value = node.style.paddingBottom; break;\n case 'column-reverse': value = node.style.paddingTop; break;\n }\n\n if (value != null && value >= 0) {\n return value;\n }\n\n if (node.style.padding !== undefined && node.style.padding >= 0) {\n return node.style.padding;\n }\n\n return 0;\n }\n\n function getLeadingBorder(node, axis) {\n if (node.style.borderStartWidth !== undefined && node.style.borderStartWidth >= 0\n && isRowDirection(axis)) {\n return node.style.borderStartWidth;\n }\n\n var value = null;\n switch (axis) {\n case 'row': value = node.style.borderLeftWidth; break;\n case 'row-reverse': value = node.style.borderRightWidth; break;\n case 'column': value = node.style.borderTopWidth; break;\n case 'column-reverse': value = node.style.borderBottomWidth; break;\n }\n\n if (value != null && value >= 0) {\n return value;\n }\n\n if (node.style.borderWidth !== undefined && node.style.borderWidth >= 0) {\n return node.style.borderWidth;\n }\n\n return 0;\n }\n\n function getTrailingBorder(node, axis) {\n if (node.style.borderEndWidth !== undefined && node.style.borderEndWidth >= 0\n && isRowDirection(axis)) {\n return node.style.borderEndWidth;\n }\n\n var value = null;\n switch (axis) {\n case 'row': value = node.style.borderRightWidth; break;\n case 'row-reverse': value = node.style.borderLeftWidth; break;\n case 'column': value = node.style.borderBottomWidth; break;\n case 'column-reverse': value = node.style.borderTopWidth; break;\n }\n\n if (value != null && value >= 0) {\n return value;\n }\n\n if (node.style.borderWidth !== undefined && node.style.borderWidth >= 0) {\n return node.style.borderWidth;\n }\n\n return 0;\n }\n\n function getLeadingPaddingAndBorder(node, axis) {\n return getLeadingPadding(node, axis) + getLeadingBorder(node, axis);\n }\n\n function getTrailingPaddingAndBorder(node, axis) {\n return getTrailingPadding(node, axis) + getTrailingBorder(node, axis);\n }\n\n function getBorderAxis(node, axis) {\n return getLeadingBorder(node, axis) + getTrailingBorder(node, axis);\n }\n\n function getMarginAxis(node, axis) {\n return getLeadingMargin(node, axis) + getTrailingMargin(node, axis);\n }\n\n function getPaddingAndBorderAxis(node, axis) {\n return getLeadingPaddingAndBorder(node, axis) +\n getTrailingPaddingAndBorder(node, axis);\n }\n\n function getJustifyContent(node) {\n if (node.style.justifyContent) {\n return node.style.justifyContent;\n }\n return 'flex-start';\n }\n\n function getAlignContent(node) {\n if (node.style.alignContent) {\n return node.style.alignContent;\n }\n return 'flex-start';\n }\n\n function getAlignItem(node, child) {\n if (child.style.alignSelf) {\n return child.style.alignSelf;\n }\n if (node.style.alignItems) {\n return node.style.alignItems;\n }\n return 'stretch';\n }\n\n function resolveAxis(axis, direction) {\n if (direction === CSS_DIRECTION_RTL) {\n if (axis === CSS_FLEX_DIRECTION_ROW) {\n return CSS_FLEX_DIRECTION_ROW_REVERSE;\n } else if (axis === CSS_FLEX_DIRECTION_ROW_REVERSE) {\n return CSS_FLEX_DIRECTION_ROW;\n }\n }\n\n return axis;\n }\n\n function resolveDirection(node, parentDirection) {\n var direction;\n if (node.style.direction) {\n direction = node.style.direction;\n } else {\n direction = CSS_DIRECTION_INHERIT;\n }\n\n if (direction === CSS_DIRECTION_INHERIT) {\n direction = (parentDirection === undefined ? CSS_DIRECTION_LTR : parentDirection);\n }\n\n return direction;\n }\n\n function getFlexDirection(node) {\n if (node.style.flexDirection) {\n return node.style.flexDirection;\n }\n return CSS_FLEX_DIRECTION_COLUMN;\n }\n\n function getCrossFlexDirection(flexDirection, direction) {\n if (isColumnDirection(flexDirection)) {\n return resolveAxis(CSS_FLEX_DIRECTION_ROW, direction);\n } else {\n return CSS_FLEX_DIRECTION_COLUMN;\n }\n }\n\n function getPositionType(node) {\n if (node.style.position) {\n return node.style.position;\n }\n return 'relative';\n }\n\n function isFlex(node) {\n return (\n getPositionType(node) === CSS_POSITION_RELATIVE &&\n node.style.flex > 0\n );\n }\n\n function isFlexWrap(node) {\n return node.style.flexWrap === 'wrap';\n }\n\n function getDimWithMargin(node, axis) {\n return node.layout[dim[axis]] + getMarginAxis(node, axis);\n }\n\n function isStyleDimDefined(node, axis) {\n return node.style[dim[axis]] !== undefined && node.style[dim[axis]] >= 0;\n }\n\n function isLayoutDimDefined(node, axis) {\n return node.layout[dim[axis]] !== undefined && node.layout[dim[axis]] >= 0;\n }\n\n function isPosDefined(node, pos) {\n return node.style[pos] !== undefined;\n }\n\n function isMeasureDefined(node) {\n return node.style.measure !== undefined;\n }\n\n function getPosition(node, pos) {\n if (node.style[pos] !== undefined) {\n return node.style[pos];\n }\n return 0;\n }\n\n function boundAxis(node, axis, value) {\n var min = {\n 'row': node.style.minWidth,\n 'row-reverse': node.style.minWidth,\n 'column': node.style.minHeight,\n 'column-reverse': node.style.minHeight\n }[axis];\n\n var max = {\n 'row': node.style.maxWidth,\n 'row-reverse': node.style.maxWidth,\n 'column': node.style.maxHeight,\n 'column-reverse': node.style.maxHeight\n }[axis];\n\n var boundValue = value;\n if (max !== undefined && max >= 0 && boundValue > max) {\n boundValue = max;\n }\n if (min !== undefined && min >= 0 && boundValue < min) {\n boundValue = min;\n }\n return boundValue;\n }\n\n function fmaxf(a, b) {\n if (a > b) {\n return a;\n }\n return b;\n }\n\n // When the user specifically sets a value for width or height\n function setDimensionFromStyle(node, axis) {\n // The parent already computed us a width or height. We just skip it\n if (isLayoutDimDefined(node, axis)) {\n return;\n }\n // We only run if there's a width or height defined\n if (!isStyleDimDefined(node, axis)) {\n return;\n }\n\n // The dimensions can never be smaller than the padding and border\n node.layout[dim[axis]] = fmaxf(\n boundAxis(node, axis, node.style[dim[axis]]),\n getPaddingAndBorderAxis(node, axis)\n );\n }\n\n function setTrailingPosition(node, child, axis) {\n child.layout[trailing[axis]] = node.layout[dim[axis]] -\n child.layout[dim[axis]] - child.layout[pos[axis]];\n }\n\n // If both left and right are defined, then use left. Otherwise return\n // +left or -right depending on which is defined.\n function getRelativePosition(node, axis) {\n if (node.style[leading[axis]] !== undefined) {\n return getPosition(node, leading[axis]);\n }\n return -getPosition(node, trailing[axis]);\n }\n\n function layoutNodeImpl(node, parentMaxWidth, parentMaxHeight, /*css_direction_t*/parentDirection) {\n var/*css_direction_t*/ direction = resolveDirection(node, parentDirection);\n var/*(c)!css_flex_direction_t*//*(java)!int*/ mainAxis = resolveAxis(getFlexDirection(node), direction);\n var/*(c)!css_flex_direction_t*//*(java)!int*/ crossAxis = getCrossFlexDirection(mainAxis, direction);\n var/*(c)!css_flex_direction_t*//*(java)!int*/ resolvedRowAxis = resolveAxis(CSS_FLEX_DIRECTION_ROW, direction);\n\n // Handle width and height style attributes\n setDimensionFromStyle(node, mainAxis);\n setDimensionFromStyle(node, crossAxis);\n\n // Set the resolved resolution in the node's layout\n node.layout.direction = direction;\n\n // The position is set by the parent, but we need to complete it with a\n // delta composed of the margin and left/top/right/bottom\n node.layout[leading[mainAxis]] += getLeadingMargin(node, mainAxis) +\n getRelativePosition(node, mainAxis);\n node.layout[trailing[mainAxis]] += getTrailingMargin(node, mainAxis) +\n getRelativePosition(node, mainAxis);\n node.layout[leading[crossAxis]] += getLeadingMargin(node, crossAxis) +\n getRelativePosition(node, crossAxis);\n node.layout[trailing[crossAxis]] += getTrailingMargin(node, crossAxis) +\n getRelativePosition(node, crossAxis);\n\n // Inline immutable values from the target node to avoid excessive method\n // invocations during the layout calculation.\n var/*int*/ childCount = node.children.length;\n var/*float*/ paddingAndBorderAxisResolvedRow = getPaddingAndBorderAxis(node, resolvedRowAxis);\n var/*float*/ paddingAndBorderAxisColumn = getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_COLUMN);\n\n if (isMeasureDefined(node)) {\n var/*bool*/ isResolvedRowDimDefined = isLayoutDimDefined(node, resolvedRowAxis);\n\n var/*float*/ width = CSS_UNDEFINED;\n if (isStyleDimDefined(node, resolvedRowAxis)) {\n width = node.style.width;\n } else if (isResolvedRowDimDefined) {\n width = node.layout[dim[resolvedRowAxis]];\n } else {\n width = parentMaxWidth -\n getMarginAxis(node, resolvedRowAxis);\n }\n width -= paddingAndBorderAxisResolvedRow;\n\n var/*float*/ height = CSS_UNDEFINED;\n if (isStyleDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) {\n height = node.style.height;\n } else if (isLayoutDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) {\n height = node.layout[dim[CSS_FLEX_DIRECTION_COLUMN]];\n } else {\n height = parentMaxHeight -\n getMarginAxis(node, resolvedRowAxis);\n }\n height -= getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_COLUMN);\n\n // We only need to give a dimension for the text if we haven't got any\n // for it computed yet. It can either be from the style attribute or because\n // the element is flexible.\n var/*bool*/ isRowUndefined = !isStyleDimDefined(node, resolvedRowAxis) && !isResolvedRowDimDefined;\n var/*bool*/ isColumnUndefined = !isStyleDimDefined(node, CSS_FLEX_DIRECTION_COLUMN) &&\n isUndefined(node.layout[dim[CSS_FLEX_DIRECTION_COLUMN]]);\n\n // Let's not measure the text if we already know both dimensions\n if (isRowUndefined || isColumnUndefined) {\n var/*css_dim_t*/ measureDim = node.style.measure(\n /*(c)!node->context,*/\n /*(java)!layoutContext.measureOutput,*/\n width,\n height\n );\n if (isRowUndefined) {\n node.layout.width = measureDim.width +\n paddingAndBorderAxisResolvedRow;\n }\n if (isColumnUndefined) {\n node.layout.height = measureDim.height +\n paddingAndBorderAxisColumn;\n }\n }\n if (childCount === 0) {\n return;\n }\n }\n\n var/*bool*/ isNodeFlexWrap = isFlexWrap(node);\n\n var/*css_justify_t*/ justifyContent = getJustifyContent(node);\n\n var/*float*/ leadingPaddingAndBorderMain = getLeadingPaddingAndBorder(node, mainAxis);\n var/*float*/ leadingPaddingAndBorderCross = getLeadingPaddingAndBorder(node, crossAxis);\n var/*float*/ paddingAndBorderAxisMain = getPaddingAndBorderAxis(node, mainAxis);\n var/*float*/ paddingAndBorderAxisCross = getPaddingAndBorderAxis(node, crossAxis);\n\n var/*bool*/ isMainDimDefined = isLayoutDimDefined(node, mainAxis);\n var/*bool*/ isCrossDimDefined = isLayoutDimDefined(node, crossAxis);\n var/*bool*/ isMainRowDirection = isRowDirection(mainAxis);\n\n var/*int*/ i;\n var/*int*/ ii;\n var/*css_node_t**/ child;\n var/*(c)!css_flex_direction_t*//*(java)!int*/ axis;\n\n var/*css_node_t**/ firstAbsoluteChild = null;\n var/*css_node_t**/ currentAbsoluteChild = null;\n\n var/*float*/ definedMainDim = CSS_UNDEFINED;\n if (isMainDimDefined) {\n definedMainDim = node.layout[dim[mainAxis]] - paddingAndBorderAxisMain;\n }\n\n // We want to execute the next two loops one per line with flex-wrap\n var/*int*/ startLine = 0;\n var/*int*/ endLine = 0;\n // var/*int*/ nextOffset = 0;\n var/*int*/ alreadyComputedNextLayout = 0;\n // We aggregate the total dimensions of the container in those two variables\n var/*float*/ linesCrossDim = 0;\n var/*float*/ linesMainDim = 0;\n var/*int*/ linesCount = 0;\n while (endLine < childCount) {\n // Layout non flexible children and count children by type\n\n // mainContentDim is accumulation of the dimensions and margin of all the\n // non flexible children. This will be used in order to either set the\n // dimensions of the node if none already exist, or to compute the\n // remaining space left for the flexible children.\n var/*float*/ mainContentDim = 0;\n\n // There are three kind of children, non flexible, flexible and absolute.\n // We need to know how many there are in order to distribute the space.\n var/*int*/ flexibleChildrenCount = 0;\n var/*float*/ totalFlexible = 0;\n var/*int*/ nonFlexibleChildrenCount = 0;\n\n // Use the line loop to position children in the main axis for as long\n // as they are using a simple stacking behaviour. Children that are\n // immediately stacked in the initial loop will not be touched again\n // in .\n var/*bool*/ isSimpleStackMain =\n (isMainDimDefined && justifyContent === CSS_JUSTIFY_FLEX_START) ||\n (!isMainDimDefined && justifyContent !== CSS_JUSTIFY_CENTER);\n var/*int*/ firstComplexMain = (isSimpleStackMain ? childCount : startLine);\n\n // Use the initial line loop to position children in the cross axis for\n // as long as they are relatively positioned with alignment STRETCH or\n // FLEX_START. Children that are immediately stacked in the initial loop\n // will not be touched again in .\n var/*bool*/ isSimpleStackCross = true;\n var/*int*/ firstComplexCross = childCount;\n\n var/*css_node_t**/ firstFlexChild = null;\n var/*css_node_t**/ currentFlexChild = null;\n\n var/*float*/ mainDim = leadingPaddingAndBorderMain;\n var/*float*/ crossDim = 0;\n\n var/*float*/ maxWidth = CSS_UNDEFINED;\n var/*float*/ maxHeight = CSS_UNDEFINED;\n for (i = startLine; i < childCount; ++i) {\n child = node.children[i];\n child.lineIndex = linesCount;\n\n child.nextAbsoluteChild = null;\n child.nextFlexChild = null;\n\n var/*css_align_t*/ alignItem = getAlignItem(node, child);\n\n // Pre-fill cross axis dimensions when the child is using stretch before\n // we call the recursive layout pass\n if (alignItem === CSS_ALIGN_STRETCH &&\n getPositionType(child) === CSS_POSITION_RELATIVE &&\n isCrossDimDefined &&\n !isStyleDimDefined(child, crossAxis)) {\n child.layout[dim[crossAxis]] = fmaxf(\n boundAxis(child, crossAxis, node.layout[dim[crossAxis]] -\n paddingAndBorderAxisCross - getMarginAxis(child, crossAxis)),\n // You never want to go smaller than padding\n getPaddingAndBorderAxis(child, crossAxis)\n );\n } else if (getPositionType(child) === CSS_POSITION_ABSOLUTE) {\n // Store a private linked list of absolutely positioned children\n // so that we can efficiently traverse them later.\n if (firstAbsoluteChild === null) {\n firstAbsoluteChild = child;\n }\n if (currentAbsoluteChild !== null) {\n currentAbsoluteChild.nextAbsoluteChild = child;\n }\n currentAbsoluteChild = child;\n\n // Pre-fill dimensions when using absolute position and both offsets for the axis are defined (either both\n // left and right or top and bottom).\n for (ii = 0; ii < 2; ii++) {\n axis = (ii !== 0) ? CSS_FLEX_DIRECTION_ROW : CSS_FLEX_DIRECTION_COLUMN;\n if (isLayoutDimDefined(node, axis) &&\n !isStyleDimDefined(child, axis) &&\n isPosDefined(child, leading[axis]) &&\n isPosDefined(child, trailing[axis])) {\n child.layout[dim[axis]] = fmaxf(\n boundAxis(child, axis, node.layout[dim[axis]] -\n getPaddingAndBorderAxis(node, axis) -\n getMarginAxis(child, axis) -\n getPosition(child, leading[axis]) -\n getPosition(child, trailing[axis])),\n // You never want to go smaller than padding\n getPaddingAndBorderAxis(child, axis)\n );\n }\n }\n }\n\n var/*float*/ nextContentDim = 0;\n\n // It only makes sense to consider a child flexible if we have a computed\n // dimension for the node.\n if (isMainDimDefined && isFlex(child)) {\n flexibleChildrenCount++;\n totalFlexible += child.style.flex;\n\n // Store a private linked list of flexible children so that we can\n // efficiently traverse them later.\n if (firstFlexChild === null) {\n firstFlexChild = child;\n }\n if (currentFlexChild !== null) {\n currentFlexChild.nextFlexChild = child;\n }\n currentFlexChild = child;\n\n // Even if we don't know its exact size yet, we already know the padding,\n // border and margin. We'll use this partial information, which represents\n // the smallest possible size for the child, to compute the remaining\n // available space.\n nextContentDim = getPaddingAndBorderAxis(child, mainAxis) +\n getMarginAxis(child, mainAxis);\n\n } else {\n maxWidth = CSS_UNDEFINED;\n maxHeight = CSS_UNDEFINED;\n\n if (!isMainRowDirection) {\n if (isLayoutDimDefined(node, resolvedRowAxis)) {\n maxWidth = node.layout[dim[resolvedRowAxis]] -\n paddingAndBorderAxisResolvedRow;\n } else {\n maxWidth = parentMaxWidth -\n getMarginAxis(node, resolvedRowAxis) -\n paddingAndBorderAxisResolvedRow;\n }\n } else {\n if (isLayoutDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) {\n maxHeight = node.layout[dim[CSS_FLEX_DIRECTION_COLUMN]] -\n paddingAndBorderAxisColumn;\n } else {\n maxHeight = parentMaxHeight -\n getMarginAxis(node, CSS_FLEX_DIRECTION_COLUMN) -\n paddingAndBorderAxisColumn;\n }\n }\n\n // This is the main recursive call. We layout non flexible children.\n if (alreadyComputedNextLayout === 0) {\n layoutNode(/*(java)!layoutContext, */child, maxWidth, maxHeight, direction);\n }\n\n // Absolute positioned elements do not take part of the layout, so we\n // don't use them to compute mainContentDim\n if (getPositionType(child) === CSS_POSITION_RELATIVE) {\n nonFlexibleChildrenCount++;\n // At this point we know the final size and margin of the element.\n nextContentDim = getDimWithMargin(child, mainAxis);\n }\n }\n\n // The element we are about to add would make us go to the next line\n if (isNodeFlexWrap &&\n isMainDimDefined &&\n mainContentDim + nextContentDim > definedMainDim &&\n // If there's only one element, then it's bigger than the content\n // and needs its own line\n i !== startLine) {\n nonFlexibleChildrenCount--;\n alreadyComputedNextLayout = 1;\n break;\n }\n\n // Disable simple stacking in the main axis for the current line as\n // we found a non-trivial child. The remaining children will be laid out\n // in .\n if (isSimpleStackMain &&\n (getPositionType(child) !== CSS_POSITION_RELATIVE || isFlex(child))) {\n isSimpleStackMain = false;\n firstComplexMain = i;\n }\n\n // Disable simple stacking in the cross axis for the current line as\n // we found a non-trivial child. The remaining children will be laid out\n // in .\n if (isSimpleStackCross &&\n (getPositionType(child) !== CSS_POSITION_RELATIVE ||\n (alignItem !== CSS_ALIGN_STRETCH && alignItem !== CSS_ALIGN_FLEX_START) ||\n (alignItem == CSS_ALIGN_STRETCH && !isCrossDimDefined))) {\n isSimpleStackCross = false;\n firstComplexCross = i;\n }\n\n if (isSimpleStackMain) {\n child.layout[pos[mainAxis]] += mainDim;\n if (isMainDimDefined) {\n setTrailingPosition(node, child, mainAxis);\n }\n\n mainDim += getDimWithMargin(child, mainAxis);\n crossDim = fmaxf(crossDim, boundAxis(child, crossAxis, getDimWithMargin(child, crossAxis)));\n }\n\n if (isSimpleStackCross) {\n child.layout[pos[crossAxis]] += linesCrossDim + leadingPaddingAndBorderCross;\n if (isCrossDimDefined) {\n setTrailingPosition(node, child, crossAxis);\n }\n }\n\n alreadyComputedNextLayout = 0;\n mainContentDim += nextContentDim;\n endLine = i + 1;\n }\n\n // Layout flexible children and allocate empty space\n\n // In order to position the elements in the main axis, we have two\n // controls. The space between the beginning and the first element\n // and the space between each two elements.\n var/*float*/ leadingMainDim = 0;\n var/*float*/ betweenMainDim = 0;\n\n // The remaining available space that needs to be allocated\n var/*float*/ remainingMainDim = 0;\n if (isMainDimDefined) {\n remainingMainDim = definedMainDim - mainContentDim;\n } else {\n remainingMainDim = fmaxf(mainContentDim, 0) - mainContentDim;\n }\n\n // If there are flexible children in the mix, they are going to fill the\n // remaining space\n if (flexibleChildrenCount !== 0) {\n var/*float*/ flexibleMainDim = remainingMainDim / totalFlexible;\n var/*float*/ baseMainDim;\n var/*float*/ boundMainDim;\n\n // If the flex share of remaining space doesn't meet min/max bounds,\n // remove this child from flex calculations.\n currentFlexChild = firstFlexChild;\n while (currentFlexChild !== null) {\n baseMainDim = flexibleMainDim * currentFlexChild.style.flex +\n getPaddingAndBorderAxis(currentFlexChild, mainAxis);\n boundMainDim = boundAxis(currentFlexChild, mainAxis, baseMainDim);\n\n if (baseMainDim !== boundMainDim) {\n remainingMainDim -= boundMainDim;\n totalFlexible -= currentFlexChild.style.flex;\n }\n\n currentFlexChild = currentFlexChild.nextFlexChild;\n }\n flexibleMainDim = remainingMainDim / totalFlexible;\n\n // The non flexible children can overflow the container, in this case\n // we should just assume that there is no space available.\n if (flexibleMainDim < 0) {\n flexibleMainDim = 0;\n }\n\n currentFlexChild = firstFlexChild;\n while (currentFlexChild !== null) {\n // At this point we know the final size of the element in the main\n // dimension\n currentFlexChild.layout[dim[mainAxis]] = boundAxis(currentFlexChild, mainAxis,\n flexibleMainDim * currentFlexChild.style.flex +\n getPaddingAndBorderAxis(currentFlexChild, mainAxis)\n );\n\n maxWidth = CSS_UNDEFINED;\n if (isLayoutDimDefined(node, resolvedRowAxis)) {\n maxWidth = node.layout[dim[resolvedRowAxis]] -\n paddingAndBorderAxisResolvedRow;\n } else if (!isMainRowDirection) {\n maxWidth = parentMaxWidth -\n getMarginAxis(node, resolvedRowAxis) -\n paddingAndBorderAxisResolvedRow;\n }\n maxHeight = CSS_UNDEFINED;\n if (isLayoutDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) {\n maxHeight = node.layout[dim[CSS_FLEX_DIRECTION_COLUMN]] -\n paddingAndBorderAxisColumn;\n } else if (isMainRowDirection) {\n maxHeight = parentMaxHeight -\n getMarginAxis(node, CSS_FLEX_DIRECTION_COLUMN) -\n paddingAndBorderAxisColumn;\n }\n\n // And we recursively call the layout algorithm for this child\n layoutNode(/*(java)!layoutContext, */currentFlexChild, maxWidth, maxHeight, direction);\n\n child = currentFlexChild;\n currentFlexChild = currentFlexChild.nextFlexChild;\n child.nextFlexChild = null;\n }\n\n // We use justifyContent to figure out how to allocate the remaining\n // space available\n } else if (justifyContent !== CSS_JUSTIFY_FLEX_START) {\n if (justifyContent === CSS_JUSTIFY_CENTER) {\n leadingMainDim = remainingMainDim / 2;\n } else if (justifyContent === CSS_JUSTIFY_FLEX_END) {\n leadingMainDim = remainingMainDim;\n } else if (justifyContent === CSS_JUSTIFY_SPACE_BETWEEN) {\n remainingMainDim = fmaxf(remainingMainDim, 0);\n if (flexibleChildrenCount + nonFlexibleChildrenCount - 1 !== 0) {\n betweenMainDim = remainingMainDim /\n (flexibleChildrenCount + nonFlexibleChildrenCount - 1);\n } else {\n betweenMainDim = 0;\n }\n } else if (justifyContent === CSS_JUSTIFY_SPACE_AROUND) {\n // Space on the edges is half of the space between elements\n betweenMainDim = remainingMainDim /\n (flexibleChildrenCount + nonFlexibleChildrenCount);\n leadingMainDim = betweenMainDim / 2;\n }\n }\n\n // Position elements in the main axis and compute dimensions\n\n // At this point, all the children have their dimensions set. We need to\n // find their position. In order to do that, we accumulate data in\n // variables that are also useful to compute the total dimensions of the\n // container!\n mainDim += leadingMainDim;\n\n for (i = firstComplexMain; i < endLine; ++i) {\n child = node.children[i];\n\n if (getPositionType(child) === CSS_POSITION_ABSOLUTE &&\n isPosDefined(child, leading[mainAxis])) {\n // In case the child is position absolute and has left/top being\n // defined, we override the position to whatever the user said\n // (and margin/border).\n child.layout[pos[mainAxis]] = getPosition(child, leading[mainAxis]) +\n getLeadingBorder(node, mainAxis) +\n getLeadingMargin(child, mainAxis);\n } else {\n // If the child is position absolute (without top/left) or relative,\n // we put it at the current accumulated offset.\n child.layout[pos[mainAxis]] += mainDim;\n\n // Define the trailing position accordingly.\n if (isMainDimDefined) {\n setTrailingPosition(node, child, mainAxis);\n }\n\n // Now that we placed the element, we need to update the variables\n // We only need to do that for relative elements. Absolute elements\n // do not take part in that phase.\n if (getPositionType(child) === CSS_POSITION_RELATIVE) {\n // The main dimension is the sum of all the elements dimension plus\n // the spacing.\n mainDim += betweenMainDim + getDimWithMargin(child, mainAxis);\n // The cross dimension is the max of the elements dimension since there\n // can only be one element in that cross dimension.\n crossDim = fmaxf(crossDim, boundAxis(child, crossAxis, getDimWithMargin(child, crossAxis)));\n }\n }\n }\n\n var/*float*/ containerCrossAxis = node.layout[dim[crossAxis]];\n if (!isCrossDimDefined) {\n containerCrossAxis = fmaxf(\n // For the cross dim, we add both sides at the end because the value\n // is aggregate via a max function. Intermediate negative values\n // can mess this computation otherwise\n boundAxis(node, crossAxis, crossDim + paddingAndBorderAxisCross),\n paddingAndBorderAxisCross\n );\n }\n\n // Position elements in the cross axis\n for (i = firstComplexCross; i < endLine; ++i) {\n child = node.children[i];\n\n if (getPositionType(child) === CSS_POSITION_ABSOLUTE &&\n isPosDefined(child, leading[crossAxis])) {\n // In case the child is absolutely positionned and has a\n // top/left/bottom/right being set, we override all the previously\n // computed positions to set it correctly.\n child.layout[pos[crossAxis]] = getPosition(child, leading[crossAxis]) +\n getLeadingBorder(node, crossAxis) +\n getLeadingMargin(child, crossAxis);\n\n } else {\n var/*float*/ leadingCrossDim = leadingPaddingAndBorderCross;\n\n // For a relative children, we're either using alignItems (parent) or\n // alignSelf (child) in order to determine the position in the cross axis\n if (getPositionType(child) === CSS_POSITION_RELATIVE) {\n /*eslint-disable */\n // This variable is intentionally re-defined as the code is transpiled to a block scope language\n var/*css_align_t*/ alignItem = getAlignItem(node, child);\n /*eslint-enable */\n if (alignItem === CSS_ALIGN_STRETCH) {\n // You can only stretch if the dimension has not already been defined\n // previously.\n if (!isStyleDimDefined(child, crossAxis)) {\n var/*float*/ dimCrossAxis = child.layout[dim[crossAxis]];\n child.layout[dim[crossAxis]] = fmaxf(\n boundAxis(child, crossAxis, containerCrossAxis -\n paddingAndBorderAxisCross - getMarginAxis(child, crossAxis)),\n // You never want to go smaller than padding\n getPaddingAndBorderAxis(child, crossAxis)\n );\n\n // If the size has changed, and this child has children we need to re-layout this child\n if (dimCrossAxis != child.layout[dim[crossAxis]] && child.children.length > 0) {\n // Reset child margins before re-layout as they are added back in layoutNode and would be doubled\n child.layout[leading[mainAxis]] -= getLeadingMargin(child, mainAxis) +\n getRelativePosition(child, mainAxis);\n child.layout[trailing[mainAxis]] -= getTrailingMargin(child, mainAxis) +\n getRelativePosition(child, mainAxis);\n child.layout[leading[crossAxis]] -= getLeadingMargin(child, crossAxis) +\n getRelativePosition(child, crossAxis);\n child.layout[trailing[crossAxis]] -= getTrailingMargin(child, crossAxis) +\n getRelativePosition(child, crossAxis);\n\n layoutNode(/*(java)!layoutContext, */child, maxWidth, maxHeight, direction);\n }\n }\n } else if (alignItem !== CSS_ALIGN_FLEX_START) {\n // The remaining space between the parent dimensions+padding and child\n // dimensions+margin.\n var/*float*/ remainingCrossDim = containerCrossAxis -\n paddingAndBorderAxisCross - getDimWithMargin(child, crossAxis);\n\n if (alignItem === CSS_ALIGN_CENTER) {\n leadingCrossDim += remainingCrossDim / 2;\n } else { // CSS_ALIGN_FLEX_END\n leadingCrossDim += remainingCrossDim;\n }\n }\n }\n\n // And we apply the position\n child.layout[pos[crossAxis]] += linesCrossDim + leadingCrossDim;\n\n // Define the trailing position accordingly.\n if (isCrossDimDefined) {\n setTrailingPosition(node, child, crossAxis);\n }\n }\n }\n\n linesCrossDim += crossDim;\n linesMainDim = fmaxf(linesMainDim, mainDim);\n linesCount += 1;\n startLine = endLine;\n }\n\n // \n //\n // Note(prenaux): More than one line, we need to layout the crossAxis\n // according to alignContent.\n //\n // Note that we could probably remove and handle the one line case\n // here too, but for the moment this is safer since it won't interfere with\n // previously working code.\n //\n // See specs:\n // http://www.w3.org/TR/2012/CR-css3-flexbox-20120918/#layout-algorithm\n // section 9.4\n //\n if (linesCount > 1 && isCrossDimDefined) {\n var/*float*/ nodeCrossAxisInnerSize = node.layout[dim[crossAxis]] -\n paddingAndBorderAxisCross;\n var/*float*/ remainingAlignContentDim = nodeCrossAxisInnerSize - linesCrossDim;\n\n var/*float*/ crossDimLead = 0;\n var/*float*/ currentLead = leadingPaddingAndBorderCross;\n\n var/*css_align_t*/ alignContent = getAlignContent(node);\n if (alignContent === CSS_ALIGN_FLEX_END) {\n currentLead += remainingAlignContentDim;\n } else if (alignContent === CSS_ALIGN_CENTER) {\n currentLead += remainingAlignContentDim / 2;\n } else if (alignContent === CSS_ALIGN_STRETCH) {\n if (nodeCrossAxisInnerSize > linesCrossDim) {\n crossDimLead = (remainingAlignContentDim / linesCount);\n }\n }\n\n var/*int*/ endIndex = 0;\n for (i = 0; i < linesCount; ++i) {\n var/*int*/ startIndex = endIndex;\n\n // compute the line's height and find the endIndex\n var/*float*/ lineHeight = 0;\n for (ii = startIndex; ii < childCount; ++ii) {\n child = node.children[ii];\n if (getPositionType(child) !== CSS_POSITION_RELATIVE) {\n continue;\n }\n if (child.lineIndex !== i) {\n break;\n }\n if (isLayoutDimDefined(child, crossAxis)) {\n lineHeight = fmaxf(\n lineHeight,\n child.layout[dim[crossAxis]] + getMarginAxis(child, crossAxis)\n );\n }\n }\n endIndex = ii;\n lineHeight += crossDimLead;\n\n for (ii = startIndex; ii < endIndex; ++ii) {\n child = node.children[ii];\n if (getPositionType(child) !== CSS_POSITION_RELATIVE) {\n continue;\n }\n\n var/*css_align_t*/ alignContentAlignItem = getAlignItem(node, child);\n if (alignContentAlignItem === CSS_ALIGN_FLEX_START) {\n child.layout[pos[crossAxis]] = currentLead + getLeadingMargin(child, crossAxis);\n } else if (alignContentAlignItem === CSS_ALIGN_FLEX_END) {\n child.layout[pos[crossAxis]] = currentLead + lineHeight - getTrailingMargin(child, crossAxis) - child.layout[dim[crossAxis]];\n } else if (alignContentAlignItem === CSS_ALIGN_CENTER) {\n var/*float*/ childHeight = child.layout[dim[crossAxis]];\n child.layout[pos[crossAxis]] = currentLead + (lineHeight - childHeight) / 2;\n } else if (alignContentAlignItem === CSS_ALIGN_STRETCH) {\n child.layout[pos[crossAxis]] = currentLead + getLeadingMargin(child, crossAxis);\n // TODO(prenaux): Correctly set the height of items with undefined\n // (auto) crossAxis dimension.\n }\n }\n\n currentLead += lineHeight;\n }\n }\n\n var/*bool*/ needsMainTrailingPos = false;\n var/*bool*/ needsCrossTrailingPos = false;\n\n // If the user didn't specify a width or height, and it has not been set\n // by the container, then we set it via the children.\n if (!isMainDimDefined) {\n node.layout[dim[mainAxis]] = fmaxf(\n // We're missing the last padding at this point to get the final\n // dimension\n boundAxis(node, mainAxis, linesMainDim + getTrailingPaddingAndBorder(node, mainAxis)),\n // We can never assign a width smaller than the padding and borders\n paddingAndBorderAxisMain\n );\n\n if (mainAxis === CSS_FLEX_DIRECTION_ROW_REVERSE ||\n mainAxis === CSS_FLEX_DIRECTION_COLUMN_REVERSE) {\n needsMainTrailingPos = true;\n }\n }\n\n if (!isCrossDimDefined) {\n node.layout[dim[crossAxis]] = fmaxf(\n // For the cross dim, we add both sides at the end because the value\n // is aggregate via a max function. Intermediate negative values\n // can mess this computation otherwise\n boundAxis(node, crossAxis, linesCrossDim + paddingAndBorderAxisCross),\n paddingAndBorderAxisCross\n );\n\n if (crossAxis === CSS_FLEX_DIRECTION_ROW_REVERSE ||\n crossAxis === CSS_FLEX_DIRECTION_COLUMN_REVERSE) {\n needsCrossTrailingPos = true;\n }\n }\n\n // Set trailing position if necessary\n if (needsMainTrailingPos || needsCrossTrailingPos) {\n for (i = 0; i < childCount; ++i) {\n child = node.children[i];\n\n if (needsMainTrailingPos) {\n setTrailingPosition(node, child, mainAxis);\n }\n\n if (needsCrossTrailingPos) {\n setTrailingPosition(node, child, crossAxis);\n }\n }\n }\n\n // Calculate dimensions for absolutely positioned elements\n currentAbsoluteChild = firstAbsoluteChild;\n while (currentAbsoluteChild !== null) {\n // Pre-fill dimensions when using absolute position and both offsets for\n // the axis are defined (either both left and right or top and bottom).\n for (ii = 0; ii < 2; ii++) {\n axis = (ii !== 0) ? CSS_FLEX_DIRECTION_ROW : CSS_FLEX_DIRECTION_COLUMN;\n\n if (isLayoutDimDefined(node, axis) &&\n !isStyleDimDefined(currentAbsoluteChild, axis) &&\n isPosDefined(currentAbsoluteChild, leading[axis]) &&\n isPosDefined(currentAbsoluteChild, trailing[axis])) {\n currentAbsoluteChild.layout[dim[axis]] = fmaxf(\n boundAxis(currentAbsoluteChild, axis, node.layout[dim[axis]] -\n getBorderAxis(node, axis) -\n getMarginAxis(currentAbsoluteChild, axis) -\n getPosition(currentAbsoluteChild, leading[axis]) -\n getPosition(currentAbsoluteChild, trailing[axis])\n ),\n // You never want to go smaller than padding\n getPaddingAndBorderAxis(currentAbsoluteChild, axis)\n );\n }\n\n if (isPosDefined(currentAbsoluteChild, trailing[axis]) &&\n !isPosDefined(currentAbsoluteChild, leading[axis])) {\n currentAbsoluteChild.layout[leading[axis]] =\n node.layout[dim[axis]] -\n currentAbsoluteChild.layout[dim[axis]] -\n getPosition(currentAbsoluteChild, trailing[axis]);\n }\n }\n\n child = currentAbsoluteChild;\n currentAbsoluteChild = currentAbsoluteChild.nextAbsoluteChild;\n child.nextAbsoluteChild = null;\n }\n }\n\n function layoutNode(node, parentMaxWidth, parentMaxHeight, parentDirection) {\n node.shouldUpdate = true;\n\n var direction = node.style.direction || CSS_DIRECTION_LTR;\n var skipLayout =\n !node.isDirty &&\n node.lastLayout &&\n node.lastLayout.requestedHeight === node.layout.height &&\n node.lastLayout.requestedWidth === node.layout.width &&\n node.lastLayout.parentMaxWidth === parentMaxWidth &&\n node.lastLayout.parentMaxHeight === parentMaxHeight &&\n node.lastLayout.direction === direction;\n\n if (skipLayout) {\n node.layout.width = node.lastLayout.width;\n node.layout.height = node.lastLayout.height;\n node.layout.top = node.lastLayout.top;\n node.layout.left = node.lastLayout.left;\n } else {\n if (!node.lastLayout) {\n node.lastLayout = {};\n }\n\n node.lastLayout.requestedWidth = node.layout.width;\n node.lastLayout.requestedHeight = node.layout.height;\n node.lastLayout.parentMaxWidth = parentMaxWidth;\n node.lastLayout.parentMaxHeight = parentMaxHeight;\n node.lastLayout.direction = direction;\n\n // Reset child layouts\n node.children.forEach(function(child) {\n child.layout.width = undefined;\n child.layout.height = undefined;\n child.layout.top = 0;\n child.layout.left = 0;\n });\n\n layoutNodeImpl(node, parentMaxWidth, parentMaxHeight, parentDirection);\n\n node.lastLayout.width = node.layout.width;\n node.lastLayout.height = node.layout.height;\n node.lastLayout.top = node.layout.top;\n node.lastLayout.left = node.layout.left;\n }\n }\n\n return {\n layoutNodeImpl: layoutNodeImpl,\n computeLayout: layoutNode,\n fillNodes: fillNodes\n };\n})();\n\n// This module export is only used for the purposes of unit testing this file. When\n// the library is packaged this file is included within css-layout.js which forms\n// the public API.\nif (typeof exports === 'object') {\n module.exports = computeLayout;\n}\n\n\n return function(node) {\n /*eslint-disable */\n // disabling ESLint because this code relies on the above include\n computeLayout.fillNodes(node);\n computeLayout.computeLayout(node);\n /*eslint-enable */\n };\n}));\n"]} \ No newline at end of file diff --git a/src/Layout.c b/src/Layout.c index 2440041f..5d112330 100644 --- a/src/Layout.c +++ b/src/Layout.c @@ -679,8 +679,8 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM float mainDim = leadingPaddingAndBorderMain; float crossDim = 0; - float maxWidth; - float maxHeight; + float maxWidth = CSS_UNDEFINED; + float maxHeight = CSS_UNDEFINED; for (i = startLine; i < childCount; ++i) { child = node->get_child(node->context, i); child->line_index = linesCount; @@ -824,7 +824,7 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM if (isSimpleStackCross && (child->style.position_type != CSS_POSITION_RELATIVE || (alignItem != CSS_ALIGN_STRETCH && alignItem != CSS_ALIGN_FLEX_START) || - !isLayoutDimDefined(child, crossAxis))) { + (alignItem == CSS_ALIGN_STRETCH && !isCrossDimDefined))) { isSimpleStackCross = false; firstComplexCross = i; } @@ -1034,15 +1034,31 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM css_align_t alignItem = getAlignItem(node, child); /*eslint-enable */ if (alignItem == CSS_ALIGN_STRETCH) { - // You can only stretch if the dimension has not already been set + // You can only stretch if the dimension has not already been defined // previously. - if (!isLayoutDimDefined(child, crossAxis)) { + if (!isStyleDimDefined(child, crossAxis)) { + float dimCrossAxis = child->layout.dimensions[dim[crossAxis]]; child->layout.dimensions[dim[crossAxis]] = fmaxf( boundAxis(child, crossAxis, containerCrossAxis - paddingAndBorderAxisCross - getMarginAxis(child, crossAxis)), // You never want to go smaller than padding getPaddingAndBorderAxis(child, crossAxis) ); + + // If the size has changed, and this child has children we need to re-layout this child + if (dimCrossAxis != child->layout.dimensions[dim[crossAxis]] && child->children_count > 0) { + // Reset child margins before re-layout as they are added back in layoutNode and would be doubled + child->layout.position[leading[mainAxis]] -= getLeadingMargin(child, mainAxis) + + getRelativePosition(child, mainAxis); + child->layout.position[trailing[mainAxis]] -= getTrailingMargin(child, mainAxis) + + getRelativePosition(child, mainAxis); + child->layout.position[leading[crossAxis]] -= getLeadingMargin(child, crossAxis) + + getRelativePosition(child, crossAxis); + child->layout.position[trailing[crossAxis]] -= getTrailingMargin(child, crossAxis) + + getRelativePosition(child, crossAxis); + + layoutNode(child, maxWidth, maxHeight, direction); + } } } else if (alignItem != CSS_ALIGN_FLEX_START) { // The remaining space between the parent dimensions+padding and child diff --git a/src/Layout.js b/src/Layout.js index ec8f0521..e656849f 100755 --- a/src/Layout.js +++ b/src/Layout.js @@ -604,8 +604,8 @@ var computeLayout = (function() { var/*float*/ mainDim = leadingPaddingAndBorderMain; var/*float*/ crossDim = 0; - var/*float*/ maxWidth; - var/*float*/ maxHeight; + var/*float*/ maxWidth = CSS_UNDEFINED; + var/*float*/ maxHeight = CSS_UNDEFINED; for (i = startLine; i < childCount; ++i) { child = node.children[i]; child.lineIndex = linesCount; @@ -749,7 +749,7 @@ var computeLayout = (function() { if (isSimpleStackCross && (getPositionType(child) !== CSS_POSITION_RELATIVE || (alignItem !== CSS_ALIGN_STRETCH && alignItem !== CSS_ALIGN_FLEX_START) || - !isLayoutDimDefined(child, crossAxis))) { + (alignItem == CSS_ALIGN_STRETCH && !isCrossDimDefined))) { isSimpleStackCross = false; firstComplexCross = i; } @@ -959,15 +959,31 @@ var computeLayout = (function() { var/*css_align_t*/ alignItem = getAlignItem(node, child); /*eslint-enable */ if (alignItem === CSS_ALIGN_STRETCH) { - // You can only stretch if the dimension has not already been set + // You can only stretch if the dimension has not already been defined // previously. - if (!isLayoutDimDefined(child, crossAxis)) { + if (!isStyleDimDefined(child, crossAxis)) { + var/*float*/ dimCrossAxis = child.layout[dim[crossAxis]]; child.layout[dim[crossAxis]] = fmaxf( boundAxis(child, crossAxis, containerCrossAxis - paddingAndBorderAxisCross - getMarginAxis(child, crossAxis)), // You never want to go smaller than padding getPaddingAndBorderAxis(child, crossAxis) ); + + // If the size has changed, and this child has children we need to re-layout this child + if (dimCrossAxis != child.layout[dim[crossAxis]] && child.children.length > 0) { + // Reset child margins before re-layout as they are added back in layoutNode and would be doubled + child.layout[leading[mainAxis]] -= getLeadingMargin(child, mainAxis) + + getRelativePosition(child, mainAxis); + child.layout[trailing[mainAxis]] -= getTrailingMargin(child, mainAxis) + + getRelativePosition(child, mainAxis); + child.layout[leading[crossAxis]] -= getLeadingMargin(child, crossAxis) + + getRelativePosition(child, crossAxis); + child.layout[trailing[crossAxis]] -= getTrailingMargin(child, crossAxis) + + getRelativePosition(child, crossAxis); + + layoutNode(/*(java)!layoutContext, */child, maxWidth, maxHeight, direction); + } } } else if (alignItem !== CSS_ALIGN_FLEX_START) { // The remaining space between the parent dimensions+padding and child diff --git a/src/__tests__/Layout-test.c b/src/__tests__/Layout-test.c index 0d462881..fe31e683 100644 --- a/src/__tests__/Layout-test.c +++ b/src/__tests__/Layout-test.c @@ -7720,6 +7720,202 @@ int main() test("should correctly progagate size contraints from flexible parents", root_node, root_layout); } + { + css_node_t *root_node = new_test_css_node(); + { + css_node_t *node_0 = root_node; + node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW; + node_0->style.align_items = CSS_ALIGN_STRETCH; + node_0->style.dimensions[CSS_WIDTH] = 150; + init_css_node_children(node_0, 2); + { + css_node_t *node_1; + node_1 = node_0->get_child(node_0->context, 0); + node_1->style.flex_direction = CSS_FLEX_DIRECTION_ROW; + node_1->style.margin[CSS_LEFT] = 10; + node_1->style.margin[CSS_TOP] = 10; + init_css_node_children(node_1, 1); + { + css_node_t *node_2; + node_2 = node_1->get_child(node_1->context, 0); + node_2->style.flex_direction = CSS_FLEX_DIRECTION_ROW; + init_css_node_children(node_2, 1); + { + css_node_t *node_3; + node_3 = node_2->get_child(node_2->context, 0); + node_3->style.align_self = CSS_ALIGN_CENTER; + } + } + node_1 = node_0->get_child(node_0->context, 1); + node_1->style.dimensions[CSS_HEIGHT] = 150; + } + } + + css_node_t *root_layout = new_test_css_node(); + { + css_node_t *node_0 = root_layout; + node_0->layout.position[CSS_TOP] = 0; + node_0->layout.position[CSS_LEFT] = 0; + node_0->layout.dimensions[CSS_WIDTH] = 150; + node_0->layout.dimensions[CSS_HEIGHT] = 150; + init_css_node_children(node_0, 2); + { + css_node_t *node_1; + node_1 = node_0->get_child(node_0->context, 0); + node_1->layout.position[CSS_TOP] = 10; + node_1->layout.position[CSS_LEFT] = 10; + node_1->layout.dimensions[CSS_WIDTH] = 0; + node_1->layout.dimensions[CSS_HEIGHT] = 140; + init_css_node_children(node_1, 1); + { + css_node_t *node_2; + node_2 = node_1->get_child(node_1->context, 0); + node_2->layout.position[CSS_TOP] = 0; + node_2->layout.position[CSS_LEFT] = 0; + node_2->layout.dimensions[CSS_WIDTH] = 0; + node_2->layout.dimensions[CSS_HEIGHT] = 140; + init_css_node_children(node_2, 1); + { + css_node_t *node_3; + node_3 = node_2->get_child(node_2->context, 0); + node_3->layout.position[CSS_TOP] = 70; + node_3->layout.position[CSS_LEFT] = 0; + node_3->layout.dimensions[CSS_WIDTH] = 0; + node_3->layout.dimensions[CSS_HEIGHT] = 0; + } + } + node_1 = node_0->get_child(node_0->context, 1); + node_1->layout.position[CSS_TOP] = 0; + node_1->layout.position[CSS_LEFT] = 10; + node_1->layout.dimensions[CSS_WIDTH] = 0; + node_1->layout.dimensions[CSS_HEIGHT] = 150; + } + } + + test("should layout content of an item which is stretched late", root_node, root_layout); + } + + { + css_node_t *root_node = new_test_css_node(); + { + css_node_t *node_0 = root_node; + init_css_node_children(node_0, 2); + { + css_node_t *node_1; + node_1 = node_0->get_child(node_0->context, 0); + init_css_node_children(node_1, 1); + { + css_node_t *node_2; + node_2 = node_1->get_child(node_1->context, 0); + node_2->style.dimensions[CSS_WIDTH] = 200; + node_2->style.dimensions[CSS_HEIGHT] = 200; + } + node_1 = node_0->get_child(node_0->context, 1); + node_1->style.margin[CSS_LEFT] = 10; + node_1->style.margin[CSS_TOP] = 10; + init_css_node_children(node_1, 1); + { + css_node_t *node_2; + node_2 = node_1->get_child(node_1->context, 0); + } + } + } + + css_node_t *root_layout = new_test_css_node(); + { + css_node_t *node_0 = root_layout; + node_0->layout.position[CSS_TOP] = 0; + node_0->layout.position[CSS_LEFT] = 0; + node_0->layout.dimensions[CSS_WIDTH] = 200; + node_0->layout.dimensions[CSS_HEIGHT] = 210; + init_css_node_children(node_0, 2); + { + css_node_t *node_1; + node_1 = node_0->get_child(node_0->context, 0); + node_1->layout.position[CSS_TOP] = 0; + node_1->layout.position[CSS_LEFT] = 0; + node_1->layout.dimensions[CSS_WIDTH] = 200; + node_1->layout.dimensions[CSS_HEIGHT] = 200; + init_css_node_children(node_1, 1); + { + css_node_t *node_2; + node_2 = node_1->get_child(node_1->context, 0); + node_2->layout.position[CSS_TOP] = 0; + node_2->layout.position[CSS_LEFT] = 0; + node_2->layout.dimensions[CSS_WIDTH] = 200; + node_2->layout.dimensions[CSS_HEIGHT] = 200; + } + node_1 = node_0->get_child(node_0->context, 1); + node_1->layout.position[CSS_TOP] = 210; + node_1->layout.position[CSS_LEFT] = 10; + node_1->layout.dimensions[CSS_WIDTH] = 190; + node_1->layout.dimensions[CSS_HEIGHT] = 0; + init_css_node_children(node_1, 1); + { + css_node_t *node_2; + node_2 = node_1->get_child(node_1->context, 0); + node_2->layout.position[CSS_TOP] = 0; + node_2->layout.position[CSS_LEFT] = 0; + node_2->layout.dimensions[CSS_WIDTH] = 190; + node_2->layout.dimensions[CSS_HEIGHT] = 0; + } + } + } + + test("should layout items whose positioning is determined by sibling tree branches", root_node, root_layout); + } + + { + css_node_t *root_node = new_test_css_node(); + { + css_node_t *node_0 = root_node; + node_0->style.flex_direction = CSS_FLEX_DIRECTION_ROW; + init_css_node_children(node_0, 3); + { + css_node_t *node_1; + node_1 = node_0->get_child(node_0->context, 0); + node_1->style.align_self = CSS_ALIGN_FLEX_START; + node_1->style.margin[CSS_LEFT] = 10; + node_1->style.margin[CSS_TOP] = 10; + node_1 = node_0->get_child(node_0->context, 1); + node_1->style.align_self = CSS_ALIGN_STRETCH; + node_1->style.dimensions[CSS_WIDTH] = 1; + node_1 = node_0->get_child(node_0->context, 2); + node_1->style.dimensions[CSS_HEIGHT] = 150; + } + } + + css_node_t *root_layout = new_test_css_node(); + { + css_node_t *node_0 = root_layout; + node_0->layout.position[CSS_TOP] = 0; + node_0->layout.position[CSS_LEFT] = 0; + node_0->layout.dimensions[CSS_WIDTH] = 11; + node_0->layout.dimensions[CSS_HEIGHT] = 150; + init_css_node_children(node_0, 3); + { + css_node_t *node_1; + node_1 = node_0->get_child(node_0->context, 0); + node_1->layout.position[CSS_TOP] = 10; + node_1->layout.position[CSS_LEFT] = 10; + node_1->layout.dimensions[CSS_WIDTH] = 0; + node_1->layout.dimensions[CSS_HEIGHT] = 0; + node_1 = node_0->get_child(node_0->context, 1); + node_1->layout.position[CSS_TOP] = 0; + node_1->layout.position[CSS_LEFT] = 10; + node_1->layout.dimensions[CSS_WIDTH] = 1; + node_1->layout.dimensions[CSS_HEIGHT] = 150; + node_1 = node_0->get_child(node_0->context, 2); + node_1->layout.position[CSS_TOP] = 0; + node_1->layout.position[CSS_LEFT] = 11; + node_1->layout.dimensions[CSS_WIDTH] = 0; + node_1->layout.dimensions[CSS_HEIGHT] = 150; + } + } + + test("should layout child whose cross axis is undefined and whose alignSelf is stretch", root_node, root_layout); + } + { css_node_t *root_node = new_test_css_node(); { diff --git a/src/__tests__/Layout-test.js b/src/__tests__/Layout-test.js index 38399ce1..aed51c52 100755 --- a/src/__tests__/Layout-test.js +++ b/src/__tests__/Layout-test.js @@ -2401,6 +2401,64 @@ describe('Layout', function() { ]} ); }); + + // https://github.com/facebook/css-layout/issues/127 + it('should layout content of an item which is stretched late', function() { + testLayout( + {style: {flexDirection: 'row', alignItems: 'stretch', width: 150}, children: [ + {style: {flexDirection: 'row', marginTop: 10, marginLeft: 10}, children: [ + {style: {flexDirection: 'row'}, children: [ + {style: {alignSelf: 'center'}} + ]} + ]}, + {style: { height: 150}} + ]}, + {width: 150, height: 150, top: 0, left: 0, children: [ + {width: 0, height: 140, top: 10, left: 10, children: [ + {width: 0, height: 140, top: 0, left: 0, children: [ + {width: 0, height: 0, top: 70, left: 0} + ]} + ]}, + {width: 0, height: 150, top: 0, left: 10} + ]} + ); + }); + + it('should layout items whose positioning is determined by sibling tree branches', function() { + testLayout( + {style: {}, children: [ + {style: {}, children: [ + {style: {width: 200, height: 200}} + ]}, + {style: {marginTop: 10, marginLeft: 10}, children: [ + {style: {}} + ]} + ]}, + {width: 200, height: 210, top: 0, left: 0, children: [ + {width: 200, height: 200, top: 0, left: 0, children: [ + {width: 200, height: 200, top: 0, left: 0} + ]}, + {width: 190, height: 0, top: 210, left: 10, children: [ + {width: 190, height: 0, top: 0, left: 0} + ]} + ]} + ); + }); + + it('should layout child whose cross axis is undefined and whose alignSelf is stretch', function() { + testLayout( + {style: {flexDirection: 'row'}, children: [ + {style: {marginTop: 10, marginLeft: 10, alignSelf: 'flex-start'}}, + {style: {width: 1, alignSelf: 'stretch'}}, + {style: {height: 150}} + ]}, + {width: 11, height: 150, top: 0, left: 0, children: [ + {width: 0, height: 0, top: 10, left: 10}, + {width: 1, height: 150, top: 0, left: 10}, + {width: 0, height: 150, top: 0, left: 11} + ]} + ); + }); }); describe('Layout alignContent', function() { diff --git a/src/csharp/Facebook.CSSLayout.Tests/LayoutCachingTest.cs b/src/csharp/Facebook.CSSLayout.Tests/LayoutCachingTest.cs index 7c260eff..cf99b36c 100644 --- a/src/csharp/Facebook.CSSLayout.Tests/LayoutCachingTest.cs +++ b/src/csharp/Facebook.CSSLayout.Tests/LayoutCachingTest.cs @@ -88,7 +88,7 @@ namespace Facebook.CSSLayout.Tests Assert.IsTrue(c0c0.HasNewLayout); Assert.IsTrue(c1.HasNewLayout); - Assert.IsFalse(c1c0.HasNewLayout); + Assert.IsTrue(c1c0.HasNewLayout); } [Test] @@ -136,7 +136,7 @@ namespace Facebook.CSSLayout.Tests Assert.IsTrue(c1.HasNewLayout); Assert.IsTrue(c0.HasNewLayout); - Assert.IsFalse(c0c0.HasNewLayout); + Assert.IsTrue(c0c0.HasNewLayout); } [Test] @@ -155,7 +155,7 @@ namespace Facebook.CSSLayout.Tests root.calculateLayout(); markLayoutAppliedForTree(root); - c0.Height = 200; + c0.Width = 200; root.calculateLayout(); Assert.IsTrue(root.HasNewLayout); @@ -163,7 +163,7 @@ namespace Facebook.CSSLayout.Tests Assert.IsTrue(c0c0.HasNewLayout); Assert.IsTrue(c1.HasNewLayout); - Assert.IsFalse(c1c0.HasNewLayout); + Assert.IsTrue(c1c0.HasNewLayout); } [Test] @@ -234,7 +234,7 @@ namespace Facebook.CSSLayout.Tests Assert.IsTrue(c1.HasNewLayout); Assert.IsTrue(c0.HasNewLayout); - Assert.IsFalse(c0c0.HasNewLayout); + Assert.IsTrue(c0c0.HasNewLayout); } } } diff --git a/src/csharp/Facebook.CSSLayout.Tests/LayoutEngineTest.cs b/src/csharp/Facebook.CSSLayout.Tests/LayoutEngineTest.cs index 0aa3d16f..3b81ed53 100644 --- a/src/csharp/Facebook.CSSLayout.Tests/LayoutEngineTest.cs +++ b/src/csharp/Facebook.CSSLayout.Tests/LayoutEngineTest.cs @@ -8185,6 +8185,208 @@ public class LayoutEngineTest [Test] public void TestCase184() + { + TestCSSNode root_node = new TestCSSNode(); + { + TestCSSNode node_0 = root_node; + node_0.style.flexDirection = CSSFlexDirection.Row; + node_0.style.alignItems = CSSAlign.Stretch; + node_0.style.dimensions[DIMENSION_WIDTH] = 150; + addChildren(node_0, 2); + { + TestCSSNode node_1; + node_1 = node_0.getChildAt(0); + node_1.style.flexDirection = CSSFlexDirection.Row; + node_1.setMargin(Spacing.LEFT, 10); + node_1.setMargin(Spacing.TOP, 10); + addChildren(node_1, 1); + { + TestCSSNode node_2; + node_2 = node_1.getChildAt(0); + node_2.style.flexDirection = CSSFlexDirection.Row; + addChildren(node_2, 1); + { + TestCSSNode node_3; + node_3 = node_2.getChildAt(0); + node_3.style.alignSelf = CSSAlign.Center; + } + } + node_1 = node_0.getChildAt(1); + node_1.style.dimensions[DIMENSION_HEIGHT] = 150; + } + } + + TestCSSNode root_layout = new TestCSSNode(); + { + TestCSSNode node_0 = root_layout; + node_0.layout.position[POSITION_TOP] = 0; + node_0.layout.position[POSITION_LEFT] = 0; + node_0.layout.dimensions[DIMENSION_WIDTH] = 150; + node_0.layout.dimensions[DIMENSION_HEIGHT] = 150; + addChildren(node_0, 2); + { + TestCSSNode node_1; + node_1 = node_0.getChildAt(0); + node_1.layout.position[POSITION_TOP] = 10; + node_1.layout.position[POSITION_LEFT] = 10; + node_1.layout.dimensions[DIMENSION_WIDTH] = 0; + node_1.layout.dimensions[DIMENSION_HEIGHT] = 140; + addChildren(node_1, 1); + { + TestCSSNode node_2; + node_2 = node_1.getChildAt(0); + node_2.layout.position[POSITION_TOP] = 0; + node_2.layout.position[POSITION_LEFT] = 0; + node_2.layout.dimensions[DIMENSION_WIDTH] = 0; + node_2.layout.dimensions[DIMENSION_HEIGHT] = 140; + addChildren(node_2, 1); + { + TestCSSNode node_3; + node_3 = node_2.getChildAt(0); + node_3.layout.position[POSITION_TOP] = 70; + node_3.layout.position[POSITION_LEFT] = 0; + node_3.layout.dimensions[DIMENSION_WIDTH] = 0; + node_3.layout.dimensions[DIMENSION_HEIGHT] = 0; + } + } + node_1 = node_0.getChildAt(1); + node_1.layout.position[POSITION_TOP] = 0; + node_1.layout.position[POSITION_LEFT] = 10; + node_1.layout.dimensions[DIMENSION_WIDTH] = 0; + node_1.layout.dimensions[DIMENSION_HEIGHT] = 150; + } + } + + test("should layout content of an item which is stretched late", root_node, root_layout); + } + + [Test] + public void TestCase185() + { + TestCSSNode root_node = new TestCSSNode(); + { + TestCSSNode node_0 = root_node; + addChildren(node_0, 2); + { + TestCSSNode node_1; + node_1 = node_0.getChildAt(0); + addChildren(node_1, 1); + { + TestCSSNode node_2; + node_2 = node_1.getChildAt(0); + node_2.style.dimensions[DIMENSION_WIDTH] = 200; + node_2.style.dimensions[DIMENSION_HEIGHT] = 200; + } + node_1 = node_0.getChildAt(1); + node_1.setMargin(Spacing.LEFT, 10); + node_1.setMargin(Spacing.TOP, 10); + addChildren(node_1, 1); + { + TestCSSNode node_2; + node_2 = node_1.getChildAt(0); + } + } + } + + TestCSSNode root_layout = new TestCSSNode(); + { + TestCSSNode node_0 = root_layout; + node_0.layout.position[POSITION_TOP] = 0; + node_0.layout.position[POSITION_LEFT] = 0; + node_0.layout.dimensions[DIMENSION_WIDTH] = 200; + node_0.layout.dimensions[DIMENSION_HEIGHT] = 210; + addChildren(node_0, 2); + { + TestCSSNode node_1; + node_1 = node_0.getChildAt(0); + node_1.layout.position[POSITION_TOP] = 0; + node_1.layout.position[POSITION_LEFT] = 0; + node_1.layout.dimensions[DIMENSION_WIDTH] = 200; + node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; + addChildren(node_1, 1); + { + TestCSSNode node_2; + node_2 = node_1.getChildAt(0); + node_2.layout.position[POSITION_TOP] = 0; + node_2.layout.position[POSITION_LEFT] = 0; + node_2.layout.dimensions[DIMENSION_WIDTH] = 200; + node_2.layout.dimensions[DIMENSION_HEIGHT] = 200; + } + node_1 = node_0.getChildAt(1); + node_1.layout.position[POSITION_TOP] = 210; + node_1.layout.position[POSITION_LEFT] = 10; + node_1.layout.dimensions[DIMENSION_WIDTH] = 190; + node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; + addChildren(node_1, 1); + { + TestCSSNode node_2; + node_2 = node_1.getChildAt(0); + node_2.layout.position[POSITION_TOP] = 0; + node_2.layout.position[POSITION_LEFT] = 0; + node_2.layout.dimensions[DIMENSION_WIDTH] = 190; + node_2.layout.dimensions[DIMENSION_HEIGHT] = 0; + } + } + } + + test("should layout items whose positioning is determined by sibling tree branches", root_node, root_layout); + } + + [Test] + public void TestCase186() + { + TestCSSNode root_node = new TestCSSNode(); + { + TestCSSNode node_0 = root_node; + node_0.style.flexDirection = CSSFlexDirection.Row; + addChildren(node_0, 3); + { + TestCSSNode node_1; + node_1 = node_0.getChildAt(0); + node_1.style.alignSelf = CSSAlign.FlexStart; + node_1.setMargin(Spacing.LEFT, 10); + node_1.setMargin(Spacing.TOP, 10); + node_1 = node_0.getChildAt(1); + node_1.style.alignSelf = CSSAlign.Stretch; + node_1.style.dimensions[DIMENSION_WIDTH] = 1; + node_1 = node_0.getChildAt(2); + node_1.style.dimensions[DIMENSION_HEIGHT] = 150; + } + } + + TestCSSNode root_layout = new TestCSSNode(); + { + TestCSSNode node_0 = root_layout; + node_0.layout.position[POSITION_TOP] = 0; + node_0.layout.position[POSITION_LEFT] = 0; + node_0.layout.dimensions[DIMENSION_WIDTH] = 11; + node_0.layout.dimensions[DIMENSION_HEIGHT] = 150; + addChildren(node_0, 3); + { + TestCSSNode node_1; + node_1 = node_0.getChildAt(0); + node_1.layout.position[POSITION_TOP] = 10; + node_1.layout.position[POSITION_LEFT] = 10; + node_1.layout.dimensions[DIMENSION_WIDTH] = 0; + node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; + node_1 = node_0.getChildAt(1); + node_1.layout.position[POSITION_TOP] = 0; + node_1.layout.position[POSITION_LEFT] = 10; + node_1.layout.dimensions[DIMENSION_WIDTH] = 1; + node_1.layout.dimensions[DIMENSION_HEIGHT] = 150; + node_1 = node_0.getChildAt(2); + node_1.layout.position[POSITION_TOP] = 0; + node_1.layout.position[POSITION_LEFT] = 11; + node_1.layout.dimensions[DIMENSION_WIDTH] = 0; + node_1.layout.dimensions[DIMENSION_HEIGHT] = 150; + } + } + + test("should layout child whose cross axis is undefined and whose alignSelf is stretch", root_node, root_layout); + } + + [Test] + public void TestCase187() { TestCSSNode root_node = new TestCSSNode(); { diff --git a/src/csharp/Facebook.CSSLayout/LayoutEngine.cs b/src/csharp/Facebook.CSSLayout/LayoutEngine.cs index 4d5543d8..51ba4d33 100644 --- a/src/csharp/Facebook.CSSLayout/LayoutEngine.cs +++ b/src/csharp/Facebook.CSSLayout/LayoutEngine.cs @@ -404,8 +404,8 @@ namespace Facebook.CSSLayout float mainDim = leadingPaddingAndBorderMain; float crossDim = 0; - float maxWidth; - float maxHeight; + float maxWidth = CSSConstants.Undefined; + float maxHeight = CSSConstants.Undefined; for (i = startLine; i < childCount; ++i) { child = node.getChildAt(i); child.lineIndex = linesCount; @@ -549,7 +549,7 @@ namespace Facebook.CSSLayout if (isSimpleStackCross && (child.style.positionType != CSSPositionType.Relative || (alignItem != CSSAlign.Stretch && alignItem != CSSAlign.FlexStart) || - !(!float.IsNaN(child.layout.dimensions[dim[crossAxis]]) && child.layout.dimensions[dim[crossAxis]] >= 0.0))) { + (alignItem == CSSAlign.Stretch && !isCrossDimDefined))) { isSimpleStackCross = false; firstComplexCross = i; } @@ -759,15 +759,31 @@ namespace Facebook.CSSLayout CSSAlign alignItem = getAlignItem(node, child); /*eslint-enable */ if (alignItem == CSSAlign.Stretch) { - // You can only stretch if the dimension has not already been set + // You can only stretch if the dimension has not already been defined // previously. - if (!(!float.IsNaN(child.layout.dimensions[dim[crossAxis]]) && child.layout.dimensions[dim[crossAxis]] >= 0.0)) { + if (!(!float.IsNaN(child.style.dimensions[dim[crossAxis]]) && child.style.dimensions[dim[crossAxis]] >= 0.0)) { + float dimCrossAxis = child.layout.dimensions[dim[crossAxis]]; child.layout.dimensions[dim[crossAxis]] = Math.Max( boundAxis(child, crossAxis, containerCrossAxis - paddingAndBorderAxisCross - (child.style.margin.getWithFallback(leadingSpacing[crossAxis], leading[crossAxis]) + child.style.margin.getWithFallback(trailingSpacing[crossAxis], trailing[crossAxis]))), // You never want to go smaller than padding ((child.style.padding.getWithFallback(leadingSpacing[crossAxis], leading[crossAxis]) + child.style.border.getWithFallback(leadingSpacing[crossAxis], leading[crossAxis])) + (child.style.padding.getWithFallback(trailingSpacing[crossAxis], trailing[crossAxis]) + child.style.border.getWithFallback(trailingSpacing[crossAxis], trailing[crossAxis]))) ); + + // If the size has changed, and this child has children we need to re-layout this child + if (dimCrossAxis != child.layout.dimensions[dim[crossAxis]] && child.getChildCount() > 0) { + // Reset child margins before re-layout as they are added back in layoutNode and would be doubled + child.layout.position[leading[mainAxis]] -= child.style.margin.getWithFallback(leadingSpacing[mainAxis], leading[mainAxis]) + + getRelativePosition(child, mainAxis); + child.layout.position[trailing[mainAxis]] -= child.style.margin.getWithFallback(trailingSpacing[mainAxis], trailing[mainAxis]) + + getRelativePosition(child, mainAxis); + child.layout.position[leading[crossAxis]] -= child.style.margin.getWithFallback(leadingSpacing[crossAxis], leading[crossAxis]) + + getRelativePosition(child, crossAxis); + child.layout.position[trailing[crossAxis]] -= child.style.margin.getWithFallback(trailingSpacing[crossAxis], trailing[crossAxis]) + + getRelativePosition(child, crossAxis); + + layoutNode(layoutContext, child, maxWidth, maxHeight, direction); + } } } else if (alignItem != CSSAlign.FlexStart) { // The remaining space between the parent dimensions+padding and child diff --git a/src/java/src/com/facebook/csslayout/LayoutEngine.java b/src/java/src/com/facebook/csslayout/LayoutEngine.java index f4743291..7106580b 100644 --- a/src/java/src/com/facebook/csslayout/LayoutEngine.java +++ b/src/java/src/com/facebook/csslayout/LayoutEngine.java @@ -380,8 +380,8 @@ public class LayoutEngine { float mainDim = leadingPaddingAndBorderMain; float crossDim = 0; - float maxWidth; - float maxHeight; + float maxWidth = CSSConstants.UNDEFINED; + float maxHeight = CSSConstants.UNDEFINED; for (i = startLine; i < childCount; ++i) { child = node.getChildAt(i); child.lineIndex = linesCount; @@ -525,7 +525,7 @@ public class LayoutEngine { if (isSimpleStackCross && (child.style.positionType != CSSPositionType.RELATIVE || (alignItem != CSSAlign.STRETCH && alignItem != CSSAlign.FLEX_START) || - !(!Float.isNaN(child.layout.dimensions[dim[crossAxis]]) && child.layout.dimensions[dim[crossAxis]] >= 0.0))) { + (alignItem == CSSAlign.STRETCH && !isCrossDimDefined))) { isSimpleStackCross = false; firstComplexCross = i; } @@ -735,15 +735,31 @@ public class LayoutEngine { CSSAlign alignItem = getAlignItem(node, child); /*eslint-enable */ if (alignItem == CSSAlign.STRETCH) { - // You can only stretch if the dimension has not already been set + // You can only stretch if the dimension has not already been defined // previously. - if (!(!Float.isNaN(child.layout.dimensions[dim[crossAxis]]) && child.layout.dimensions[dim[crossAxis]] >= 0.0)) { + if (!(!Float.isNaN(child.style.dimensions[dim[crossAxis]]) && child.style.dimensions[dim[crossAxis]] >= 0.0)) { + float dimCrossAxis = child.layout.dimensions[dim[crossAxis]]; child.layout.dimensions[dim[crossAxis]] = Math.max( boundAxis(child, crossAxis, containerCrossAxis - paddingAndBorderAxisCross - (child.style.margin.getWithFallback(leadingSpacing[crossAxis], leading[crossAxis]) + child.style.margin.getWithFallback(trailingSpacing[crossAxis], trailing[crossAxis]))), // You never want to go smaller than padding ((child.style.padding.getWithFallback(leadingSpacing[crossAxis], leading[crossAxis]) + child.style.border.getWithFallback(leadingSpacing[crossAxis], leading[crossAxis])) + (child.style.padding.getWithFallback(trailingSpacing[crossAxis], trailing[crossAxis]) + child.style.border.getWithFallback(trailingSpacing[crossAxis], trailing[crossAxis]))) ); + + // If the size has changed, and this child has children we need to re-layout this child + if (dimCrossAxis != child.layout.dimensions[dim[crossAxis]] && child.getChildCount() > 0) { + // Reset child margins before re-layout as they are added back in layoutNode and would be doubled + child.layout.position[leading[mainAxis]] -= child.style.margin.getWithFallback(leadingSpacing[mainAxis], leading[mainAxis]) + + getRelativePosition(child, mainAxis); + child.layout.position[trailing[mainAxis]] -= child.style.margin.getWithFallback(trailingSpacing[mainAxis], trailing[mainAxis]) + + getRelativePosition(child, mainAxis); + child.layout.position[leading[crossAxis]] -= child.style.margin.getWithFallback(leadingSpacing[crossAxis], leading[crossAxis]) + + getRelativePosition(child, crossAxis); + child.layout.position[trailing[crossAxis]] -= child.style.margin.getWithFallback(trailingSpacing[crossAxis], trailing[crossAxis]) + + getRelativePosition(child, crossAxis); + + layoutNode(layoutContext, child, maxWidth, maxHeight, direction); + } } } else if (alignItem != CSSAlign.FLEX_START) { // The remaining space between the parent dimensions+padding and child diff --git a/src/java/tests/com/facebook/csslayout/LayoutCachingTest.java b/src/java/tests/com/facebook/csslayout/LayoutCachingTest.java index 6e630fbb..866996ee 100644 --- a/src/java/tests/com/facebook/csslayout/LayoutCachingTest.java +++ b/src/java/tests/com/facebook/csslayout/LayoutCachingTest.java @@ -83,7 +83,7 @@ public class LayoutCachingTest { assertTrue(c0c0.hasNewLayout()); assertTrue(c1.hasNewLayout()); - assertFalse(c1c0.hasNewLayout()); + assertTrue(c1c0.hasNewLayout()); } @Test @@ -131,7 +131,7 @@ public class LayoutCachingTest { assertTrue(c1.hasNewLayout()); assertTrue(c0.hasNewLayout()); - assertFalse(c0c0.hasNewLayout()); + assertTrue(c0c0.hasNewLayout()); } @Test @@ -158,7 +158,7 @@ public class LayoutCachingTest { assertTrue(c0c0.hasNewLayout()); assertTrue(c1.hasNewLayout()); - assertFalse(c1c0.hasNewLayout()); + assertTrue(c1c0.hasNewLayout()); } @Test @@ -235,6 +235,6 @@ public class LayoutCachingTest { assertTrue(c1.hasNewLayout()); assertTrue(c0.hasNewLayout()); - assertFalse(c0c0.hasNewLayout()); + assertTrue(c0c0.hasNewLayout()); } } diff --git a/src/java/tests/com/facebook/csslayout/LayoutEngineTest.java b/src/java/tests/com/facebook/csslayout/LayoutEngineTest.java index b18859ec..66788c50 100644 --- a/src/java/tests/com/facebook/csslayout/LayoutEngineTest.java +++ b/src/java/tests/com/facebook/csslayout/LayoutEngineTest.java @@ -8188,6 +8188,208 @@ public class LayoutEngineTest { @Test public void testCase184() + { + TestCSSNode root_node = new TestCSSNode(); + { + TestCSSNode node_0 = root_node; + node_0.style.flexDirection = CSSFlexDirection.ROW; + node_0.style.alignItems = CSSAlign.STRETCH; + node_0.style.dimensions[DIMENSION_WIDTH] = 150; + addChildren(node_0, 2); + { + TestCSSNode node_1; + node_1 = node_0.getChildAt(0); + node_1.style.flexDirection = CSSFlexDirection.ROW; + node_1.setMargin(Spacing.LEFT, 10); + node_1.setMargin(Spacing.TOP, 10); + addChildren(node_1, 1); + { + TestCSSNode node_2; + node_2 = node_1.getChildAt(0); + node_2.style.flexDirection = CSSFlexDirection.ROW; + addChildren(node_2, 1); + { + TestCSSNode node_3; + node_3 = node_2.getChildAt(0); + node_3.style.alignSelf = CSSAlign.CENTER; + } + } + node_1 = node_0.getChildAt(1); + node_1.style.dimensions[DIMENSION_HEIGHT] = 150; + } + } + + TestCSSNode root_layout = new TestCSSNode(); + { + TestCSSNode node_0 = root_layout; + node_0.layout.position[POSITION_TOP] = 0; + node_0.layout.position[POSITION_LEFT] = 0; + node_0.layout.dimensions[DIMENSION_WIDTH] = 150; + node_0.layout.dimensions[DIMENSION_HEIGHT] = 150; + addChildren(node_0, 2); + { + TestCSSNode node_1; + node_1 = node_0.getChildAt(0); + node_1.layout.position[POSITION_TOP] = 10; + node_1.layout.position[POSITION_LEFT] = 10; + node_1.layout.dimensions[DIMENSION_WIDTH] = 0; + node_1.layout.dimensions[DIMENSION_HEIGHT] = 140; + addChildren(node_1, 1); + { + TestCSSNode node_2; + node_2 = node_1.getChildAt(0); + node_2.layout.position[POSITION_TOP] = 0; + node_2.layout.position[POSITION_LEFT] = 0; + node_2.layout.dimensions[DIMENSION_WIDTH] = 0; + node_2.layout.dimensions[DIMENSION_HEIGHT] = 140; + addChildren(node_2, 1); + { + TestCSSNode node_3; + node_3 = node_2.getChildAt(0); + node_3.layout.position[POSITION_TOP] = 70; + node_3.layout.position[POSITION_LEFT] = 0; + node_3.layout.dimensions[DIMENSION_WIDTH] = 0; + node_3.layout.dimensions[DIMENSION_HEIGHT] = 0; + } + } + node_1 = node_0.getChildAt(1); + node_1.layout.position[POSITION_TOP] = 0; + node_1.layout.position[POSITION_LEFT] = 10; + node_1.layout.dimensions[DIMENSION_WIDTH] = 0; + node_1.layout.dimensions[DIMENSION_HEIGHT] = 150; + } + } + + test("should layout content of an item which is stretched late", root_node, root_layout); + } + + @Test + public void testCase185() + { + TestCSSNode root_node = new TestCSSNode(); + { + TestCSSNode node_0 = root_node; + addChildren(node_0, 2); + { + TestCSSNode node_1; + node_1 = node_0.getChildAt(0); + addChildren(node_1, 1); + { + TestCSSNode node_2; + node_2 = node_1.getChildAt(0); + node_2.style.dimensions[DIMENSION_WIDTH] = 200; + node_2.style.dimensions[DIMENSION_HEIGHT] = 200; + } + node_1 = node_0.getChildAt(1); + node_1.setMargin(Spacing.LEFT, 10); + node_1.setMargin(Spacing.TOP, 10); + addChildren(node_1, 1); + { + TestCSSNode node_2; + node_2 = node_1.getChildAt(0); + } + } + } + + TestCSSNode root_layout = new TestCSSNode(); + { + TestCSSNode node_0 = root_layout; + node_0.layout.position[POSITION_TOP] = 0; + node_0.layout.position[POSITION_LEFT] = 0; + node_0.layout.dimensions[DIMENSION_WIDTH] = 200; + node_0.layout.dimensions[DIMENSION_HEIGHT] = 210; + addChildren(node_0, 2); + { + TestCSSNode node_1; + node_1 = node_0.getChildAt(0); + node_1.layout.position[POSITION_TOP] = 0; + node_1.layout.position[POSITION_LEFT] = 0; + node_1.layout.dimensions[DIMENSION_WIDTH] = 200; + node_1.layout.dimensions[DIMENSION_HEIGHT] = 200; + addChildren(node_1, 1); + { + TestCSSNode node_2; + node_2 = node_1.getChildAt(0); + node_2.layout.position[POSITION_TOP] = 0; + node_2.layout.position[POSITION_LEFT] = 0; + node_2.layout.dimensions[DIMENSION_WIDTH] = 200; + node_2.layout.dimensions[DIMENSION_HEIGHT] = 200; + } + node_1 = node_0.getChildAt(1); + node_1.layout.position[POSITION_TOP] = 210; + node_1.layout.position[POSITION_LEFT] = 10; + node_1.layout.dimensions[DIMENSION_WIDTH] = 190; + node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; + addChildren(node_1, 1); + { + TestCSSNode node_2; + node_2 = node_1.getChildAt(0); + node_2.layout.position[POSITION_TOP] = 0; + node_2.layout.position[POSITION_LEFT] = 0; + node_2.layout.dimensions[DIMENSION_WIDTH] = 190; + node_2.layout.dimensions[DIMENSION_HEIGHT] = 0; + } + } + } + + test("should layout items whose positioning is determined by sibling tree branches", root_node, root_layout); + } + + @Test + public void testCase186() + { + TestCSSNode root_node = new TestCSSNode(); + { + TestCSSNode node_0 = root_node; + node_0.style.flexDirection = CSSFlexDirection.ROW; + addChildren(node_0, 3); + { + TestCSSNode node_1; + node_1 = node_0.getChildAt(0); + node_1.style.alignSelf = CSSAlign.FLEX_START; + node_1.setMargin(Spacing.LEFT, 10); + node_1.setMargin(Spacing.TOP, 10); + node_1 = node_0.getChildAt(1); + node_1.style.alignSelf = CSSAlign.STRETCH; + node_1.style.dimensions[DIMENSION_WIDTH] = 1; + node_1 = node_0.getChildAt(2); + node_1.style.dimensions[DIMENSION_HEIGHT] = 150; + } + } + + TestCSSNode root_layout = new TestCSSNode(); + { + TestCSSNode node_0 = root_layout; + node_0.layout.position[POSITION_TOP] = 0; + node_0.layout.position[POSITION_LEFT] = 0; + node_0.layout.dimensions[DIMENSION_WIDTH] = 11; + node_0.layout.dimensions[DIMENSION_HEIGHT] = 150; + addChildren(node_0, 3); + { + TestCSSNode node_1; + node_1 = node_0.getChildAt(0); + node_1.layout.position[POSITION_TOP] = 10; + node_1.layout.position[POSITION_LEFT] = 10; + node_1.layout.dimensions[DIMENSION_WIDTH] = 0; + node_1.layout.dimensions[DIMENSION_HEIGHT] = 0; + node_1 = node_0.getChildAt(1); + node_1.layout.position[POSITION_TOP] = 0; + node_1.layout.position[POSITION_LEFT] = 10; + node_1.layout.dimensions[DIMENSION_WIDTH] = 1; + node_1.layout.dimensions[DIMENSION_HEIGHT] = 150; + node_1 = node_0.getChildAt(2); + node_1.layout.position[POSITION_TOP] = 0; + node_1.layout.position[POSITION_LEFT] = 11; + node_1.layout.dimensions[DIMENSION_WIDTH] = 0; + node_1.layout.dimensions[DIMENSION_HEIGHT] = 150; + } + } + + test("should layout child whose cross axis is undefined and whose alignSelf is stretch", root_node, root_layout); + } + + @Test + public void testCase187() { TestCSSNode root_node = new TestCSSNode(); {