diff --git a/CSSLayout/CSSLayout.c b/CSSLayout/CSSLayout.c index eba66a5b..94e34421 100644 --- a/CSSLayout/CSSLayout.c +++ b/CSSLayout/CSSLayout.c @@ -2512,3 +2512,13 @@ void CSSLog(CSSLogLevel level, const char *format, ...) { gLogger(level, format, args); va_end(args); } + +static bool experimentalFeatures[CSSExperimentalFeatureCount]; + +void CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeature feature, bool enabled) { + experimentalFeatures[feature] = enabled; +} + +bool CSSLayoutIsExperimentalFeatureEnabled(CSSExperimentalFeature feature) { + return experimentalFeatures[feature]; +} diff --git a/CSSLayout/CSSLayout.h b/CSSLayout/CSSLayout.h index b860b9c3..7fdde1a8 100644 --- a/CSSLayout/CSSLayout.h +++ b/CSSLayout/CSSLayout.h @@ -123,6 +123,10 @@ typedef enum CSSLogLevel { CSSLogLevelVerbose, } CSSLogLevel; +typedef enum CSSExperimentalFeature { + CSSExperimentalFeatureCount, +} CSSExperimentalFeature; + typedef struct CSSNode *CSSNodeRef; typedef CSSSize (*CSSMeasureFunc)(CSSNodeRef node, float width, @@ -238,4 +242,7 @@ CSS_NODE_LAYOUT_PROPERTY(CSSDirection, Direction); WIN_EXPORT void CSSLayoutSetLogger(CSSLogger logger); WIN_EXPORT void CSSLog(CSSLogLevel level, const char *message, ...); +WIN_EXPORT void CSSLayoutSetExperimentalFeatureEnabled(CSSExperimentalFeature feature, bool enabled); +WIN_EXPORT bool CSSLayoutIsExperimentalFeatureEnabled(CSSExperimentalFeature feature); + CSS_EXTERN_C_END diff --git a/csharp/Facebook.CSSLayout/CSSExperimentalFeature.cs b/csharp/Facebook.CSSLayout/CSSExperimentalFeature.cs new file mode 100644 index 00000000..bd080932 --- /dev/null +++ b/csharp/Facebook.CSSLayout/CSSExperimentalFeature.cs @@ -0,0 +1,15 @@ +/** + * 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. + */ + +namespace Facebook.CSSLayout +{ + public enum CSSExperimentalFeature + { + } +} diff --git a/csharp/Facebook.CSSLayout/CSSNode.cs b/csharp/Facebook.CSSLayout/CSSNode.cs index 1fea4c8a..95547abf 100644 --- a/csharp/Facebook.CSSLayout/CSSNode.cs +++ b/csharp/Facebook.CSSLayout/CSSNode.cs @@ -550,5 +550,17 @@ namespace Facebook.CSSLayout { return Native.CSSNodeGetInstanceCount(); } + + public static void setExperimentalFeatureEnabled( + CSSExperimentalFeature feature, + bool enabled) + { + return Native.CSSLayoutSetExperimentalFeatureEnabled(feature, enabled); + } + + public static bool isExperimentalFeatureEnabled(CSSExperimentalFeature feature) + { + return Native.CSSLayoutIsExperimentalFeatureEnabled(feature); + } } } diff --git a/csharp/Facebook.CSSLayout/Native.cs b/csharp/Facebook.CSSLayout/Native.cs index 105652aa..c734e1f6 100644 --- a/csharp/Facebook.CSSLayout/Native.cs +++ b/csharp/Facebook.CSSLayout/Native.cs @@ -37,7 +37,13 @@ namespace Facebook.CSSLayout public static extern void CSSNodeReset(IntPtr cssNode); [DllImport(DllName)] - public static extern int CSSNodeGetInstanceCount(); + public static extern void CSSLayoutSetExperimentalFeatureEnabled( + CSSExperimentalFeature feature, + bool enabled); + + [DllImport(DllName)] + public static extern bool CSSLayoutIsExperimentalFeatureEnabled( + CSSExperimentalFeature feature); [DllImport(DllName)] public static extern void CSSNodeInsertChild(IntPtr node, IntPtr child, uint index); diff --git a/java/com/facebook/csslayout/CSSExperimentalFeature.java b/java/com/facebook/csslayout/CSSExperimentalFeature.java new file mode 100644 index 00000000..a92d522d --- /dev/null +++ b/java/com/facebook/csslayout/CSSExperimentalFeature.java @@ -0,0 +1,13 @@ +/** + * 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 CSSExperimentalFeature { +} diff --git a/java/com/facebook/csslayout/CSSNode.java b/java/com/facebook/csslayout/CSSNode.java index 9cc47686..6c3419bc 100644 --- a/java/com/facebook/csslayout/CSSNode.java +++ b/java/com/facebook/csslayout/CSSNode.java @@ -40,6 +40,20 @@ public class CSSNode implements CSSNodeAPI { jni_CSSLayoutSetLogger(logger); } + private static native void jni_CSSLayoutSetExperimentalFeatureEnabled( + int feature, + boolean enabled); + public static void setExperimentalFeatureEnabled( + CSSExperimentalFeature feature, + boolean enabled) { + jni_CSSLayoutSetExperimentalFeatureEnabled(feature.ordinal(), enabled); + } + + private static native boolean jni_CSSLayoutIsExperimentalFeatureEnabled(int feature); + public static boolean isExperimentalFeatureEnabled(CSSExperimentalFeature feature) { + return jni_CSSLayoutIsExperimentalFeatureEnabled(feature.ordinal()); + } + private CSSNode mParent; private List mChildren; private MeasureFunction mMeasureFunction; diff --git a/java/jni/CSSJNI.cpp b/java/jni/CSSJNI.cpp index 8460e86a..65a994c1 100644 --- a/java/jni/CSSJNI.cpp +++ b/java/jni/CSSJNI.cpp @@ -105,6 +105,14 @@ void jni_CSSLog(alias_ref clazz, jint level, jstring message) { Environment::current()->ReleaseStringUTFChars(message, nMessage); } +void jni_CSSLayoutSetExperimentalFeatureEnabled(alias_ref clazz, jint feature, jboolean enabled) { + CSSLayoutSetExperimentalFeatureEnabled(static_cast(feature), enabled); +} + +jboolean jni_CSSLayoutIsExperimentalFeatureEnabled(alias_ref clazz, jint feature) { + return CSSLayoutIsExperimentalFeatureEnabled(static_cast(feature)); +} + jint jni_CSSNodeGetInstanceCount(alias_ref clazz) { return CSSNodeGetInstanceCount(); } @@ -291,6 +299,8 @@ jint JNI_OnLoad(JavaVM *vm, void *) { CSSMakeNativeMethod(jni_CSSNodeGetInstanceCount), CSSMakeNativeMethod(jni_CSSLayoutSetLogger), CSSMakeNativeMethod(jni_CSSLog), + CSSMakeNativeMethod(jni_CSSLayoutSetExperimentalFeatureEnabled), + CSSMakeNativeMethod(jni_CSSLayoutIsExperimentalFeatureEnabled), }); }); }