Add option to use aspect-ratio in test fixtures
Summary: Wires up codegen for aspect-ratio styles in JS, Java and CPP gentest fixtures. Reviewed By: NickGerleman Differential Revision: D50225805 fbshipit-source-id: 660a3999eab24611b7c2d2e073b1d55180a5d4f0
This commit is contained in:
committed by
Facebook GitHub Bot
parent
fad4d50b8e
commit
a876372357
@@ -219,6 +219,20 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetAspectRatio: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
'YGNodeStyleSetAspectRatio' +
|
||||
toFunctionName(value) +
|
||||
'(' +
|
||||
nodeName +
|
||||
', ' +
|
||||
toValueCpp(value) +
|
||||
');',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetBorder: {
|
||||
value: function (nodeName, edge, value) {
|
||||
this.push(
|
||||
|
@@ -239,6 +239,12 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetAspectRatio: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(nodeName + '.setAspectRatio(' + toValueJava(value) + 'f);');
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetBorder: {
|
||||
value: function (nodeName, edge, value) {
|
||||
this.push(
|
||||
|
@@ -222,6 +222,14 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetAspectRatio: {
|
||||
value: function (nodeName, value) {
|
||||
this.push(
|
||||
nodeName + '.setAspectRatio(' + toValueJavascript(value) + ');',
|
||||
);
|
||||
},
|
||||
},
|
||||
|
||||
YGNodeStyleSetBorder: {
|
||||
value: function (nodeName, edge, value) {
|
||||
this.push(
|
||||
|
@@ -211,6 +211,12 @@ function setupTestTree(
|
||||
|
||||
if (!isDefaultStyleValue(style, node.style[style])) {
|
||||
switch (style) {
|
||||
case 'aspect-ratio':
|
||||
e.YGNodeStyleSetAspectRatio(
|
||||
nodeName,
|
||||
pointValue(e, node.style[style]),
|
||||
);
|
||||
break;
|
||||
case 'gap':
|
||||
e.YGNodeStyleSetGap(
|
||||
nodeName,
|
||||
@@ -742,6 +748,7 @@ function getYogaStyle(node) {
|
||||
'column-gap',
|
||||
'row-gap',
|
||||
'display',
|
||||
'aspect-ratio',
|
||||
].reduce((map, key) => {
|
||||
map[key] =
|
||||
node.style[key] || getComputedStyle(node, null).getPropertyValue(key);
|
||||
|
Reference in New Issue
Block a user