Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -49,10 +49,6 @@ public class CSSNode {
|
||||
public void measure(CSSNode node, float width, MeasureOutput measureOutput);
|
||||
}
|
||||
|
||||
private final float[] mMargin = Spacing.newFullSpacingArray();
|
||||
private final float[] mPadding = Spacing.newFullSpacingArray();
|
||||
private final float[] mBorder = Spacing.newFullSpacingArray();
|
||||
|
||||
// VisibleForTesting
|
||||
/*package*/ final CSSStyle style = new CSSStyle();
|
||||
/*package*/ final CSSLayout layout = new CSSLayout();
|
||||
@@ -127,7 +123,7 @@ public class CSSNode {
|
||||
*/
|
||||
public void calculateLayout(CSSLayoutContext layoutContext) {
|
||||
layout.resetResult();
|
||||
LayoutEngine.layoutNode(layoutContext, this, CSSConstants.UNDEFINED);
|
||||
LayoutEngine.layoutNode(layoutContext, this, CSSConstants.UNDEFINED, null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -265,24 +261,19 @@ public class CSSNode {
|
||||
}
|
||||
|
||||
public void setMargin(int spacingType, float margin) {
|
||||
setSpacing(mMargin, style.margin, spacingType, margin);
|
||||
if (style.margin.set(spacingType, margin)) {
|
||||
dirty();
|
||||
}
|
||||
}
|
||||
|
||||
public void setPadding(int spacingType, float padding) {
|
||||
setSpacing(mPadding, style.padding, spacingType, padding);
|
||||
if (style.padding.set(spacingType, padding)) {
|
||||
dirty();
|
||||
}
|
||||
}
|
||||
|
||||
public void setBorder(int spacingType, float border) {
|
||||
setSpacing(mBorder, style.border, spacingType, border);
|
||||
}
|
||||
|
||||
protected void setSpacing(
|
||||
float[] spacingDef,
|
||||
float[] cssStyle,
|
||||
int spacingType,
|
||||
float spacing) {
|
||||
if (!valuesEqual(spacingDef[spacingType], spacing)) {
|
||||
Spacing.updateSpacing(spacingDef, cssStyle, spacingType, spacing, 0);
|
||||
if (style.border.set(spacingType, border)) {
|
||||
dirty();
|
||||
}
|
||||
}
|
||||
@@ -330,11 +321,11 @@ public class CSSNode {
|
||||
}
|
||||
|
||||
public float getLayoutX() {
|
||||
return layout.x;
|
||||
return layout.left;
|
||||
}
|
||||
|
||||
public float getLayoutY() {
|
||||
return layout.y;
|
||||
return layout.top;
|
||||
}
|
||||
|
||||
public float getLayoutWidth() {
|
||||
@@ -344,4 +335,34 @@ public class CSSNode {
|
||||
public float getLayoutHeight() {
|
||||
return layout.height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's padding, as defined by style + default padding.
|
||||
*/
|
||||
public Spacing getStylePadding() {
|
||||
return style.padding;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's width, as defined in the style.
|
||||
*/
|
||||
public float getStyleWidth() {
|
||||
return style.width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this node's height, as defined in the style.
|
||||
*/
|
||||
public float getStyleHeight() {
|
||||
return style.height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a default padding (left/top/right/bottom) for this node.
|
||||
*/
|
||||
public void setDefaultPadding(int spacingType, float padding) {
|
||||
if (style.padding.setDefault(spacingType, padding)) {
|
||||
dirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user