Add errata for fix to marginStart/End for row-reverse flex direction (#1419)
Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1419 X-link: https://github.com/facebook/litho/pull/961 X-link: https://github.com/facebook/react-native/pull/40803 This stack is ultimately aiming to solve https://github.com/facebook/yoga/issues/1208 This adds an value to the Errata enum. I will use this to gate this fix as there is potential for users to rely on this bug or have a hack in place to fix it and this would be a breaking change. Reviewed By: NickGerleman Differential Revision: D50145273 fbshipit-source-id: 913d2103cd31c1fa94cb39fc15d05b0c0b255920
This commit is contained in:
committed by
Facebook GitHub Bot
parent
50ecd98141
commit
50dc5ae2d1
2
enums.py
2
enums.py
@@ -67,6 +67,8 @@ ENUMS = {
|
|||||||
# Allows main-axis flex basis to be stretched without flexGrow being
|
# Allows main-axis flex basis to be stretched without flexGrow being
|
||||||
# set (previously referred to as "UseLegacyStretchBehaviour")
|
# set (previously referred to as "UseLegacyStretchBehaviour")
|
||||||
("StretchFlexBasis", 1 << 0),
|
("StretchFlexBasis", 1 << 0),
|
||||||
|
# Solely uses the flex-direction to determine starting and ending edges
|
||||||
|
("StartingEndingEdgeFromFlexDirection", 1 << 1),
|
||||||
# Enable all incorrect behavior (preserve compatibility)
|
# Enable all incorrect behavior (preserve compatibility)
|
||||||
("All", 0x7FFFFFFF),
|
("All", 0x7FFFFFFF),
|
||||||
# Enable all errata except for "StretchFlexBasis" (Defaults behavior
|
# Enable all errata except for "StretchFlexBasis" (Defaults behavior
|
||||||
|
@@ -12,6 +12,7 @@ package com.facebook.yoga;
|
|||||||
public enum YogaErrata {
|
public enum YogaErrata {
|
||||||
NONE(0),
|
NONE(0),
|
||||||
STRETCH_FLEX_BASIS(1),
|
STRETCH_FLEX_BASIS(1),
|
||||||
|
STARTING_ENDING_EDGE_FROM_FLEX_DIRECTION(2),
|
||||||
ALL(2147483647),
|
ALL(2147483647),
|
||||||
CLASSIC(2147483646);
|
CLASSIC(2147483646);
|
||||||
|
|
||||||
@@ -29,6 +30,7 @@ public enum YogaErrata {
|
|||||||
switch (value) {
|
switch (value) {
|
||||||
case 0: return NONE;
|
case 0: return NONE;
|
||||||
case 1: return STRETCH_FLEX_BASIS;
|
case 1: return STRETCH_FLEX_BASIS;
|
||||||
|
case 2: return STARTING_ENDING_EDGE_FROM_FLEX_DIRECTION;
|
||||||
case 2147483647: return ALL;
|
case 2147483647: return ALL;
|
||||||
case 2147483646: return CLASSIC;
|
case 2147483646: return CLASSIC;
|
||||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||||
|
@@ -49,6 +49,7 @@ export enum Edge {
|
|||||||
export enum Errata {
|
export enum Errata {
|
||||||
None = 0,
|
None = 0,
|
||||||
StretchFlexBasis = 1,
|
StretchFlexBasis = 1,
|
||||||
|
StartingEndingEdgeFromFlexDirection = 2,
|
||||||
All = 2147483647,
|
All = 2147483647,
|
||||||
Classic = 2147483646,
|
Classic = 2147483646,
|
||||||
}
|
}
|
||||||
@@ -158,6 +159,7 @@ const constants = {
|
|||||||
EDGE_ALL: Edge.All,
|
EDGE_ALL: Edge.All,
|
||||||
ERRATA_NONE: Errata.None,
|
ERRATA_NONE: Errata.None,
|
||||||
ERRATA_STRETCH_FLEX_BASIS: Errata.StretchFlexBasis,
|
ERRATA_STRETCH_FLEX_BASIS: Errata.StretchFlexBasis,
|
||||||
|
ERRATA_STARTING_ENDING_EDGE_FROM_FLEX_DIRECTION: Errata.StartingEndingEdgeFromFlexDirection,
|
||||||
ERRATA_ALL: Errata.All,
|
ERRATA_ALL: Errata.All,
|
||||||
ERRATA_CLASSIC: Errata.Classic,
|
ERRATA_CLASSIC: Errata.Classic,
|
||||||
EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: ExperimentalFeature.WebFlexBasis,
|
EXPERIMENTAL_FEATURE_WEB_FLEX_BASIS: ExperimentalFeature.WebFlexBasis,
|
||||||
|
@@ -93,6 +93,8 @@ const char* YGErrataToString(const YGErrata value) {
|
|||||||
return "none";
|
return "none";
|
||||||
case YGErrataStretchFlexBasis:
|
case YGErrataStretchFlexBasis:
|
||||||
return "stretch-flex-basis";
|
return "stretch-flex-basis";
|
||||||
|
case YGErrataStartingEndingEdgeFromFlexDirection:
|
||||||
|
return "starting-ending-edge-from-flex-direction";
|
||||||
case YGErrataAll:
|
case YGErrataAll:
|
||||||
return "all";
|
return "all";
|
||||||
case YGErrataClassic:
|
case YGErrataClassic:
|
||||||
|
@@ -55,6 +55,7 @@ YG_ENUM_DECL(
|
|||||||
YGErrata,
|
YGErrata,
|
||||||
YGErrataNone = 0,
|
YGErrataNone = 0,
|
||||||
YGErrataStretchFlexBasis = 1,
|
YGErrataStretchFlexBasis = 1,
|
||||||
|
YGErrataStartingEndingEdgeFromFlexDirection = 2,
|
||||||
YGErrataAll = 2147483647,
|
YGErrataAll = 2147483647,
|
||||||
YGErrataClassic = 2147483646)
|
YGErrataClassic = 2147483646)
|
||||||
YG_DEFINE_ENUM_FLAG_OPERATORS(YGErrata)
|
YG_DEFINE_ENUM_FLAG_OPERATORS(YGErrata)
|
||||||
|
@@ -18,6 +18,7 @@ namespace facebook::yoga {
|
|||||||
enum class Errata : uint32_t {
|
enum class Errata : uint32_t {
|
||||||
None = YGErrataNone,
|
None = YGErrataNone,
|
||||||
StretchFlexBasis = YGErrataStretchFlexBasis,
|
StretchFlexBasis = YGErrataStretchFlexBasis,
|
||||||
|
StartingEndingEdgeFromFlexDirection = YGErrataStartingEndingEdgeFromFlexDirection,
|
||||||
All = YGErrataAll,
|
All = YGErrataAll,
|
||||||
Classic = YGErrataClassic,
|
Classic = YGErrataClassic,
|
||||||
};
|
};
|
||||||
@@ -26,12 +27,12 @@ YG_DEFINE_ENUM_FLAG_OPERATORS(Errata)
|
|||||||
|
|
||||||
template <>
|
template <>
|
||||||
constexpr inline int32_t ordinalCount<Errata>() {
|
constexpr inline int32_t ordinalCount<Errata>() {
|
||||||
return 4;
|
return 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
constexpr inline int32_t bitCount<Errata>() {
|
constexpr inline int32_t bitCount<Errata>() {
|
||||||
return 2;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr inline Errata scopedEnum(YGErrata unscoped) {
|
constexpr inline Errata scopedEnum(YGErrata unscoped) {
|
||||||
|
Reference in New Issue
Block a user