From 7bd6b2b7dd18e32d1aaaad922be8b13b2d3af2b0 Mon Sep 17 00:00:00 2001 From: Emil Sjolander Date: Wed, 6 Jan 2016 16:56:56 +0000 Subject: [PATCH] Add support for measure mode --- TestResult.xml | 9 ++++++ dist/css-layout.h | 30 +++++++++++++++--- dist/css-layout.jar | Bin 15019 -> 15067 bytes dist/css-layout.js | 24 ++++++++++++-- dist/css-layout.min.js | 2 +- dist/css-layout.min.js.map | 2 +- src/CSharpTranspiler.js | 4 ++- src/JavaTranspiler.js | 2 ++ src/Layout-test-utils.c | 16 +++++++--- src/Layout-test-utils.h | 2 +- src/Layout-test-utils.js | 18 +++++++---- src/Layout.c | 18 ++++++++++- src/Layout.h | 8 ++++- src/Layout.js | 24 ++++++++++++-- .../LayoutCachingTest.cs | 2 +- .../LayoutEngineTest.cs | 14 +++++--- .../Facebook.CSSLayout/CSSMeasureMode.cs | 18 +++++++++++ src/csharp/Facebook.CSSLayout/CSSNode.cs | 6 ++-- .../Facebook.CSSLayout.csproj | 3 +- src/csharp/Facebook.CSSLayout/LayoutEngine.cs | 18 ++++++++++- .../facebook/csslayout/CSSMeasureMode.java | 15 +++++++++ .../src/com/facebook/csslayout/CSSNode.java | 6 ++-- .../com/facebook/csslayout/LayoutEngine.java | 18 ++++++++++- .../facebook/csslayout/LayoutCachingTest.java | 2 +- .../facebook/csslayout/LayoutEngineTest.java | 16 +++++++--- src/transpile.js | 5 +++ 26 files changed, 237 insertions(+), 45 deletions(-) create mode 100644 TestResult.xml create mode 100644 src/csharp/Facebook.CSSLayout/CSSMeasureMode.cs create mode 100644 src/java/src/com/facebook/csslayout/CSSMeasureMode.java diff --git a/TestResult.xml b/TestResult.xml new file mode 100644 index 00000000000..77989325cb6 --- /dev/null +++ b/TestResult.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/dist/css-layout.h b/dist/css-layout.h index 29c08575d00..5cf505214e7 100644 --- a/dist/css-layout.h +++ b/dist/css-layout.h @@ -80,6 +80,12 @@ typedef enum { CSS_POSITION_COUNT } css_position_t; +typedef enum { + CSS_MEASURE_MODE_UNDEFINED = 0, + CSS_MEASURE_MODE_EXACTLY, + CSS_MEASURE_MODE_AT_MOST +} css_measure_mode_t; + typedef enum { CSS_WIDTH = 0, CSS_HEIGHT @@ -144,7 +150,7 @@ struct css_node { css_node_t *next_absolute_child; css_node_t *next_flex_child; - css_dim_t (*measure)(void *context, float width, float height); + css_dim_t (*measure)(void *context, float width, css_measure_mode_t widthMode, float height, css_measure_mode_t heightMode); void (*print)(void *context); struct css_node* (*get_child)(void *context, int i); bool (*is_dirty)(void *context); @@ -734,26 +740,40 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM bool isResolvedRowDimDefined = isLayoutDimDefined(node, resolvedRowAxis); float width = CSS_UNDEFINED; + css_measure_mode_t widthMode = CSS_MEASURE_MODE_UNDEFINED; if (isStyleDimDefined(node, resolvedRowAxis)) { width = node->style.dimensions[CSS_WIDTH]; + widthMode = CSS_MEASURE_MODE_EXACTLY; } else if (isResolvedRowDimDefined) { width = node->layout.dimensions[dim[resolvedRowAxis]]; + widthMode = CSS_MEASURE_MODE_EXACTLY; } else { width = parentMaxWidth - getMarginAxis(node, resolvedRowAxis); + widthMode = CSS_MEASURE_MODE_AT_MOST; } width -= paddingAndBorderAxisResolvedRow; + if (isUndefined(width)) { + widthMode = CSS_MEASURE_MODE_UNDEFINED; + } float height = CSS_UNDEFINED; + css_measure_mode_t heightMode = CSS_MEASURE_MODE_UNDEFINED; if (isStyleDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { height = node->style.dimensions[CSS_HEIGHT]; + heightMode = CSS_MEASURE_MODE_EXACTLY; } else if (isLayoutDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { height = node->layout.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]]; + heightMode = CSS_MEASURE_MODE_EXACTLY; } else { height = parentMaxHeight - getMarginAxis(node, resolvedRowAxis); + heightMode = CSS_MEASURE_MODE_AT_MOST; } height -= getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_COLUMN); + if (isUndefined(height)) { + heightMode = CSS_MEASURE_MODE_UNDEFINED; + } // 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 @@ -768,7 +788,9 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM node->context, width, - height + widthMode, + height, + heightMode ); if (isRowUndefined) { node->layout.dimensions[CSS_WIDTH] = measureDim.dimensions[CSS_WIDTH] + @@ -1447,8 +1469,8 @@ void layoutNode(css_node_t *node, float parentMaxWidth, float parentMaxHeight, c !node->is_dirty(node->context) && eq(layout->last_requested_dimensions[CSS_WIDTH], layout->dimensions[CSS_WIDTH]) && eq(layout->last_requested_dimensions[CSS_HEIGHT], layout->dimensions[CSS_HEIGHT]) && - eq(layout->last_parent_max_width, parentMaxWidth); - eq(layout->last_parent_max_height, parentMaxHeight); + eq(layout->last_parent_max_width, parentMaxWidth) && + eq(layout->last_parent_max_height, parentMaxHeight) && eq(layout->last_direction, direction); if (skipLayout) { diff --git a/dist/css-layout.jar b/dist/css-layout.jar index 9a0a701dee6a32bb0ff150cc2d9a2fd462bf6a73..5ebc995f4c504d4a69a90834868633c4843800ad 100644 GIT binary patch delta 13288 zcmYkD18^rnx3^<%Y}>ZAv2EMhBpc@+V`JO4ZQHhOJNb6sx9Yk3Id9#;TKNU$rNiR7R0D=G8 z@ZzTdRbVVJmBZ=4)Xbu3vn$IOX##T={xiI#3_JvNhX6d3yO#xJr| z-&(UdZl^%mR8hc}v5sG<5yaSB#3fvgT zOjG0H?_*b`xQNhZGP`Btd4c1#uwXu{*g&O6EX+VGgT@B@dqe=TFIW~1&S{sl1O&eX z{f{iAHO49!ZPSvjGzt^c6AF%ncMjt|R*rHmw-}Ypj0_#tjwWe^cx78IufQ9B{;#oJ zpxx1)<|wiFZr+mVH2!(gnRGEnv<52Ei>DR~8h*G)S*uMe?M z>;MpIS9RGTn6o5&l01iyj!x8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Ms4j|EI1h`_PO|RF&vm?=^VG~-MpNDc>#N0v)&lr<2a|+QMrzmDUEj3Rsd z=#6$=aQlKuf#f5#Q-XJbm!XVF$ikhQXAlhsG6$D5T1g-%s(1tmoDhSBBk~2uG`?dO zfuA`&qtg}jcK@7lmn#-;`3kI^qgkVY zKtV3C^T3SJH0A*^G;D>N=I1PGR^l2s{D92l<#O!hhSom=I@hL=`KLHYqyJRqqwE+^GyD2cCUsZ_n z2(1C-mhMhD(xCf-?*7=4<4lIF197)MlIig^ru;8&N6DP6KEVB-13NcYUh)n;qmHN7 zfog((82>e|Cmh{1iL!w}6;ZJN&k)Re^Ll+CFE8|eQ#0UJetyJvDf{2N4ETv(0Oox} z2F&-#6zzRPM)v=2eg_wQGNgEaPWJzOqu~2!&Hp{Jz#jzUVg753cM>3hmgEH|@Ctwj N1Tf*h^Z%#xe*oFvceVfk diff --git a/dist/css-layout.js b/dist/css-layout.js index edb20968c79..d35506d1275 100644 --- a/dist/css-layout.js +++ b/dist/css-layout.js @@ -53,6 +53,10 @@ var computeLayout = (function() { var CSS_POSITION_RELATIVE = 'relative'; var CSS_POSITION_ABSOLUTE = 'absolute'; + var CSS_MEASURE_MODE_UNDEFINED = 'undefined'; + var CSS_MEASURE_MODE_EXACTLY = 'exactly'; + var CSS_MEASURE_MODE_AT_MOST = 'at-most'; + var leading = { 'row': 'left', 'row-reverse': 'right', @@ -110,7 +114,7 @@ var computeLayout = (function() { } function isUndefined(value) { - return value === undefined; + return value === undefined || isNaN(value); } function isRowDirection(flexDirection) { @@ -501,26 +505,40 @@ var computeLayout = (function() { var/*bool*/ isResolvedRowDimDefined = isLayoutDimDefined(node, resolvedRowAxis); var/*float*/ width = CSS_UNDEFINED; + var/*css_measure_mode_t*/ widthMode = CSS_MEASURE_MODE_UNDEFINED; if (isStyleDimDefined(node, resolvedRowAxis)) { width = node.style.width; + widthMode = CSS_MEASURE_MODE_EXACTLY; } else if (isResolvedRowDimDefined) { width = node.layout[dim[resolvedRowAxis]]; + widthMode = CSS_MEASURE_MODE_EXACTLY; } else { width = parentMaxWidth - getMarginAxis(node, resolvedRowAxis); + widthMode = CSS_MEASURE_MODE_AT_MOST; } width -= paddingAndBorderAxisResolvedRow; + if (isUndefined(width)) { + widthMode = CSS_MEASURE_MODE_UNDEFINED; + } var/*float*/ height = CSS_UNDEFINED; + var/*css_measure_mode_t*/ heightMode = CSS_MEASURE_MODE_UNDEFINED; if (isStyleDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { height = node.style.height; + heightMode = CSS_MEASURE_MODE_EXACTLY; } else if (isLayoutDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { height = node.layout[dim[CSS_FLEX_DIRECTION_COLUMN]]; + heightMode = CSS_MEASURE_MODE_EXACTLY; } else { height = parentMaxHeight - getMarginAxis(node, resolvedRowAxis); + heightMode = CSS_MEASURE_MODE_AT_MOST; } height -= getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_COLUMN); + if (isUndefined(height)) { + heightMode = CSS_MEASURE_MODE_UNDEFINED; + } // 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 @@ -535,7 +553,9 @@ var computeLayout = (function() { /*(c)!node->context,*/ /*(java)!layoutContext.measureOutput,*/ width, - height + widthMode, + height, + heightMode ); if (isRowUndefined) { node.layout.width = measureDim.width + diff --git a/dist/css-layout.min.js b/dist/css-layout.min.js index 3d1afcd89bc..7ea18191954 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===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)}}); +!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||isNaN(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[ja[b]]+n(a,b)}function A(a,b){return void 0!==a.style[ja[b]]&&a.style[ja[b]]>=0}function B(a,b){return void 0!==a.layout[ja[b]]&&a.layout[ja[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[ja[b]]=G(F(a,b,a.style[ja[b]]),o(a,b)))}function I(a,b,c){b.layout[ha[c]]=a.layout[ja[c]]-b.layout[ja[c]]-b.layout[ia[c]]}function J(a,b){return void 0!==a.style[ga[b]]?E(a,ga[b]):-E(a,ha[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[ga[K]]+=e(a,K)+J(a,K),a.layout[ha[K]]+=f(a,K)+J(a,K),a.layout[ga[N]]+=e(a,N)+J(a,N),a.layout[ha[N]]+=f(a,N)+J(a,N);var P=a.children.length,ka=o(a,O),la=o(a,S);if(D(a)){var ma=B(a,O),na=M,oa=da;A(a,O)?(na=a.style.width,oa=ea):ma?(na=a.layout[ja[O]],oa=ea):(na=d-n(a,O),oa=fa),na-=ka,b(na)&&(oa=da);var pa=M,qa=da;A(a,S)?(pa=a.style.height,qa=ea):B(a,S)?(pa=a.layout[ja[S]],qa=ea):(pa=g-n(a,O),qa=fa),pa-=o(a,S),b(pa)&&(qa=da);var ra=!A(a,O)&&!ma,sa=!A(a,S)&&b(a.layout[ja[S]]);if(ra||sa){var ta=a.style.measure(na,oa,pa,qa);ra&&(a.layout.width=ta.width+ka),sa&&(a.layout.height=ta.height+la)}if(0===P)return}var ua,va,wa,xa,ya=y(a),za=p(a),Aa=k(a,K),Ba=k(a,N),Ca=o(a,K),Da=o(a,N),Ea=B(a,K),Fa=B(a,N),Ga=c(K),Ha=null,Ia=null,Ja=M;Ea&&(Ja=a.layout[ja[K]]-Ca);for(var Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0;P>La;){var Qa=0,Ra=0,Sa=0,Ta=0,Ua=Ea&&za===U||!Ea&&za!==V,Va=Ua?P:Ka,Wa=!0,Xa=P,Ya=null,Za=null,$a=Aa,_a=0,ab=M,bb=M;for(ua=Ka;P>ua;++ua){wa=a.children[ua],wa.lineIndex=Pa,wa.nextAbsoluteChild=null,wa.nextFlexChild=null;var cb=r(a,wa);if(cb===aa&&w(wa)===ba&&Fa&&!A(wa,N))wa.layout[ja[N]]=G(F(wa,N,a.layout[ja[N]]-Da-n(wa,N)),o(wa,N));else if(w(wa)===ca)for(null===Ha&&(Ha=wa),null!==Ia&&(Ia.nextAbsoluteChild=wa),Ia=wa,va=0;2>va;va++)xa=0!==va?Q:S,B(a,xa)&&!A(wa,xa)&&C(wa,ga[xa])&&C(wa,ha[xa])&&(wa.layout[ja[xa]]=G(F(wa,xa,a.layout[ja[xa]]-o(a,xa)-n(wa,xa)-E(wa,ga[xa])-E(wa,ha[xa])),o(wa,xa)));var db=0;if(Ea&&x(wa)?(Ra++,Sa+=wa.style.flex,null===Ya&&(Ya=wa),null!==Za&&(Za.nextFlexChild=wa),Za=wa,db=o(wa,K)+n(wa,K)):(ab=M,bb=M,Ga?bb=B(a,S)?a.layout[ja[S]]-la:g-n(a,S)-la:ab=B(a,O)?a.layout[ja[O]]-ka:d-n(a,O)-ka,0===Ma&&L(wa,ab,bb,j),w(wa)===ba&&(Ta++,db=z(wa,K))),ya&&Ea&&Qa+db>Ja&&ua!==Ka){Ta--,Ma=1;break}Ua&&(w(wa)!==ba||x(wa))&&(Ua=!1,Va=ua),Wa&&(w(wa)!==ba||cb!==aa&&cb!==Z||cb==aa&&!Fa)&&(Wa=!1,Xa=ua),Ua&&(wa.layout[ia[K]]+=$a,Ea&&I(a,wa,K),$a+=z(wa,K),_a=G(_a,F(wa,N,z(wa,N)))),Wa&&(wa.layout[ia[N]]+=Na+Ba,Fa&&I(a,wa,N)),Ma=0,Qa+=db,La=ua+1}var eb=0,fb=0,gb=0;if(gb=Ea?Ja-Qa:G(Qa,0)-Qa,0!==Ra){var hb,ib,jb=gb/Sa;for(Za=Ya;null!==Za;)hb=jb*Za.style.flex+o(Za,K),ib=F(Za,K,hb),hb!==ib&&(gb-=ib,Sa-=Za.style.flex),Za=Za.nextFlexChild;for(jb=gb/Sa,0>jb&&(jb=0),Za=Ya;null!==Za;)Za.layout[ja[K]]=F(Za,K,jb*Za.style.flex+o(Za,K)),ab=M,B(a,O)?ab=a.layout[ja[O]]-ka:Ga||(ab=d-n(a,O)-ka),bb=M,B(a,S)?bb=a.layout[ja[S]]-la:Ga&&(bb=g-n(a,S)-la),L(Za,ab,bb,j),wa=Za,Za=Za.nextFlexChild,wa.nextFlexChild=null}else za!==U&&(za===V?eb=gb/2:za===W?eb=gb:za===X?(gb=G(gb,0),fb=Ra+Ta-1!==0?gb/(Ra+Ta-1):0):za===Y&&(fb=gb/(Ra+Ta),eb=fb/2));for($a+=eb,ua=Va;La>ua;++ua)wa=a.children[ua],w(wa)===ca&&C(wa,ga[K])?wa.layout[ia[K]]=E(wa,ga[K])+i(a,K)+e(wa,K):(wa.layout[ia[K]]+=$a,Ea&&I(a,wa,K),w(wa)===ba&&($a+=fb+z(wa,K),_a=G(_a,F(wa,N,z(wa,N)))));var kb=a.layout[ja[N]];for(Fa||(kb=G(F(a,N,_a+Da),Da)),ua=Xa;La>ua;++ua)if(wa=a.children[ua],w(wa)===ca&&C(wa,ga[N]))wa.layout[ia[N]]=E(wa,ga[N])+i(a,N)+e(wa,N);else{var lb=Ba;if(w(wa)===ba){var cb=r(a,wa);if(cb===aa){if(!A(wa,N)){var mb=wa.layout[ja[N]];wa.layout[ja[N]]=G(F(wa,N,kb-Da-n(wa,N)),o(wa,N)),mb!=wa.layout[ja[N]]&&wa.children.length>0&&(wa.layout[ga[K]]-=e(wa,K)+J(wa,K),wa.layout[ha[K]]-=f(wa,K)+J(wa,K),wa.layout[ga[N]]-=e(wa,N)+J(wa,N),wa.layout[ha[N]]-=f(wa,N)+J(wa,N),L(wa,ab,bb,j))}}else if(cb!==Z){var nb=kb-Da-z(wa,N);lb+=cb===$?nb/2:nb}}wa.layout[ia[N]]+=Na+lb,Fa&&I(a,wa,N)}Na+=_a,Oa=G(Oa,$a),Pa+=1,Ka=La}if(Pa>1&&Fa){var ob=a.layout[ja[N]]-Da,pb=ob-Na,qb=0,rb=Ba,sb=q(a);sb===_?rb+=pb:sb===$?rb+=pb/2:sb===aa&&ob>Na&&(qb=pb/Pa);var tb=0;for(ua=0;Pa>ua;++ua){var ub=tb,vb=0;for(va=ub;P>va;++va)if(wa=a.children[va],w(wa)===ba){if(wa.lineIndex!==ua)break;B(wa,N)&&(vb=G(vb,wa.layout[ja[N]]+n(wa,N)))}for(tb=va,vb+=qb,va=ub;tb>va;++va)if(wa=a.children[va],w(wa)===ba){var wb=r(a,wa);if(wb===Z)wa.layout[ia[N]]=rb+e(wa,N);else if(wb===_)wa.layout[ia[N]]=rb+vb-f(wa,N)-wa.layout[ja[N]];else if(wb===$){var xb=wa.layout[ja[N]];wa.layout[ia[N]]=rb+(vb-xb)/2}else wb===aa&&(wa.layout[ia[N]]=rb+e(wa,N))}rb+=vb}}var yb=!1,zb=!1;if(Ea||(a.layout[ja[K]]=G(F(a,K,Oa+l(a,K)),Ca),(K===R||K===T)&&(yb=!0)),Fa||(a.layout[ja[N]]=G(F(a,N,Na+Da),Da),(N===R||N===T)&&(zb=!0)),yb||zb)for(ua=0;P>ua;++ua)wa=a.children[ua],yb&&I(a,wa,K),zb&&I(a,wa,N);for(Ia=Ha;null!==Ia;){for(va=0;2>va;va++)xa=0!==va?Q:S,B(a,xa)&&!A(Ia,xa)&&C(Ia,ga[xa])&&C(Ia,ha[xa])&&(Ia.layout[ja[xa]]=G(F(Ia,xa,a.layout[ja[xa]]-m(a,xa)-n(Ia,xa)-E(Ia,ga[xa])-E(Ia,ha[xa])),o(Ia,xa))),C(Ia,ha[xa])&&!C(Ia,ga[xa])&&(Ia.layout[ga[xa]]=a.layout[ja[xa]]-Ia.layout[ja[xa]]-E(Ia,ha[xa]));wa=Ia,Ia=Ia.nextAbsoluteChild,wa.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="undefined",ea="exactly",fa="at-most",ga={row:"left","row-reverse":"right",column:"top","column-reverse":"bottom"},ha={row:"right","row-reverse":"left",column:"bottom","column-reverse":"top"},ia={row:"left","row-reverse":"right",column:"top","column-reverse":"bottom"},ja={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 b037ac65a5c..0d933772414 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","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,EAAKE,UACvBF,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,GACnB,MAAiBb,UAAVa,EAGT,QAASC,GAAeC,GACtB,MAAOA,KAAkBC,GAClBD,IAAkBE,EAG3B,QAASC,GAAkBH,GACzB,MAAOA,KAAkBI,GAClBJ,IAAkBK,EAG3B,QAASC,GAAiBzB,EAAM0B,GAC9B,GAA+BtB,SAA3BJ,EAAKU,MAAMiB,aAA6BT,EAAeQ,GACzD,MAAO1B,GAAKU,MAAMiB,WAGpB,IAAIV,GAAQ,IACZ,QAAQS,GACN,IAAK,MAAkBT,EAAQjB,EAAKU,MAAMkB,UAAc,MACxD,KAAK,cAAkBX,EAAQjB,EAAKU,MAAMmB,WAAc,MACxD,KAAK,SAAkBZ,EAAQjB,EAAKU,MAAMoB,SAAc,MACxD,KAAK,iBAAkBb,EAAQjB,EAAKU,MAAMqB,aAG5C,MAAc3B,UAAVa,EACKA,EAGiBb,SAAtBJ,EAAKU,MAAMsB,OACNhC,EAAKU,MAAMsB,OAG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,EAAM9D,OAAOK,IAAM,EACnByD,EAAM9D,OAAOM,KAAO,IAGtBuG,EAAe9G,EAAM+G,EAAgBC,EAAiB1C,GAEtDtE,EAAKkM,WAAW/L,MAAQH,EAAKC,OAAOE,MACpCH,EAAKkM,WAAW7L,OAASL,EAAKC,OAAOI,OACrCL,EAAKkM,WAAW5L,IAAMN,EAAKC,OAAOK,IAClCN,EAAKkM,WAAW3L,KAAOP,EAAKC,OAAOM,MAlsCvC,GAAIiH,GAEAjD,EAAwB,UACxBC,EAAoB,MACpBJ,EAAoB,MAEpBhD,EAAyB,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 +{"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","isNaN","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","widthMode","CSS_MEASURE_MODE_UNDEFINED","CSS_MEASURE_MODE_EXACTLY","CSS_MEASURE_MODE_AT_MOST","heightMode","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,WA2DlB,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,GACnB,MAAiBb,UAAVa,GAAuBC,MAAMD,GAGtC,QAASE,GAAeC,GACtB,MAAOA,KAAkBC,GAClBD,IAAkBE,EAG3B,QAASC,GAAkBH,GACzB,MAAOA,KAAkBI,GAClBJ,IAAkBK,EAG3B,QAASC,GAAiB1B,EAAM2B,GAC9B,GAA+BvB,SAA3BJ,EAAKU,MAAMkB,aAA6BT,EAAeQ,GACzD,MAAO3B,GAAKU,M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QACPE,cAAe,OACfC,OAAU,SACVE,iBAAkB,OAEhBV,IACFK,IAAO,OACPE,cAAe,QACfC,OAAU,MACVE,iBAAkB,UAEhBd,IACFS,IAAO,QACPE,cAAe,QACfC,OAAU,SACVE,iBAAkB,SAuqCpB,QACEa,eAAgBA,EAChBlH,cAAe6K,EACf3K,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 CSS_MEASURE_MODE_UNDEFINED = 'undefined';\n var CSS_MEASURE_MODE_EXACTLY = 'exactly';\n var CSS_MEASURE_MODE_AT_MOST = 'at-most';\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 || isNaN(value);\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 var/*css_measure_mode_t*/ widthMode = CSS_MEASURE_MODE_UNDEFINED;\n if (isStyleDimDefined(node, resolvedRowAxis)) {\n width = node.style.width;\n widthMode = CSS_MEASURE_MODE_EXACTLY;\n } else if (isResolvedRowDimDefined) {\n width = node.layout[dim[resolvedRowAxis]];\n widthMode = CSS_MEASURE_MODE_EXACTLY;\n } else {\n width = parentMaxWidth -\n getMarginAxis(node, resolvedRowAxis);\n widthMode = CSS_MEASURE_MODE_AT_MOST;\n }\n width -= paddingAndBorderAxisResolvedRow;\n if (isUndefined(width)) {\n widthMode = CSS_MEASURE_MODE_UNDEFINED;\n }\n\n var/*float*/ height = CSS_UNDEFINED;\n var/*css_measure_mode_t*/ heightMode = CSS_MEASURE_MODE_UNDEFINED;\n if (isStyleDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) {\n height = node.style.height;\n heightMode = CSS_MEASURE_MODE_EXACTLY;\n } else if (isLayoutDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) {\n height = node.layout[dim[CSS_FLEX_DIRECTION_COLUMN]];\n heightMode = CSS_MEASURE_MODE_EXACTLY;\n } else {\n height = parentMaxHeight -\n getMarginAxis(node, resolvedRowAxis);\n heightMode = CSS_MEASURE_MODE_AT_MOST;\n }\n height -= getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_COLUMN);\n if (isUndefined(height)) {\n heightMode = CSS_MEASURE_MODE_UNDEFINED;\n }\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 widthMode,\n height,\n heightMode\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/CSharpTranspiler.js b/src/CSharpTranspiler.js index 5fbe5b76f25..1342347a3ec 100644 --- a/src/CSharpTranspiler.js +++ b/src/CSharpTranspiler.js @@ -11,12 +11,14 @@ function __transpileToCSharpCommon(code) { return code .replace(/CSS_UNDEFINED/g, 'CSSConstants.UNDEFINED') .replace(/CSS_JUSTIFY_/g, 'CSSJustify.') + .replace(/CSS_MEASURE_MODE_/g, 'CSSMeasureMode.') .replace(/CSS_ALIGN_/g, 'CSSAlign.') .replace(/CSS_POSITION_/g, 'CSSPositionType.') .replace(/css_flex_direction_t/g, 'CSSFlexDirection') .replace(/css_direction_t/g, 'CSSDirection') .replace(/css_align_t/g, 'CSSAlign') .replace(/css_justify_t/g, 'CSSJustify') + .replace(/css_measure_mode_t/g, 'CSSMeasureMode') .replace(/css_dim_t/g, 'MeasureOutput') .replace(/bool/g, 'boolean') .replace(/style\[dim/g, 'style.dimensions[dim') @@ -56,7 +58,7 @@ function __transpileToCSharpCommon(code) { // additional case conversions - .replace(/(CSSConstants|CSSWrap|CSSJustify|CSSAlign|CSSPositionType)\.([_A-Z]+)/g, + .replace(/(CSSConstants|CSSWrap|CSSJustify|CSSMeasureMode|CSSAlign|CSSPositionType)\.([_A-Z]+)/g, function(str, match1, match2) { return match1 + '.' + constantToPascalCase(match2); }); diff --git a/src/JavaTranspiler.js b/src/JavaTranspiler.js index 60b26e9cefd..8623794f140 100644 --- a/src/JavaTranspiler.js +++ b/src/JavaTranspiler.js @@ -11,12 +11,14 @@ function __transpileToJavaCommon(code) { return code .replace(/CSS_UNDEFINED/g, 'CSSConstants.UNDEFINED') .replace(/CSS_JUSTIFY_/g, 'CSSJustify.') + .replace(/CSS_MEASURE_MODE_/g, 'CSSMeasureMode.') .replace(/CSS_ALIGN_/g, 'CSSAlign.') .replace(/CSS_POSITION_/g, 'CSSPositionType.') .replace(/css_flex_direction_t/g, 'CSSFlexDirection') .replace(/css_direction_t/g, 'CSSDirection') .replace(/css_align_t/g, 'CSSAlign') .replace(/css_justify_t/g, 'CSSJustify') + .replace(/css_measure_mode_t/g, 'CSSMeasureMode') .replace(/css_dim_t/g, 'MeasureOutput') .replace(/bool/g, 'boolean') .replace(/style\[dim/g, 'style.dimensions[dim') diff --git a/src/Layout-test-utils.c b/src/Layout-test-utils.c index 8b66e2632df..06237650ab7 100644 --- a/src/Layout-test-utils.c +++ b/src/Layout-test-utils.c @@ -82,11 +82,11 @@ static bool are_layout_equal(css_node_t *a, css_node_t *b) { return true; } -css_dim_t measure(void *context, float width, float height) { +css_dim_t measure(void *context, float width, css_measure_mode_t widthMode, float height, css_measure_mode_t heightMode) { const char *text = (const char *)context; css_dim_t dim; if (strcmp(text, SMALL_TEXT) == 0) { - if (width != width) { + if (widthMode == CSS_MEASURE_MODE_UNDEFINED) { width = 1000000; } dim.dimensions[CSS_WIDTH] = fminf(SMALL_WIDTH, width); @@ -94,7 +94,7 @@ css_dim_t measure(void *context, float width, float height) { return dim; } if (strcmp(text, LONG_TEXT) == 0) { - if (width != width) { + if (widthMode == CSS_MEASURE_MODE_UNDEFINED) { width = 1000000; } dim.dimensions[CSS_WIDTH] = width >= BIG_WIDTH ? BIG_WIDTH : fmaxf(BIG_MIN_WIDTH, width); @@ -103,10 +103,10 @@ css_dim_t measure(void *context, float width, float height) { } if (strcmp(text, MEASURE_WITH_RATIO_2) == 0) { - if (width > 0) { + if (widthMode != CSS_MEASURE_MODE_UNDEFINED) { dim.dimensions[CSS_WIDTH] = width; dim.dimensions[CSS_HEIGHT] = width * 2; - } else if (height > 0) { + } else if (heightMode != CSS_MEASURE_MODE_UNDEFINED) { dim.dimensions[CSS_WIDTH] = height * 2; dim.dimensions[CSS_HEIGHT] = height; } else { @@ -117,6 +117,12 @@ css_dim_t measure(void *context, float width, float height) { } if (strcmp(text, MEASURE_WITH_MATCH_PARENT) == 0) { + if (widthMode == CSS_MEASURE_MODE_UNDEFINED) { + width = 99999; + } + if (heightMode == CSS_MEASURE_MODE_UNDEFINED) { + height = 99999; + } dim.dimensions[CSS_WIDTH] = width; dim.dimensions[CSS_HEIGHT] = height; return dim; diff --git a/src/Layout-test-utils.h b/src/Layout-test-utils.h index 0bcb3be2ced..a83162f9afb 100644 --- a/src/Layout-test-utils.h +++ b/src/Layout-test-utils.h @@ -13,6 +13,6 @@ void test(const char *name, css_node_t *style, css_node_t *expected_layout); int tests_finished(void); -css_dim_t measure(void *context, float width, float height); +css_dim_t measure(void *context, float width, css_measure_mode_t widthMode, float height, css_measure_mode_t heightMode); void init_css_node_children(css_node_t *node, int children_count); css_node_t *new_test_css_node(void); diff --git a/src/Layout-test-utils.js b/src/Layout-test-utils.js index 799393ac136..3195b09f545 100644 --- a/src/Layout-test-utils.js +++ b/src/Layout-test-utils.js @@ -494,8 +494,8 @@ var layoutTestUtils = (function() { computeDOMLayout: computeDOMLayout, reduceTest: reduceTest, text: function(text) { - var fn = function(width, height) { - if (width === undefined || isNaN(width)) { + var fn = function(width, widthMode, height, heightMode) { + if (widthMode === 'undefined') { width = Infinity; } @@ -522,10 +522,10 @@ var layoutTestUtils = (function() { return fn; }, measureWithRatio2: function() { - var fn = function(width, height) { - if (width > 0) { + var fn = function(width, widthMode, height, heightMode) { + if (widthMode !== 'undefined') { height = width * 2; - } else if (height > 0) { + } else if (heightMode !== 'undefined') { width = height * 2; } else { // This should be Infinity, but it would be pain to transpile, @@ -540,7 +540,13 @@ var layoutTestUtils = (function() { return fn; }, measureWithMatchParent: function() { - var fn = function(width, height) { + var fn = function(width, widthMode, height, heightMode) { + if (widthMode === 'undefined') { + width = 99999; + } + if (heightMode === 'undefined') { + height = 99999; + } return {width: width, height: height}; }; // This is necessary for transpiled tests, see previous comment diff --git a/src/Layout.c b/src/Layout.c index fd04cb9b1ee..1d03edf8164 100644 --- a/src/Layout.c +++ b/src/Layout.c @@ -557,26 +557,40 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM bool isResolvedRowDimDefined = isLayoutDimDefined(node, resolvedRowAxis); float width = CSS_UNDEFINED; + css_measure_mode_t widthMode = CSS_MEASURE_MODE_UNDEFINED; if (isStyleDimDefined(node, resolvedRowAxis)) { width = node->style.dimensions[CSS_WIDTH]; + widthMode = CSS_MEASURE_MODE_EXACTLY; } else if (isResolvedRowDimDefined) { width = node->layout.dimensions[dim[resolvedRowAxis]]; + widthMode = CSS_MEASURE_MODE_EXACTLY; } else { width = parentMaxWidth - getMarginAxis(node, resolvedRowAxis); + widthMode = CSS_MEASURE_MODE_AT_MOST; } width -= paddingAndBorderAxisResolvedRow; + if (isUndefined(width)) { + widthMode = CSS_MEASURE_MODE_UNDEFINED; + } float height = CSS_UNDEFINED; + css_measure_mode_t heightMode = CSS_MEASURE_MODE_UNDEFINED; if (isStyleDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { height = node->style.dimensions[CSS_HEIGHT]; + heightMode = CSS_MEASURE_MODE_EXACTLY; } else if (isLayoutDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { height = node->layout.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]]; + heightMode = CSS_MEASURE_MODE_EXACTLY; } else { height = parentMaxHeight - getMarginAxis(node, resolvedRowAxis); + heightMode = CSS_MEASURE_MODE_AT_MOST; } height -= getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_COLUMN); + if (isUndefined(height)) { + heightMode = CSS_MEASURE_MODE_UNDEFINED; + } // 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 @@ -591,7 +605,9 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth, float parentM node->context, width, - height + widthMode, + height, + heightMode ); if (isRowUndefined) { node->layout.dimensions[CSS_WIDTH] = measureDim.dimensions[CSS_WIDTH] + diff --git a/src/Layout.h b/src/Layout.h index 0a82e6c7436..1df58225563 100644 --- a/src/Layout.h +++ b/src/Layout.h @@ -76,6 +76,12 @@ typedef enum { CSS_POSITION_COUNT } css_position_t; +typedef enum { + CSS_MEASURE_MODE_UNDEFINED = 0, + CSS_MEASURE_MODE_EXACTLY, + CSS_MEASURE_MODE_AT_MOST +} css_measure_mode_t; + typedef enum { CSS_WIDTH = 0, CSS_HEIGHT @@ -140,7 +146,7 @@ struct css_node { css_node_t *next_absolute_child; css_node_t *next_flex_child; - css_dim_t (*measure)(void *context, float width, float height); + css_dim_t (*measure)(void *context, float width, css_measure_mode_t widthMode, float height, css_measure_mode_t heightMode); void (*print)(void *context); struct css_node* (*get_child)(void *context, int i); bool (*is_dirty)(void *context); diff --git a/src/Layout.js b/src/Layout.js index e656849f6e8..e926592e2b9 100755 --- a/src/Layout.js +++ b/src/Layout.js @@ -34,6 +34,10 @@ var computeLayout = (function() { var CSS_POSITION_RELATIVE = 'relative'; var CSS_POSITION_ABSOLUTE = 'absolute'; + var CSS_MEASURE_MODE_UNDEFINED = 'undefined'; + var CSS_MEASURE_MODE_EXACTLY = 'exactly'; + var CSS_MEASURE_MODE_AT_MOST = 'at-most'; + var leading = { 'row': 'left', 'row-reverse': 'right', @@ -91,7 +95,7 @@ var computeLayout = (function() { } function isUndefined(value) { - return value === undefined; + return value === undefined || isNaN(value); } function isRowDirection(flexDirection) { @@ -482,26 +486,40 @@ var computeLayout = (function() { var/*bool*/ isResolvedRowDimDefined = isLayoutDimDefined(node, resolvedRowAxis); var/*float*/ width = CSS_UNDEFINED; + var/*css_measure_mode_t*/ widthMode = CSS_MEASURE_MODE_UNDEFINED; if (isStyleDimDefined(node, resolvedRowAxis)) { width = node.style.width; + widthMode = CSS_MEASURE_MODE_EXACTLY; } else if (isResolvedRowDimDefined) { width = node.layout[dim[resolvedRowAxis]]; + widthMode = CSS_MEASURE_MODE_EXACTLY; } else { width = parentMaxWidth - getMarginAxis(node, resolvedRowAxis); + widthMode = CSS_MEASURE_MODE_AT_MOST; } width -= paddingAndBorderAxisResolvedRow; + if (isUndefined(width)) { + widthMode = CSS_MEASURE_MODE_UNDEFINED; + } var/*float*/ height = CSS_UNDEFINED; + var/*css_measure_mode_t*/ heightMode = CSS_MEASURE_MODE_UNDEFINED; if (isStyleDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { height = node.style.height; + heightMode = CSS_MEASURE_MODE_EXACTLY; } else if (isLayoutDimDefined(node, CSS_FLEX_DIRECTION_COLUMN)) { height = node.layout[dim[CSS_FLEX_DIRECTION_COLUMN]]; + heightMode = CSS_MEASURE_MODE_EXACTLY; } else { height = parentMaxHeight - getMarginAxis(node, resolvedRowAxis); + heightMode = CSS_MEASURE_MODE_AT_MOST; } height -= getPaddingAndBorderAxis(node, CSS_FLEX_DIRECTION_COLUMN); + if (isUndefined(height)) { + heightMode = CSS_MEASURE_MODE_UNDEFINED; + } // 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 @@ -516,7 +534,9 @@ var computeLayout = (function() { /*(c)!node->context,*/ /*(java)!layoutContext.measureOutput,*/ width, - height + widthMode, + height, + heightMode ); if (isRowUndefined) { node.layout.width = measureDim.width + diff --git a/src/csharp/Facebook.CSSLayout.Tests/LayoutCachingTest.cs b/src/csharp/Facebook.CSSLayout.Tests/LayoutCachingTest.cs index cf99b36c7c6..31139492b7f 100644 --- a/src/csharp/Facebook.CSSLayout.Tests/LayoutCachingTest.cs +++ b/src/csharp/Facebook.CSSLayout.Tests/LayoutCachingTest.cs @@ -226,7 +226,7 @@ public void testInvalidatesOnNewMeasureFunction() root.calculateLayout(); markLayoutAppliedForTree(root); - c1.setMeasureFunction((node, width, height) => new MeasureOutput(100, 20)); + c1.setMeasureFunction((node, width, widthMode, height, heightMode) => new MeasureOutput(100, 20)); root.calculateLayout(); diff --git a/src/csharp/Facebook.CSSLayout.Tests/LayoutEngineTest.cs b/src/csharp/Facebook.CSSLayout.Tests/LayoutEngineTest.cs index e787b5084fb..c44dd882e91 100644 --- a/src/csharp/Facebook.CSSLayout.Tests/LayoutEngineTest.cs +++ b/src/csharp/Facebook.CSSLayout.Tests/LayoutEngineTest.cs @@ -25,11 +25,11 @@ public class LayoutEngineTest const int DIMENSION_HEIGHT = CSSLayout.DIMENSION_HEIGHT; const int DIMENSION_WIDTH = CSSLayout.DIMENSION_WIDTH; - static readonly MeasureFunction sTestMeasureFunction = (node, width, height) => + static readonly MeasureFunction sTestMeasureFunction = (node, width, widthMode, height, heightMode) => { TestCSSNode testNode = (TestCSSNode) node; if (testNode.context.Equals(TestConstants.SMALL_TEXT)) { - if (CSSConstants.IsUndefined(width)) { + if (widthMode == CSSMeasureMode.Undefined) { width = 10000000; } return new MeasureOutput( @@ -46,14 +46,20 @@ public class LayoutEngineTest ? TestConstants.SMALL_HEIGHT : TestConstants.BIG_HEIGHT); } else if (testNode.context.Equals(TestConstants.MEASURE_WITH_RATIO_2)) { - if (width > 0) { + if (widthMode != CSSMeasureMode.Undefined) { return new MeasureOutput(width, width * 2); - } else if (height > 0) { + } else if (heightMode != CSSMeasureMode.Undefined) { return new MeasureOutput(height * 2, height); } else { return new MeasureOutput(99999, 99999); } } else if (testNode.context.Equals(TestConstants.MEASURE_WITH_MATCH_PARENT)) { + if (widthMode == CSSMeasureMode.Undefined) { + width = 99999; + } + if (heightMode == CSSMeasureMode.Undefined) { + height = 99999; + } return new MeasureOutput(width, height); } else { throw new Exception("Got unknown test: " + testNode.context); diff --git a/src/csharp/Facebook.CSSLayout/CSSMeasureMode.cs b/src/csharp/Facebook.CSSLayout/CSSMeasureMode.cs new file mode 100644 index 00000000000..3e8dc546a2e --- /dev/null +++ b/src/csharp/Facebook.CSSLayout/CSSMeasureMode.cs @@ -0,0 +1,18 @@ +/** + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +namespace Facebook.CSSLayout +{ + public enum CSSMeasureMode + { + Undefined, + Exactly, + AtMost, + } +} diff --git a/src/csharp/Facebook.CSSLayout/CSSNode.cs b/src/csharp/Facebook.CSSLayout/CSSNode.cs index 0f44f4a9903..bf42d6894d7 100644 --- a/src/csharp/Facebook.CSSLayout/CSSNode.cs +++ b/src/csharp/Facebook.CSSLayout/CSSNode.cs @@ -17,7 +17,7 @@ namespace Facebook.CSSLayout * Should measure the given node and put the result in the given MeasureOutput. */ - public delegate MeasureOutput MeasureFunction(CSSNode node, float width, float height); + public delegate MeasureOutput MeasureFunction(CSSNode node, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode); /** * A CSS Node. It has a style object you can manipulate at {@link #style}. After calling @@ -140,13 +140,13 @@ public bool IsMeasureDefined get { return mMeasureFunction != null; } } - internal MeasureOutput measure(MeasureOutput measureOutput, float width, float height) + internal MeasureOutput measure(MeasureOutput measureOutput, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode) { if (!IsMeasureDefined) { throw new Exception("Measure function isn't defined!"); } - return Assertions.assertNotNull(mMeasureFunction)(this, width, height); + return Assertions.assertNotNull(mMeasureFunction)(this, width, widthMode, height, heightMode); } /** diff --git a/src/csharp/Facebook.CSSLayout/Facebook.CSSLayout.csproj b/src/csharp/Facebook.CSSLayout/Facebook.CSSLayout.csproj index ace4f00b625..0fb115e96fe 100755 --- a/src/csharp/Facebook.CSSLayout/Facebook.CSSLayout.csproj +++ b/src/csharp/Facebook.CSSLayout/Facebook.CSSLayout.csproj @@ -45,6 +45,7 @@ + @@ -67,4 +68,4 @@ --> - \ No newline at end of file + diff --git a/src/csharp/Facebook.CSSLayout/LayoutEngine.cs b/src/csharp/Facebook.CSSLayout/LayoutEngine.cs index 51ba4d33844..9f448a3783b 100644 --- a/src/csharp/Facebook.CSSLayout/LayoutEngine.cs +++ b/src/csharp/Facebook.CSSLayout/LayoutEngine.cs @@ -282,26 +282,40 @@ static void layoutNodeImpl(CSSLayoutContext layoutContext, CSSNode node, float p boolean isResolvedRowDimDefined = (!float.IsNaN(node.layout.dimensions[dim[resolvedRowAxis]]) && node.layout.dimensions[dim[resolvedRowAxis]] >= 0.0); float width = CSSConstants.Undefined; + CSSMeasureMode widthMode = CSSMeasureMode.Undefined; if ((!float.IsNaN(node.style.dimensions[dim[resolvedRowAxis]]) && node.style.dimensions[dim[resolvedRowAxis]] >= 0.0)) { width = node.style.dimensions[DIMENSION_WIDTH]; + widthMode = CSSMeasureMode.Exactly; } else if (isResolvedRowDimDefined) { width = node.layout.dimensions[dim[resolvedRowAxis]]; + widthMode = CSSMeasureMode.Exactly; } else { width = parentMaxWidth - (node.style.margin.getWithFallback(leadingSpacing[resolvedRowAxis], leading[resolvedRowAxis]) + node.style.margin.getWithFallback(trailingSpacing[resolvedRowAxis], trailing[resolvedRowAxis])); + widthMode = CSSMeasureMode.AtMost; } width -= paddingAndBorderAxisResolvedRow; + if (float.IsNaN(width)) { + widthMode = CSSMeasureMode.Undefined; + } float height = CSSConstants.Undefined; + CSSMeasureMode heightMode = CSSMeasureMode.Undefined; if ((!float.IsNaN(node.style.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]]) && node.style.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]] >= 0.0)) { height = node.style.dimensions[DIMENSION_HEIGHT]; + heightMode = CSSMeasureMode.Exactly; } else if ((!float.IsNaN(node.layout.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]]) && node.layout.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]] >= 0.0)) { height = node.layout.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]]; + heightMode = CSSMeasureMode.Exactly; } else { height = parentMaxHeight - (node.style.margin.getWithFallback(leadingSpacing[resolvedRowAxis], leading[resolvedRowAxis]) + node.style.margin.getWithFallback(trailingSpacing[resolvedRowAxis], trailing[resolvedRowAxis])); + heightMode = CSSMeasureMode.AtMost; } height -= ((node.style.padding.getWithFallback(leadingSpacing[CSS_FLEX_DIRECTION_COLUMN], leading[CSS_FLEX_DIRECTION_COLUMN]) + node.style.border.getWithFallback(leadingSpacing[CSS_FLEX_DIRECTION_COLUMN], leading[CSS_FLEX_DIRECTION_COLUMN])) + (node.style.padding.getWithFallback(trailingSpacing[CSS_FLEX_DIRECTION_COLUMN], trailing[CSS_FLEX_DIRECTION_COLUMN]) + node.style.border.getWithFallback(trailingSpacing[CSS_FLEX_DIRECTION_COLUMN], trailing[CSS_FLEX_DIRECTION_COLUMN]))); + if (float.IsNaN(height)) { + heightMode = CSSMeasureMode.Undefined; + } // 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 @@ -316,7 +330,9 @@ static void layoutNodeImpl(CSSLayoutContext layoutContext, CSSNode node, float p layoutContext.measureOutput, width, - height + widthMode, + height, + heightMode ); if (isRowUndefined) { node.layout.dimensions[DIMENSION_WIDTH] = measureDim.width + diff --git a/src/java/src/com/facebook/csslayout/CSSMeasureMode.java b/src/java/src/com/facebook/csslayout/CSSMeasureMode.java new file mode 100644 index 00000000000..eb327b33363 --- /dev/null +++ b/src/java/src/com/facebook/csslayout/CSSMeasureMode.java @@ -0,0 +1,15 @@ +/** + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ +package com.facebook.csslayout; + +public enum CSSMeasureMode { + UNDEFINED, + EXACTLY, + AT_MOST, +} diff --git a/src/java/src/com/facebook/csslayout/CSSNode.java b/src/java/src/com/facebook/csslayout/CSSNode.java index 674e9469138..87c63124c29 100644 --- a/src/java/src/com/facebook/csslayout/CSSNode.java +++ b/src/java/src/com/facebook/csslayout/CSSNode.java @@ -53,7 +53,7 @@ public static interface MeasureFunction { * * NB: measure is NOT guaranteed to be threadsafe/re-entrant safe! */ - public void measure(CSSNode node, float width, float height, MeasureOutput measureOutput); + public void measure(CSSNode node, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode, MeasureOutput measureOutput); } // VisibleForTesting @@ -125,13 +125,13 @@ public boolean isMeasureDefined() { return mMeasureFunction != null; } - /*package*/ MeasureOutput measure(MeasureOutput measureOutput, float width, float height) { + /*package*/ MeasureOutput measure(MeasureOutput measureOutput, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode) { if (!isMeasureDefined()) { throw new RuntimeException("Measure function isn't defined!"); } measureOutput.height = CSSConstants.UNDEFINED; measureOutput.width = CSSConstants.UNDEFINED; - Assertions.assertNotNull(mMeasureFunction).measure(this, width, height, measureOutput); + Assertions.assertNotNull(mMeasureFunction).measure(this, width, widthMode, height, heightMode, measureOutput); return measureOutput; } diff --git a/src/java/src/com/facebook/csslayout/LayoutEngine.java b/src/java/src/com/facebook/csslayout/LayoutEngine.java index ea1e66c7eaa..99fe91003f6 100644 --- a/src/java/src/com/facebook/csslayout/LayoutEngine.java +++ b/src/java/src/com/facebook/csslayout/LayoutEngine.java @@ -258,26 +258,40 @@ private static void layoutNodeImpl( boolean isResolvedRowDimDefined = (!Float.isNaN(node.layout.dimensions[dim[resolvedRowAxis]]) && node.layout.dimensions[dim[resolvedRowAxis]] >= 0.0); float width = CSSConstants.UNDEFINED; + CSSMeasureMode widthMode = CSSMeasureMode.UNDEFINED; if ((!Float.isNaN(node.style.dimensions[dim[resolvedRowAxis]]) && node.style.dimensions[dim[resolvedRowAxis]] >= 0.0)) { width = node.style.dimensions[DIMENSION_WIDTH]; + widthMode = CSSMeasureMode.EXACTLY; } else if (isResolvedRowDimDefined) { width = node.layout.dimensions[dim[resolvedRowAxis]]; + widthMode = CSSMeasureMode.EXACTLY; } else { width = parentMaxWidth - (node.style.margin.getWithFallback(leadingSpacing[resolvedRowAxis], leading[resolvedRowAxis]) + node.style.margin.getWithFallback(trailingSpacing[resolvedRowAxis], trailing[resolvedRowAxis])); + widthMode = CSSMeasureMode.AT_MOST; } width -= paddingAndBorderAxisResolvedRow; + if (Float.isNaN(width)) { + widthMode = CSSMeasureMode.UNDEFINED; + } float height = CSSConstants.UNDEFINED; + CSSMeasureMode heightMode = CSSMeasureMode.UNDEFINED; if ((!Float.isNaN(node.style.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]]) && node.style.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]] >= 0.0)) { height = node.style.dimensions[DIMENSION_HEIGHT]; + heightMode = CSSMeasureMode.EXACTLY; } else if ((!Float.isNaN(node.layout.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]]) && node.layout.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]] >= 0.0)) { height = node.layout.dimensions[dim[CSS_FLEX_DIRECTION_COLUMN]]; + heightMode = CSSMeasureMode.EXACTLY; } else { height = parentMaxHeight - (node.style.margin.getWithFallback(leadingSpacing[resolvedRowAxis], leading[resolvedRowAxis]) + node.style.margin.getWithFallback(trailingSpacing[resolvedRowAxis], trailing[resolvedRowAxis])); + heightMode = CSSMeasureMode.AT_MOST; } height -= ((node.style.padding.getWithFallback(leadingSpacing[CSS_FLEX_DIRECTION_COLUMN], leading[CSS_FLEX_DIRECTION_COLUMN]) + node.style.border.getWithFallback(leadingSpacing[CSS_FLEX_DIRECTION_COLUMN], leading[CSS_FLEX_DIRECTION_COLUMN])) + (node.style.padding.getWithFallback(trailingSpacing[CSS_FLEX_DIRECTION_COLUMN], trailing[CSS_FLEX_DIRECTION_COLUMN]) + node.style.border.getWithFallback(trailingSpacing[CSS_FLEX_DIRECTION_COLUMN], trailing[CSS_FLEX_DIRECTION_COLUMN]))); + if (Float.isNaN(height)) { + heightMode = CSSMeasureMode.UNDEFINED; + } // 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 @@ -292,7 +306,9 @@ private static void layoutNodeImpl( layoutContext.measureOutput, width, - height + widthMode, + height, + heightMode ); if (isRowUndefined) { node.layout.dimensions[DIMENSION_WIDTH] = measureDim.width + diff --git a/src/java/tests/com/facebook/csslayout/LayoutCachingTest.java b/src/java/tests/com/facebook/csslayout/LayoutCachingTest.java index 866996eeffb..492571cf063 100644 --- a/src/java/tests/com/facebook/csslayout/LayoutCachingTest.java +++ b/src/java/tests/com/facebook/csslayout/LayoutCachingTest.java @@ -223,7 +223,7 @@ public void testInvalidatesOnNewMeasureFunction() { c1.setMeasureFunction(new CSSNode.MeasureFunction() { @Override - public void measure(CSSNode node, float width, float height, MeasureOutput measureOutput) { + public void measure(CSSNode node, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode, MeasureOutput measureOutput) { measureOutput.width = 100; measureOutput.height = 20; } diff --git a/src/java/tests/com/facebook/csslayout/LayoutEngineTest.java b/src/java/tests/com/facebook/csslayout/LayoutEngineTest.java index f44e764298e..7958ffb96fc 100644 --- a/src/java/tests/com/facebook/csslayout/LayoutEngineTest.java +++ b/src/java/tests/com/facebook/csslayout/LayoutEngineTest.java @@ -27,16 +27,16 @@ public class LayoutEngineTest { new CSSNode.MeasureFunction() { @Override - public void measure(CSSNode node, float width, float height, MeasureOutput measureOutput) { + public void measure(CSSNode node, float width, CSSMeasureMode widthMode, float height, CSSMeasureMode heightMode, MeasureOutput measureOutput) { TestCSSNode testNode = (TestCSSNode) node; if (testNode.context.equals(TestConstants.SMALL_TEXT)) { - if (CSSConstants.isUndefined(width)) { + if (widthMode == CSSMeasureMode.UNDEFINED) { width = 10000000; } measureOutput.width = Math.min(width, TestConstants.SMALL_WIDTH); measureOutput.height = TestConstants.SMALL_HEIGHT; } else if (testNode.context.equals(TestConstants.LONG_TEXT)) { - if (CSSConstants.isUndefined(width)) { + if (widthMode == CSSMeasureMode.UNDEFINED) { width = 10000000; } measureOutput.width = width >= TestConstants.BIG_WIDTH ? @@ -44,10 +44,10 @@ public void measure(CSSNode node, float width, float height, MeasureOutput measu measureOutput.height = width >= TestConstants.BIG_WIDTH ? TestConstants.SMALL_HEIGHT : TestConstants.BIG_HEIGHT; } else if (testNode.context.equals(TestConstants.MEASURE_WITH_RATIO_2)) { - if (width > 0) { + if (widthMode != CSSMeasureMode.UNDEFINED) { measureOutput.width = width; measureOutput.height = width * 2; - } else if (height > 0) { + } else if (heightMode != CSSMeasureMode.UNDEFINED) { measureOutput.width = height * 2; measureOutput.height = height; } else { @@ -55,6 +55,12 @@ public void measure(CSSNode node, float width, float height, MeasureOutput measu measureOutput.height = 99999; } } else if (testNode.context.equals(TestConstants.MEASURE_WITH_MATCH_PARENT)) { + if (widthMode == CSSMeasureMode.UNDEFINED) { + width = 99999; + } + if (heightMode == CSSMeasureMode.UNDEFINED) { + height = 99999; + } measureOutput.width = width; measureOutput.height = height; } else { diff --git a/src/transpile.js b/src/transpile.js index 01f9821c846..e2ffa16abee 100644 --- a/src/transpile.js +++ b/src/transpile.js @@ -170,6 +170,11 @@ function printLayout(test) { 'nowrap': 'CSS_NOWRAP', 'wrap': 'CSS_WRAP' }); + addEnum(node, 'measureMode', 'measure_mode', { + 'undefined': 'CSS_MEASURE_MODE_UNDEFINED', + 'exactly': 'CSS_MEASURE_MODE_EXACTLY', + 'at-most': 'CSS_MEASURE_MODE_AT_MOST' + }); addFloat(node, 'flex', 'flex'); addFloat(node, 'width', 'dimensions[CSS_WIDTH]'); addFloat(node, 'height', 'dimensions[CSS_HEIGHT]');