Summary: Don't want to autoformat tests as they are autogenerated. Also they contain html which we don't want to get limited by line length.
Reviewed By: lucasr
Differential Revision: D3785246
fbshipit-source-id: 3e07b300ad16a1f0de53840e399eea25f4672b58
Summary: Allow adding test name within html through the id of the root element. This makes it much easier to re-generate test files.
Differential Revision: D3771966
fbshipit-source-id: 313e1648dcf4521e7c649f54c4ced2aa3297bf06
Summary: So that it can be reset when Spacing is used outside CSSNode.
Differential Revision: D3763593
fbshipit-source-id: 27436c0dbd292b38cfc98f4cfb8e2d12787b85d6
Summary: Revert changes to flex-basis as it broke some specific layouts. Will update later with a more comprehensive set of tests
Differential Revision: D3776987
fbshipit-source-id: 06bd154a36f895782f45511cd8cf49cc6d7cbe7d
Summary: Generate tests for flex-properties and fix bug where flex basis was not taken into account when parent main dimension was undefined.
Differential Revision: D3771513
fbshipit-source-id: 1b5edc7a28bb26217e8a6d10d1829d9031c3ae2e
Summary: Generate tests for flex wrap. The behavior for how the parents cross dimension is sized based on the children differs between browsers but looking at the spec this is the correct implementation.
Differential Revision: D3771140
fbshipit-source-id: bf144d506834e1d4217222bc2422150884a0be1c
Summary: These props were never tested so I didn't notice the typo until now.
Differential Revision: D3771132
fbshipit-source-id: 9d7c2037195f29b3cac5d21599035edf3b7830ff
Summary: generate absolute layout tests. Also make sure default value for position is relative (#default div is absolutely positioned)
Reviewed By: IanChilds
Differential Revision: D3770947
fbshipit-source-id: 0327b071c0dc1aa4574ded759dcc667768b28f55
Summary: Remove output properties from computed styles as they will be computed to their output values before we can read them. Only include them if they are explicitly set by the user.
Reviewed By: IanChilds
Differential Revision: D3770917
fbshipit-source-id: e55996cf8744073496debea19c36a188d2e5086c
Summary: Make the test cases absolute to ensure left/top are both zero for each layout in the test case.
Reviewed By: IanChilds
Differential Revision: D3770913
fbshipit-source-id: c3085c2f8709b52fde0af7f47e1417252997b610
Summary: Implement flexShrink flexGrow and flexBasis in java as well because it will take a bit until the java code is removed
Reviewed By: lucasr
Differential Revision: D3753231
fbshipit-source-id: ea41d887cd99d1f03d2bc876a2fd7141dbe48320
Summary: Benchmarks were broken by const diff leaving in some code which should not have changed. This was not caught earlier due to benchmarks only being run on travis.
Reviewed By: IanChilds
Differential Revision: D3751151
fbshipit-source-id: 08207ce7ad584d4681a27ec0727bbfdbc1198d05
Summary: Use const where possible. This does not use const for all variables as that would require too much refactoring for one diff. It does however use const where currently possible as well as does some small refactoring to enable const usage in more locations. Striving for 100% const usage leads to code with is easier to reason about as a reference will always reference the same value. The compiler will also assist if you accidentally override a reference.
Reviewed By: IanChilds
Differential Revision: D3741999
fbshipit-source-id: 1ba7da5784c3047f2d4c03746890192f724aa65e
Summary: Remove unnecessary function calls which just caused indirection and thus confusion. These were an artifact of the regex transpilation.
Reviewed By: IanChilds
Differential Revision: D3741988
fbshipit-source-id: fdb31dc45a478508b41c522f0e1b3ef842971b50
Summary: The concept of default padding was confusing and only used by react-native android. Makes more sense to let them manage this themselve.
Reviewed By: foghina
Differential Revision: D3709574
fbshipit-source-id: 6e0277bd97407a5c642d742f93ca2ac70d7307da
Summary: When moving over java code to JNI we must make sure things like spacing behave the same. This introduces the same concepts to the C code.
Reviewed By: lexs
Differential Revision: D3728742
fbshipit-source-id: aa19400880afa49664f7bde72b1df45314e699bb
Summary: When adding CSSEdge I kinda forgot we had CSSPosition. I should have just refactor renamed CSSPosition and added some fields. Well this cleans that up.
Reviewed By: IanChilds
Differential Revision: D3728740
fbshipit-source-id: 19dc817a637b80d1f6df8d76982feb2e1fb2705a
Summary: Pointers are 64 bit on 64 bit platforms so using an int might truncate the pointer. Using longs supports 32 bit platforms as well.
Reviewed By: davidaurelio
Differential Revision: D3722479
fbshipit-source-id: c132f24c92c8476b328713861ad30670a43040c4
Summary: JNI code isn't covered by tests yet so I accidentally passed the spacing constant as a pointer value. oops.
Differential Revision: D3722391
fbshipit-source-id: 9adaf7b80d7bad93887a122c10eb06159a5189c2
Summary: We don't run this file internally so this was not caught earlier. Must of course include the function before using it.
Reviewed By: lucasr
Differential Revision: D3717080
fbshipit-source-id: 15c070b6b18bfa4fdd495e8c3b1b5ae62cb09824
Summary:
marginLeft(node, margin) -> margin(node, CSSEdgeLeft, margin)
This reduces the api surface of CSSLayout as well as puts the api more in line with the java version. This also adds support for CSSEdgeAll which java has had support for for a while. This also open up the possibility of doing margin(node, CSSEdgeLeft | CSSEdgeTop, margin) in the future.
Reviewed By: lucasr
Differential Revision: D3715201
fbshipit-source-id: ea81ed426f0f7853bb542355c01fc16ae4360238
Summary: We don't want to format files in lib/ for example. For some reason java/jni and tests/CSSLayoutTestUtils folders were previously ignored. This change formats those folders as well.
Reviewed By: lucasr
Differential Revision: D3715203
fbshipit-source-id: 37bcbd36bcf8535cfca73d6a806ab0f1d097dde7
Summary: Previously format script had to be run from the root directory. With this change it can be run from anywhere
Reviewed By: lucasr
Differential Revision: D3715186
fbshipit-source-id: a46bc0b49aa32f0860bb3e3097ae7b08bdccbf2e
Summary: Add header to generated code so that code can easily be re-generated in case test generation is improved in the future.
Reviewed By: lucasr
Differential Revision: D3715181
fbshipit-source-id: 593baa691c2d7c7f171c6673898fb8a2ecf0e008
Summary: Modify test generation script to be able to generate multiple test cases
Reviewed By: lucasr
Differential Revision: D3714577
fbshipit-source-id: d2bc2155712f946c5a24231a9532d2acc097524c
Summary: Add support for flex-grow, flex-shrink, and flex-basis properties. The flex property behavior is preserved for backwards compatibility.
Reviewed By: lucasr
Differential Revision: D3714520
fbshipit-source-id: 80d3a9a1e2b6f74b863bbe22357f2c9865fa290e
Summary: Spent a couple hours customizing the clang-format rules to better match the desired code style.
Reviewed By: IanChilds
Differential Revision: D3714510
fbshipit-source-id: f6d0436346416aab023aacbedd70ea189e583e8d
Summary: allow_unsafe_import was added to internal builds. add no-op version for open source
Reviewed By: IanChilds
Differential Revision: D3714497
fbshipit-source-id: fac9710726fd981d442c84c5b5879a94b955d102
Summary:
Enable build file sandboxing in fbandroid.
Importing modules in build files that are not whitelisted will be blocked, this can be overriden by using
with allow_unsafe_import():
import foo
`import os` and `import os.path` will not be blocked and will import a safe version of `os` module instead (functions not accessing the file system like `os.path.join()` will be accessible), full `os` module can be imported using `allow_unsafe_import()`
Reviewed By: plamenko
Differential Revision: D3649817
fbshipit-source-id: 3e6a3ab9c4c6a56a99ca7adf599323143a5844f4
Summary: Mean was previously printed just because it was the quickest. Median is a better measurement and we need to include stddev for the sake of comparison against previous diff.
Differential Revision: D3709165
fbshipit-source-id: 67aff0877192143df82a9c24cbedb1f49616eec7
Summary: A .so file is only needed for the JNI target. The main library can be static.
Differential Revision: D3703897
fbshipit-source-id: b2efb98a6ae4488e6107c736c263cad35ef7c4fe
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