From 1cbb5eef26478bc79ae4f823cd15e537f90e26c0 Mon Sep 17 00:00:00 2001 From: Tadeu Zagallo Date: Fri, 24 Apr 2015 14:00:40 +0100 Subject: [PATCH 1/2] Fix lint errors and consts tests --- src/Layout-test-utils.js | 6 +++--- src/__tests__/Layout-test.js | 36 ++++++++++++++++++------------------ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Layout-test-utils.js b/src/Layout-test-utils.js index c60be4c3..3e1efaaa 100644 --- a/src/Layout-test-utils.js +++ b/src/Layout-test-utils.js @@ -361,10 +361,10 @@ var layoutTestUtils = (function() { var preDefinedTextSizes = { smallWidth: 34.671875, - smallHeight: 16, + smallHeight: 18, bigWidth: 172.421875, - bigHeight: 32, - bigMinWidth: 100.453125 + bigHeight: 36, + bigMinWidth: 100.4375 }; var textSizes; diff --git a/src/__tests__/Layout-test.js b/src/__tests__/Layout-test.js index 53f02106..a86550bb 100755 --- a/src/__tests__/Layout-test.js +++ b/src/__tests__/Layout-test.js @@ -1317,7 +1317,7 @@ describe('Layout', function() { it('should not override flex direction size within bounds', function() { testLayout( - {style: {width: 300, height: 200, flexDirection:'row'}, children: [ + {style: {width: 300, height: 200, flexDirection: 'row'}, children: [ {style: {flex: 1}}, {style: {flex: 1, minWidth: 90, maxWidth: 110}}, {style: {flex: 1}} @@ -1345,7 +1345,7 @@ describe('Layout', function() { ); }); - it ('should ignore flex size if fully max bound', function() { + it('should ignore flex size if fully max bound', function() { testLayout( {style: {width: 300, height: 200, flexDirection: 'row'}, children: [ {style: {flex: 1, maxWidth: 60}}, @@ -1360,7 +1360,7 @@ describe('Layout', function() { ); }); - it ('should ignore flex size if fully min bound', function() { + it('should ignore flex size if fully min bound', function() { testLayout( {style: {width: 300, height: 200, flexDirection: 'row'}, children: [ {style: {flex: 1, minWidth: 120}}, @@ -1378,10 +1378,10 @@ describe('Layout', function() { it('should pre-fill child size within bounds', function() { testLayout( {style: {width: 300, height: 200}, children: [ - {style: {flex: 1, minWidth: 290, maxWidth: 310}}, + {style: {flex: 1, minWidth: 290, maxWidth: 310}} ]}, {width: 300, height: 200, top: 0, left: 0, children: [ - {width: 300, height: 200, top: 0, left: 0}, + {width: 300, height: 200, top: 0, left: 0} ]} ); }); @@ -1389,10 +1389,10 @@ describe('Layout', function() { it('should pre-fill child size within max bound', function() { testLayout( {style: {width: 300, height: 200}, children: [ - {style: {flex: 1, maxWidth: 290}}, + {style: {flex: 1, maxWidth: 290}} ]}, {width: 300, height: 200, top: 0, left: 0, children: [ - {width: 290, height: 200, top: 0, left: 0}, + {width: 290, height: 200, top: 0, left: 0} ]} ); }); @@ -1400,10 +1400,10 @@ describe('Layout', function() { it('should pre-fill child size within min bounds', function() { testLayout( {style: {width: 300, height: 200}, children: [ - {style: {flex: 1, minWidth: 310}}, + {style: {flex: 1, minWidth: 310}} ]}, {width: 300, height: 200, top: 0, left: 0, children: [ - {width: 310, height: 200, top: 0, left: 0}, + {width: 310, height: 200, top: 0, left: 0} ]} ); }); @@ -1412,11 +1412,11 @@ describe('Layout', function() { testLayout( {style: {minWidth: 100, maxWidth: 300, minHeight: 500, maxHeight: 700}, children: [ {style: {width: 200, height: 300}}, - {style: {width: 200, height: 300}}, + {style: {width: 200, height: 300}} ]}, {width: 200, height: 600, top: 0, left: 0, children: [ {width: 200, height: 300, top: 0, left: 0}, - {width: 200, height: 300, top: 300, left: 0}, + {width: 200, height: 300, top: 300, left: 0} ]} ); }); @@ -1425,11 +1425,11 @@ describe('Layout', function() { testLayout( {style: {maxWidth: 100, maxHeight: 500}, children: [ {style: {width: 200, height: 300}}, - {style: {width: 200, height: 300}}, + {style: {width: 200, height: 300}} ]}, {width: 100, height: 500, top: 0, left: 0, children: [ {width: 200, height: 300, top: 0, left: 0}, - {width: 200, height: 300, top: 300, left: 0}, + {width: 200, height: 300, top: 300, left: 0} ]} ); }); @@ -1438,11 +1438,11 @@ describe('Layout', function() { testLayout( {style: {minWidth: 300, minHeight: 700}, children: [ {style: {width: 200, height: 300}}, - {style: {width: 200, height: 300}}, + {style: {width: 200, height: 300}} ]}, {width: 300, height: 700, top: 0, left: 0, children: [ {width: 200, height: 300, top: 0, left: 0}, - {width: 200, height: 300, top: 300, left: 0}, + {width: 200, height: 300, top: 300, left: 0} ]} ); }); @@ -1497,7 +1497,7 @@ describe('Layout', function() { {style: {position: 'absolute', top: 100, left: 100, bottom: 100, right: 100, maxWidth: 500, maxHeight: 600}} ]}, {width: 1000, height: 1000, top: 0, left: 0, children: [ - {width: 500, height: 600, top: 100, left: 100}, + {width: 500, height: 600, top: 100, left: 100} ]} ); }); @@ -1508,7 +1508,7 @@ describe('Layout', function() { {style: {position: 'absolute', top: 100, left: 100, bottom: 100, right: 100, minWidth: 900, minHeight: 1000}} ]}, {width: 1000, height: 1000, top: 0, left: 0, children: [ - {width: 900, height: 1000, top: 100, left: 100}, + {width: 900, height: 1000, top: 100, left: 100} ]} ); }); @@ -1541,7 +1541,7 @@ describe('Layout', function() { {style: {width: 5}}, {style: {}, children: [ {style: {}} - ]}, + ]} ]}, {width: 5, height: 0, top: 0, left: 0, children: [ {width: 5, height: 0, top: 0, left: 0}, -- 2.50.1.windows.1 From aad5efe938d8f568d4be001fa59252ca979c1a4c Mon Sep 17 00:00:00 2001 From: Tadeu Zagallo Date: Fri, 24 Apr 2015 14:12:18 +0100 Subject: [PATCH 2/2] Remove unused code pointed by Xcode --- src/Layout.c | 13 ------------- src/Layout.js | 13 ------------- .../src/com/facebook/csslayout/LayoutEngine.java | 13 ------------- 3 files changed, 39 deletions(-) diff --git a/src/Layout.c b/src/Layout.c index 5fbbd594..d0aac101 100644 --- a/src/Layout.c +++ b/src/Layout.c @@ -693,19 +693,6 @@ static void layoutNodeImpl(css_node_t *node, float parentMaxWidth) { } } - float containerMainAxis = node->layout.dimensions[dim[mainAxis]]; - // If the user didn't specify a width or height, and it has not been set - // by the container, then we set it via the children. - if (isUndefined(containerMainAxis)) { - containerMainAxis = fmaxf( - // We're missing the last padding at this point to get the final - // dimension - boundAxis(node, mainAxis, mainDim + getPaddingAndBorder(node, trailing[mainAxis])), - // We can never assign a width smaller than the padding and borders - getPaddingAndBorderAxis(node, mainAxis) - ); - } - float containerCrossAxis = node->layout.dimensions[dim[crossAxis]]; if (isUndefined(node->layout.dimensions[dim[crossAxis]])) { containerCrossAxis = fmaxf( diff --git a/src/Layout.js b/src/Layout.js index 652dc891..cf8353b8 100755 --- a/src/Layout.js +++ b/src/Layout.js @@ -584,19 +584,6 @@ var computeLayout = (function() { } } - var/*float*/ containerMainAxis = node.layout[dim[mainAxis]]; - // If the user didn't specify a width or height, and it has not been set - // by the container, then we set it via the children. - if (isUndefined(containerMainAxis)) { - containerMainAxis = fmaxf( - // We're missing the last padding at this point to get the final - // dimension - boundAxis(node, mainAxis, mainDim + getPaddingAndBorder(node, trailing[mainAxis])), - // We can never assign a width smaller than the padding and borders - getPaddingAndBorderAxis(node, mainAxis) - ); - } - var/*float*/ containerCrossAxis = node.layout[dim[crossAxis]]; if (isUndefined(node.layout[dim[crossAxis]])) { containerCrossAxis = fmaxf( diff --git a/src/java/src/com/facebook/csslayout/LayoutEngine.java b/src/java/src/com/facebook/csslayout/LayoutEngine.java index 2518bb00..c7283a14 100644 --- a/src/java/src/com/facebook/csslayout/LayoutEngine.java +++ b/src/java/src/com/facebook/csslayout/LayoutEngine.java @@ -638,19 +638,6 @@ public class LayoutEngine { } } - float containerMainAxis = getLayoutDimension(node, getDim(mainAxis)); - // If the user didn't specify a width or height, and it has not been set - // by the container, then we set it via the children. - if (CSSConstants.isUndefined(containerMainAxis)) { - containerMainAxis = Math.max( - // We're missing the last padding at this point to get the final - // dimension - boundAxis(node, mainAxis, mainDim + getPaddingAndBorder(node, getTrailing(mainAxis))), - // We can never assign a width smaller than the padding and borders - getPaddingAndBorderAxis(node, mainAxis) - ); - } - float containerCrossAxis = getLayoutDimension(node, getDim(crossAxis)); if (CSSConstants.isUndefined(getLayoutDimension(node, getDim(crossAxis)))) { containerCrossAxis = Math.max( -- 2.50.1.windows.1