Autogenerate enum defenitions for all languages

Reviewed By: gkassabli

Differential Revision: D4174263

fbshipit-source-id: 478961a8f683e196704d3c6ea1505a05c85fcb10
This commit is contained in:
Emil Sjolander 2016-11-15 08:42:33 -08:00 committed by Facebook Github Bot
parent 27ae04cabd
commit ffcdf25281
25 changed files with 602 additions and 230 deletions

106
React/CSSLayout/CSSEnums.h Normal file
View File

@ -0,0 +1,106 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
typedef enum CSSOverflow {
CSSOverflowVisible,
CSSOverflowHidden,
CSSOverflowScroll,
CSSOverflowCount,
} CSSOverflow;
typedef enum CSSJustify {
CSSJustifyFlexStart,
CSSJustifyCenter,
CSSJustifyFlexEnd,
CSSJustifySpaceBetween,
CSSJustifySpaceAround,
CSSJustifyCount,
} CSSJustify;
typedef enum CSSFlexDirection {
CSSFlexDirectionColumn,
CSSFlexDirectionColumnReverse,
CSSFlexDirectionRow,
CSSFlexDirectionRowReverse,
CSSFlexDirectionCount,
} CSSFlexDirection;
typedef enum CSSAlign {
CSSAlignAuto,
CSSAlignFlexStart,
CSSAlignCenter,
CSSAlignFlexEnd,
CSSAlignStretch,
CSSAlignCount,
} CSSAlign;
typedef enum CSSEdge {
CSSEdgeLeft,
CSSEdgeTop,
CSSEdgeRight,
CSSEdgeBottom,
CSSEdgeStart,
CSSEdgeEnd,
CSSEdgeHorizontal,
CSSEdgeVertical,
CSSEdgeAll,
CSSEdgeCount,
} CSSEdge;
typedef enum CSSWrap {
CSSWrapNoWrap,
CSSWrapWrap,
CSSWrapCount,
} CSSWrap;
typedef enum CSSDirection {
CSSDirectionInherit,
CSSDirectionLTR,
CSSDirectionRTL,
CSSDirectionCount,
} CSSDirection;
typedef enum CSSExperimentalFeature {
CSSExperimentalFeatureCount,
} CSSExperimentalFeature;
typedef enum CSSLogLevel {
CSSLogLevelError,
CSSLogLevelWarn,
CSSLogLevelInfo,
CSSLogLevelDebug,
CSSLogLevelVerbose,
CSSLogLevelCount,
} CSSLogLevel;
typedef enum CSSDimension {
CSSDimensionWidth,
CSSDimensionHeight,
CSSDimensionCount,
} CSSDimension;
typedef enum CSSMeasureMode {
CSSMeasureModeUndefined,
CSSMeasureModeExactly,
CSSMeasureModeAtMost,
CSSMeasureModeCount,
} CSSMeasureMode;
typedef enum CSSPositionType {
CSSPositionTypeRelative,
CSSPositionTypeAbsolute,
CSSPositionTypeCount,
} CSSPositionType;
typedef enum CSSPrintOptions {
CSSPrintOptionsLayout = 1,
CSSPrintOptionsStyle = 2,
CSSPrintOptionsChildren = 4,
CSSPrintOptionsCount,
} CSSPrintOptions;

View File

@ -122,6 +122,8 @@ static int _csslayoutAndroidLog(CSSLogLevel level, const char *format, va_list a
case CSSLogLevelVerbose:
androidLevel = ANDROID_LOG_VERBOSE;
break;
case CSSLogLevelCount:
break;
}
const int result = __android_log_vprint(androidLevel, "css-layout", format, args);
return result;
@ -1824,6 +1826,7 @@ static void layoutNodeImpl(const CSSNodeRef node,
leadingMainDim = betweenMainDim / 2;
break;
case CSSJustifyFlexStart:
case CSSJustifyCount:
break;
}
@ -2015,6 +2018,7 @@ static void layoutNodeImpl(const CSSNodeRef node,
break;
case CSSAlignAuto:
case CSSAlignFlexStart:
case CSSAlignCount:
break;
}
@ -2074,6 +2078,7 @@ static void layoutNodeImpl(const CSSNodeRef node,
break;
}
case CSSAlignAuto:
case CSSAlignCount:
break;
}
}

View File

