Expose methods to set position Start|End

Differential Revision: D3669177

fbshipit-source-id: b06f382cb89546e817a2475298cf2cad17d95a2c
This commit is contained in:
Emil Sjolander 2016-08-09 04:28:20 -07:00 committed by Facebook Github Bot 7
parent c43c80bd7c
commit 1227675e0a
3 changed files with 60 additions and 0 deletions

View File

@ -20,8 +20,10 @@ import static com.facebook.csslayout.CSSLayout.DIMENSION_WIDTH;
import static com.facebook.csslayout.CSSLayout.POSITION_LEFT;
import static com.facebook.csslayout.CSSLayout.POSITION_TOP;
import static com.facebook.csslayout.Spacing.BOTTOM;
import static com.facebook.csslayout.Spacing.END;
import static com.facebook.csslayout.Spacing.LEFT;
import static com.facebook.csslayout.Spacing.RIGHT;
import static com.facebook.csslayout.Spacing.START;
import static com.facebook.csslayout.Spacing.TOP;
/**
@ -475,6 +477,32 @@ public class CSSNode implements CSSNodeAPI<CSSNode> {
setPositionValue(RIGHT, positionRight);
}
/**
* Get this node's position start, as defined by style.
*/
@Override
public float getPositionStart() {
return style.position.get(START);
}
@Override
public void setPositionStart(float positionStart) {
setPositionValue(START, positionStart);
}
/**
* Get this node's position end, as defined by style.
*/
@Override
public float getPositionEnd() {
return style.position.get(END);
}
@Override
public void setPositionEnd(float positionEnd) {
setPositionValue(END, positionEnd);
}
/**
* Get this node's width, as defined in the style.
*/

View File

@ -68,6 +68,10 @@ public interface CSSNodeAPI<CSSNodeType extends CSSNodeAPI> {
void setPositionLeft(float positionLeft);
float getPositionRight();
void setPositionRight(float positionRight);
float getPositionStart();
void setPositionStart(float positionStart);
float getPositionEnd();
void setPositionEnd(float positionEnd);
float getStyleWidth();
void setStyleWidth(float width);
float getStyleHeight();

View File

@ -572,6 +572,34 @@ public class CSSNodeJNI implements CSSNodeAPI<CSSNodeJNI> {
jni_CSSNodeStyleSetPositionRight(mNativePointer, positionRight);
}
private native float jni_CSSNodeStyleGetPositionStart(int nativePointer);
@Override
public float getPositionStart() {
assertNativeInstance();
return jni_CSSNodeStyleGetPositionStart(mNativePointer);
}
private native void jni_CSSNodeStyleSetPositionStart(int nativePointer, float positionStart);
@Override
public void setPositionStart(float positionStart) {
assertNativeInstance();
jni_CSSNodeStyleSetPositionStart(mNativePointer, positionStart);
}
private native float jni_CSSNodeStyleGetPositionEnd(int nativePointer);
@Override
public float getPositionEnd() {
assertNativeInstance();
return jni_CSSNodeStyleGetPositionEnd(mNativePointer);
}
private native void jni_CSSNodeStyleSetPositionEnd(int nativePointer, float positionEnd);
@Override
public void setPositionEnd(float positionEnd) {
assertNativeInstance();
jni_CSSNodeStyleSetPositionEnd(mNativePointer, positionEnd);
}
private native float jni_CSSNodeStyleGetWidth(int nativePointer);
@Override
public float getStyleWidth() {