Commit Graph

304 Commits

Author SHA1 Message Date
Lucas Rocha
996f2a03d5 Merge pre-fill loop into main line loop
There's no need to go through all children before starting the main line loop
as we'll visit all children in the former loop anyway. This diff merges the
pre-fill loop into the main line one to avoid an extraneous traversal on the
node's children.
2015-09-08 15:34:27 +01:00
Lucas Rocha
877a2838a6 Skip trailing position loop, if possible
There's no need to set the trailing position on left-to-right layouts
as the nodes will already have what we need (x, y, width, and height).
This means we still have an extra cost for reversed layout directions
but they are not as common as LTR ones.
2015-09-08 15:33:26 +01:00
Lucas Rocha
1ab785b7a3 Inline immutable values in layout algorithm
Store immutable values from the node being laid out to avoid unnecessary
method invocations during layout calculation. This gives us a 3%-5%
performance boost in my benchmarks on Android.
2015-09-08 15:15:52 +01:00
Lucas Rocha
06c708053f Change Java to use array indexes instead of methods
Method invocations are not entirely free on Android. Change the
generated Java code to use the same array-based approach used in
JS and C to compute dimensions, positions, etc instead of relying
too heavily on method invovations. As a bonus, the Java transpiler
becomes a lot simpler because the code is more analogous to the C
counterpart.

In my local benchmarks this change gives us a major performance
boost on Android (between 15% and 30%) depending on the device
and the runtime (Dalvik|Art).
2015-09-08 15:15:46 +01:00
Colin Eberhardt
e9b1258d5f Merge pull request #108 from ColinEberhardt/api-update
Updated the public API to no-longer extract nodes
2015-08-17 11:50:27 +01:00
Pierre Renaux
fee4d39367 feat(Gruntfile.js): Added package-c task which creates a unified single header css-layout.h for use in C code ; 2015-08-13 16:56:41 +08:00
Colin Eberhardt
f9bb74aedf Updated the public API to no-longer extract nodes 2015-08-13 09:56:16 +01:00
Colin Eberhardt
6d10a623d0 Added Java to the build 2015-08-12 07:42:29 +01:00
Colin Eberhardt
5653e4ef82 Fixed build and added distribution files to the repo 2015-08-11 21:22:27 +01:00
Colin Eberhardt
7f9b3afe33 Updated documentation
(And added missing change from previous commit!)
2015-08-11 17:56:21 +01:00
Colin Eberhardt
3b406b30c2 Module pattern is now implemented via templating
Previously two modules were defined, Layout.js, which is the internal implementation, and main.js, which depended on Layout.js and performed the fill / extract functionality required for a public JavaScript API.

This simplifies the implementation by just exposing a single UMD module by directly including Layout.js within the module wrapper.

