Summary:
Add first version of test generation script. Currently works for most layouts and styles. Probably has a bunch of broken edge-case.
Usage:
$ gentest/gentest.sh
<Enter HTML with inline styles> e.g. <div style="width: 100px; height: 100px;"></div>
Open chrome dev tools console tab.
Copy code from console into file and save.
Run buck test //:CSSLayout
Differential Revision: D3697812
fbshipit-source-id: e6809f95bf6782e7e2cc47b9cdd3a25a13163c5c
Summary: Modern C allows us to document this kind of thing using C and not comments.
Reviewed By: adamjernst
Differential Revision: D3698569
fbshipit-source-id: c92b18540140662979cf001aeedaa76504c6a3ac
Summary: The previous repetition count did not scale to many benchmarks. Also add more benchmarks
Reviewed By: adamjernst
Differential Revision: D3697280
fbshipit-source-id: 56fe424f36936445f31d6e9fa080abbdd816d32d
Summary: Building on osx machines makes things a lot easier.
Differential Revision: D3693987
fbshipit-source-id: f6e2599f99a3fd4ac6fb2a6efd5563074da707d0
Summary: .buckversion is not needed in open source and we have no good way to keep it updated.
Differential Revision: D3696643
fbshipit-source-id: 3ce47a605730935e40f3cd3256a8ec3bd1f7b396
Summary: This means we don't need to use buck fetch. soloader ships as an aar and does not get updated often.
Differential Revision: D3696638
fbshipit-source-id: 57fc7c24067ee833f47ed7c34b927a0d84e20200
Summary: Use spacing for position in public api. This was already the case internally
Differential Revision: D3690235
fbshipit-source-id: 4c04952e6ded32fd5fbfdccf63736cf025ae470e
Summary:
As they're were not available yet.
Emil, I'm going to wait for your diffs to land before pushing this to
avoid disruptions on your side.
Differential Revision: D3669177
fbshipit-source-id: b06f382cb89546e817a2475298cf2cad17d95a2c
Summary:
Consistently namespace all of css-layout's public C API with "CSS". The only function that needed to be renamed was isUndefined, which I renamed to CSSValueIsUndefined.
Fixes#210.
Closes https://github.com/facebook/css-layout/pull/211
Reviewed By: lucasr
Differential Revision: D3674922
Pulled By: emilsjolander
fbshipit-source-id: 1752f477bde45586db112fe2654d0404cc52e1d1
Summary: This code used to be auto generated. Let's let clang-format clean up some stuff for us.
Reviewed By: lucasr
Differential Revision: D3662225
fbshipit-source-id: ddd4064cbf9be21ca6a97001ace1b56b4314c86f
Summary: The C version already has this ability via the same name 'context'. This can be used to attach arbitrary data about your view hierarchy to a CSSNode. Previously this could only be done in java via subclassing CSSNode.
Reviewed By: lucasr
Differential Revision: D3662065
fbshipit-source-id: 560a768092f17381e99b349d08bd4a8b365541be
Summary: To make the library easier to get started with we don't want to force people to use SoLoader. If SoLoader is not initialized we will fall back to the standard System.loadLibrary() method.
Reviewed By: lucasr
Differential Revision: D3661990
fbshipit-source-id: f2003577aa3d2f89ec579b6f889fdfb684110b60
Summary: This caches the class and method id references between calls. The class lookup is done once per method still but I think that is ok for now as the code becomes somewhat cleaner and more self contained.
Reviewed By: lucasr
Differential Revision: D3661989
fbshipit-source-id: 68d4557364bb8957400aefb2603c2e46424ccec3
Summary: Add jni bindings for csslayout. First step in many of removing LayoutEngine.java and performing all layout in native.
Reviewed By: lucasr
Differential Revision: D3648793
fbshipit-source-id: d0e696e196fa7c63109c9117a65645ca3d6c9c00
Summary: Anyone importing this header would have abort() redefined to nothing. That's not good. Fix mistake by defining a CSS_ABORT() macro instead.
Differential Revision: D3661871
fbshipit-source-id: 14a9d076299b4f21d17a2bed68aa30b796c438a5
Summary: assert.h assertion gets stripped from builds. I don't want these assertions to be stripped so implement a custom assert macro. This also allows the assertion to be documented with a message.
Reviewed By: javache
Differential Revision: D3648805
fbshipit-source-id: a6bf1bb55e1e0ee37284647ab76d66f3956a66c0
Summary: #pragma once is widely supported and is a lot harder to get wrong than #ifdef include guards.
Reviewed By: lucasr
Differential Revision: D3648895
fbshipit-source-id: faf42cda82764adaf41cf3f3f9109d48aea203fe
Summary: Java instructions were missing from the readme. Add a quick note about how to run tests in java.
Reviewed By: lucasr
Differential Revision: D3648981
fbshipit-source-id: d9009a60bb1bb0837722f914981ef4e31f0adb68
Summary: stdint.h defines the modern standard c types which have a fixed memory size. This makes the program run more predictably as well as removing the need to ugly double work types such as `unsigned int` or `long long`.
Reviewed By: lucasr
Differential Revision: D3649096
fbshipit-source-id: dc9fc8861c3106494c5d00d6ac337da50a4c945b
Summary: Implement some very basic benchmarking infra. We need benchmarks in css-layout and I want to add something now so that others have the option to follow an example when implementing a benchmark.
Reviewed By: lucasr
Differential Revision: D3648889
fbshipit-source-id: 60b93c6e5ed027a37195a9a5d86e681e3e79a5b9
Summary: This moves the api in line with the java api. hasNewLayout makes for sense than shouldUpdate because the API is not telling css layout to update but is instead just a marker for the user of the API to know if there has been a new layout since last time it checked.
Reviewed By: majak
Differential Revision: D3613695
fbshipit-source-id: 4e16e8d4de90660a09d6e1d3a43c6c5e89349993
Summary:
@public The make current RCTShadowView support RTL layout.
1 Change all left/right to start/end for margin, padding, boarder and position
2 Calculate position in the same way as margin, padding and boarder
Reviewed By: fkgozali
Differential Revision: D3619292
fbshipit-source-id: eaaa6faeee93c964d59bb6f498d89effc09ed567
Summary: @public The new CSSLayout have a wrong calculate for the getRelativePosition. So use the getLeadingPosition will get 0 instead of return undefined. Fix it with using isLeadingPosDefined.
Reviewed By: fkgozali
Differential Revision: D3640799
fbshipit-source-id: 50d3bd2ea4c0d8bf96ba34297425ba269b0535cd
Summary: The test case CSSLayoutTest/test_layout_node_with_bottom has some problem. I can't find a way to fix it without get the screen size. I decided to remove it first. If we could find a better way to right this test case. We can add it again.
Reviewed By: fkgozali
Differential Revision: D3629662
fbshipit-source-id: 303f81a74919e5d3bf037e2809e1345a554a7009
Summary:
@public The current CSSLayout can't support RTL because wrong calculation for absolute position.
This change is mainly to fix the issue: https://github.com/facebook/css-layout/issues/197
Three main problems I fixed:
1. Calculate the position in the same way as margin, boarder, and padding. So that to fix the absolute problem.
2. Fix one wrong calculation for leading value when we only know the trailing value. It was hard code for the LTR situation. Now I changed it to depends on the main Axis.
3. Expose getter and setter function for RN to read layout direction and start/end position value.
Reviewed By: fkgozali
Differential Revision: D3616949
fbshipit-source-id: ae7a47cc0a5d02b42b95f87232be51ab144056d9
Summary: The test case CSSLayoutTest/test_layout_node_with_bottom has some problem. I can't find a way to fix it without get the screen size. I decided to remove it first. If we could find a better way to right this test case. We can add it again.
Reviewed By: fkgozali
Differential Revision: D3629662
fbshipit-source-id: 62d6cd3827d20ae670af55d1c072bd9645a701b9
Summary: Update readme with info about building and github markdown syntax
Differential Revision: D3613284
fbshipit-source-id: 1f57009ccf02a48fe100f675ce08503e15cb6c22
We already did this optimization when there wasn't any
available horizontal space. Now we're covering the
vertical space case as well.
This optimization assumes that, for a node with a
measure function, if there isn't any available
horizontal or vertical space, then we don't need to
measure the node and can assume that the node is 0x0.