mirror of
https://github.com/status-im/react-native.git
synced 2025-02-27 08:30:34 +00:00
import latest changes from github
Differential Revision: D2536028 fb-gh-sync-id: 2d28b10f06b4ab3a9113b7870e58faf6debba9b6
This commit is contained in:
parent
c73ceff914
commit
b721c12516
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
// NOTE: this file is auto-copied from https://github.com/facebook/css-layout
|
||||
// @generated SignedSource<<638f16255d86b878b0377e1070cc2b44>>
|
||||
// @generated SignedSource<<1e547b3af02a275fe73089e5a0a172c5>>
|
||||
|
||||
package com.facebook.csslayout;
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
// NOTE: this file is auto-copied from https://github.com/facebook/css-layout
|
||||
// @generated SignedSource<<560f2fd13ec8e1100a71958529146055>>
|
||||
// @generated SignedSource<<dea2f20b2f05b18bed5e32b4d048a7b2>>
|
||||
|
||||
package com.facebook.csslayout;
|
||||
|
||||
@ -118,7 +118,7 @@ public class CSSNode {
|
||||
}
|
||||
|
||||
public void setMeasureFunction(MeasureFunction measureFunction) {
|
||||
if (!valuesEqual(mMeasureFunction, measureFunction)) {
|
||||
if (mMeasureFunction != measureFunction) {
|
||||
mMeasureFunction = measureFunction;
|
||||
dirty();
|
||||
}
|
||||
@ -224,57 +224,50 @@ public class CSSNode {
|
||||
return FloatUtil.floatsEqual(f1, f2);
|
||||
}
|
||||
|
||||
protected <T> boolean valuesEqual(@Nullable T o1, @Nullable T o2) {
|
||||
if (o1 == null) {
|
||||
return o2 == null;
|
||||
}
|
||||
return o1.equals(o2);
|
||||
}
|
||||
|
||||
public void setDirection(CSSDirection direction) {
|
||||
if (!valuesEqual(style.direction, direction)) {
|
||||
if (style.direction != direction) {
|
||||
style.direction = direction;
|
||||
dirty();
|
||||
}
|
||||
}
|
||||
|
||||
public void setFlexDirection(CSSFlexDirection flexDirection) {
|
||||
if (!valuesEqual(style.flexDirection, flexDirection)) {
|
||||
if (style.flexDirection != flexDirection) {
|
||||
style.flexDirection = flexDirection;
|
||||
dirty();
|
||||
}
|
||||
}
|
||||
|
||||
public void setJustifyContent(CSSJustify justifyContent) {
|
||||
if (!valuesEqual(style.justifyContent, justifyContent)) {
|
||||
if (style.justifyContent != justifyContent) {
|
||||
style.justifyContent = justifyContent;
|
||||
dirty();
|
||||
}
|
||||
}
|
||||
|
||||
public void setAlignItems(CSSAlign alignItems) {
|
||||
if (!valuesEqual(style.alignItems, alignItems)) {
|
||||
if (style.alignItems != alignItems) {
|
||||
style.alignItems = alignItems;
|
||||
dirty();
|
||||
}
|
||||
}
|
||||
|
||||
public void setAlignSelf(CSSAlign alignSelf) {
|
||||
if (!valuesEqual(style.alignSelf, alignSelf)) {
|
||||
if (style.alignSelf != alignSelf) {
|
||||
style.alignSelf = alignSelf;
|
||||
dirty();
|
||||
}
|
||||
}
|
||||
|
||||
public void setPositionType(CSSPositionType positionType) {
|
||||
if (!valuesEqual(style.positionType, positionType)) {
|
||||
if (style.positionType != positionType) {
|
||||
style.positionType = positionType;
|
||||
dirty();
|
||||
}
|
||||
}
|
||||
|
||||
public void setWrap(CSSWrap flexWrap) {
|
||||
if (!valuesEqual(style.flexWrap, flexWrap)) {
|
||||
if (style.flexWrap != flexWrap) {
|
||||
style.flexWrap = flexWrap;
|
||||
dirty();
|
||||
}
|
||||
@ -403,4 +396,19 @@ public class CSSNode {
|
||||
dirty();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets this instance to its default state. This method is meant to be used when
|
||||
* recycling {@link CSSNode} instances.
|
||||
*/
|
||||
public void reset() {
|
||||
if (mParent != null || (mChildren != null && mChildren.size() > 0)) {
|
||||
throw new IllegalStateException("You should not reset an attached CSSNode");
|
||||
}
|
||||
|
||||
style.reset();
|
||||
layout.resetResult();
|
||||
lineIndex = 0;
|
||||
mLayoutState = LayoutState.DIRTY;
|
||||
}
|
||||
}
|
||||
|
@ -7,44 +7,66 @@
|
||||
*/
|
||||
|
||||
// NOTE: this file is auto-copied from https://github.com/facebook/css-layout
|
||||
// @generated SignedSource<<2fc400ad927a17e1b13430210531ce86>>
|
||||
// @generated SignedSource<<4c7c75ffd4800aee843a5f5828f3e3ab>>
|
||||
|
||||
package com.facebook.csslayout;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* The CSS style definition for a {@link CSSNode}.
|
||||
*/
|
||||
public class CSSStyle {
|
||||
|
||||
public CSSDirection direction = CSSDirection.INHERIT;
|
||||
public CSSFlexDirection flexDirection = CSSFlexDirection.COLUMN;
|
||||
public CSSJustify justifyContent = CSSJustify.FLEX_START;
|
||||
public CSSAlign alignContent = CSSAlign.FLEX_START;
|
||||
public CSSAlign alignItems = CSSAlign.STRETCH;
|
||||
public CSSAlign alignSelf = CSSAlign.AUTO;
|
||||
public CSSPositionType positionType = CSSPositionType.RELATIVE;
|
||||
public CSSWrap flexWrap = CSSWrap.NOWRAP;
|
||||
public CSSDirection direction;
|
||||
public CSSFlexDirection flexDirection;
|
||||
public CSSJustify justifyContent;
|
||||
public CSSAlign alignContent;
|
||||
public CSSAlign alignItems;
|
||||
public CSSAlign alignSelf;
|
||||
public CSSPositionType positionType;
|
||||
public CSSWrap flexWrap;
|
||||
public float flex;
|
||||
|
||||
public Spacing margin = new Spacing();
|
||||
public Spacing padding = new Spacing();
|
||||
public Spacing border = new Spacing();
|
||||
|
||||
public float[] position = {
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
};
|
||||
|
||||
public float[] dimensions = {
|
||||
CSSConstants.UNDEFINED,
|
||||
CSSConstants.UNDEFINED,
|
||||
};
|
||||
public float[] position = new float[4];
|
||||
public float[] dimensions = new float[2];
|
||||
|
||||
public float minWidth = CSSConstants.UNDEFINED;
|
||||
public float minHeight = CSSConstants.UNDEFINED;
|
||||
|
||||
public float maxWidth = CSSConstants.UNDEFINED;
|
||||
public float maxHeight = CSSConstants.UNDEFINED;
|
||||
|
||||
CSSStyle() {
|
||||
reset();
|
||||
}
|
||||
|
||||
void reset() {
|
||||
direction = CSSDirection.INHERIT;
|
||||
flexDirection = CSSFlexDirection.COLUMN;
|
||||
justifyContent = CSSJustify.FLEX_START;
|
||||
alignContent = CSSAlign.FLEX_START;
|
||||
alignItems = CSSAlign.STRETCH;
|
||||
alignSelf = CSSAlign.AUTO;
|
||||
positionType = CSSPositionType.RELATIVE;
|
||||
flexWrap = CSSWrap.NOWRAP;
|
||||
flex = 0f;
|
||||
|
||||
margin.reset();;
|
||||
padding.reset();
|
||||
border.reset();
|
||||
|
||||
Arrays.fill(position, CSSConstants.UNDEFINED);
|
||||
Arrays.fill(dimensions, CSSConstants.UNDEFINED);
|
||||
|
||||
minWidth = CSSConstants.UNDEFINED;
|
||||
minHeight = CSSConstants.UNDEFINED;
|
||||
|
||||
maxWidth = CSSConstants.UNDEFINED;
|
||||
maxHeight = CSSConstants.UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
// NOTE: this file is auto-copied from https://github.com/facebook/css-layout
|
||||
// @generated SignedSource<<b8b881922a917015f33e0b1d70b8202b>>
|
||||
// @generated SignedSource<<c4feb337df98136c86629cf72c93f049>>
|
||||
|
||||
package com.facebook.csslayout;
|
||||
|
||||
@ -695,11 +695,14 @@ public class LayoutEngine {
|
||||
// For a relative children, we're either using alignItems (parent) or
|
||||
// alignSelf (child) in order to determine the position in the cross axis
|
||||
if (child.style.positionType == CSSPositionType.RELATIVE) {
|
||||
/*eslint-disable */
|
||||
// This variable is intentionally re-defined as the code is transpiled to a block scope language
|
||||
CSSAlign alignItem = getAlignItem(node, child);
|
||||
/*eslint-enable */
|
||||
if (alignItem == CSSAlign.STRETCH) {
|
||||
// You can only stretch if the dimension has not already been set
|
||||
// previously.
|
||||
if (!(!Float.isNaN(child.style.dimensions[dim[crossAxis]]) && child.style.dimensions[dim[crossAxis]] > 0.0)) {
|
||||
if (Float.isNaN(child.layout.dimensions[dim[crossAxis]])) {
|
||||
child.layout.dimensions[dim[crossAxis]] = Math.max(
|
||||
boundAxis(child, crossAxis, containerCrossAxis -
|
||||
paddingAndBorderAxisCross - (child.style.margin.getWithFallback(leadingSpacing[crossAxis], leading[crossAxis]) + child.style.margin.getWithFallback(trailingSpacing[crossAxis], trailing[crossAxis]))),
|
||||
|
@ -1,7 +1,7 @@
|
||||
The source of truth for css-layout is: https://github.com/facebook/css-layout
|
||||
|
||||
The code here should be kept in sync with GitHub.
|
||||
HEAD at the time this code was synced: https://github.com/facebook/css-layout/commit/f51c2d004de7744f9cefb98aa2a9c1c22168d49c
|
||||
HEAD at the time this code was synced: https://github.com/facebook/css-layout/commit/4b4cd06be2f0cd2aea476e893c60443082826fb8
|
||||
|
||||
There is generated code in:
|
||||
- README (this file)
|
||||
|
@ -1,7 +1,7 @@
|
||||
The source of truth for css-layout is: https://github.com/facebook/css-layout
|
||||
|
||||
The code here should be kept in sync with GitHub.
|
||||
HEAD at the time this code was synced: https://github.com/facebook/css-layout/commit/f51c2d004de7744f9cefb98aa2a9c1c22168d49c
|
||||
HEAD at the time this code was synced: https://github.com/facebook/css-layout/commit/4b4cd06be2f0cd2aea476e893c60443082826fb8
|
||||
|
||||
There is generated code in:
|
||||
- README.facebook (this file)
|
||||
|
@ -7,12 +7,14 @@
|
||||
*/
|
||||
|
||||
// NOTE: this file is auto-copied from https://github.com/facebook/css-layout
|
||||
// @generated SignedSource<<fcf3439e46c4c76e42357c348a9ffe99>>
|
||||
// @generated SignedSource<<3177826257fea8b5ac1fc9d1d514935a>>
|
||||
|
||||
package com.facebook.csslayout;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* Class representing CSS spacing (padding, margin, and borders). This is mostly necessary to
|
||||
* properly implement interactions and updates for properties like margin, marginLeft, and
|
||||
@ -164,6 +166,17 @@ public class Spacing {
|
||||
return mSpacing[spacingType];
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the spacing instance to its default state. This method is meant to be used when
|
||||
* recycling {@link Spacing} instances.
|
||||
*/
|
||||
void reset() {
|
||||
Arrays.fill(mSpacing, CSSConstants.UNDEFINED);
|
||||
mDefaultSpacing = null;
|
||||
mHasAliasesSet = false;
|
||||
mValueFlags = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to get start value and fallback to given type if not defined. This is used privately
|
||||
* by the layout engine as a more efficient way to fetch direction-aware values by
|
||||
|
Loading…
x
Reference in New Issue
Block a user