@ -29,104 +29,15 @@ static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff};
#define CSSUndefined NAN
#include "CSSMacros.h"
#include "CSSEnums.h"
CSS_EXTERN_C_BEGIN
typedef enum CSSDirection {
CSSDirectionInherit,
CSSDirectionLTR,
CSSDirectionRTL,
} CSSDirection;
typedef enum CSSFlexDirection {
CSSFlexDirectionColumn,
CSSFlexDirectionColumnReverse,
CSSFlexDirectionRow,
CSSFlexDirectionRowReverse,
} CSSFlexDirection;
typedef enum CSSJustify {
CSSJustifyFlexStart,
CSSJustifyCenter,
CSSJustifyFlexEnd,
CSSJustifySpaceBetween,
CSSJustifySpaceAround,
} CSSJustify;
typedef enum CSSOverflow {
CSSOverflowVisible,
CSSOverflowHidden,
CSSOverflowScroll,
} CSSOverflow;
// Note: auto is only a valid value for alignSelf. It is NOT a valid value for
// alignItems.
typedef enum CSSAlign {
CSSAlignAuto,
CSSAlignFlexStart,
CSSAlignCenter,
CSSAlignFlexEnd,
CSSAlignStretch,
} CSSAlign;
typedef enum CSSPositionType {
CSSPositionTypeRelative,
CSSPositionTypeAbsolute,
} CSSPositionType;
typedef enum CSSWrap {
CSSWrapNoWrap,
CSSWrapWrap,
} CSSWrap;
typedef enum CSSMeasureMode {
CSSMeasureModeUndefined,
CSSMeasureModeExactly,
CSSMeasureModeAtMost,
CSSMeasureModeCount,
} CSSMeasureMode;
typedef enum CSSDimension {
CSSDimensionWidth,
CSSDimensionHeight,
} CSSDimension;
typedef enum CSSEdge {
CSSEdgeLeft,
CSSEdgeTop,
CSSEdgeRight,
CSSEdgeBottom,
CSSEdgeStart,
CSSEdgeEnd,
CSSEdgeHorizontal,
CSSEdgeVertical,
CSSEdgeAll,
CSSEdgeCount,
} CSSEdge;
typedef enum CSSPrintOptions {
CSSPrintOptionsLayout = 1,
CSSPrintOptionsStyle = 2,
CSSPrintOptionsChildren = 4,
} CSSPrintOptions;
typedef struct CSSSize {
float width;
float height;
} CSSSize;
typedef enum CSSLogLevel {
CSSLogLevelError,
CSSLogLevelWarn,
CSSLogLevelInfo,
CSSLogLevelDebug,
CSSLogLevelVerbose,
} CSSLogLevel;
typedef enum CSSExperimentalFeature {
CSSExperimentalFeatureCount,
} CSSExperimentalFeature;
typedef struct CSSNode *CSSNodeRef;
typedef CSSSize (*CSSMeasureFunc)(CSSNodeRef node,
float width,

View File

@ -599,6 +599,8 @@ static inline void RCTAssignSuggestedDimension(CSSNodeRef cssNode, CSSDimension
CSSNodeStyleSetHeight(cssNode, amount);
}
break;
case CSSDimensionCount:
break;
}
}
}

View File

@ -10,9 +10,30 @@
package com.facebook.csslayout;
public enum CSSAlign {
AUTO,
FLEX_START,
CENTER,
FLEX_END,
STRETCH,
AUTO(0),
FLEX_START(1),
CENTER(2),
FLEX_END(3),
STRETCH(4);
private int mIntValue;
CSSAlign(int intValue) {
mIntValue = intValue;
}
public int intValue() {
return mIntValue;
}
public static CSSAlign fromInt(int value) {
switch (value) {
case 0: return AUTO;
case 1: return FLEX_START;
case 2: return CENTER;
case 3: return FLEX_END;
case 4: return STRETCH;
default: throw new IllegalArgumentException("Unkown enum value: " + value);
}
}
}

View File

@ -0,0 +1,33 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
package com.facebook.csslayout;
public enum CSSDimension {
WIDTH(0),
HEIGHT(1);
private int mIntValue;
CSSDimension(int intValue) {
mIntValue = intValue;
}
public int intValue() {
return mIntValue;
}
public static CSSDimension fromInt(int value) {
switch (value) {
case 0: return WIDTH;
case 1: return HEIGHT;
default: throw new IllegalArgumentException("Unkown enum value: " + value);
}
}
}

