forked from facebook/yoga
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: This adds a `YGErrata` bitset enum matching the API and guarantees described in facebook#1247. It is hooked up in later diffs. There are a couple of `YGExperimentalFeature` values that belong here, but keeping the current options means that the default `YGErrataNone` corresponds to existing default behavior, letting us stage the series of changes as: 1. Implement errata API 2. Update internal Yoga users we want to de-risk to `YGErrataClassic` or `YGErrataAll` (if setting `UseLegacyStretchBehaviour`) 3. Add new errata, changing Yoga defaults to be conformant, while letting internal apps opt into compatibility modes pending experimentation. I also added a macro to let C++ users of Yoga perform bitwise operations on the enum without casting (already available for C users). Differential Revision: D45254098 fbshipit-source-id: 6033a7ee82afcf8b7142ec8817fdf4505597b693
- Loading branch information
1 parent
85ff2f0
commit f277581
Showing
8 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// @generated by enums.py | ||
|
||
namespace Facebook.Yoga | ||
{ | ||
[System.Flags] | ||
public enum YogaErrata | ||
{ | ||
None = 0, | ||
StretchFlexBasis = 1, | ||
All = 2147483647, | ||
Classic = 2147483646, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// @generated by enums.py | ||
|
||
package com.facebook.yoga; | ||
|
||
public enum YogaErrata { | ||
NONE(0), | ||
STRETCH_FLEX_BASIS(1), | ||
ALL(2147483647), | ||
CLASSIC(2147483646); | ||
|
||
private final int mIntValue; | ||
|
||
YogaErrata(int intValue) { | ||
mIntValue = intValue; | ||
} | ||
|
||
public int intValue() { | ||
return mIntValue; | ||
} | ||
|
||
public static YogaErrata fromInt(int value) { | ||
switch (value) { | ||
case 0: return NONE; | ||
case 1: return STRETCH_FLEX_BASIS; | ||
case 2147483647: return ALL; | ||
case 2147483646: return CLASSIC; | ||
default: throw new IllegalArgumentException("Unknown enum value: " + value); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters