Lucas Rocha
909c14117f
Fix dimension check for STRETCH children
...
The correct check is on the layout state, no the style.
2015-09-10 11:19:28 +01:00
Lucas Rocha
9a149c83ff
Avoid extra work when justifyContent is FLEX_START
...
Remaining space and between space only need to be updated when
justifyContent is not FLEX_START.
2015-09-10 11:19:28 +01:00
Lucas Rocha
2321165d53
Move condition to the non-redundant block
...
No need to check for RELATIVE position when position type is ABSOLUTE
and dimension is set.
2015-09-08 15:34:51 +01:00
Lucas Rocha
d1a49a4f0b
Reduce search range of flexible children
...
We were traversing all children to only perform calculations/changes to
flexible children in order to avoid new allocations during layout. This
diff ensures we only visit flexible children during layout calculations
if any are present. We accomplish this by keeping a private linked list
of flexible children.
2015-09-08 15:34:51 +01:00
Lucas Rocha
793220faf8
Skip final loop on absolute children, if possible
...
There's no need to go through all absolute children at the end of the
layout calculation if the node at hand doesn't have any. This also
ensures only absolutely positioned children are traversed in the final
loop.
2015-09-08 15:34:51 +01:00
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
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
Lucas Rocha
524b44200a
Expose the resolved direction in the node's layout
2015-05-20 11:35:01 +01:00
Pierre Renaux
019fc9b88c
Merge remote-tracking branch 'upstream/master'
2015-05-17 21:54:30 +08: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
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
cc5f772bff
Style fixes ;
2015-05-10 00:19:29 +08:00
Pierre Renaux
998fa1d6ba
[Issue facebook/css-layout#78 ]: Implemented alignContent ;
2015-05-10 00:19:27 +08: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
Tadeu Zagallo
aad5efe938
Remove unused code pointed by Xcode
2015-04-24 16:45:49 +01:00
Russell Keith-Magee
b8316413b3
Ensure that flex children adopt their parent's cross-axis min dimension.
2015-04-07 10:52:15 +08:00
Russell Keith-Magee
2b6844f00a
Simplified logic distributing flex space.
2015-03-31 18:58:56 +08:00
Russell Keith-Magee
c523b7c404
Added support for min/max width and height constraints.
2015-03-31 17:32:54 +08:00
Tom Mulcahy
ddd7a899ac
Make Java measure thread-safe.
2015-03-26 22:49:48 +00:00
Russell Keith-Magee
8f6a96adbc
Normalized C and Java definition of isDimDefined.
...
The JavaScript implementation of isDimDefined contains a check to ensure
that the dimension value is positive; the C and Java versions did not
have this check. As a result, a negative style value for 'width' (such
as that used by the "should layout node with negative width" test) would
have different layout under the C/Java implementation to the JavaScript
implementation.
This was hidden because the C/Java transpilers filtered out any negative
instantiation values from the test suite. In effect, the negative value
tests weren't running on the C/Java implementation.
This patch removes the negative value filter from the transpiler, and
makes the isDimDefined definition consistent between the three
implementations.
2015-03-22 14:36:16 +08:00
daviskoh
9c71cc6d1f
resolve merge conflicts
2015-02-17 21:30:41 -05:00
daviskoh
3a6e50db99
Address eslint errors:
...
* modify .eslintrc w/ globals & rules
* use judgement in deciding bet proj style & eslint recommendation
* make
2015-02-17 21:12:29 -05:00
Christopher Chedeau
5f8c3b0eb7
Update C version
2015-02-04 07:50:15 -08:00
Christopher Chedeau
10fb645777
Initial implementation of flexWrap
2014-12-12 12:03:31 +00:00
Christopher Chedeau
28243156e4
make C and Java tests pass and update their code
2014-12-11 20:23:53 +00:00
Christopher Chedeau
c2aa92cd0b
Add licenses and remove third party libraries
2014-10-29 08:01:22 -07:00
Christopher Chedeau
c0f895c6f2
Make align-items: stretch the default
2014-10-08 09:35:44 -07:00
Andy Street
6d93c20610
Java
2014-10-07 16:22:27 -07:00
Andrew Rasmussen
7eef01f299
make setting bottom/right calculate top/left
2014-09-30 15:24:42 -07:00
Andrew Rasmussen
91786cd2c7
make isUndefined public, add CSS_POSITION_COUNT back
2014-09-30 13:18:03 -07:00
Andrew Rasmussen
0ae8bcf8f6
Add second position: absolute pass
2014-09-30 13:11:32 -07:00
Alex Kotliarskyi
08095b7d2c
Travis CI integration
2014-09-26 18:54:34 -07:00
Alex Kotliarskyi
a047e4d5fe
Automated script to transpile code and tests to C
2014-09-26 17:19:59 -07:00
Andrew Rasmussen
6f347d74a3
Added another pass to calclulate absolutely positioned elements last
2014-09-25 16:05:01 -07:00
Christopher Chedeau
d7f3ea868d
Import latest changes
2014-09-11 09:23:30 -07:00
Christopher Chedeau
9a45599b84
better print utils
2014-06-11 21:00:57 -07:00
Christopher Chedeau
d2ce2420f4
Lots of changes that I forgot to properly commit
2014-06-04 10:51:23 -07:00