View File

@ -10,7 +10,26 @@
package com.facebook.csslayout;
public enum CSSDirection {
INHERIT,
LTR,
RTL,
INHERIT(0),
LTR(1),
RTL(2);
private int mIntValue;
CSSDirection(int intValue) {
mIntValue = intValue;
}
public int intValue() {
return mIntValue;
}
public static CSSDirection fromInt(int value) {
switch (value) {
case 0: return INHERIT;
case 1: return LTR;
case 2: return RTL;
default: throw new IllegalArgumentException("Unkown enum value: " + value);
}
}
}

View File

@ -0,0 +1,47 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
package com.facebook.csslayout;
public enum CSSEdge {
LEFT(0),
TOP(1),
RIGHT(2),
BOTTOM(3),
START(4),
END(5),
HORIZONTAL(6),
VERTICAL(7),
ALL(8);
private int mIntValue;
CSSEdge(int intValue) {
mIntValue = intValue;
}
public int intValue() {
return mIntValue;
}
public static CSSEdge fromInt(int value) {
switch (value) {
case 0: return LEFT;
case 1: return TOP;
case 2: return RIGHT;
case 3: return BOTTOM;
case 4: return START;
case 5: return END;
case 6: return HORIZONTAL;
case 7: return VERTICAL;
case 8: return ALL;
default: throw new IllegalArgumentException("Unkown enum value: " + value);
}
}
}

View File

@ -10,4 +10,20 @@
package com.facebook.csslayout;
public enum CSSExperimentalFeature {
__EMPTY(-1);
private int mIntValue;
CSSExperimentalFeature(int intValue) {
mIntValue = intValue;
}
public int intValue() {
return mIntValue;
}
public static CSSExperimentalFeature fromInt(int value) {
switch (value) {
default: throw new IllegalArgumentException("Unkown enum value: " + value);
}
}
}

View File

@ -10,8 +10,28 @@
package com.facebook.csslayout;
public enum CSSFlexDirection {
COLUMN,
COLUMN_REVERSE,
ROW,
ROW_REVERSE
COLUMN(0),
COLUMN_REVERSE(1),
ROW(2),
ROW_REVERSE(3);
private int mIntValue;
CSSFlexDirection(int intValue) {
mIntValue = intValue;
}
public int intValue() {
return mIntValue;
}
public static CSSFlexDirection fromInt(int value) {
switch (value) {
case 0: return COLUMN;
case 1: return COLUMN_REVERSE;
case 2: return ROW;
case 3: return ROW_REVERSE;
default: throw new IllegalArgumentException("Unkown enum value: " + value);
}
}
}

View File

@ -10,9 +10,30 @@
package com.facebook.csslayout;
public enum CSSJustify {
FLEX_START,
CENTER,
FLEX_END,
SPACE_BETWEEN,
SPACE_AROUND,
FLEX_START(0),
CENTER(1),
FLEX_END(2),
SPACE_BETWEEN(3),
SPACE_AROUND(4);
private int mIntValue;
CSSJustify(int intValue) {
mIntValue = intValue;
}
public int intValue() {
return mIntValue;
}
public static CSSJustify fromInt(int value) {
switch (value) {
case 0: return FLEX_START;
case 1: return CENTER;
case 2: return FLEX_END;
case 3: return SPACE_BETWEEN;
case 4: return SPACE_AROUND;
default: throw new IllegalArgumentException("Unkown enum value: " + value);
}
}
}

View File

@ -0,0 +1,39 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
package com.facebook.csslayout;
public enum CSSLogLevel {
ERROR(0),
WARN(1),
INFO(2),
DEBUG(3),
VERBOSE(4);
private int mIntValue;
CSSLogLevel(int intValue) {
mIntValue = intValue;
}
public int intValue() {
return mIntValue;
}
public static CSSLogLevel fromInt(int value) {
switch (value) {
case 0: return ERROR;
case 1: return WARN;
case 2: return INFO;
case 3: return DEBUG;
case 4: return VERBOSE;
default: throw new IllegalArgumentException("Unkown enum value: " + value);
}
}
}

View File

