Back out "Back out "[yoga][intrinsic sizing] Update public API for intrinsic sizing setters""
Summary: Original commit changeset: 793f77dad021 Original Phabricator Diff: D66332309 Changelog: [Internal] Reviewed By: NickGerleman Differential Revision: D66662661 fbshipit-source-id: 22ed3ac9492f0a563c041ce4cb5fba4b65b53211
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a9246bc7db
commit
f99e657acd
@@ -160,6 +160,18 @@ void Node::setFlexBasisAuto() {
|
||||
YGNodeStyleSetFlexBasisAuto(m_node);
|
||||
}
|
||||
|
||||
void Node::setFlexBasisMaxContent() {
|
||||
YGNodeStyleSetFlexBasisMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setFlexBasisFitContent() {
|
||||
YGNodeStyleSetFlexBasisFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setFlexBasisStretch() {
|
||||
YGNodeStyleSetFlexBasisStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setFlexGrow(double flexGrow) {
|
||||
YGNodeStyleSetFlexGrow(m_node, flexGrow);
|
||||
}
|
||||
@@ -180,6 +192,18 @@ void Node::setWidthAuto() {
|
||||
YGNodeStyleSetWidthAuto(m_node);
|
||||
}
|
||||
|
||||
void Node::setWidthMaxContent() {
|
||||
YGNodeStyleSetWidthMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setWidthFitContent() {
|
||||
YGNodeStyleSetWidthFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setWidthStretch() {
|
||||
YGNodeStyleSetWidthStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setHeight(double height) {
|
||||
YGNodeStyleSetHeight(m_node, height);
|
||||
}
|
||||
@@ -192,6 +216,18 @@ void Node::setHeightAuto() {
|
||||
YGNodeStyleSetHeightAuto(m_node);
|
||||
}
|
||||
|
||||
void Node::setHeightMaxContent() {
|
||||
YGNodeStyleSetHeightMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setHeightFitContent() {
|
||||
YGNodeStyleSetHeightFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setHeightStretch() {
|
||||
YGNodeStyleSetHeightStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setMinWidth(double minWidth) {
|
||||
YGNodeStyleSetMinWidth(m_node, minWidth);
|
||||
}
|
||||
@@ -200,6 +236,18 @@ void Node::setMinWidthPercent(double minWidth) {
|
||||
YGNodeStyleSetMinWidthPercent(m_node, minWidth);
|
||||
}
|
||||
|
||||
void Node::setMinWidthMaxContent() {
|
||||
YGNodeStyleSetMinWidthMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMinWidthFitContent() {
|
||||
YGNodeStyleSetMinWidthFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMinWidthStretch() {
|
||||
YGNodeStyleSetMinWidthStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setMinHeight(double minHeight) {
|
||||
YGNodeStyleSetMinHeight(m_node, minHeight);
|
||||
}
|
||||
@@ -208,6 +256,18 @@ void Node::setMinHeightPercent(double minHeight) {
|
||||
YGNodeStyleSetMinHeightPercent(m_node, minHeight);
|
||||
}
|
||||
|
||||
void Node::setMinHeightMaxContent() {
|
||||
YGNodeStyleSetMinHeightMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMinHeightFitContent() {
|
||||
YGNodeStyleSetMinHeightFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMinHeightStretch() {
|
||||
YGNodeStyleSetMinHeightStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setMaxWidth(double maxWidth) {
|
||||
YGNodeStyleSetMaxWidth(m_node, maxWidth);
|
||||
}
|
||||
@@ -216,6 +276,18 @@ void Node::setMaxWidthPercent(double maxWidth) {
|
||||
YGNodeStyleSetMaxWidthPercent(m_node, maxWidth);
|
||||
}
|
||||
|
||||
void Node::setMaxWidthMaxContent() {
|
||||
YGNodeStyleSetMaxWidthMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMaxWidthFitContent() {
|
||||
YGNodeStyleSetMaxWidthFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMaxWidthStretch() {
|
||||
YGNodeStyleSetMaxWidthStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setMaxHeight(double maxHeight) {
|
||||
YGNodeStyleSetMaxHeight(m_node, maxHeight);
|
||||
}
|
||||
@@ -224,6 +296,18 @@ void Node::setMaxHeightPercent(double maxHeight) {
|
||||
YGNodeStyleSetMaxHeightPercent(m_node, maxHeight);
|
||||
}
|
||||
|
||||
void Node::setMaxHeightMaxContent() {
|
||||
YGNodeStyleSetMaxHeightMaxContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMaxHeightFitContent() {
|
||||
YGNodeStyleSetMaxHeightFitContent(m_node);
|
||||
}
|
||||
|
||||
void Node::setMaxHeightStretch() {
|
||||
YGNodeStyleSetMaxHeightStretch(m_node);
|
||||
}
|
||||
|
||||
void Node::setAspectRatio(double aspectRatio) {
|
||||
YGNodeStyleSetAspectRatio(m_node, aspectRatio);
|
||||
}
|
||||
|
@@ -97,25 +97,46 @@ class Node {
|
||||
void setFlexBasis(double flexBasis);
|
||||
void setFlexBasisPercent(double flexBasis);
|
||||
void setFlexBasisAuto();
|
||||
void setFlexBasisMaxContent();
|
||||
void setFlexBasisFitContent();
|
||||
void setFlexBasisStretch();
|
||||
void setFlexGrow(double flexGrow);
|
||||
void setFlexShrink(double flexShrink);
|
||||
|
||||
void setWidth(double width);
|
||||
void setWidthPercent(double width);
|
||||
void setWidthAuto();
|
||||
void setWidthMaxContent();
|
||||
void setWidthFitContent();
|
||||
void setWidthStretch();
|
||||
void setHeight(double height);
|
||||
void setHeightPercent(double height);
|
||||
void setHeightAuto();
|
||||
void setHeightMaxContent();
|
||||
void setHeightFitContent();
|
||||
void setHeightStretch();
|
||||
|
||||
void setMinWidth(double minWidth);
|
||||
void setMinWidthPercent(double minWidth);
|
||||
void setMinWidthMaxContent();
|
||||
void setMinWidthFitContent();
|
||||
void setMinWidthStretch();
|
||||
void setMinHeight(double minHeight);
|
||||
void setMinHeightPercent(double minHeight);
|
||||
void setMinHeightMaxContent();
|
||||
void setMinHeightFitContent();
|
||||
void setMinHeightStretch();
|
||||
|
||||
void setMaxWidth(double maxWidth);
|
||||
void setMaxWidthPercent(double maxWidth);
|
||||
void setMaxWidthMaxContent();
|
||||
void setMaxWidthFitContent();
|
||||
void setMaxWidthStretch();
|
||||
void setMaxHeight(double maxHeight);
|
||||
void setMaxHeightPercent(double maxHeight);
|
||||
void setMaxHeightMaxContent();
|
||||
void setMaxHeightFitContent();
|
||||
void setMaxHeightStretch();
|
||||
|
||||
void setAspectRatio(double aspectRatio);
|
||||
|
||||
|
@@ -90,25 +90,46 @@ EMSCRIPTEN_BINDINGS(YOGA_LAYOUT) {
|
||||
.function("setFlexBasis", &Node::setFlexBasis)
|
||||
.function("setFlexBasisPercent", &Node::setFlexBasisPercent)
|
||||
.function("setFlexBasisAuto", &Node::setFlexBasisAuto)
|
||||
.function("setFlexBasisMaxContent", &Node::setFlexBasisMaxContent)
|
||||
.function("setFlexBasisFitContent", &Node::setFlexBasisFitContent)
|
||||
.function("setFlexBasisStretch", &Node::setFlexBasisStretch)
|
||||
.function("setFlexGrow", &Node::setFlexGrow)
|
||||
.function("setFlexShrink", &Node::setFlexShrink)
|
||||
|
||||
.function("setWidth", &Node::setWidth)
|
||||
.function("setWidthPercent", &Node::setWidthPercent)
|
||||
.function("setWidthAuto", &Node::setWidthAuto)
|
||||
.function("setWidthMaxContent", &Node::setWidthMaxContent)
|
||||
.function("setWidthFitContent", &Node::setWidthFitContent)
|
||||
.function("setWidthStretch", &Node::setWidthStretch)
|
||||
.function("setHeight", &Node::setHeight)
|
||||
.function("setHeightPercent", &Node::setHeightPercent)
|
||||
.function("setHeightAuto", &Node::setHeightAuto)
|
||||
.function("setHeightMaxContent", &Node::setHeightMaxContent)
|
||||
.function("setHeightFitContent", &Node::setHeightFitContent)
|
||||
.function("setHeightStretch", &Node::setHeightStretch)
|
||||
|
||||
.function("setMinWidth", &Node::setMinWidth)
|
||||
.function("setMinWidthPercent", &Node::setMinWidthPercent)
|
||||
.function("setMinWidthMaxContent", &Node::setMinWidthMaxContent)
|
||||
.function("setMinWidthFitContent", &Node::setMinWidthFitContent)
|
||||
.function("setMinWidthStretch", &Node::setMinWidthStretch)
|
||||
.function("setMinHeight", &Node::setMinHeight)
|
||||
.function("setMinHeightPercent", &Node::setMinHeightPercent)
|
||||
.function("setMinHeightMaxContent", &Node::setMinHeightMaxContent)
|
||||
.function("setMinHeightFitContent", &Node::setMinHeightFitContent)
|
||||
.function("setMinHeightStretch", &Node::setMinHeightStretch)
|
||||
|
||||
.function("setMaxWidth", &Node::setMaxWidth)
|
||||
.function("setMaxWidthPercent", &Node::setMaxWidthPercent)
|
||||
.function("setMaxWidthMaxContent", &Node::setMaxWidthMaxContent)
|
||||
.function("setMaxWidthFitContent", &Node::setMaxWidthFitContent)
|
||||
.function("setMaxWidthStretch", &Node::setMaxWidthStretch)
|
||||
.function("setMaxHeight", &Node::setMaxHeight)
|
||||
.function("setMaxHeightPercent", &Node::setMaxHeightPercent)
|
||||
.function("setMaxHeightMaxContent", &Node::setMaxHeightMaxContent)
|
||||
.function("setMaxHeightFitContent", &Node::setMaxHeightFitContent)
|
||||
.function("setMaxHeightStretch", &Node::setMaxHeightStretch)
|
||||
|
||||
.function("setBoxSizing", &Node::setBoxSizing)
|
||||
|
||||
|
@@ -134,17 +134,41 @@ export type Node = {
|
||||
setDirection(direction: Direction): void;
|
||||
setDisplay(display: Display): void;
|
||||
setFlex(flex: number | undefined): void;
|
||||
setFlexBasis(flexBasis: number | 'auto' | `${number}%` | undefined): void;
|
||||
setFlexBasis(
|
||||
flexBasis:
|
||||
| number
|
||||
| 'auto'
|
||||
| 'fit-content'
|
||||
| 'max-content'
|
||||
| 'stretch'
|
||||
| `${number}%`
|
||||
| undefined,
|
||||
): void;
|
||||
setFlexBasisPercent(flexBasis: number | undefined): void;
|
||||
setFlexBasisAuto(): void;
|
||||
setFlexBasisFitContent(): void;
|
||||
setFlexBasisMaxContent(): void;
|
||||
setFlexBasisStretch(): void;
|
||||
setFlexDirection(flexDirection: FlexDirection): void;
|
||||
setFlexGrow(flexGrow: number | undefined): void;
|
||||
setFlexShrink(flexShrink: number | undefined): void;
|
||||
setFlexWrap(flexWrap: Wrap): void;
|
||||
setHeight(height: number | 'auto' | `${number}%` | undefined): void;
|
||||
setHeight(
|
||||
height:
|
||||
| number
|
||||
| 'auto'
|
||||
| 'fit-content'
|
||||
| 'max-content'
|
||||
| 'stretch'
|
||||
| `${number}%`
|
||||
| undefined,
|
||||
): void;
|
||||
setIsReferenceBaseline(isReferenceBaseline: boolean): void;
|
||||
setHeightAuto(): void;
|
||||
setHeightFitContent(): void;
|
||||
setHeightMaxContent(): void;
|
||||
setHeightPercent(height: number | undefined): void;
|
||||
setHeightStretch(): void;
|
||||
setJustifyContent(justifyContent: Justify): void;
|
||||
setGap(gutter: Gutter, gapLength: number | `${number}%` | undefined): Value;
|
||||
setGapPercent(gutter: Gutter, gapLength: number | undefined): Value;
|
||||
@@ -154,16 +178,60 @@ export type Node = {
|
||||
): void;
|
||||
setMarginAuto(edge: Edge): void;
|
||||
setMarginPercent(edge: Edge, margin: number | undefined): void;
|
||||
setMaxHeight(maxHeight: number | `${number}%` | undefined): void;
|
||||
setMaxHeight(
|
||||
maxHeight:
|
||||
| number
|
||||
| 'fit-content'
|
||||
| 'max-content'
|
||||
| 'stretch'
|
||||
| `${number}%`
|
||||
| undefined,
|
||||
): void;
|
||||
setMaxHeightFitContent(): void;
|
||||
setMaxHeightMaxContent(): void;
|
||||
setMaxHeightPercent(maxHeight: number | undefined): void;
|
||||
setMaxWidth(maxWidth: number | `${number}%` | undefined): void;
|
||||
setMaxHeightStretch(): void;
|
||||
setMaxWidth(
|
||||
maxWidth:
|
||||
| number
|
||||
| 'fit-content'
|
||||
| 'max-content'
|
||||
| 'stretch'
|
||||
| `${number}%`
|
||||
| undefined,
|
||||
): void;
|
||||
setMaxWidthFitContent(): void;
|
||||
setMaxWidthMaxContent(): void;
|
||||
setMaxWidthPercent(maxWidth: number | undefined): void;
|
||||
setMaxWidthStretch(): void;
|
||||
setDirtiedFunc(dirtiedFunc: DirtiedFunction | null): void;
|
||||
setMeasureFunc(measureFunc: MeasureFunction | null): void;
|
||||
setMinHeight(minHeight: number | `${number}%` | undefined): void;
|
||||
setMinHeight(
|
||||
minHeight:
|
||||
| number
|
||||
| 'fit-content'
|
||||
| 'max-content'
|
||||
| 'stretch'
|
||||
| `${number}%`
|
||||
| undefined,
|
||||
): void;
|
||||
setMinHeightFitContent(): void;
|
||||
setMinHeightMaxContent(): void;
|
||||
setMinHeightPercent(minHeight: number | undefined): void;
|
||||
setMinWidth(minWidth: number | `${number}%` | undefined): void;
|
||||
setMinHeightStretch(): void;
|
||||
setMinWidth(
|
||||
minWidth:
|
||||
| number
|
||||
| 'fit-content'
|
||||
| 'max-content'
|
||||
| 'stretch'
|
||||
| `${number}%`
|
||||
| undefined,
|
||||
): void;
|
||||
setMinWidthFitContent(): void;
|
||||
setMinWidthMaxContent(): void;
|
||||
setMinWidthPercent(minWidth: number | undefined): void;
|
||||
setMinWidthStretch(): void;
|
||||
setOverflow(overflow: Overflow): void;
|
||||
setPadding(edge: Edge, padding: number | `${number}%` | undefined): void;
|
||||
setPaddingPercent(edge: Edge, padding: number | undefined): void;
|
||||
@@ -172,9 +240,21 @@ export type Node = {
|
||||
setPositionType(positionType: PositionType): void;
|
||||
setPositionAuto(edge: Edge): void;
|
||||
setBoxSizing(boxSizing: BoxSizing): void;
|
||||
setWidth(width: number | 'auto' | `${number}%` | undefined): void;
|
||||
setWidth(
|
||||
width:
|
||||
| number
|
||||
| 'auto'
|
||||
| 'fit-content'
|
||||
| 'max-content'
|
||||
| 'stretch'
|
||||
| `${number}%`
|
||||
| undefined,
|
||||
): void;
|
||||
setWidthAuto(): void;
|
||||
setWidthFitContent(): void;
|
||||
setWidthMaxContent(): void;
|
||||
setWidthPercent(width: number | undefined): void;
|
||||
setWidthStretch(): void;
|
||||
unsetDirtiedFunc(): void;
|
||||
unsetMeasureFunc(): void;
|
||||
setAlwaysFormsContainingBlock(alwaysFormsContainingBlock: boolean): void;
|
||||
@@ -220,6 +300,9 @@ export default function wrapAssembly(lib: any): Yoga {
|
||||
[Unit.Point]: lib.Node.prototype[fnName],
|
||||
[Unit.Percent]: lib.Node.prototype[`${fnName}Percent`],
|
||||
[Unit.Auto]: lib.Node.prototype[`${fnName}Auto`],
|
||||
[Unit.MaxContent]: lib.Node.prototype[`${fnName}MaxContent`],
|
||||
[Unit.FitContent]: lib.Node.prototype[`${fnName}FitContent`],
|
||||
[Unit.Stretch]: lib.Node.prototype[`${fnName}Stretch`],
|
||||
};
|
||||
|
||||
patch(lib.Node.prototype, fnName, function (original, ...args) {
|
||||
@@ -232,6 +315,15 @@ export default function wrapAssembly(lib: any): Yoga {
|
||||
if (value === 'auto') {
|
||||
unit = Unit.Auto;
|
||||
asNumber = undefined;
|
||||
} else if (value == 'max-content') {
|
||||
unit = Unit.MaxContent;
|
||||
asNumber = undefined;
|
||||
} else if (value == 'fit-content') {
|
||||
unit = Unit.FitContent;
|
||||
asNumber = undefined;
|
||||
} else if (value == 'stretch') {
|
||||
unit = Unit.Stretch;
|
||||
asNumber = undefined;
|
||||
} else if (typeof value === 'object') {
|
||||
unit = value.unit;
|
||||
asNumber = value.valueOf();
|
||||
|
Reference in New Issue
Block a user