Remove flex shorthand getter because it doesnt make a lot of sense

Summary: It doesn't make sense to have a getter for the shorthand as it is the computed flexGrow and flexShrink values that you should care about.

Reviewed By: gkassabli

Differential Revision: D4064674

fbshipit-source-id: 69935b85042020b4e8c61a393c1be8f4d42a6674
This commit is contained in:
Emil Sjolander
2016-10-24 03:34:55 -07:00
committed by Facebook Github Bot
parent c28429efc8
commit 4c57029a28
8 changed files with 6 additions and 44 deletions

View File

@@ -302,16 +302,6 @@ void CSSNodeStyleSetFlex(const CSSNodeRef node, const float flex) {
}
}
float CSSNodeStyleGetFlex(const CSSNodeRef node) {
if (CSSNodeStyleGetFlexGrow(node) > 0) {
return CSSNodeStyleGetFlexGrow(node);
} else if (CSSNodeStyleGetFlexShrink(node) > 0) {
return -CSSNodeStyleGetFlexShrink(node);
}
return 0;
}
#define CSS_NODE_PROPERTY_IMPL(type, name, paramName, instanceName) \
void CSSNodeSet##name(const CSSNodeRef node, type paramName) { \
node->instanceName = paramName; \

View File

@@ -192,7 +192,8 @@ CSS_NODE_STYLE_PROPERTY(CSSAlign, AlignSelf, alignSelf);
CSS_NODE_STYLE_PROPERTY(CSSPositionType, PositionType, positionType);
CSS_NODE_STYLE_PROPERTY(CSSWrapType, FlexWrap, flexWrap);
CSS_NODE_STYLE_PROPERTY(CSSOverflow, Overflow, overflow);
CSS_NODE_STYLE_PROPERTY(float, Flex, flex);
WIN_EXPORT void CSSNodeStyleSetFlex(const CSSNodeRef node, const float flex);
CSS_NODE_STYLE_PROPERTY(float, FlexGrow, flexGrow);
CSS_NODE_STYLE_PROPERTY(float, FlexShrink, flexShrink);
CSS_NODE_STYLE_PROPERTY(float, FlexBasis, flexBasis);

View File

@@ -310,12 +310,6 @@ namespace Facebook.CSSLayout
public float Flex
{
get
{
AssertNativeInstance();
return Native.CSSNodeStyleGetFlex(_cssNode);
}
set
{
AssertNativeInstance();

View File

@@ -164,9 +164,6 @@ namespace Facebook.CSSLayout
[DllImport(DllName)]
public static extern void CSSNodeStyleSetFlex(IntPtr node, float flex);
[DllImport(DllName)]
public static extern float CSSNodeStyleGetFlex(IntPtr node);
[DllImport(DllName)]
public static extern void CSSNodeStyleSetFlexGrow(IntPtr node, float flexGrow);

View File

@@ -295,13 +295,6 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
jni_CSSNodeStyleSetOverflow(mNativePointer, overflow.ordinal());
}
private native float jni_CSSNodeStyleGetFlex(long nativePointer);
@Override
public float getFlex() {
assertNativeInstance();
return jni_CSSNodeStyleGetFlex(mNativePointer);
}
private native void jni_CSSNodeStyleSetFlex(long nativePointer, float flex);
@Override
public void setFlex(float flex) {

View File

@@ -52,7 +52,6 @@ public interface CSSNodeAPI<CSSNodeType extends CSSNodeAPI> {
CSSPositionType getPositionType();
void setPositionType(CSSPositionType positionType);
void setWrap(CSSWrap flexWrap);
float getFlex();
void setFlex(float flex);
float getFlexGrow();
void setFlexGrow(float flexGrow);

View File

@@ -358,20 +358,6 @@ public class CSSNodeDEPRECATED implements CSSNodeAPI<CSSNodeDEPRECATED> {
}
}
/**
* Get this node's flex, as defined by style.
*/
@Override
public float getFlex() {
if (style.flexGrow > 0) {
return style.flexGrow;
} else if (style.flexShrink > 0) {
return -style.flexShrink;
}
return 0;
}
@Override
public void setFlex(float flex) {
if (CSSConstants.isUndefined(flex) || flex == 0) {

View File

@@ -145,7 +145,10 @@ CSS_NODE_JNI_STYLE_PROP(jint, CSSAlign, AlignContent);
CSS_NODE_JNI_STYLE_PROP(jint, CSSPositionType, PositionType);
CSS_NODE_JNI_STYLE_PROP(jint, CSSWrapType, FlexWrap);
CSS_NODE_JNI_STYLE_PROP(jint, CSSOverflow, Overflow);
CSS_NODE_JNI_STYLE_PROP(jfloat, float, Flex);
void jni_CSSNodeStyleSetFlex(alias_ref<jobject>, jlong nativePointer, jfloat value) {
CSSNodeStyleSetFlex(_jlong2CSSNodeRef(nativePointer), static_cast<float>(value));
}
CSS_NODE_JNI_STYLE_PROP(jfloat, float, FlexGrow);
CSS_NODE_JNI_STYLE_PROP(jfloat, float, FlexShrink);
CSS_NODE_JNI_STYLE_PROP(jfloat, float, FlexBasis);
@@ -204,7 +207,6 @@ jint JNI_OnLoad(JavaVM *vm, void *) {
CSSMakeNativeMethod(jni_CSSNodeStyleSetFlexWrap),
CSSMakeNativeMethod(jni_CSSNodeStyleGetOverflow),
CSSMakeNativeMethod(jni_CSSNodeStyleSetOverflow),
CSSMakeNativeMethod(jni_CSSNodeStyleGetFlex),
CSSMakeNativeMethod(jni_CSSNodeStyleSetFlex),
CSSMakeNativeMethod(jni_CSSNodeStyleGetFlexGrow),
CSSMakeNativeMethod(jni_CSSNodeStyleSetFlexGrow),