@ -13,15 +13,9 @@ import com.facebook.proguard.annotations.DoNotStrip;
/**
* Inteface for recieving logs from native layer. Use by setting CSSNode.setLogger(myLogger);
* LOG_LEVEL_ERROR indicated a fatal error.
* See CSSLogLevel for the different log levels.
*/
public interface CSSLogger {
public final int LOG_LEVEL_ERROR = 0;
public final int LOG_LEVEL_WARN = 1;
public final int LOG_LEVEL_INFO = 2;
public final int LOG_LEVEL_DEBUG = 3;
public final int LOG_LEVEL_VERBOSE = 4;
@DoNotStrip
void log(int level, String message);
void log(CSSLogLevel level, String message);
}

View File

@ -10,7 +10,26 @@
package com.facebook.csslayout;
public enum CSSMeasureMode {
UNDEFINED,
EXACTLY,
AT_MOST,
UNDEFINED(0),
EXACTLY(1),
AT_MOST(2);
private int mIntValue;
CSSMeasureMode(int intValue) {
mIntValue = intValue;
}
public int intValue() {
return mIntValue;
}
public static CSSMeasureMode fromInt(int value) {
switch (value) {
case 0: return UNDEFINED;
case 1: return EXACTLY;
case 2: return AT_MOST;
default: throw new IllegalArgumentException("Unkown enum value: " + value);
}
}
}

View File

@ -46,12 +46,12 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
public static void setExperimentalFeatureEnabled(
CSSExperimentalFeature feature,
boolean enabled) {
jni_CSSLayoutSetExperimentalFeatureEnabled(feature.ordinal(), enabled);
jni_CSSLayoutSetExperimentalFeatureEnabled(feature.intValue(), enabled);
}
private static native boolean jni_CSSLayoutIsExperimentalFeatureEnabled(int feature);
public static boolean isExperimentalFeatureEnabled(CSSExperimentalFeature feature) {
return jni_CSSLayoutIsExperimentalFeatureEnabled(feature.ordinal());
return jni_CSSLayoutIsExperimentalFeatureEnabled(feature.intValue());
}
private CSSNode mParent;
@ -199,7 +199,7 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
private native void jni_CSSNodeStyleSetDirection(long nativePointer, int direction);
@Override
public void setDirection(CSSDirection direction) {
jni_CSSNodeStyleSetDirection(mNativePointer, direction.ordinal());
jni_CSSNodeStyleSetDirection(mNativePointer, direction.intValue());
}
private native int jni_CSSNodeStyleGetFlexDirection(long nativePointer);
@ -211,7 +211,7 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
private native void jni_CSSNodeStyleSetFlexDirection(long nativePointer, int flexDirection);
@Override
public void setFlexDirection(CSSFlexDirection flexDirection) {
jni_CSSNodeStyleSetFlexDirection(mNativePointer, flexDirection.ordinal());
jni_CSSNodeStyleSetFlexDirection(mNativePointer, flexDirection.intValue());
}
private native int jni_CSSNodeStyleGetJustifyContent(long nativePointer);
@ -223,7 +223,7 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
private native void jni_CSSNodeStyleSetJustifyContent(long nativePointer, int justifyContent);
@Override
public void setJustifyContent(CSSJustify justifyContent) {
jni_CSSNodeStyleSetJustifyContent(mNativePointer, justifyContent.ordinal());
jni_CSSNodeStyleSetJustifyContent(mNativePointer, justifyContent.intValue());
}
private native int jni_CSSNodeStyleGetAlignItems(long nativePointer);
@ -235,7 +235,7 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
private native void jni_CSSNodeStyleSetAlignItems(long nativePointer, int alignItems);
@Override
public void setAlignItems(CSSAlign alignItems) {
jni_CSSNodeStyleSetAlignItems(mNativePointer, alignItems.ordinal());
jni_CSSNodeStyleSetAlignItems(mNativePointer, alignItems.intValue());
}
private native int jni_CSSNodeStyleGetAlignSelf(long nativePointer);
@ -247,7 +247,7 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
private native void jni_CSSNodeStyleSetAlignSelf(long nativePointer, int alignSelf);
@Override
public void setAlignSelf(CSSAlign alignSelf) {
jni_CSSNodeStyleSetAlignSelf(mNativePointer, alignSelf.ordinal());
jni_CSSNodeStyleSetAlignSelf(mNativePointer, alignSelf.intValue());
}
private native int jni_CSSNodeStyleGetAlignContent(long nativePointer);
@ -259,7 +259,7 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
private native void jni_CSSNodeStyleSetAlignContent(long nativePointer, int alignContent);
@Override
public void setAlignContent(CSSAlign alignContent) {
jni_CSSNodeStyleSetAlignContent(mNativePointer, alignContent.ordinal());
jni_CSSNodeStyleSetAlignContent(mNativePointer, alignContent.intValue());
}
private native int jni_CSSNodeStyleGetPositionType(long nativePointer);
@ -271,13 +271,13 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
private native void jni_CSSNodeStyleSetPositionType(long nativePointer, int positionType);
@Override
public void setPositionType(CSSPositionType positionType) {
jni_CSSNodeStyleSetPositionType(mNativePointer, positionType.ordinal());
jni_CSSNodeStyleSetPositionType(mNativePointer, positionType.intValue());
}
private native void jni_CSSNodeStyleSetFlexWrap(long nativePointer, int wrapType);
@Override
public void setWrap(CSSWrap flexWrap) {
jni_CSSNodeStyleSetFlexWrap(mNativePointer, flexWrap.ordinal());
jni_CSSNodeStyleSetFlexWrap(mNativePointer, flexWrap.intValue());
}
private native int jni_CSSNodeStyleGetOverflow(long nativePointer);
@ -289,7 +289,7 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
private native void jni_CSSNodeStyleSetOverflow(long nativePointer, int overflow);
@Override
public void setOverflow(CSSOverflow overflow) {
jni_CSSNodeStyleSetOverflow(mNativePointer, overflow.ordinal());
jni_CSSNodeStyleSetOverflow(mNativePointer, overflow.intValue());
}
private native void jni_CSSNodeStyleSetFlex(long nativePointer, float flex);

