Commit Graph

312 Commits

Author SHA1 Message Date
Nick Gerleman
080d16cabf Cleanup YGValue.h header (#37179)
Summary:
X-link: https://github.com/facebook/react-native/pull/37179

Pull Request resolved: https://github.com/facebook/yoga/pull/1273

1. Simplify nan handling a bit
2. Remove string literal operators which seem dead enough to remove. These are public, so anyone could be using them, but it seems like almost nobody is.
    1. FB has no usages of `using namespace facebook::yoga::literals` (exposing the literal operators) outside of Yoga tests.
    1. There is only [a single usage](6dfba905ea/SDLTest/UIKit.hpp (L19)) on GitHub.

Reviewed By: yungsters

Differential Revision: D45419970

fbshipit-source-id: 8121303e5ae66596132a848a711802081728f4fb
2023-05-02 17:08:24 -07:00
Nick Gerleman
f32d37a3d5 Deprecate YGConfigSetUseLegacyStretchBehaviour (#37117)
Summary:
X-link: https://github.com/facebook/react-native/pull/37117

Pull Request resolved: https://github.com/facebook/yoga/pull/1265

This deprecates `YGConfigSetUseLegacyStretchBehaviour` and `YGConfigGetUseLegacyStretchBehaviour`and points users to errata APIs instead. Using the C API will fire deprecation warnings, which should create errors in builds with `-Werror`, though they can be ignored if truly needed (like we do with the language bindings which need to expose their own deprecated interface).

Reviewed By: rshest

Differential Revision: D45337198

fbshipit-source-id: 7f069623e38834171f5702382bbf47c37a556a22
2023-04-30 08:20:05 -07:00
Nick Gerleman
85ff2f06c2 Remove C++ form of YGNodeSetChildren (#37013)
Summary:
X-link: https://github.com/facebook/react-native/pull/37013

Pull Request resolved: https://github.com/facebook/yoga/pull/1254

Brings Yoga public interface back to a nice pure C ABI.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D45138827

fbshipit-source-id: 8df7e4fd03afcda9a714d193b0430c122a7a7574
2023-04-21 15:36:17 -07:00
Nick Gerleman
3138a438af Remove YGTraversePreOrder (#37014)
Summary:
X-link: https://github.com/facebook/react-native/pull/37014

Pull Request resolved: https://github.com/facebook/yoga/pull/1253

This is unused, and kinda missed the intent of Yoga.h and YG* functions being a C ABI.

Reviewed By: rshest

Differential Revision: D45138646

fbshipit-source-id: 743e7d0f43c122932c3a6f43ce564c0f209b4771
2023-04-21 09:58:07 -07:00
Ruslan Shestopalyuk
3782644b32 Find and fix typos in yoga code (#36560)
Summary:
X-link: https://github.com/facebook/react-native/pull/36560

X-link: https://github.com/facebook/litho/pull/935

Pull Request resolved: https://github.com/facebook/yoga/pull/1239

Changelog:
[Internal] -

A follow-up to D44172494, I've run a pass of [typos](https://github.com/crate-ci/typos) on the Yoga code to detect/fix typos in comments and identifiers (with a manual review afterwards).

Reviewed By: javache

Differential Revision: D44254911

fbshipit-source-id: 6e8bfe83ec2f963108450cdcb8c79dfc8d1a7375
2023-03-21 16:29:09 -07:00
Eric Rozell
996267dbcb Revert D13866122: Fix negative value rounding issue for nodes across an axis
Differential Revision:
D13866122 (4266409934)

Original commit changeset: 4faf8a9efc86

Original Phabricator Diff: D13866122 (4266409934)

fbshipit-source-id: c11919fdd585f09b0422e8db55a8a3d66027676f
2023-02-02 14:04:12 -08:00
Jonathan Maurice
4266409934 Fix negative value rounding issue for nodes across an axis (#688)
Summary:
This fix issue https://github.com/facebook/yoga/issues/683 the rounding calculation is incorrect if a node is crossing an axis and it will shrink it's width/height on layout calculation.

The following test reproduce the issue :

```
TEST(YogaTest, node_shrink_on_axis)
{
  const YGConfigRef config = YGConfigNew();
  const YGNodeRef root = YGNodeNewWithConfig(config);
  const YGNodeRef child = YGNodeNewWithConfig(config);

  YGNodeInsertChild(root, child, 0);

  YGNodeStyleSetWidth(child, 10);
  YGNodeStyleSetHeight(child, 10);
  YGNodeStyleSetPosition(root, YGEdgeLeft, -0.75f);
  YGNodeStyleSetPosition(root, YGEdgeTop, -0.75f);

  YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);

  ASSERT_FLOAT_EQ(YGNodeLayoutGetWidth(child), 10);
  ASSERT_FLOAT_EQ(YGNodeLayoutGetHeight(child), 10);

  YGNodeFreeRecursive(root);

  YGConfigFree(config);
}
```

Pull Request resolved: https://github.com/facebook/yoga/pull/688

Reviewed By: NickGerleman

Differential Revision: D13866122

Pulled By: rozele

fbshipit-source-id: 4faf8a9efc86723c303f600d730660a2e13d8a73
2023-02-02 07:50:12 -08:00
Nick Gerleman
9e1bcd8557 Remove legacy layout diffing
Summary:
This removes some unused flags which will cause Yoga to layout every tree twice, then diffing the tree, reporting whether the whole tree is different. This is too expensive to run outside of local experimentation, but we have more nuanced ways to implement the `YGNodeLayoutAffectedByQuirk` I am wanting to add.

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D42406917

fbshipit-source-id: b415ed02768f6b59de3a6fa90c60c750d56fd4b0
2023-01-19 06:38:45 -08:00
Nick Gerleman
83c6997f29 Add Global CMake Build and OSS Tests (#1217)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1217

This updates the CMake build present for being able to share options, fixing up flags, etc. A GTest build is added as well, along with a script and VSCode debug target so that OSS contributors can very easily run and debug tests on any OS.

Note that this isn't completely done (need to revise Windows, Mac, documentation), but should be finished enough otherwise for review.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D42406686

fbshipit-source-id: 95e7ba5e4751c496a171785490e85cf0097fa839
2023-01-16 07:56:11 -08:00
Nick Gerleman
83cef5b12f Fixup UTs for MSVC and Release Mode
Summary: This fixes incompatibility with MSVC in /W3 (designated initializers, precision loss) along with guarding tests which will only pass in DEBUG builds

Reviewed By: cortinico

Differential Revision: D42406531

fbshipit-source-id: 2c0d59678f76decf9b9b4d91a7c9ec12136ca1b9
2023-01-09 13:59:19 -08:00
Nick Gerleman
7e96b65790 Import "Fix percent absolute position and size calcuate different with web" behind experimental feature (#1028) (#1201)
Summary:
Fixes https://github.com/facebook/yoga/issues/850

https://github.com/facebook/yoga/issues/850 describes a conformance issue where positioning of an absolute child using percentages is not calculated against the correct box size.

This takes the fix for that in https://github.com/facebook/yoga/pull/1028, regenerates tests, and fixes tests so that the experimental feature can be enabled. Goal is to run this as an experiment internally to see if we can enable by default.

Changelog:
[Internal]

Pull Request resolved: https://github.com/facebook/yoga/pull/1201

Reviewed By: yungsters

Differential Revision: D42282358

Pulled By: NickGerleman

fbshipit-source-id: 57c0dd9b0f1c47cb9335ff6e13d44b4646e5fa58
2023-01-08 13:41:27 -08:00
Nick Gerleman
287c48f7e3 Remove yoga/internal/experiments (#1195)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1195

These files are remnants of experimentation functions from D16687367 (dcfdb955b3). They do not seem to be included anywhere anymore, and we already have a YGExperimentalFeature setter in config we can use in the more common case.

Changelog:
[Internal]

Reviewed By: christophpurrer

Differential Revision: D42241980

fbshipit-source-id: 482984b9a619dba8042e9166aee02a5e75e761ee
2022-12-28 01:29:36 -08:00
Nick Gerleman
08eaae7223 Reorgnaize C++ tests
Summary:
This does some preprataion for the Yoga CMake Build. The main change is removing the dedicated testutil top-level-directory and static library. This contains a method to count nodes using the event functions exposed to C++, along with a Java binding for the test utility (since the events don't have a Java binding). It is only used in a single place in a way that isn't very useful, so it simplifies things to treat is as source in the existing C++ test library.

This also separates the hand-written and generated UTs, like we are doing in the JS directory in D42207782.

Reviewed By: christophpurrer

Differential Revision: D42247762

fbshipit-source-id: f8a270e99d0315ba7fc608f2471333e7a7be9d79
2022-12-28 01:21:52 -08:00
Nishan
ba27f9d1ec fix: remove gap if its last element in line (fix flex gap extra spacing when children determine parents main axis size) (#1188)
Summary:
Fixes - https://github.com/facebook/react-native/issues/35553

## Approach
We're using `betweenMainDim` to add [gap between](bbeede82d3/yoga/Yoga.cpp (L2495)) items in main axis. This is resulting in increased [main axis](bbeede82d3/yoga/Yoga.cpp (L2598)) dimension of the container as it gets added even for the last element. One solution is to keep using it and subtract the gap when last element is reached.

## Aside
Mutating this value feels weird, but I think `betweenMainDim` gets initialized for every line so should be fine? I did some manual tests to verify. I tried running tests but I'll have to downgrade the java version. Let me know if anything fails. Thanks! 🙏

Pull Request resolved: https://github.com/facebook/yoga/pull/1188

Test Plan: Added fixtures which previously failed but now pass.

Reviewed By: necolas

Differential Revision: D42078162

Pulled By: NickGerleman

fbshipit-source-id: 0e535618350422e001141a8786a83fc81651afe9
2022-12-15 16:30:37 -08:00
Nick Gerleman
5a257aac85 Add tests for gap interaction with child margins
Summary:
Adds a couple test fixtures to validate the interaction of flex gap with children with margins. In both Yoga, and web browsers, these are additive vs collapsing.

Fixes a couple misspellings as well that weren't caught during review.

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D41343407

fbshipit-source-id: 427f94faf248901517feff24d334f17ccb85266b
2022-11-16 14:02:31 -08:00
Nick Gerleman
efefc1eb7f Use lowercase @generated in tests
Summary:
The presence of lowercase "generated" anywhere in a file means Phabricator and Meta's fork of VSCode will treat the file as generated. Change generated tests to use the exact string.

Changelog:
[Internal]

Reviewed By: yungsters

Differential Revision: D41312171

fbshipit-source-id: 2bc8ef450d8377ffbacf443043d115a418db4a2e
2022-11-15 19:51:48 -08:00
Nick Gerleman
8166c81135 Incorporate gap space into main axis overflow flag (#1173)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1173

In https://github.com/facebook/react-native/issues/35351 we see incorrect child item height when the flex-wrap is enabled, the cross-axis is to be stretched, and main-axis overflow is caused by gap.

In YGDistributeFreeSpaceSecondPass, if we do not have overflow (determined by flexBasisOverflows), we have stretch cross-alignment, and we reason that nothing can add to main axis dimensions, we know we're a single line and want to take full cross dimensions. and can set YGMeasureModeExactly which uses parent dimensions. Guessing an optimization?

If we do have overflow, then we set YGMeasureModeAtMost to find minimum possible cross-axis dimensions instead.

`flexBasisOverflows` incorporates both computed flex basis, and margin, so it is more generally a flag for whether we will wrap. So we should incorporate gap spacing into it. E.g. it is also used for whether we should the match main axis parent dimension of the overall container. This change does just that, and renames the flag to `mainAxisOverflows`.

We will want to cherry-pick the fix for this into RN 0.71 since we have not yet introduced the community to the incorrect behavior, and we expect a lot of usage of flex-gap.

Changelog:
[General][Fixed] - Fix incorrect height when gap causes main axis to overflow and cross-axis is stretched

Reviewed By: yungsters

Differential Revision: D41311424

fbshipit-source-id: bd0c3b5aac478a56878703b6da84fc3993cc14da
2022-11-15 19:51:48 -08:00
Nick Gerleman
c2a0ccf0d4 Add tests for row-gap and column-gap
Summary:
This adds the fixtures from https://github.com/facebook/yoga/pull/1116 and generates tests.

This adds a good amount of coverage, but I plan to follow up with a diff adding a bit more, e.g. for interactions with flex direction of column when we should no-op, etc. I also discovered the current fixtures do not allow testing shorthand props like "gap" without changes.

This also updates the `webdrivers` gem to respond to a break with chromedriver on m1 macs from 4 days ago https://github.com/titusfortner/webdrivers/pull/239.

Reviewed By: yungsters

Differential Revision: D39922413

fbshipit-source-id: dfc7bda894be8dfcb24e25c19a4df0b09a72ce7e
2022-10-13 08:18:49 -07:00
simonla
1daed063f3 Fix memory leak (#1167)
Summary:
<img width="1126" alt="image" src="https://user-images.githubusercontent.com/14934570/195335369-e3fccde7-ff6c-4437-a261-7bc7435143c2.png">

`root_child0` be removed by`YGNodeRemoveChild(root, root_child0);`
so `YGNodeFreeRecursive(root);` can not free `root_child0`

Pull Request resolved: https://github.com/facebook/yoga/pull/1167

Reviewed By: NickGerleman, cipolleschi

Differential Revision: D40298891

Pulled By: motiz88

fbshipit-source-id: 251d3b3decfbd102372a7afeb2e95c907f96a980
2022-10-12 08:09:34 -07:00
Nick Gerleman
c96564d23d Fix License Headers and Whitespace
Summary: This change applies all Arcanist recommended lint changes, which amounts to changing copyright headers and some cases of whitespace changes.

Reviewed By: yungsters

Differential Revision: D40060899

fbshipit-source-id: b62f9472e6ef58a3fc3d22eed661578a2635cb1f
2022-10-04 13:59:32 -07:00
Nick Gerleman
585df10ee8 strech -> stretch
Summary: This replicates https://github.com/facebook/yoga/pull/760, to fix a typo around align-items. It does not have an effect on the tests themselves, since align-items defaults to stretch, and the test generator omits CSS properties of a default value.

Reviewed By: yungsters

Differential Revision: D40060324

fbshipit-source-id: da0565f2ad17e3e4e0f541a1c7006cdeeb991ece
2022-10-04 08:51:51 -07:00
Yannic Bonenberger
e1b401ca36 Re-add support for using Yoga without exceptions (#1006)
Summary:
This is a partial rollback of 07c0d539bd.

Pull Request resolved: https://github.com/facebook/yoga/pull/1006

Reviewed By: yungsters

Differential Revision: D40032544

Pulled By: yungsters

fbshipit-source-id: 9ef9b80672eced86a98cfae66c81710bd3ee6f9b
2022-10-03 23:35:46 -07:00
Nick Gerleman
fd180de774 Fix Generation of Tests from Fixtures
Summary:
https://github.com/facebook/yoga/pull/1116 added a change to the test generator "gentests.rb" to support a newer version of chromedriver, along with a change to the enum generator (not touched in this diff) to produce code consistent with the current tests, which seem to have been manually edited since last generation.

I had trouble running the test generator locally, because it relies on unversioned third-party dependencies, whose APIs change. Looking at source history, it seems like each time someone wants to run the script, they end up updating its syntax to match whatever versions they pull in.

This change adds a Gemfile and lock so that that the version of "watir" is locked, and so that we will also automatically pull in a consistent "chomedriver" version via the "webdrivers" gem. It includes the updates from the PR to be consistent with already output tests, and I have also updated the copyright header generation to no longer create lint warnings on newly generated tests (some of the previous ones were fixed manually it looks like).

The test generator would still produce bodies which would fail clang-format, and were manually edited (causing generation to emit new lint warnings), so I updated the generator to suppress clang-format in the body of the generated files.

Three tests, around the interaction of minimum dimensions and flexible children produce different results in Chrome now compared to when the tests were added, so running `gentests.rb` creates tests which break UTs. This doesn't seem like any sort of rounding, or device specific difference, so I have disabled these tests for now. While digging around, it does look like Chrome periodically will fix bugs in its own layout implementation which cause differences, like https://bugs.chromium.org/p/chromium/issues/detail?id=927066

Reviewed By: rozele, Andrey-Mishanin

Differential Revision: D39907416

fbshipit-source-id: f88714ff038b42f935901783452df25eabb6ebb1
2022-09-29 22:25:24 -07:00
Andres Suarez
a999150c19 Apply clang-format
Reviewed By: igorsugak

Differential Revision: D28477074

fbshipit-source-id: f15dfc45b9fb30c661ebe2899cd882676d0fdf2a
2021-05-20 21:24:14 -07:00
Eric Rozell
342aebe1d7 Fixes layout of nodes with YGDisplayNone and YGPositionTypeAbsolute (#1068)
Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1068

There is an issue in react-native when the Yoga node position type is set to absolute and display: none is set where the node layout calculation gives the absolute dimensions, rather than the expected 0 x 0.

Here are some OSS issues tracking this:
https://github.com/facebook/react-native/issues/18415
https://github.com/microsoft/react-native-windows/issues/7289

## Changelog

[General] [Fix] - Fixes layout of nodes with YGDisplayNone and YGPositionTypeAbsolute

Reviewed By: Andrey-Mishanin

Differential Revision: D26849307

fbshipit-source-id: 197618aa3c4e1b3b7efeba7ea4efd30b2d1c982d
2021-03-10 13:10:32 -08:00
Andres Suarez
584dfe961e Apply clang-format update fixes
Reviewed By: igorsugak

Differential Revision: D25861849

fbshipit-source-id: 840dc1061e557717c7f9ffcccbc09c24b96b78e0
2021-01-10 10:05:56 -08:00
Valentin Shergin
fc88b2f774 Introducing YGPositionTypeStatic
Summary:
Changelog: [Internal] Fabric-specific internal change.
This diff introduces a new value for `YGPositionType`: `YGPositionTypeStatic`.
No part of Yoga, RN, Litho or CK uses this value yet. `relative` and `static` values behave the same way for now. We also do not change any defaults. So, it should be fine.

Reviewed By: SidharthGuglani

Differential Revision: D22386732

fbshipit-source-id: 39cd9e818458ac2a91efb175f24a74c8c303ff08
2020-07-20 00:33:02 -07:00
Sidharth Guglani
07c0d539bd throw std::logic_error instead of aborting the process and convert to java exception
Summary: Changelog: [Internal][Yoga] throw std::logic_error instead of aborting the process and convert to java exception for jni layer

Reviewed By: pasqualeanatriello

Differential Revision: D21301235

fbshipit-source-id: 148b27920e62990a271e1d0df8c85a2cc42f4fd4
2020-05-14 06:39:25 -07:00
Sidharth Guglani
2049c85a6c Unit tests for flexshrink min width cases
Reviewed By: pasqualeanatriello

Differential Revision: D20219428

fbshipit-source-id: 8cbd028627095d9f7b393489ddba1f31c3207b67
2020-04-01 14:56:49 -07:00
Sidharth Guglani
9650c1903d converts BitfieldTests to BitUtilsTest
Summary: Use BitUtils for testing bit operations

Reviewed By: astreet

Differential Revision: D18596312

fbshipit-source-id: 83f93cd7f1f056b3f64070debbc452877b44ac7a
2019-11-22 04:51:13 -08:00
Sidharth Guglani
7ec0ef8470 add test for margin and padding percent applied on leaf nodes with measure function
Summary: Add tests for using margin and padding percent on nodes with measure function set on them

Reviewed By: alickbass

Differential Revision: D17130693

fbshipit-source-id: 9a5c963671f7649dead459969b008335f15e45ce
2019-11-15 05:13:35 -08:00
Sidharth Guglani
b88cf7ff67 use owner's width for resolving the margin and padding for node
Summary:
The margin and padding are resolved incorrectly for leaf nodes (nodes with measure function set) if margin and padding are used in percentages.
Here we were using node's width instead of container width to calculate the margin and padding.

Fixed this to use container's width.

## Changelog:

[General][Yoga] : Fixed an issue where margin and padding were resolved incorrectly for leaf nodes (nodes with measure function set) if margin and padding are used in percentages.

Reviewed By: alickbass

Differential Revision: D17130520

fbshipit-source-id: ac904d432f121973e7739debd9136909b5ca1427
2019-11-15 05:13:34 -08:00
Sidharth Guglani
5960dd888d Add test for margin top not calculated correctly if defined in percentage
Summary:
Unit tests for margin percent scenario where height was being used instead of width

## Changelog:

[Internal] [Yoga] - Added unit tests for margin percent

Reviewed By: alickbass

Differential Revision: D18448365

fbshipit-source-id: f4404b0c493938fc04dc685e97effa08bfd553b0
2019-11-13 07:25:59 -08:00
Andres Suarez
42bba10894 Tidy up license headers
Summary: Changelog: Tidy up license headers

Reviewed By: SidharthGuglani

Differential Revision: D17919414

fbshipit-source-id: 0501b495dc0a42256ca6ba3284a873da1ab175c0
2019-10-15 10:36:38 -07:00
David Aurelio
3ed9bec05c Remove style property bitmask
Summary:
@public

Removes the style properties bitmask. We have used this for experimentation, and it's no longer necessary.

This simplifyies the code, and allows us to cut over to `Bitfield.h` more easily.

Reviewed By: astreet

Differential Revision: D16648862

fbshipit-source-id: 17c0899807af976f4ba34db54f8f0f6a3cd92519
2019-08-07 16:29:03 -07:00
David Aurelio
dadf0473b7 Add portable bit field implementation
Summary:
@public
Our usage of C++ bit fields has lead to quite some problems with different compiler setups. Problems include sign bits, alignment, etc.

Here we introduce a portable implementation as a variadic template, allowing the user to store a number of booleans and enums (defined with `YG_ENUM_SEQ_DECL`) in an unsigned integer type of their choice.

This will replace all usages of bit fields across the Yoga code base.

Differential Revision: D16647801

fbshipit-source-id: 230ffab500885a3ad662ea8f19e35a5e9357a563
2019-08-07 16:29:02 -07:00
David Aurelio
a53c14dc75 Add internal experiments API
Summary: Adds internal API that we can use to conduct experiments.

Reviewed By: SidharthGuglani

Differential Revision: D16340463

fbshipit-source-id: 07a8bb7dbc4a02c5c95f1ad29b18845ab43752cf
2019-07-19 10:40:16 -07:00
Sidharth Guglani
5e40e4b682 remove YGMarker code
Summary: Removes code for now unused marker based approach

Reviewed By: davidaurelio

Differential Revision: D16048800

fbshipit-source-id: 228e0e906252782ee0bed543728b666d1f9cc854
2019-07-17 08:11:38 -07:00
Sidharth Guglani
7c891db9af move YGMarkerMeasure and YGMarkerBaselineFn to event based system
Summary: Using yoga event listener for adding systrace sections for measure and baseline events

Reviewed By: davidaurelio

Differential Revision: D16048795

fbshipit-source-id: 3c2161328250184929ed1a3357b8c42ec8ca2e29
2019-07-17 08:11:37 -07:00
Sidharth Guglani
39e512f691 Add tests for measure and baseline events
Summary: Add tests for measure and baseline events , same as we had in InstrumentationTests for marker based approach

Reviewed By: davidaurelio

Differential Revision: D16074402

fbshipit-source-id: 8b11cd6468420428701fd5be5c57700cbd913d23
2019-07-10 08:50:44 -07:00
Sidharth Guglani
0f250490d4 add baseline start and baseline end events
Summary: Adds Baseline start and end events to be handled later for instrumentation

Reviewed By: davidaurelio

Differential Revision: D16048790

fbshipit-source-id: 8409dbb633168753a7bf8fab20bc6551d113ddd6
2019-07-10 08:50:43 -07:00
Sidharth Guglani
eeae39d707 move YGMarkerLayout to event based system
Summary: Using layoutPassStart and LayoutPassEnd events instead of YGMarkerLayout for instrumentation

Reviewed By: davidaurelio

Differential Revision: D16048789

fbshipit-source-id: 041a35bc2cb1b7281ca83cf9d35041b4011cfeb9
2019-07-10 08:50:42 -07:00
Sidharth Guglani
ce517689ff add tests for layoutPassStart and layoutPassEnd
Summary: Add tests for layout pass start and end , same as what we had in InstrumentationTests for marker based approach

Reviewed By: davidaurelio

Differential Revision: D16073121

fbshipit-source-id: 838f01cb2a41d2d2764ba7ce2f317147f737b287
2019-07-10 08:50:42 -07:00
Sidharth Guglani
9c82ba783f Adds typed event test data for test cases
Summary: We are now using custom TypedEventTestData for test cases as we need to copy some data passed from the yoga event system

Reviewed By: davidaurelio

Differential Revision: D16090931

fbshipit-source-id: 4d11bdbdd73b67172ad4bba4b294c71f1c24cc10
2019-07-10 08:50:41 -07:00
James Burnett
1c8e8d3aec Compile Issues with Recent GCC (#895)
Summary:
GCC 8.3.0 (and possibly all gcc 7+) identified several warnings for signed unsigned integer comparison. With `-Werror` enabled this broke compiling tests. I suspect the warning is related to google/googletest#683. This diff updates those `ASSERT_EQ` calls that attempt to compare signed and unsigned errors by specifically declaring the literals to be unsigned.

There is also an issue with Buck where it will not link to pthreads. facebook/buck#1443. Adding a `prebuilt_cxx_library` for pthread fixes that issue and the tests will compile and run.

Finally, there was a warning about a missing return after a switch in `InstrumentationTest.cpp`. I added a `return ""` as a default, but it might be better to throw something. Thoughts?
Pull Request resolved: https://github.com/facebook/yoga/pull/895

Reviewed By: davidaurelio

Differential Revision: D15393082

Pulled By: davidaurelio

fbshipit-source-id: 4f13ec2f016af39537c08fb591b188a6a0ed55ce
2019-07-04 19:08:18 -07:00
David Aurelio
73224c62b5 Publish two events for measure callbacks
Summary: Publishing two events will allow us to replace marker functionality completely with events. This also allows us to remove measuring time spent from Yoga itself.

Reviewed By: SidharthGuglani

Differential Revision: D16049810

fbshipit-source-id: 98628a92ed3c94d479e9fbcd53fac90c5f524087
2019-06-28 09:58:56 -07:00
Sidharth Guglani
2dc5a16d1f Move event NodeLayout to end of NodeLayout step
Summary:
Added event NodeLayoutEnd and this is being used now instead of NodeLayout
It will be used later to add more information about caches

Reviewed By: davidaurelio

Differential Revision: D15920935

fbshipit-source-id: c9f5e193bc8cc70d26ff5d84882d483c9b09f67d
2019-06-24 08:37:17 -07:00
Sidharth Guglani
755fa07b39 add node measure event and passing the callback to java layer
Summary: Adds measure event and its listener initial code structure

Reviewed By: davidaurelio

Differential Revision: D15600738

fbshipit-source-id: d15764e0b64edb170fcb15e0912ecce5f7e53595
2019-06-06 21:03:24 -07:00
Rain ⁣
a4bdd9cd9b standardize C-like MIT copyright headers throughout fbsource
Summary:
`/*` is the standard throughout open source code. For example, Firefox uses single /*: https://hg.mozilla.org/mozilla-central/file/21d22b2f541258d3d1cf96c7ba5ad73e96e616b5/gfx/ipc/CompositorWidgetVsyncObserver.cpp#l3

In addition, Rust considers `/**` to be a doc comment (similar to Javadoc) and having such a comment at the beginning of the file causes `rustc` to barf.

Note that some JavaScript tooling requires `/**`. This is OK since JavaScript files were not covered by the linter in the first place, but it would be good to have that tooling fixed too.

Reviewed By: zertosh

Differential Revision: D15640366

fbshipit-source-id: b4ed4599071516364d6109720750d6a43304c089
2019-06-06 19:44:16 -07:00
David Aurelio
1180afed9c Fix style property bits
Summary: Style bits had overlap, because `dimensionBit` was set with an incorrect increment.

Reviewed By: SidharthGuglani

Differential Revision: D15335134

fbshipit-source-id: 370e1a73547d76b0e26bc6ab67acb96d33ddf180
2019-05-16 11:47:30 -07:00