mirror of
https://github.com/status-im/react-native.git
synced 2025-02-04 21:53:30 +00:00
Fixup recent fix to flex basis and put it behind an experimental flag
Reviewed By: gkassabli Differential Revision: D4222910 fbshipit-source-id: d693482441fcc4d37a288e2e3529057a04f60541
This commit is contained in:
parent
68c6d71cea
commit
dad520476e
@ -68,6 +68,7 @@ typedef enum CSSDirection {
|
||||
|
||||
typedef enum CSSExperimentalFeature {
|
||||
CSSExperimentalFeatureRounding,
|
||||
CSSExperimentalFeatureWebFlexBasis,
|
||||
CSSExperimentalFeatureCount,
|
||||
} CSSExperimentalFeature;
|
||||
|
||||
|
@ -49,7 +49,6 @@ typedef struct CSSLayout {
|
||||
float dimensions[2];
|
||||
CSSDirection direction;
|
||||
|
||||
uint32_t computedFlexBasisGeneration;
|
||||
float computedFlexBasis;
|
||||
|
||||
// Instead of recomputing the entire layout every single time, we
|
||||
@ -974,10 +973,14 @@ static void computeChildFlexBasis(const CSSNodeRef node,
|
||||
const bool isRowStyleDimDefined = isStyleDimDefined(child, CSSFlexDirectionRow);
|
||||
const bool isColumnStyleDimDefined = isStyleDimDefined(child, CSSFlexDirectionColumn);
|
||||
|
||||
if (!CSSValueIsUndefined(CSSNodeStyleGetFlexBasis(child)) &&
|
||||
!CSSValueIsUndefined(isMainAxisRow ? width : height)) {
|
||||
if (CSSValueIsUndefined(child->layout.computedFlexBasis) ||
|
||||
child->layout.computedFlexBasisGeneration != gCurrentGenerationCount) {
|
||||
if (CSSLayoutIsExperimentalFeatureEnabled(CSSExperimentalFeatureWebFlexBasis) &&
|
||||
!CSSValueIsUndefined(CSSNodeStyleGetFlexBasis(child))) {
|
||||
child->layout.computedFlexBasis =
|
||||
fmaxf(CSSNodeStyleGetFlexBasis(child), getPaddingAndBorderAxis(child, mainAxis));
|
||||
} else if (!CSSLayoutIsExperimentalFeatureEnabled(CSSExperimentalFeatureWebFlexBasis) &&
|
||||
!CSSValueIsUndefined(CSSNodeStyleGetFlexBasis(child)) &&
|
||||
!CSSValueIsUndefined(isMainAxisRow ? width : height)) {
|
||||
if (CSSValueIsUndefined(child->layout.computedFlexBasis)) {
|
||||
child->layout.computedFlexBasis =
|
||||
fmaxf(CSSNodeStyleGetFlexBasis(child), getPaddingAndBorderAxis(child, mainAxis));
|
||||
}
|
||||
@ -1076,8 +1079,6 @@ static void computeChildFlexBasis(const CSSNodeRef node,
|
||||
: child->layout.measuredDimensions[CSSDimensionHeight],
|
||||
getPaddingAndBorderAxis(child, mainAxis));
|
||||
}
|
||||
|
||||
child->layout.computedFlexBasisGeneration = gCurrentGenerationCount;
|
||||
}
|
||||
|
||||
static void absoluteLayoutChild(const CSSNodeRef node,
|
||||
@ -1535,7 +1536,6 @@ static void layoutNodeImpl(const CSSNodeRef node,
|
||||
child->nextChild = NULL;
|
||||
} else {
|
||||
if (child == singleFlexChild) {
|
||||
child->layout.computedFlexBasisGeneration = gCurrentGenerationCount;
|
||||
child->layout.computedFlexBasis = 0;
|
||||
} else {
|
||||
computeChildFlexBasis(node,
|
||||
|
@ -10,7 +10,8 @@
|
||||
package com.facebook.csslayout;
|
||||
|
||||
public enum CSSExperimentalFeature {
|
||||
ROUNDING(0);
|
||||
ROUNDING(0),
|
||||
WEB_FLEX_BASIS(1);
|
||||
|
||||
private int mIntValue;
|
||||
|
||||
@ -25,6 +26,7 @@ public enum CSSExperimentalFeature {
|
||||
public static CSSExperimentalFeature fromInt(int value) {
|
||||
switch (value) {
|
||||
case 0: return ROUNDING;
|
||||
case 1: return WEB_FLEX_BASIS;
|
||||
default: throw new IllegalArgumentException("Unkown enum value: " + value);
|
||||
}
|
||||
}
|
||||
|
@ -68,6 +68,7 @@ typedef enum CSSDirection {
|
||||
|
||||
typedef enum CSSExperimentalFeature {
|
||||
CSSExperimentalFeatureRounding,
|
||||
CSSExperimentalFeatureWebFlexBasis,
|
||||
CSSExperimentalFeatureCount,
|
||||
} CSSExperimentalFeature;
|
||||
|
||||
|
@ -977,7 +977,8 @@ static void computeChildFlexBasis(const CSSNodeRef node,
|
||||
if (!CSSValueIsUndefined(CSSNodeStyleGetFlexBasis(child)) &&
|
||||
!CSSValueIsUndefined(isMainAxisRow ? width : height)) {
|
||||
if (CSSValueIsUndefined(child->layout.computedFlexBasis) ||
|
||||
child->layout.computedFlexBasisGeneration != gCurrentGenerationCount) {
|
||||
(CSSLayoutIsExperimentalFeatureEnabled(CSSExperimentalFeatureWebFlexBasis) &&
|
||||
child->layout.computedFlexBasisGeneration != gCurrentGenerationCount)) {
|
||||
child->layout.computedFlexBasis =
|
||||
fmaxf(CSSNodeStyleGetFlexBasis(child), getPaddingAndBorderAxis(child, mainAxis));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user