View File

@ -10,7 +10,26 @@
package com.facebook.csslayout;
public enum CSSOverflow {
VISIBLE,
HIDDEN,
SCROLL,
VISIBLE(0),
HIDDEN(1),
SCROLL(2);
private int mIntValue;
CSSOverflow(int intValue) {
mIntValue = intValue;
}
public int intValue() {
return mIntValue;
}
public static CSSOverflow fromInt(int value) {
switch (value) {
case 0: return VISIBLE;
case 1: return HIDDEN;
case 2: return SCROLL;
default: throw new IllegalArgumentException("Unkown enum value: " + value);
}
}
}

View File

@ -10,6 +10,24 @@
package com.facebook.csslayout;
public enum CSSPositionType {
RELATIVE,
ABSOLUTE,
RELATIVE(0),
ABSOLUTE(1);
private int mIntValue;
CSSPositionType(int intValue) {
mIntValue = intValue;
}
public int intValue() {
return mIntValue;
}
public static CSSPositionType fromInt(int value) {
switch (value) {
case 0: return RELATIVE;
case 1: return ABSOLUTE;
default: throw new IllegalArgumentException("Unkown enum value: " + value);
}
}
}

View File

@ -0,0 +1,35 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
package com.facebook.csslayout;
public enum CSSPrintOptions {
LAYOUT(1),
STYLE(2),
CHILDREN(4);
private int mIntValue;
CSSPrintOptions(int intValue) {
mIntValue = intValue;
}
public int intValue() {
return mIntValue;
}
public static CSSPrintOptions fromInt(int value) {
switch (value) {
case 1: return LAYOUT;
case 2: return STYLE;
case 4: return CHILDREN;
default: throw new IllegalArgumentException("Unkown enum value: " + value);
}
}
}

View File

