Commit Graph

289 Commits

Author SHA1 Message Date
Emil Sjolander
21a05417cd Generate RTL version of tests
Summary: Generate RTL versions of css-layout tests

Reviewed By: lucasr

Differential Revision: D3863081

fbshipit-source-id: df4debb3c1e371425d7c297f8d013b8042ad1e0e
2016-09-14 08:52:44 -07:00
Emil Sjolander
8fcb265830 Make generated test input more copy pastable
Summary: previously when copying in a test inout into an editor the user of gentest needed to remove the ` * ` prefix. This was annoying so this diff fixes that by removing that from gentest.

Reviewed By: lucasr

Differential Revision: D3862943

fbshipit-source-id: 06bd3ee3fa3f85cc44b6ea1d67cf3e91ed368791
2016-09-14 08:52:44 -07:00
Emil Sjolander
059384f277 Improve formatting of generated test code input
Summary: Make input html easier to read by indenting it and adding a space between children. The code to do this could very well be improved but it works for the current set of inputs.

Reviewed By: lucasr

Differential Revision: D3798087

fbshipit-source-id: 0d50ff276000f14ed078cf5ce2e7560ace285a6a
2016-08-31 11:22:42 -07:00
Adam Comella
b51e832e4e Fix sizing of absolutely positioned nodes inside overflow:hidden parent
Summary:
When an absolutely positioned node appeared inside an overflow:hidden
parent, we were limiting its height. This is inconsistent with how
layout behaves on the web.
Closes https://github.com/facebook/css-layout/pull/218

Reviewed By: lucasr

Differential Revision: D3797285

Pulled By: emilsjolander

fbshipit-source-id: 98f98e77aa26edce86b9882c1cac284799b69a27
2016-08-31 08:07:59 -07:00
Emil Sjolander
d9191431ff Generate test for border (and fix gentest to include border offset)
Summary: Generate tests for border. This required modifying gentest to add the parent clientLeft and clientTop so that border width are accounted for in output.

Reviewed By: lucasr

Differential Revision: D3791286

fbshipit-source-id: 698cc2332a3f4118e1afdfbfd745ba824e8ec3f4
2016-08-31 08:07:59 -07:00
Emil Sjolander
251a499ba6 Generate tests for padding
Summary: Add generated tests for padding

Reviewed By: lucasr

Differential Revision: D3791211

fbshipit-source-id: 7fb4580c2ab8fba05532df746297c7a0ec6a734e
2016-08-31 08:07:59 -07:00
Emil Sjolander
3c33184dbb Add tests for margin
Summary: Generate tests for margins

Reviewed By: lucasr

Differential Revision: D3791131

fbshipit-source-id: e038ccd8b9314a8cc472e4f57d77c5f097228344
2016-08-31 08:07:59 -07:00
Emil Sjolander
583830b3df Fix and add tests for cssedge priority
Summary: While adding tests for CSSEdge I found that when setting both horizontal/vertical/all + left/right then left/right were not correctly overriding the others. This is now fixed and validated through added tests

Reviewed By: lucasr

Differential Revision: D3791106

fbshipit-source-id: 3e0c943f94218848a1fbf36e5ae48dbc720ea923
2016-08-31 08:07:59 -07:00
Emil Sjolander
36eaae88e0 Add tests for dirty propagation
Summary: Previous test for dirty propagation (last test in CSSLayoutTest.cpp) only tested one specific case. This tests much more of the bahavior to ensure that a vital optimization in css-layout is applied correctly.

Reviewed By: lucasr

Differential Revision: D3790968

fbshipit-source-id: af11a5924640cd1d497920cd97549603a9f147cc
2016-08-31 08:07:59 -07:00
Emil Sjolander
284634c880 Remove unnecesarry imports for tests
Summary: Minimal imports

Reviewed By: lucasr

Differential Revision: D3790919

fbshipit-source-id: 496078d8132252307ef2b3cb45472917a19d7750
2016-08-31 06:22:46 -07:00
Emil Sjolander
1051c39a59 Add tests for measure caching
Summary: Measure caching is a crucial optimization to css-layout which re-uses the output of the measure function if possible. This logic was never covered by tests.

Reviewed By: lucasr

Differential Revision: D3790915

fbshipit-source-id: 7fe6d5ebb1303d3186d24d15e401901bc7c8ecdb
2016-08-31 05:08:29 -07:00
Emil Sjolander
e3fa40e694 Allow specifying the test name in the input to gentest
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
2016-08-26 10:38:01 -07:00
Emil Sjolander
2808e547c6 Revert changes causing layout failures
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
2016-08-26 03:22:35 -07:00
Emil Sjolander
8b4a61df1a Generate tests for min/max height/width
Summary: Generate tests for min/max height/width