Fixes #103
2015-08-11 17:42:59 +01:00
Colin Eberhardt
401f473449 Added eslint to the build
Fixes #102
2015-08-11 16:52:57 +01:00
Jared Forsyth
f7bab441e0 change to an xit 2015-08-06 12:35:12 -07:00
Jared Forsyth
3e9ac12d22 add failing test 2015-08-06 09:36:28 -07:00
Jared Forsyth
e1d99952f7 update const 2015-08-05 21:57:06 -07:00
Martin Konicek
b8981485d4 Fix a typo in CSSLayout.toString 2015-07-30 12:22:14 +01:00
Andy Street
7104f7c8eb Lazy init children ArrayList in CSSNode, update removeChildAt to return removed child 2015-07-29 11:39:42 +01:00
Lucas Rocha
3fc99b02ae Add style direction getter to CSSNode 2015-05-27 19:19:43 +01:00
Krzysztof Magiera
e932e4420d Update visibility of isDirty in CSSNode 2015-05-21 17:35:46 +01:00
Lucas Rocha
524b44200a Expose the resolved direction in the node's layout 2015-05-20 11:35:01 +01:00
Christopher Chedeau
ee1cbacc30 Merge pull request #79 from prenaux/master
[Issue facebook/css-layout#78]: Implemented alignContent ;
2015-05-17 08:58:05 -07:00
Pierre Renaux
019fc9b88c Merge remote-tracking branch 'upstream/master' 2015-05-17 21:54:30 +08:00
Felix Oghină
da98e234d7 [java] use getRaw to test if START/END were set 2015-05-15 16:52:57 +01:00
Felix Oghină
11f09d1a65 [java] simplify Spacing, reduce allocations 2015-05-15 14:13:25 +01:00
Lucas Rocha
6d72f472f5 Add getters for CSSNode's style width and height 2015-05-14 20:59:14 +01:00
Lucas Rocha
03dfe7bb17 Implement (padding|border|margin)-(start|end) support 2015-05-14 17:43:33 +01:00
Christopher Chedeau
c3a2ddcce7 Merge pull request #84 from lukasreichart/master
If the measure function is defined: only return from execution of lay…
2015-05-14 08:48:04 -07:00
Felix Oghină
bb8fdf57eb [java] implement proper spacing objects, with support for default spacing 2015-05-14 13:59:13 +01:00
Nick Lockwood
9175721f07 Removed space before -- for consistency with code style. 2015-05-12 10:10:39 +01:00
Nick Lockwood
bf1d7eacfd Fixed spacing for wrapped elements 2015-05-12 09:54:02 +01:00
Lucas Rocha
36a46673f9 Support ROW_REVERSE, COLUMN_REVERSE and RTL direction 2015-05-11 11:24:21 +01:00
Lukas Reichart
fca176109d If the measure function is defined: only return from execution of layoutNode, when the node has no children. 2015-05-10 17:46:48 +02:00
Pierre Renaux
a91566d6db [src/Layout.c & Layout-test-utils.c]: Don't define fmaxf/fminf if we're building with VC12+, its already declared from then on ; 2015-05-10 00:20:29 +08:00
Pierre Renaux
09f0c12a8f [src/Layout.js]: Cleaner line loop in <Loop E> (alignContent layout) ; 2015-05-10 00:20:29 +08:00
Pierre Renaux
14e264f5be Made relevant JS tests transpile to C ; [src/Layout.c]: print_css_node_rec(): print alignContent ; [src/Layout-test-utils.c]: add_failed_test(): Sets failed_test->next to NULL, otherwise the test crashes if there's one and only one failure ; Added type casts so that it can be compiled as C++ by MSVC on Windows ; [Makefile]: Added c_test_msvc target when running in Windows so that the test executable can be built and debugged with Visual Studio on Windows ; 2015-05-10 00:20:28 +08:00
Pierre Renaux
c7fbf44474 'alignContent' defaults to 'flex-start' instead of 'stretch' ; 2015-05-10 00:19:30 +08:00
Pierre Renaux
8493789989 [src/Layout-test-utils.js]: Fix so that RunLayoutTests.html works on Chrome for Windows ; 2015-05-10 00:19:29 +08:00
Pierre Renaux
cc5f772bff Style fixes ; 2015-05-10 00:19:29 +08:00
Pierre Renaux
9ca681ff28 [src/__tests__/Layout-random-test.js]: Added alignContent in the list of random permutations ; 2015-05-10 00:19:28 +08:00
Pierre Renaux
7679ed77d9 Updated generated C & Java code ; 2015-05-10 00:19:28 +08:00
Pierre Renaux
15a8430be9 [src/Layout-test-utils.js]: Added inplaceRoundNumbersInObject to testRandomLayout so that much less random tests fail ; Moved inplaceRoundNumbersInObject in the main functions instead of having it in nameLayout ; 2015-05-10 00:19:28 +08:00
Pierre Renaux
68d029e460 [src/__tests__/Layout-test.js]: Added 16 test cases for each alignContent / alignItems combination - also includes alignSelf testing within the test data ; 2015-05-10 00:19:27 +08:00
Pierre Renaux
f4226d3ff5 [src/Layout-test-utils.js]: Added testMeasurePrecision and inplaceRoundNumbersInObject which snap the numbers to pixels so that we don't have to re-adjust for each browser version (Chrome 42 changed their computation, it can output floating point values for dom elements) ; 2015-05-10 00:19:27 +08:00
Pierre Renaux
998fa1d6ba [Issue facebook/css-layout#78]: Implemented alignContent ; 2015-05-10 00:19:27 +08:00
Christopher Chedeau
8cdf0d0228 Display children for test failures 2015-05-08 17:02:34 -07:00
Christopher Chedeau
3203e86155 Merge pull request #70 from tadeuzagallo/remove-dead-code
Remove unused code pointed by Xcode
2015-05-05 08:10:04 -07:00
Pierre Renaux
ee5e8c1722 [Layout.c/h]: Minor modifications so that the Microsoft compiler can compile the file as C++ directly ; 2015-05-05 18:07:06 +08:00
Andrew Rasmussen
86c39b5e4f Revert "Ensure that flex children adopt their parent's cross-axis min dimension."
This reverts commit b8316413b3.

This was causing issues for existing components built with React
Native.. we need to investigate more in the future.
2015-05-01 12:16:47 -07:00
Andrew Rasmussen
5f52e947cb Fix layout for absolutely positioned nodes with absolutely positioned parents that have border and/or padding 2015-04-30 14:40:39 -07:00
Eunchong Yu
129e41f832 Transpile to update the changes of consts omitted in #69 2015-04-26 14:11:05 +09:00