Summary: We were using a very out-dated version of watir which did not run with latest ruby
Reviewed By: priteshrnandgaonkar
Differential Revision: D6447029
fbshipit-source-id: ff4ccb8c96947811ff09f7e87cb504e3e7cb834e
Summary:
If you have a measurable node and set ```marign-left: auto``` + ```align-item:stretch``` on it, it won't get measured and they get a width/height of ```-(nan)```. This change fixes that behaviour. Fixes#644.
Closes https://github.com/facebook/yoga/pull/645
Differential Revision: D6413512
Pulled By: emilsjolander
fbshipit-source-id: 755febeb33bb0d4520ca6b3c28d56ac333e4a14d
Summary:
Adds new ```space-evenly``` for ```justify-content```.
Also adds a typofix in one of the other justify-content tests.
Fixes#657
Closes https://github.com/facebook/yoga/pull/658
Differential Revision: D6407996
Pulled By: emilsjolander
fbshipit-source-id: cc837409e1345624b4bd72c31e25fe68dcb0f6a3
Summary:
This fixes shrinking of elements which are in a non stretch alignment, but keeps the legacy stretch behaviour in place. Additionally this adds a testcase for ```useLegacyStretchBehaviour```
Fixes#633
Closes https://github.com/facebook/yoga/pull/635
Differential Revision: D6408037
Pulled By: emilsjolander
fbshipit-source-id: 377ab0308dd3a75a148a0af31ab5eb3ffb5b5d83
Summary:
The min/max inner width shouldn't take the margins into account.
Adds a test for both cases.
Fixes#664
Closes https://github.com/facebook/yoga/pull/665
Differential Revision: D6407982
Pulled By: emilsjolander
fbshipit-source-id: ffa549a06f802263e3b8488e90756aa3f722d52d
Summary:
This fixes shrinking of elements which are in a non stretch alignment
Fixes#633
Closes https://github.com/facebook/yoga/pull/634
Differential Revision: D5874862
Pulled By: emilsjolander
fbshipit-source-id: 1426aa6b60f6ba42c2be702e6f24cea935ab7acb
Summary:
The only thing I found in the spec for this change is the following. Not exactly sure if this is the thing this PR is about:
> For each flex item, subtract its outer flex base size from its max-content contribution size. If that result is not zero, divide it by (if the result was positive) its **flex grow factor floored at 1** or (if the result was negative) by its scaled flex shrink factor, having **floored the flex shrink factor at 1**. This is the item’s max-content flex fraction.
But at least it seems a required change.
Fixesfacebook/yoga#566
Closes https://github.com/facebook/yoga/pull/572
Differential Revision: D5264388
Pulled By: emilsjolander
fbshipit-source-id: 0004d1c3b9bad070a98cd6766c1adc06a54475f8
Summary:
This is a fix on top of 56b10fc. It takes the case into account were you have `wrap-reverse` and `align-items: flex-end` set.
Closes https://github.com/facebook/yoga/pull/568
Differential Revision: D5155521
Pulled By: emilsjolander
fbshipit-source-id: 7e5fcfa2fbb48b6c6279da46cc648a071ff2b079
Summary:
1, Change bottom to be based� on height of parent.
2, Respect margin value when layout with right/bottom.
Closes https://github.com/facebook/yoga/pull/552
Differential Revision: D5102090
Pulled By: emilsjolander
fbshipit-source-id: dca291413ffc2027d7628f4c8b8eeeb0b4823bc2
Summary: We should always try to make root node as small as possible, while previously this wasn't functioning this way
Reviewed By: emilsjolander
Differential Revision: D5071164
fbshipit-source-id: b8afef42477d0ed87d0c9fcfd26349e0a0babd6e
Summary: Include margin when calculating if children overflow
Reviewed By: passy
Differential Revision: D5044471
fbshipit-source-id: e7c1eb694445ffb898bcf375d9deefc558c49f11
Summary: Fix flex basis not being constraint to the max size in the main direction. Previously this caused the added test to fail due to NaN in child dimensions.
Reviewed By: gkassabli
Differential Revision: D5044314
fbshipit-source-id: d9f9db832e4943a57a89c9d162ff6077b709795a
Summary:
Fixes the sizing of items so that under most scenarios it calcultes its height by it's content for non exact measurings. This introduces a new useLegacyStretchBehaviour flag on the config to opt out of this change as it is breaking.
See facebook/yoga#505
Closes https://github.com/facebook/yoga/pull/506
Reviewed By: astreet
Differential Revision: D4954016
Pulled By: emilsjolander
fbshipit-source-id: d28bd5d174cd76951fb94df85e3b0cfab7f81ff7
Summary: Rounding has been successfully adopted by multiple products and frameworks. Time to move it out of experimental mode. Rounding can still be turned of by setting the point scale factor to 0 on the config.
Reviewed By: gkassabli
Differential Revision: D4953838
fbshipit-source-id: 3ee5f27d92f95b3ed4a01c98bc35e9157f2e91c5
Summary:
Fixes `flex-wrap` with a max constraint and `justify-content`. Fixesfacebook/yoga#514.
Closes https://github.com/facebook/yoga/pull/519
Differential Revision: D4953727
Pulled By: emilsjolander
fbshipit-source-id: 32dec48220be1392ea8dac5f34871d407eb8d49b
Summary:
This diff introduces new, little bit sophisticated round-to-pixel-grid algorithm.
**Motivation:**
Previous simple and straightforward solution works in most cases but sometimes produce the not-so-great result. A while ago Nick Lockwood described this problem and proposed the solution in RN's RCTShadowView class:
For example, say you have the following structure:
// +--------+---------+--------+
// | |+-------+| |
// | || || |
// | |+-------+| |
// +--------+---------+--------+
Say the screen width is 320 pts so the three big views will get the following x bounds from our layout system:
{0, 106.667}, {106.667, 213.333}, {213.333, 320}
Assuming screen scale is 2, these numbers must be rounded to the nearest 0.5 to fit the pixel grid:
{0, 106.5}, {106.5, 213.5}, {213.5, 320}
You'll notice that the three widths are 106.5, 107, 106.5.
This is great for the parent views but it gets trickier when we consider rounding for the subview. When we go to round the bounds for the subview in the middle, it's relative bounds are {0, 106.667} which gets rounded to {0, 106.5}. This will cause the subview to be one pixel smaller than it should be. This is why we need to pass in the absolute position in order to do the rounding relative to the screen's grid rather than the view's grid. After passing in the absolutePosition of {106.667, y}, we do the following calculations:
absoluteLeft = round(absolutePosition.x + viewPosition.left) = round(106.667 + 0) = 106.5
absoluteRight = round(absolutePosition.x + viewPosition.left + viewSize.width) + round(106.667 + 0 + 106.667) = 213.5
width = 213.5 - 106.5 = 107
You'll notice that this is the same width we calculated for the parent view because we've taken its position into account.
I believe this is awesome. I also believe that we have to decouple this logic from RN and put it into awesome Yoga. So I did it in this diff.
**Fun fact:**
The original implementation of this algorithm in RN had (and still have) a bug, which was found by Dustin dshahidehpour and fixed in D4133643. Therefore that diff was unlanded because it broke something unrelated inside RN text engine. I will fix that problem in RN later.
**Why do we need to change test methodology?**
Because the way we receive layout metrics from Chrome browser actually directly related to rounding problem. Previously we used `offsetHeight` and `offsetWidth` properties of the DOM node, which contain naively rounded values from `computedStyle` or `getBoundingClientRect`. (Which is we are trying to fix!) So, I added the new function that computes node size using two-step-rounding approach, conceptually similar to one that implemented in Yoga. Note: Chrome browser performs rounding layout as part of rendering process and actual values that can ve computed by counting actual pixel are different from these natively rounded ones.
**Why do some tests now have different desired values?**
These changes actually prove that my approach is correct and more useful for actual view rendering goals. So, let's take a look at test with changed values `rounding_fractial_input_3`:
Previously: 64+25+24=114 (Incorrect!)
Now: 65+24+25=114 (Correct!)
Previously: 64+25+24=114 (Incorrect!)
Now: 65+24+25=114 (Correct!)
Reviewed By: emilsjolander
Differential Revision: D4941266
fbshipit-source-id: 07500f5cc93c628219500e9e07291438e9d5d36c
Summary: This diff corrects the fix to be limited only to cases when either element itself or all of it's children can't be flexed
Reviewed By: emilsjolander
Differential Revision: D4915189
fbshipit-source-id: efccee2fe39ed0f474a41dc3250d24c546f3f5d9
Summary:
Fixes the sizing of items so that under most scenarios it calcultes its height by it's content for non exact measurings. See facebook/yoga#505
Closes https://github.com/facebook/yoga/pull/506
Differential Revision: D4878875
Pulled By: emilsjolander
fbshipit-source-id: ab1174ac7a76dcf20aae7b29a3bc396e11077c4d
Summary:
If the root node has a position and we have a RTL layout, that position must be like LTR direction. See #477.
Closes https://github.com/facebook/yoga/pull/502
Differential Revision: D4867144
Pulled By: emilsjolander
fbshipit-source-id: b5ad3d87e7054090da12d7665a3d1abe8496a548
Summary:
The following PR fixes the tests used in the javascript port (it modifies gentest.rb).
These changes don't yet pass, it seems something is segfaulting somewhere. I have to check if it comes from nbind, the yoga library, or the node bridge itself. There's also some fails on the browser build, but it might be the same issue.
Closes https://github.com/facebook/yoga/pull/487
Reviewed By: emilsjolander
Differential Revision: D4778870
Pulled By: astreet
fbshipit-source-id: 936fbca564ec89738c78e50c4402c53eb6867dec
Summary:
This fixes ```align-content: center``` and ```align-content: flex-end``` when the child exceeds the parents size. See #476. It also fixes those layouts if the child has ```margin: auto``` set.
Closes https://github.com/facebook/yoga/pull/477
Differential Revision: D4697833
Pulled By: emilsjolander
fbshipit-source-id: d081ec7ea559a5f2bd3271c3a4dc272960beddfa
Summary:
We need to take the margin into account if we clip on max dimension. Fixes#466.
Closes https://github.com/facebook/yoga/pull/467
Differential Revision: D4681342
Pulled By: emilsjolander
fbshipit-source-id: 56311df9864a284d553c31f1c6db382f337f1fad
Summary: Add test covering a nested percentage container inside of a unconstraint container. This is something we ran into recently and want to make sure to cover in tests.
Reviewed By: astreet
Differential Revision: D4637519
fbshipit-source-id: a8fe3c7702c2ea0ad954cce80fbdf953bb23c997
Summary:
Move configuration to new ```YGConfig``` and pass them down to CalculateLayout. See #418 .
Adds ```YGConfigNew()``` + ```YGConfigFree```, and changed ```YGSetExperimentalFeatureEnabled``` to use the config.
New function for calculation is ```YGNodeCalculateLayoutWithConfig```.
Closes https://github.com/facebook/yoga/pull/432
Reviewed By: astreet
Differential Revision: D4611359
Pulled By: emilsjolander
fbshipit-source-id: a1332f0e1b21cec02129dd021ee57408449e10b0
Summary: Test fails when we have flexible child and min/max layout dimension. Yoga should flex the child to minimal size, while in reality Yoga flexes it to maximal size
Reviewed By: emilsjolander
Differential Revision: D4558653
fbshipit-source-id: 06b38d7ed43aee063cc881f38b84558641f043f3
Summary:
Fix for #413. This was a hangover from a previous attept to fix other align-content problems.
Closes https://github.com/facebook/yoga/pull/417
Reviewed By: astreet
Differential Revision: D4604727
Pulled By: emilsjolander
fbshipit-source-id: 92fd31a385d8182c6b201c891d5ae478372d525d
Summary:
Since my new main work maschine is a hdpi device, all the gentests with rounding are producing different outputs.
This PR force the scalefactor=1 for gentest to fix issues with generation on hdpi devices.
Closes https://github.com/facebook/yoga/pull/434
Differential Revision: D4604724
Pulled By: emilsjolander
fbshipit-source-id: ce4036ae71a45775280e0504f20c06a4622ccceb
Summary: When a container's children wrap the container should match the parent size and not wrap to the new size of the children. This is confirmed behavior in chrome.
Reviewed By: astreet
Differential Revision: D4578614
fbshipit-source-id: 5d22a3a673735587384d775189158a87bb1d457d
Summary:
I couldn't resist to do this 😄#394
This adds ```flex-wrap: wrap-reverse```
I think we hit a edge case here:
https://stackoverflow.com/questions/33891709/when-flexbox-items-wrap-in-column-mode-container-does-not-grow-its-width
as is differs here from chrome, but I think that yoga is here more correct.
So I haven't added this test yet as this would fail against chrome, as chrome outputs a width of 30 for root, whereas yoga gets a width of 60 here, which I think is correct. Strangely the output of ```flex-wrap:wrap``` is in jsfiddle also only with a (visual) width of 30 on chrome, while the tests gets generated with 60.
```html
<div id="wrap_reverse_column" style="height: 100px; flex-wrap: wrap-reverse">
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
<div style="height: 30px; width: 30px;"></div>
</div>
```
Looking forward what you think here emilsjolander
Closes https://github.com/facebook/yoga/pull/398
Reviewed By: astreet
Differential Revision: D4564711
Pulled By: emilsjolander
fbshipit-source-id: 33dc055abd8444b2aa7796ef90bd7ec99e961bb8
Summary:
...to reflect the modern world we live in with dynamic DPI platforms :)
Closes https://github.com/facebook/yoga/pull/375
Reviewed By: dshahidehpour
Differential Revision: D4528518
Pulled By: emilsjolander
fbshipit-source-id: e422bd4ae148e02c598a7b484a6adfa8c0e1e0c9
Summary:
Even so I know there are some opinions against ```margin: 0 auto``` it's still part of the spec: https://www.w3.org/TR/css-flexbox-1/#auto-margins and pretty usefull if you have to position via ```justify-content```.
This PR adds an implementation for that.
It adds an additonal ```YGUnitAuto``` and margins got ```YGNodeStyleSetMarginAuto``` functions as well.
Closes https://github.com/facebook/yoga/pull/357
Reviewed By: astreet
Differential Revision: D4501142
Pulled By: emilsjolander
fbshipit-source-id: 86519f8632496f46e78a7c9dbc5b21e212e3e0c7
Summary: This is an update of facebook/yoga#368 which was reverted. It fixes support for align-content: strech with multiple lines. The problem with the last attempt at solving this was that align-items:stretch was interfering. We handle this now by detecting when the flex basis of the children hints at them overflowing. This is not 100% correct as the size of the items could change when remeasuring but it will work in 99% of cases.
Reviewed By: astreet
Differential Revision: D4551234
fbshipit-source-id: 2964f19cf415991dc55dfa2caa4868cb00c56bd0
Summary:
Fixes ```align-content:strech``` on nodes without specified cross dimension, if there are multiple lines. Currently it uses the full height of the parent, but it has to use the line height. As we don't know the number of lines until here, we need to realign the relevant children.
Closes https://github.com/facebook/yoga/pull/368
Reviewed By: gkassabli
Differential Revision: D4528559
Pulled By: emilsjolander
fbshipit-source-id: 019e6f85fa452d0c3412f711e3886f0c4452da47
Summary:
Adds the two missing alignments ```space-between``` and ```space-around``` for ```align-content``` . Those values are a noop on ```align-items``` in order to prevent a breaking changes for an additional enum.
Fix#229
Closes https://github.com/facebook/yoga/pull/364
Reviewed By: gkassabli
Differential Revision: D4528561
Pulled By: emilsjolander
fbshipit-source-id: ea6291b6dd22cef05d9eec03893250d50371236e
Summary:
Two bugs:
1. Min/Max width/height should have higher priority than width/height
2. custom measure nodes percentages should be based in parent size like everything else.
Differential Revision: D4537576
fbshipit-source-id: c003f723f424afbca63170d41e54fd5ff837926d
Summary: Test fails when we have flexible child and min/max layout dimension. Yoga should flex the child to minimal size, while in reality Yoga flexes it to maximal size
Reviewed By: emilsjolander
Differential Revision: D4456312
fbshipit-source-id: 82a39bc93cf3bf2374b968e9f7403397e752908e
Summary:
Fix#241 and successor for #302
Added new property ```display``` with ```YGDisplayFlex``` and ```YGDisplayNone```. Allows to hide nodes from the layout without the need to remove it from the DOM.
Closes https://github.com/facebook/yoga/pull/369
Reviewed By: astreet
Differential Revision: D4501141
Pulled By: emilsjolander
fbshipit-source-id: 0dfeee381f6d1e4bbba81926126b83dd7abab9d6
Summary: For percentage paddings/margins/sizes to work on the root node we need to have the ability to pass down the parent sizes. This has always been possible with the C API but was never exposed to java. This diff exposes this functionality.
Reviewed By: astreet
Differential Revision: D4501016
fbshipit-source-id: 0c9502e86ff200c021c78afb7ac4b48cf11b3bdb