@ -54,7 +54,7 @@ public class CSSStyle {
alignItems = CSSAlign.STRETCH;
alignSelf = CSSAlign.AUTO;
positionType = CSSPositionType.RELATIVE;
flexWrap = CSSWrap.NOWRAP;
flexWrap = CSSWrap.NO_WRAP;
overflow = CSSOverflow.VISIBLE;
flexGrow = 0;
flexShrink = 0;

View File

@ -10,6 +10,24 @@
package com.facebook.csslayout;
public enum CSSWrap {
NOWRAP,
WRAP,
NO_WRAP(0),
WRAP(1);
private int mIntValue;
CSSWrap(int intValue) {
mIntValue = intValue;
}
public int intValue() {
return mIntValue;
}
public static CSSWrap fromInt(int value) {
switch (value) {
case 0: return NO_WRAP;
case 1: return WRAP;
default: throw new IllegalArgumentException("Unkown enum value: " + value);
}
}
}

View File

@ -87,7 +87,7 @@ public class LayoutShadowNode extends ReactShadowNode {
@ReactProp(name = ViewProps.FLEX_WRAP)
public void setFlexWrap(@Nullable String flexWrap) {
setFlexWrap(
flexWrap == null ? CSSWrap.NOWRAP : CSSWrap.valueOf(flexWrap.toUpperCase(Locale.US)));
flexWrap == null ? CSSWrap.NO_WRAP : CSSWrap.valueOf(flexWrap.toUpperCase(Locale.US)));
}
@ReactProp(name = ViewProps.ALIGN_SELF)

View File

@ -68,14 +68,21 @@ static CSSSize _jniMeasureFunc(CSSNodeRef node,
return CSSSize{measuredWidth, measuredHeight};
}
struct JCSSLogLevel : public JavaClass<JCSSLogLevel> {
static constexpr auto kJavaDescriptor = "Lcom/facebook/csslayout/CSSLogLevel;";
};
static global_ref<jobject> *jLogger;
static int _jniLog(CSSLogLevel level, const char *format, va_list args) {
char buffer[256];
int result = vsnprintf(buffer, sizeof(buffer), format, args);
static auto logFunc =
findClassLocal("com/facebook/csslayout/CSSLogger")->getMethod<void(jint, jstring)>("log");
logFunc(jLogger->get(), static_cast<jint>(level), Environment::current()->NewStringUTF(buffer));
findClassLocal("com/facebook/csslayout/CSSLogger")->getMethod<void(local_ref<JCSSLogLevel>, jstring)>("log");
static auto logLevelFromInt = JCSSLogLevel::javaClassStatic()->getStaticMethod<JCSSLogLevel::javaobject(jint)>("fromInt");
logFunc(jLogger->get(), logLevelFromInt(JCSSLogLevel::javaClassStatic(), static_cast<jint>(level)), Environment::current()->NewStringUTF(buffer));
return result;
}

View File

@ -0,0 +1,106 @@
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
typedef enum CSSOverflow {
CSSOverflowVisible,
CSSOverflowHidden,
CSSOverflowScroll,
CSSOverflowCount,
} CSSOverflow;
typedef enum CSSJustify {
CSSJustifyFlexStart,
CSSJustifyCenter,
CSSJustifyFlexEnd,
CSSJustifySpaceBetween,
CSSJustifySpaceAround,
CSSJustifyCount,
} CSSJustify;
typedef enum CSSFlexDirection {
CSSFlexDirectionColumn,
CSSFlexDirectionColumnReverse,
CSSFlexDirectionRow,
CSSFlexDirectionRowReverse,
CSSFlexDirectionCount,
} CSSFlexDirection;
typedef enum CSSAlign {
CSSAlignAuto,
CSSAlignFlexStart,
CSSAlignCenter,
CSSAlignFlexEnd,
CSSAlignStretch,
CSSAlignCount,
} CSSAlign;
typedef enum CSSEdge {
CSSEdgeLeft,
CSSEdgeTop,
CSSEdgeRight,
CSSEdgeBottom,
CSSEdgeStart,
CSSEdgeEnd,
CSSEdgeHorizontal,
CSSEdgeVertical,
CSSEdgeAll,
CSSEdgeCount,
} CSSEdge;
typedef enum CSSWrap {
CSSWrapNoWrap,
CSSWrapWrap,
CSSWrapCount,
} CSSWrap;
typedef enum CSSDirection {
CSSDirectionInherit,
CSSDirectionLTR,
CSSDirectionRTL,
CSSDirectionCount,
} CSSDirection;
typedef enum CSSExperimentalFeature {
CSSExperimentalFeatureCount,
} CSSExperimentalFeature;
typedef enum CSSLogLevel {
CSSLogLevelError,
CSSLogLevelWarn,
CSSLogLevelInfo,
CSSLogLevelDebug,
CSSLogLevelVerbose,
CSSLogLevelCount,
} CSSLogLevel;
typedef enum CSSDimension {
CSSDimensionWidth,
CSSDimensionHeight,
CSSDimensionCount,
} CSSDimension;
typedef enum CSSMeasureMode {
CSSMeasureModeUndefined,
CSSMeasureModeExactly,
CSSMeasureModeAtMost,
CSSMeasureModeCount,
} CSSMeasureMode;
typedef enum CSSPositionType {
CSSPositionTypeRelative,
CSSPositionTypeAbsolute,
CSSPositionTypeCount,
} CSSPositionType;
typedef enum CSSPrintOptions {
CSSPrintOptionsLayout = 1,
CSSPrintOptionsStyle = 2,
CSSPrintOptionsChildren = 4,
CSSPrintOptionsCount,
} CSSPrintOptions;

View File

@ -122,6 +122,8 @@ static int _csslayoutAndroidLog(CSSLogLevel level, const char *format, va_list a
case CSSLogLevelVerbose:
androidLevel = ANDROID_LOG_VERBOSE;
break;
case CSSLogLevelCount:
break;
}
const int result = __android_log_vprint(androidLevel, "css-layout", format, args);
return result;
@ -1824,6 +1826,7 @@ static void layoutNodeImpl(const CSSNodeRef node,
leadingMainDim = betweenMainDim / 2;
break;
case CSSJustifyFlexStart:
case CSSJustifyCount:
break;
}
@ -2015,6 +2018,7 @@ static void layoutNodeImpl(const CSSNodeRef node,
break;
case CSSAlignAuto:
case CSSAlignFlexStart:
case CSSAlignCount:
break;
}
@ -2074,6 +2078,7 @@ static void layoutNodeImpl(const CSSNodeRef node,
break;
}
case CSSAlignAuto:
case CSSAlignCount:
break;
}
}

