Summary: When config was added to YGNodeCanUseCachedMeasurement we didn't account for default 0 scale factor. This diff fixes that
Reviewed By: emilsjolander
Differential Revision: D5061016
fbshipit-source-id: 907ef987bd0ead29cf02f6945a3f03d4ffb58a2e
Summary: We want to be able to use YGConfig to account for possible rounding of width/height
Reviewed By: emilsjolander
Differential Revision: D5059560
fbshipit-source-id: d729e991758a8c668a4b373105b71337961875cd
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: This adds very little (no?) new features and mostly just refactors code to live in a singular place. Instead of users having to worry about DebugComponent as well as the DebugInfo object and attaching it correctly to a tree now user's of the DebugComponent API only need to worry about a single class, greatly simplifying its usage.
Reviewed By: passy
Differential Revision: D5027780
fbshipit-source-id: 95a95b3572747aa2088f8f9b35a160257eb59269
Summary: This diff adds node type definition to Yoga and moves rounding to rely on the node type. If the node has measure function we consider that node to be text node, otherwise we have default behavior.
Reviewed By: emilsjolander
Differential Revision: D5025107
fbshipit-source-id: a8d66e2f9c5d02ab080784cc474be583a09b92e2
Summary: Also bumped the version number for the existing dependency examples.
Reviewed By: emilsjolander
Differential Revision: D5044190
fbshipit-source-id: 4199ab114450a256efaa30a811822923beafb378
Summary:
Fix some long-standing issues with the android build on Travis (and elsewhere)
and enable automatic publishing of snapshots.
Reviewed By: emilsjolander
Differential Revision: D5044001
fbshipit-source-id: f00be07f33c8018573af0b98233068ebd93360b4
Summary: The appcompat library was way outdated and failed CI: https://travis-ci.org/facebook/yoga/builds/231065300
Reviewed By: emilsjolander
Differential Revision: D5043967
fbshipit-source-id: a5bb02110cf016972d983f511cf8c31dd9d667e1
Summary: So I can use them from JSBigString whose methods are marked const.
Reviewed By: emilsjolander
Differential Revision: D5020648
fbshipit-source-id: 6e60b80cb3d4718bab25dd6ca9627aee862117db
Summary:
Gets all the pieces in place to automatically publish snapshot artifacts after
successful travis build.
I'll test the actual publishing in a separate branch and then flip the switch in
a separate diff when it's ready.
Reviewed By: emilsjolander
Differential Revision: D5028239
fbshipit-source-id: c57d02a1dee41c84001bd17821b050c8c9aa4134
Summary:
Reuse the gradle setup we've built for Litho which allows for parallel publishing to Bintray and Maven Central in addition to Sonatype Snapshots.
This appears not to break the existing jcenter deploy script which is pretty great.
Reviewed By: emilsjolander
Differential Revision: D5020576
fbshipit-source-id: 3ef163ccbfe91c6858b051d39dcf237ca388e18d
Summary:
fbjni was previously dependency-free but now requires some annotations and
soloader. This unbreaks the gradle build.
Reviewed By: emilsjolander
Differential Revision: D5020069
fbshipit-source-id: b8bde83ce6a70b06e04491f1d70c2a6b568bc99c
Summary:
Moves the `YGLogger` into `YGConfig` and pass the `YGNodeRef` into the logger to be able to associate the log messages and assertions with the specific node.
Tackles facebook/yoga#530 and facebook/yoga#446
Closes https://github.com/facebook/yoga/pull/531
Reviewed By: astreet
Differential Revision: D4970149
Pulled By: emilsjolander
fbshipit-source-id: b7fcdaa273143ea2fa35861620b2e4d79f04f0af
Summary:
ActionBarActivity has been deprecated for 2+ years now.
Closes https://github.com/facebook/yoga/pull/538
Differential Revision: D4985973
Pulled By: emilsjolander
fbshipit-source-id: 09f2a8a12943c9b3ccdaee9cac684276b42ff843
Summary:
ActionBarActivity has been deprecated for 2+ years now.
Closes https://github.com/facebook/yoga/pull/539
Differential Revision: D4985970
Pulled By: emilsjolander
fbshipit-source-id: 2e2fcc5188c08ef1cd78f7e1be71917f0395ff2c
Summary: See blame revision. we are still passing all the added tests from that pull request but with much simpler logic.
Reviewed By: gkassabli
Differential Revision: D4977923
fbshipit-source-id: cb488e63c7c2e15e4c0f0133a16df36580c646fd
Summary: We need to treat measurements from nodes with measure functions as minimum values as to not truncate text.
Reviewed By: shergin
Differential Revision: D4972290
fbshipit-source-id: 0a7bcc7f47b3e5acb8745da5286abcb9c4e44a38
Summary:
We still need to wait for the `YGUnitPoint` PR to be merged :) But please let me know what you think. One caveat: because of a limitation of Swift, a literal value can be automatically understood as a point-based `YGValue`, but variables have to be explicitly cast. I haven't found a way around it yet:
```
view.yoga.width = 10 // value == 10, unit == YGUnitPixel
let a: CGFloat = 100
view.yoga.height = a // Compiler error
view.yoga.height = YGValue(a) // works, not great
```
Closes https://github.com/facebook/yoga/pull/390
Reviewed By: emilsjolander
Differential Revision: D4954021
Pulled By: maxoll
fbshipit-source-id: 5eff6aeb6dd969d0d5dc557b149bb5819b0e31de
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:
Hi! After merging 3db38f2a80 the rounding algorithm become broken in YogaKit because it doesn't configure scale factor.
Closes https://github.com/facebook/yoga/pull/534
Differential Revision: D4969481
Pulled By: emilsjolander
fbshipit-source-id: 57ea42a3b1f37007b2392cda724d509e0b28c4cb
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:
Nodes with a measure function needs to be measured even so it seems there is no available space. So it behaves more like on the web. Fixfacebook/yoga#488
Closes https://github.com/facebook/yoga/pull/499
Reviewed By: astreet
Differential Revision: D4954008
Pulled By: emilsjolander
fbshipit-source-id: 5b6d9afae0cdebe33f8b82b67620b3b4527d1efc
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: Update yoga's copy of fbjni to include some missing java files.
Reviewed By: IanChilds
Differential Revision: D4953841
fbshipit-source-id: 74d5c617a6fcd11e82c86f03e61448b14a34b86b
Summary:
Fixes#507 . The attribute name format got changed and the docs were left behind.
Closes https://github.com/facebook/yoga/pull/510
Differential Revision: D4953733
Pulled By: emilsjolander
fbshipit-source-id: 6eb02d6745d08fdd8cce669c691794351bd6fbc7
Summary:
Hey there, lets downgrade deployment target of YogaKit pod to iOS7. This days there is a lot of apps that still have support of ios7 (and i'm working on one of them :)). And I didnt't find any reason why it couldn't be done.
Thanks
Closes https://github.com/facebook/yoga/pull/524
Differential Revision: D4953726
Pulled By: emilsjolander
fbshipit-source-id: 9e17a40caaa0a3ae26779c0d08acb59f71df2b23
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