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

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 dc142ad8f9
commit ea6458b63e
6 changed files with 8 additions and 35 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

@ -595,7 +595,7 @@ static inline void RCTAssignSuggestedDimension(CSSNodeRef cssNode, CSSDimension
- (void)setIntrinsicContentSize:(CGSize)size
{
if (CSSNodeStyleGetFlex(_cssNode) == 0) {
if (CSSNodeStyleGetFlexGrow(_cssNode) == 0 && CSSNodeStyleGetFlexShrink(_cssNode) == 0) {
RCTAssignSuggestedDimension(_cssNode, CSSDimensionHeight, size.height);
RCTAssignSuggestedDimension(_cssNode, CSSDimensionWidth, size.width);
}
@ -615,6 +615,11 @@ static inline void RCTAssignSuggestedDimension(CSSNodeRef cssNode, CSSDimension
// Flex
- (void)setFlex:(CGFloat)value
{
CSSNodeStyleSetFlex(_cssNode, value);
}
#define RCT_STYLE_PROPERTY(setProp, getProp, cssProp, type) \
- (void)set##setProp:(type)value \
{ \
@ -625,7 +630,6 @@ static inline void RCTAssignSuggestedDimension(CSSNodeRef cssNode, CSSDimension
return CSSNodeStyleGet##cssProp(_cssNode); \
}
RCT_STYLE_PROPERTY(Flex, flex, Flex, CGFloat)
RCT_STYLE_PROPERTY(FlexGrow, flexGrow, FlexGrow, CGFloat)
RCT_STYLE_PROPERTY(FlexShrink, flexShrink, FlexShrink, CGFloat)
RCT_STYLE_PROPERTY(FlexBasis, flexBasis, FlexBasis, CGFloat)

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) {