View File

@ -29,104 +29,15 @@ static const unsigned long __nan[2] = {0xffffffff, 0x7fffffff};
#define CSSUndefined NAN
#include "CSSMacros.h"
#include "CSSEnums.h"
CSS_EXTERN_C_BEGIN
typedef enum CSSDirection {
CSSDirectionInherit,
CSSDirectionLTR,
CSSDirectionRTL,
} CSSDirection;
typedef enum CSSFlexDirection {
CSSFlexDirectionColumn,
CSSFlexDirectionColumnReverse,
CSSFlexDirectionRow,
CSSFlexDirectionRowReverse,
} CSSFlexDirection;
typedef enum CSSJustify {
CSSJustifyFlexStart,
CSSJustifyCenter,
CSSJustifyFlexEnd,
CSSJustifySpaceBetween,
CSSJustifySpaceAround,
} CSSJustify;
typedef enum CSSOverflow {
CSSOverflowVisible,
CSSOverflowHidden,
CSSOverflowScroll,
} CSSOverflow;
// Note: auto is only a valid value for alignSelf. It is NOT a valid value for
// alignItems.
typedef enum CSSAlign {
CSSAlignAuto,
CSSAlignFlexStart,
CSSAlignCenter,
CSSAlignFlexEnd,
CSSAlignStretch,
} CSSAlign;
typedef enum CSSPositionType {
CSSPositionTypeRelative,
CSSPositionTypeAbsolute,
} CSSPositionType;
typedef enum CSSWrap {
CSSWrapNoWrap,
CSSWrapWrap,
} CSSWrap;
typedef enum CSSMeasureMode {
CSSMeasureModeUndefined,
CSSMeasureModeExactly,
CSSMeasureModeAtMost,
CSSMeasureModeCount,
} CSSMeasureMode;
typedef enum CSSDimension {
CSSDimensionWidth,
CSSDimensionHeight,
} CSSDimension;
typedef enum CSSEdge {
CSSEdgeLeft,
CSSEdgeTop,
CSSEdgeRight,
CSSEdgeBottom,
CSSEdgeStart,
CSSEdgeEnd,
CSSEdgeHorizontal,
CSSEdgeVertical,
CSSEdgeAll,
CSSEdgeCount,
} CSSEdge;
typedef enum CSSPrintOptions {
CSSPrintOptionsLayout = 1,
CSSPrintOptionsStyle = 2,
CSSPrintOptionsChildren = 4,
} CSSPrintOptions;
typedef struct CSSSize {
float width;
float height;
} CSSSize;
typedef enum CSSLogLevel {
CSSLogLevelError,
CSSLogLevelWarn,
CSSLogLevelInfo,
CSSLogLevelDebug,
CSSLogLevelVerbose,
} CSSLogLevel;
typedef enum CSSExperimentalFeature {
CSSExperimentalFeatureCount,
} CSSExperimentalFeature;
typedef struct CSSNode *CSSNodeRef;
typedef CSSSize (*CSSMeasureFunc)(CSSNodeRef node,
float width,