Use single function for margin, position, padding, and border

Summary:
marginLeft(node, margin) -> margin(node, CSSEdgeLeft, margin)

This reduces the api surface of CSSLayout as well as puts the api more in line with the java version. This also adds support for CSSEdgeAll which java has had support for for a while. This also open up the possibility of doing margin(node, CSSEdgeLeft | CSSEdgeTop, margin) in the future.

Reviewed By: lucasr

Differential Revision: D3715201

fbshipit-source-id: ea81ed426f0f7853bb542355c01fc16ae4360238
This commit is contained in:
Emil Sjolander
2016-08-15 09:15:10 -07:00
committed by Facebook Github Bot 6
parent 48e5304276
commit a960203567
6 changed files with 125 additions and 330 deletions

View File

@@ -37,22 +37,22 @@ public class Spacing {
*/
public static final int BOTTOM = 3;
/**
* Spacing type that represents vertical direction (top and bottom). E.g. {@code marginVertical}.
* Spacing type that represents start direction e.g. left in left-to-right, right in right-to-left.
*/
public static final int VERTICAL = 4;
public static final int START = 4;
/**
* Spacing type that represents end direction e.g. right in left-to-right, left in right-to-left.
*/
public static final int END = 5;
/**
* Spacing type that represents horizontal direction (left and right). E.g.
* {@code marginHorizontal}.
*/
public static final int HORIZONTAL = 5;
public static final int HORIZONTAL = 6;
/**
* Spacing type that represents start direction e.g. left in left-to-right, right in right-to-left.
* Spacing type that represents vertical direction (top and bottom). E.g. {@code marginVertical}.
*/
public static final int START = 6;
/**
* Spacing type that represents end direction e.g. right in left-to-right, left in right-to-left.
*/
public static final int END = 7;
public static final int VERTICAL = 7;
/**
* Spacing type that represents all directions (left, top, right, bottom). E.g. {@code margin}.
*/
@@ -63,10 +63,10 @@ public class Spacing {
2, /*TOP*/
4, /*RIGHT*/
8, /*BOTTOM*/
16, /*VERTICAL*/
32, /*HORIZONTAL*/
64, /*START*/
128, /*END*/
16, /*START*/
32, /*END*/
64, /*HORIZONTAL*/
128, /*VERTICAL*/
256, /*ALL*/
};
@@ -211,11 +211,11 @@ public class Spacing {
defaultValue,
defaultValue,
defaultValue,
defaultValue,
defaultValue,
CSSConstants.UNDEFINED,
CSSConstants.UNDEFINED,
defaultValue,
defaultValue,
defaultValue,
};
}
}