Differential Revision: D3771576

fbshipit-source-id: a114f79bdb3d36237d7ecc22f8cef69b6899fc3d
2016-08-25 15:38:14 -07:00
Emil Sjolander
43faff434a Generate tests for flex properties
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
2016-08-25 15:38:14 -07:00
Emil Sjolander
ea9a6ce06f Generate test for justify content
Summary: Generate tests for justify content

Differential Revision: D3771389

fbshipit-source-id: 2f6c5a38e6899b9ef05b7ad2da9b881c3b71e15c
2016-08-25 15:38:14 -07:00
Emil Sjolander
beb51fac1b Generate test for align content
Summary: Generate tests for align content

Differential Revision: D3771383

fbshipit-source-id: 4a0798486522bdfd7f10ca4db7086096494f03d8
2016-08-25 15:38:14 -07:00
Emil Sjolander
d33befeb98 Generate test for align self
Summary: Generate tests for align self

Differential Revision: D3771377

fbshipit-source-id: eaeec8a7ac5609bd8dd95d31500054510ab749d9
2016-08-25 15:38:14 -07:00
Emil Sjolander
2fc622adbd Generate test for flex wrap
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
2016-08-25 15:38:14 -07:00
Emil Sjolander
aa70125f6c Generate tests for absolute layout
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
2016-08-25 15:38:14 -07:00
Emil Sjolander
9985e398b3 Generate test for align items
Summary: generate align-items tests

Reviewed By: IanChilds

Differential Revision: D3770946

fbshipit-source-id: 30ec043a8819d31a611f689bf89635f6a51c1628
2016-08-25 15:38:14 -07:00
Emil Sjolander
b629bcacab Generate test for flex direction
Summary: Generate flex-direction tests

Reviewed By: IanChilds

Differential Revision: D3770939

fbshipit-source-id: 7c02fe91bd50345c18653f70d1b572b643c44d26
2016-08-25 15:38:14 -07:00
Emil Sjolander
f65febb1af Remove certain computed values from output style
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
2016-08-25 15:38:14 -07:00
Emil Sjolander
f1ae87cd73 Implement flex properties in java version as well
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
2016-08-23 04:37:46 -07:00
Emil Sjolander
ca72b2b796 Use const where possible
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
2016-08-22 07:07:41 -07:00
Emil Sjolander
dab03cb800 Remove CSSPosition in favor of CSSEdge
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
2016-08-17 10:38:38 -07:00
Emil Sjolander
48e5304276 Specify format folders more granularly
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
2016-08-15 09:23:28 -07:00
Emil Sjolander
28bc42a988 Add generation script header to generated tests
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
2016-08-15 09:23:28 -07:00
Emil Sjolander
f68521aa69 Add support for flex-grow, flex-shrink, and flex-basis
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
2016-08-15 09:23:28 -07:00
Emil Sjolander
7a1e353404 Update clang-format rules
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
2016-08-15 09:23:27 -07:00
Emil Sjolander
f15b563166 Use spacing for position
Summary: Use spacing for position in public api. This was already the case internally

Differential Revision: D3690235

fbshipit-source-id: 4c04952e6ded32fd5fbfdccf63736cf025ae470e
2016-08-10 05:22:32 -07:00
Emil Sjolander
efe1595f0e Add and run clang format script
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
2016-08-04 08:23:02 -07:00
Emil Sjolander
c74eae50ac Add jni bindings
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
2016-08-04 08:23:01 -07:00
Mengjue Wang
5207b90420 Provide RTL support for RCTShadowView according to new csslayout
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
2016-07-29 10:37:40 -07:00
Mengjue Wang
041960fcbc Reverted commit D3629662
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
2016-07-28 21:52:33 -07:00
Mengjue Wang
46c842c71a Fix CSSLayout to Support RTL
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
2016-07-28 14:52:40 -07:00
Mengjue Wang
b26794a375 Fix the test files according to new CSSLayout change
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
2016-07-28 11:07:38 -07:00
FBShipIt
fdd8552c4e Import new C source of truth css-layout
fbshipit-source-id: e866918d6c62fc1cf3a04c269f782b94db9b875a
2016-07-25 15:53:07 +01:00
Emil Sjolander
93809b69c8 Restructure things to fit upcoming diff 2016-07-25 15:48:39 +01:00