Compare commits
4 Commits
dependabot
...
v3.2.0
Author | SHA1 | Date | |
---|---|---|---|
|
f55265f518 | ||
|
be00354b71 | ||
|
0c995496c8 | ||
|
c12e732fab |
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
Pod::Spec.new do |spec|
|
Pod::Spec.new do |spec|
|
||||||
spec.name = 'Yoga'
|
spec.name = 'Yoga'
|
||||||
spec.version = '0.0.0'
|
spec.version = '3.2.0'
|
||||||
spec.license = { :type => 'MIT', :file => "LICENSE" }
|
spec.license = { :type => 'MIT', :file => "LICENSE" }
|
||||||
spec.homepage = 'https://yogalayout.dev/'
|
spec.homepage = 'https://yogalayout.dev/'
|
||||||
spec.documentation_url = 'https://yogalayout.dev/docs'
|
spec.documentation_url = 'https://yogalayout.dev/docs'
|
||||||
|
10
enums.py
10
enums.py
@@ -8,15 +8,7 @@ import os
|
|||||||
|
|
||||||
ENUMS = {
|
ENUMS = {
|
||||||
"Direction": ["Inherit", "LTR", "RTL"],
|
"Direction": ["Inherit", "LTR", "RTL"],
|
||||||
"Unit": [
|
"Unit": ["Undefined", "Point", "Percent", "Auto"],
|
||||||
"Undefined",
|
|
||||||
"Point",
|
|
||||||
"Percent",
|
|
||||||
"Auto",
|
|
||||||
"MaxContent",
|
|
||||||
"FitContent",
|
|
||||||
"Stretch",
|
|
||||||
],
|
|
||||||
"FlexDirection": ["Column", "ColumnReverse", "Row", "RowReverse"],
|
"FlexDirection": ["Column", "ColumnReverse", "Row", "RowReverse"],
|
||||||
"Justify": [
|
"Justify": [
|
||||||
"FlexStart",
|
"FlexStart",
|
||||||
|
@@ -219,251 +219,3 @@
|
|||||||
Sed at consectetur ipsum.
|
Sed at consectetur ipsum.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="max_content_width" style="flex-direction: row; width:max-content; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 100px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 25px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-disabled="true" id="fit_content_width" style="width: 90px; position: relative;">
|
|
||||||
<div style="flex-direction: row; width: fit-content; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 100px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 25px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-disabled="true" id="stretch_width" style="width: 500px; position: relative;">
|
|
||||||
<div style="flex-direction: row; width: -webkit-fill-available; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 100px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 25px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="max_content_height" style="height:max-content; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 100px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 25px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-disabled="true" id="fit_content_height" style="height: 90px; position: relative;">
|
|
||||||
<div style="height: fit-content; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 100px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 25px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-disabled="true" id="stretch_height" style="height: 500px; position: relative;">
|
|
||||||
<div style="height: -webkit-fill-available; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 100px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 25px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="max_content_flex_basis_column" style="flex-basis: max-content; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 100px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 25px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-disabled="true" id="fit_content_flex_basis_column" style="height: 90px; position: relative;">
|
|
||||||
<div style="flex-basis: fit-content; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 100px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 25px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-disabled="true" id="stretch_flex_basis_column" style="height: 500px; position: relative;">
|
|
||||||
<div style="flex-basis: -webkit-fill-available; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 100px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 25px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="max_content_flex_basis_row" style="flex-direction: row; flex-basis: max-content; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 100px; height: 500px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 25px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-disabled="true" id="fit_content_flex_basis_row" style="width: 90px; position: relative;">
|
|
||||||
<div style="flex-direction: row; flex-basis: fit-content; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 100px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 25px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-disabled="true" id="stretch_flex_basis_row" style="width: 500px; position: relative;">
|
|
||||||
<div style="flex-direction: row; flex-basis: -webkit-fill-available; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 100px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 25px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-disabled="true" id="max_content_max_width" style="flex-direction: row; max-width:max-content; width: 200px; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 100px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 25px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-disabled="true" id="fit_content_max_width" style="width: 90px; position: relative;">
|
|
||||||
<div style="flex-direction: row; max-width: fit-content; width: 110px; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 100px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 25px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-disabled="true" id="stretch_max_width" style="width: 500px; position: relative;">
|
|
||||||
<div style="flex-direction: row; max-width: -webkit-fill-available; width: 600px; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 100px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 25px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-disabled="true" id="max_content_min_width" style="flex-direction: row; min-width:max-content; width: 100px; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 100px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 25px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-disabled="true" id="fit_content_min_width" style="width: 90px; position: relative;">
|
|
||||||
<div style="flex-direction: row; min-width: fit-content; width: 90px; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 100px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 25px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-disabled="true" id="stretch_min_width" style="width: 500px; position: relative;">
|
|
||||||
<div style="flex-direction: row; min-width: -webkit-fill-available; width: 400px; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 100px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 25px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-disabled="true" id="max_content_max_height" style="max-height:max-content; height: 200px; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 100px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 25px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-disabled="true" id="fit_content_max_height" style="height: 90px; position: relative;">
|
|
||||||
<div style="max-height: fit-content; height: 110px; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 100px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 25px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-disabled="true" id="stretch_max_height" style="height: 500px; position: relative;">
|
|
||||||
<div style="max-height: -webkit-fill-available; flex-wrap: wrap; height: 600px;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 100px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 25px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-disabled="true" id="max_content_min_height" style="min-height:max-content; height: 100px; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 100px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 25px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-disabled="true" id="fit_content_min_height" style="height: 90px; position: relative;">
|
|
||||||
<div style="min-height: fit-content; height: 90px; flex-wrap: wrap;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 100px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 25px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div data-disabled="true" id="stretch_min_height" style="height: 500px; position: relative;">
|
|
||||||
<div style="min-height: -webkit-fill-available; flex-wrap: wrap; height: 400px;">
|
|
||||||
<div style="width: 50px; height: 50px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 100px;">
|
|
||||||
</div>
|
|
||||||
<div style="width: 50px; height: 25px;">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
@@ -17,25 +17,13 @@ function toFunctionNameCpp(value) {
|
|||||||
return 'Percent';
|
return 'Percent';
|
||||||
} else if (value.indexOf('Auto') >= 0) {
|
} else if (value.indexOf('Auto') >= 0) {
|
||||||
return 'Auto';
|
return 'Auto';
|
||||||
} else if (value.indexOf('MaxContent') >= 0) {
|
|
||||||
return 'MaxContent';
|
|
||||||
} else if (value.indexOf('FitContent') >= 0) {
|
|
||||||
return 'FitContent';
|
|
||||||
} else if (value.indexOf('Stretch') >= 0) {
|
|
||||||
return 'Stretch';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function keywordFunctionCpp(functionPrefix, nodeName, value) {
|
function keywordFunctionCpp(functionPrefix, nodeName, value) {
|
||||||
const functionSuffix = toFunctionNameCpp(value);
|
const functionSuffix = toFunctionNameCpp(value);
|
||||||
if (
|
if (functionSuffix == 'Auto') {
|
||||||
functionSuffix == 'Auto' ||
|
|
||||||
functionSuffix == 'MaxContent' ||
|
|
||||||
functionSuffix == 'FitContent' ||
|
|
||||||
functionSuffix == 'Stretch'
|
|
||||||
) {
|
|
||||||
return functionPrefix + functionSuffix + '(' + nodeName + ');';
|
return functionPrefix + functionSuffix + '(' + nodeName + ');';
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
@@ -175,10 +163,6 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
|||||||
YGDisplayContents: {value: 'YGDisplayContents'},
|
YGDisplayContents: {value: 'YGDisplayContents'},
|
||||||
YGAuto: {value: 'YGAuto'},
|
YGAuto: {value: 'YGAuto'},
|
||||||
|
|
||||||
YGMaxContent: {value: 'MaxContent'},
|
|
||||||
YGFitContent: {value: 'FitContent'},
|
|
||||||
YGStretch: {value: 'Stretch'},
|
|
||||||
|
|
||||||
YGNodeCalculateLayout: {
|
YGNodeCalculateLayout: {
|
||||||
value: function (node, dir, _experiments) {
|
value: function (node, dir, _experiments) {
|
||||||
this.push(
|
this.push(
|
||||||
@@ -398,25 +382,57 @@ CPPEmitter.prototype = Object.create(Emitter.prototype, {
|
|||||||
|
|
||||||
YGNodeStyleSetMaxHeight: {
|
YGNodeStyleSetMaxHeight: {
|
||||||
value: function (nodeName, value) {
|
value: function (nodeName, value) {
|
||||||
this.push(keywordFunctionCpp('YGNodeStyleSetMaxHeight', nodeName, value));
|
this.push(
|
||||||
|
'YGNodeStyleSetMaxHeight' +
|
||||||
|
toFunctionNameCpp(value) +
|
||||||
|
'(' +
|
||||||
|
nodeName +
|
||||||
|
', ' +
|
||||||
|
toValueCpp(value) +
|
||||||
|
');',
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
YGNodeStyleSetMaxWidth: {
|
YGNodeStyleSetMaxWidth: {
|
||||||
value: function (nodeName, value) {
|
value: function (nodeName, value) {
|
||||||
this.push(keywordFunctionCpp('YGNodeStyleSetMaxWidth', nodeName, value));
|
this.push(
|
||||||
|
'YGNodeStyleSetMaxWidth' +
|
||||||
|
toFunctionNameCpp(value) +
|
||||||
|
'(' +
|
||||||
|
nodeName +
|
||||||
|
', ' +
|
||||||
|
toValueCpp(value) +
|
||||||
|
');',
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
YGNodeStyleSetMinHeight: {
|
YGNodeStyleSetMinHeight: {
|
||||||
value: function (nodeName, value) {
|
value: function (nodeName, value) {
|
||||||
this.push(keywordFunctionCpp('YGNodeStyleSetMinHeight', nodeName, value));
|
this.push(
|
||||||
|
'YGNodeStyleSetMinHeight' +
|
||||||
|
toFunctionNameCpp(value) +
|
||||||
|
'(' +
|
||||||
|
nodeName +
|
||||||
|
', ' +
|
||||||
|
toValueCpp(value) +
|
||||||
|
');',
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
YGNodeStyleSetMinWidth: {
|
YGNodeStyleSetMinWidth: {
|
||||||
value: function (nodeName, value) {
|
value: function (nodeName, value) {
|
||||||
this.push(keywordFunctionCpp('YGNodeStyleSetMinWidth', nodeName, value));
|
this.push(
|
||||||
|
'YGNodeStyleSetMinWidth' +
|
||||||
|
toFunctionNameCpp(value) +
|
||||||
|
'(' +
|
||||||
|
nodeName +
|
||||||
|
', ' +
|
||||||
|
toValueCpp(value) +
|
||||||
|
');',
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@@ -17,24 +17,13 @@ function toMethodName(value) {
|
|||||||
return 'Percent';
|
return 'Percent';
|
||||||
} else if (value.indexOf('AUTO') >= 0) {
|
} else if (value.indexOf('AUTO') >= 0) {
|
||||||
return 'Auto';
|
return 'Auto';
|
||||||
} else if (value.indexOf('MAX_CONTENT') >= 0) {
|
|
||||||
return 'MaxContent';
|
|
||||||
} else if (value.indexOf('FIT_CONTENT') >= 0) {
|
|
||||||
return 'FitContent';
|
|
||||||
} else if (value.indexOf('STRETCH') >= 0) {
|
|
||||||
return 'Stretch';
|
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function keywordMethod(methodPrefix, nodeName, value) {
|
function keywordMethod(methodPrefix, nodeName, value) {
|
||||||
const methodSuffix = toMethodName(value);
|
const methodSuffix = toMethodName(value);
|
||||||
if (
|
if (methodSuffix == 'Auto') {
|
||||||
methodSuffix == 'Auto' ||
|
|
||||||
methodSuffix == 'MaxContent' ||
|
|
||||||
methodSuffix == 'FitContent' ||
|
|
||||||
methodSuffix == 'Stretch'
|
|
||||||
) {
|
|
||||||
return nodeName + '.' + methodPrefix + methodSuffix + '();';
|
return nodeName + '.' + methodPrefix + methodSuffix + '();';
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
@@ -216,10 +205,6 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
|||||||
YGBoxSizingBorderBox: {value: 'YogaBoxSizing.BORDER_BOX'},
|
YGBoxSizingBorderBox: {value: 'YogaBoxSizing.BORDER_BOX'},
|
||||||
YGBoxSizingContentBox: {value: 'YogaBoxSizing.CONTENT_BOX'},
|
YGBoxSizingContentBox: {value: 'YogaBoxSizing.CONTENT_BOX'},
|
||||||
|
|
||||||
YGMaxContent: {value: 'MAX_CONTENT'},
|
|
||||||
YGFitContent: {value: 'FIT_CONTENT'},
|
|
||||||
YGStretch: {value: 'STRETCH'},
|
|
||||||
|
|
||||||
YGNodeCalculateLayout: {
|
YGNodeCalculateLayout: {
|
||||||
value: function (node, dir, _experiments) {
|
value: function (node, dir, _experiments) {
|
||||||
this.push(node + '.setDirection(' + dir + ');');
|
this.push(node + '.setDirection(' + dir + ');');
|
||||||
@@ -375,25 +360,53 @@ JavaEmitter.prototype = Object.create(Emitter.prototype, {
|
|||||||
|
|
||||||
YGNodeStyleSetMaxHeight: {
|
YGNodeStyleSetMaxHeight: {
|
||||||
value: function (nodeName, value) {
|
value: function (nodeName, value) {
|
||||||
this.push(keywordMethod('setMaxHeight', nodeName, value));
|
this.push(
|
||||||
|
nodeName +
|
||||||
|
'.setMaxHeight' +
|
||||||
|
toMethodName(value) +
|
||||||
|
'(' +
|
||||||
|
toValueJava(value) +
|
||||||
|
'f);',
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
YGNodeStyleSetMaxWidth: {
|
YGNodeStyleSetMaxWidth: {
|
||||||
value: function (nodeName, value) {
|
value: function (nodeName, value) {
|
||||||
this.push(keywordMethod('setMaxWidth', nodeName, value));
|
this.push(
|
||||||
|
nodeName +
|
||||||
|
'.setMaxWidth' +
|
||||||
|
toMethodName(value) +
|
||||||
|
'(' +
|
||||||
|
toValueJava(value) +
|
||||||
|
'f);',
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
YGNodeStyleSetMinHeight: {
|
YGNodeStyleSetMinHeight: {
|
||||||
value: function (nodeName, value) {
|
value: function (nodeName, value) {
|
||||||
this.push(keywordMethod('setMinHeight', nodeName, value));
|
this.push(
|
||||||
|
nodeName +
|
||||||
|
'.setMinHeight' +
|
||||||
|
toMethodName(value) +
|
||||||
|
'(' +
|
||||||
|
toValueJava(value) +
|
||||||
|
'f);',
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
YGNodeStyleSetMinWidth: {
|
YGNodeStyleSetMinWidth: {
|
||||||
value: function (nodeName, value) {
|
value: function (nodeName, value) {
|
||||||
this.push(keywordMethod('setMinWidth', nodeName, value));
|
this.push(
|
||||||
|
nodeName +
|
||||||
|
'.setMinWidth' +
|
||||||
|
toMethodName(value) +
|
||||||
|
'(' +
|
||||||
|
toValueJava(value) +
|
||||||
|
'f);',
|
||||||
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@@ -15,9 +15,6 @@ function toValueJavascript(value) {
|
|||||||
if (value.match(/^[0-9.e+-]+px$/i)) return parseFloat(value);
|
if (value.match(/^[0-9.e+-]+px$/i)) return parseFloat(value);
|
||||||
if (value.match(/^[0-9.e+-]+%/i)) return JSON.stringify(value);
|
if (value.match(/^[0-9.e+-]+%/i)) return JSON.stringify(value);
|
||||||
if (value == 'Yoga.AUTO') return '"auto"';
|
if (value == 'Yoga.AUTO') return '"auto"';
|
||||||
if (value == 'max-content') return '"max-content"';
|
|
||||||
if (value == 'fit-content') return '"fit-content"';
|
|
||||||
if (value == 'stretch') return '"stretch"';
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,10 +176,6 @@ JavascriptEmitter.prototype = Object.create(Emitter.prototype, {
|
|||||||
YGBoxSizingBorderBox: {value: 'BoxSizing.BorderBox'},
|
YGBoxSizingBorderBox: {value: 'BoxSizing.BorderBox'},
|
||||||
YGBoxSizingContentBox: {value: 'BoxSizing.ContentBox'},
|
YGBoxSizingContentBox: {value: 'BoxSizing.ContentBox'},
|
||||||
|
|
||||||
YGMaxContent: {value: 'max-content'},
|
|
||||||
YGFitContent: {value: 'fit-content'},
|
|
||||||
YGStretch: {value: 'stretch'},
|
|
||||||
|
|
||||||
YGNodeCalculateLayout: {
|
YGNodeCalculateLayout: {
|
||||||
value: function (node, dir, _experiments) {
|
value: function (node, dir, _experiments) {
|
||||||
this.push(node + '.calculateLayout(undefined, undefined, ' + dir + ');');
|
this.push(node + '.calculateLayout(undefined, undefined, ' + dir + ');');
|
||||||
|
@@ -654,13 +654,6 @@ function pointValue(e, value) {
|
|||||||
return e.YGAuto;
|
return e.YGAuto;
|
||||||
case 'undefined':
|
case 'undefined':
|
||||||
return e.YGUndefined;
|
return e.YGUndefined;
|
||||||
case 'max-content':
|
|
||||||
return e.YGMaxContent;
|
|
||||||
case 'fit-content':
|
|
||||||
return e.YGFitContent;
|
|
||||||
case 'stretch':
|
|
||||||
case '-webkit-fill-available':
|
|
||||||
return e.YGStretch;
|
|
||||||
default:
|
default:
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
@@ -11,4 +11,4 @@ android.useAndroidX=true
|
|||||||
|
|
||||||
org.gradle.jvmargs=-Xmx1536M
|
org.gradle.jvmargs=-Xmx1536M
|
||||||
|
|
||||||
VERSION_NAME=0.0.0
|
VERSION_NAME=3.2.0
|
||||||
|
@@ -74,9 +74,6 @@ public class YogaNative {
|
|||||||
static native void jni_YGNodeStyleSetFlexBasisJNI(long nativePointer, float flexBasis);
|
static native void jni_YGNodeStyleSetFlexBasisJNI(long nativePointer, float flexBasis);
|
||||||
static native void jni_YGNodeStyleSetFlexBasisPercentJNI(long nativePointer, float percent);
|
static native void jni_YGNodeStyleSetFlexBasisPercentJNI(long nativePointer, float percent);
|
||||||
static native void jni_YGNodeStyleSetFlexBasisAutoJNI(long nativePointer);
|
static native void jni_YGNodeStyleSetFlexBasisAutoJNI(long nativePointer);
|
||||||
static native void jni_YGNodeStyleSetFlexBasisMaxContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetFlexBasisFitContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetFlexBasisStretchJNI(long nativePointer);
|
|
||||||
static native long jni_YGNodeStyleGetMarginJNI(long nativePointer, int edge);
|
static native long jni_YGNodeStyleGetMarginJNI(long nativePointer, int edge);
|
||||||
static native void jni_YGNodeStyleSetMarginJNI(long nativePointer, int edge, float margin);
|
static native void jni_YGNodeStyleSetMarginJNI(long nativePointer, int edge, float margin);
|
||||||
static native void jni_YGNodeStyleSetMarginPercentJNI(long nativePointer, int edge, float percent);
|
static native void jni_YGNodeStyleSetMarginPercentJNI(long nativePointer, int edge, float percent);
|
||||||
@@ -94,40 +91,22 @@ public class YogaNative {
|
|||||||
static native void jni_YGNodeStyleSetWidthJNI(long nativePointer, float width);
|
static native void jni_YGNodeStyleSetWidthJNI(long nativePointer, float width);
|
||||||
static native void jni_YGNodeStyleSetWidthPercentJNI(long nativePointer, float percent);
|
static native void jni_YGNodeStyleSetWidthPercentJNI(long nativePointer, float percent);
|
||||||
static native void jni_YGNodeStyleSetWidthAutoJNI(long nativePointer);
|
static native void jni_YGNodeStyleSetWidthAutoJNI(long nativePointer);
|
||||||
static native void jni_YGNodeStyleSetWidthMaxContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetWidthFitContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetWidthStretchJNI(long nativePointer);
|
|
||||||
static native long jni_YGNodeStyleGetHeightJNI(long nativePointer);
|
static native long jni_YGNodeStyleGetHeightJNI(long nativePointer);
|
||||||
static native void jni_YGNodeStyleSetHeightJNI(long nativePointer, float height);
|
static native void jni_YGNodeStyleSetHeightJNI(long nativePointer, float height);
|
||||||
static native void jni_YGNodeStyleSetHeightPercentJNI(long nativePointer, float percent);
|
static native void jni_YGNodeStyleSetHeightPercentJNI(long nativePointer, float percent);
|
||||||
static native void jni_YGNodeStyleSetHeightAutoJNI(long nativePointer);
|
static native void jni_YGNodeStyleSetHeightAutoJNI(long nativePointer);
|
||||||
static native void jni_YGNodeStyleSetHeightMaxContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetHeightFitContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetHeightStretchJNI(long nativePointer);
|
|
||||||
static native long jni_YGNodeStyleGetMinWidthJNI(long nativePointer);
|
static native long jni_YGNodeStyleGetMinWidthJNI(long nativePointer);
|
||||||
static native void jni_YGNodeStyleSetMinWidthJNI(long nativePointer, float minWidth);
|
static native void jni_YGNodeStyleSetMinWidthJNI(long nativePointer, float minWidth);
|
||||||
static native void jni_YGNodeStyleSetMinWidthPercentJNI(long nativePointer, float percent);
|
static native void jni_YGNodeStyleSetMinWidthPercentJNI(long nativePointer, float percent);
|
||||||
static native void jni_YGNodeStyleSetMinWidthMaxContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetMinWidthFitContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetMinWidthStretchJNI(long nativePointer);
|
|
||||||
static native long jni_YGNodeStyleGetMinHeightJNI(long nativePointer);
|
static native long jni_YGNodeStyleGetMinHeightJNI(long nativePointer);
|
||||||
static native void jni_YGNodeStyleSetMinHeightJNI(long nativePointer, float minHeight);
|
static native void jni_YGNodeStyleSetMinHeightJNI(long nativePointer, float minHeight);
|
||||||
static native void jni_YGNodeStyleSetMinHeightPercentJNI(long nativePointer, float percent);
|
static native void jni_YGNodeStyleSetMinHeightPercentJNI(long nativePointer, float percent);
|
||||||
static native void jni_YGNodeStyleSetMinHeightMaxContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetMinHeightFitContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetMinHeightStretchJNI(long nativePointer);
|
|
||||||
static native long jni_YGNodeStyleGetMaxWidthJNI(long nativePointer);
|
static native long jni_YGNodeStyleGetMaxWidthJNI(long nativePointer);
|
||||||
static native void jni_YGNodeStyleSetMaxWidthJNI(long nativePointer, float maxWidth);
|
static native void jni_YGNodeStyleSetMaxWidthJNI(long nativePointer, float maxWidth);
|
||||||
static native void jni_YGNodeStyleSetMaxWidthPercentJNI(long nativePointer, float percent);
|
static native void jni_YGNodeStyleSetMaxWidthPercentJNI(long nativePointer, float percent);
|
||||||
static native void jni_YGNodeStyleSetMaxWidthMaxContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetMaxWidthFitContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetMaxWidthStretchJNI(long nativePointer);
|
|
||||||
static native long jni_YGNodeStyleGetMaxHeightJNI(long nativePointer);
|
static native long jni_YGNodeStyleGetMaxHeightJNI(long nativePointer);
|
||||||
static native void jni_YGNodeStyleSetMaxHeightJNI(long nativePointer, float maxheight);
|
static native void jni_YGNodeStyleSetMaxHeightJNI(long nativePointer, float maxheight);
|
||||||
static native void jni_YGNodeStyleSetMaxHeightPercentJNI(long nativePointer, float percent);
|
static native void jni_YGNodeStyleSetMaxHeightPercentJNI(long nativePointer, float percent);
|
||||||
static native void jni_YGNodeStyleSetMaxHeightMaxContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetMaxHeightFitContentJNI(long nativePointer);
|
|
||||||
static native void jni_YGNodeStyleSetMaxHeightStretchJNI(long nativePointer);
|
|
||||||
static native float jni_YGNodeStyleGetAspectRatioJNI(long nativePointer);
|
static native float jni_YGNodeStyleGetAspectRatioJNI(long nativePointer);
|
||||||
static native void jni_YGNodeStyleSetAspectRatioJNI(long nativePointer, float aspectRatio);
|
static native void jni_YGNodeStyleSetAspectRatioJNI(long nativePointer, float aspectRatio);
|
||||||
static native float jni_YGNodeStyleGetGapJNI(long nativePointer, int gutter);
|
static native float jni_YGNodeStyleGetGapJNI(long nativePointer, int gutter);
|
||||||
|
@@ -124,12 +124,6 @@ public abstract class YogaNode implements YogaProps {
|
|||||||
|
|
||||||
public abstract void setFlexBasisAuto();
|
public abstract void setFlexBasisAuto();
|
||||||
|
|
||||||
public abstract void setFlexBasisMaxContent();
|
|
||||||
|
|
||||||
public abstract void setFlexBasisFitContent();
|
|
||||||
|
|
||||||
public abstract void setFlexBasisStretch();
|
|
||||||
|
|
||||||
public abstract YogaValue getMargin(YogaEdge edge);
|
public abstract YogaValue getMargin(YogaEdge edge);
|
||||||
|
|
||||||
public abstract void setMargin(YogaEdge edge, float margin);
|
public abstract void setMargin(YogaEdge edge, float margin);
|
||||||
@@ -164,12 +158,6 @@ public abstract class YogaNode implements YogaProps {
|
|||||||
|
|
||||||
public abstract void setWidthAuto();
|
public abstract void setWidthAuto();
|
||||||
|
|
||||||
public abstract void setWidthMaxContent();
|
|
||||||
|
|
||||||
public abstract void setWidthFitContent();
|
|
||||||
|
|
||||||
public abstract void setWidthStretch();
|
|
||||||
|
|
||||||
public abstract YogaValue getHeight();
|
public abstract YogaValue getHeight();
|
||||||
|
|
||||||
public abstract void setHeight(float height);
|
public abstract void setHeight(float height);
|
||||||
@@ -178,60 +166,30 @@ public abstract class YogaNode implements YogaProps {
|
|||||||
|
|
||||||
public abstract void setHeightAuto();
|
public abstract void setHeightAuto();
|
||||||
|
|
||||||
public abstract void setHeightMaxContent();
|
|
||||||
|
|
||||||
public abstract void setHeightFitContent();
|
|
||||||
|
|
||||||
public abstract void setHeightStretch();
|
|
||||||
|
|
||||||
public abstract YogaValue getMinWidth();
|
public abstract YogaValue getMinWidth();
|
||||||
|
|
||||||
public abstract void setMinWidth(float minWidth);
|
public abstract void setMinWidth(float minWidth);
|
||||||
|
|
||||||
public abstract void setMinWidthPercent(float percent);
|
public abstract void setMinWidthPercent(float percent);
|
||||||
|
|
||||||
public abstract void setMinWidthMaxContent();
|
|
||||||
|
|
||||||
public abstract void setMinWidthFitContent();
|
|
||||||
|
|
||||||
public abstract void setMinWidthStretch();
|
|
||||||
|
|
||||||
public abstract YogaValue getMinHeight();
|
public abstract YogaValue getMinHeight();
|
||||||
|
|
||||||
public abstract void setMinHeight(float minHeight);
|
public abstract void setMinHeight(float minHeight);
|
||||||
|
|
||||||
public abstract void setMinHeightPercent(float percent);
|
public abstract void setMinHeightPercent(float percent);
|
||||||
|
|
||||||
public abstract void setMinHeightMaxContent();
|
|
||||||
|
|
||||||
public abstract void setMinHeightFitContent();
|
|
||||||
|
|
||||||
public abstract void setMinHeightStretch();
|
|
||||||
|
|
||||||
public abstract YogaValue getMaxWidth();
|
public abstract YogaValue getMaxWidth();
|
||||||
|
|
||||||
public abstract void setMaxWidth(float maxWidth);
|
public abstract void setMaxWidth(float maxWidth);
|
||||||
|
|
||||||
public abstract void setMaxWidthPercent(float percent);
|
public abstract void setMaxWidthPercent(float percent);
|
||||||
|
|
||||||
public abstract void setMaxWidthMaxContent();
|
|
||||||
|
|
||||||
public abstract void setMaxWidthFitContent();
|
|
||||||
|
|
||||||
public abstract void setMaxWidthStretch();
|
|
||||||
|
|
||||||
public abstract YogaValue getMaxHeight();
|
public abstract YogaValue getMaxHeight();
|
||||||
|
|
||||||
public abstract void setMaxHeight(float maxheight);
|
public abstract void setMaxHeight(float maxheight);
|
||||||
|
|
||||||
public abstract void setMaxHeightPercent(float percent);
|
public abstract void setMaxHeightPercent(float percent);
|
||||||
|
|
||||||
public abstract void setMaxHeightMaxContent();
|
|
||||||
|
|
||||||
public abstract void setMaxHeightFitContent();
|
|
||||||
|
|
||||||
public abstract void setMaxHeightStretch();
|
|
||||||
|
|
||||||
public abstract float getAspectRatio();
|
public abstract float getAspectRatio();
|
||||||
|
|
||||||
public abstract void setAspectRatio(float aspectRatio);
|
public abstract void setAspectRatio(float aspectRatio);
|
||||||
|
@@ -373,18 +373,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
|||||||
YogaNative.jni_YGNodeStyleSetFlexBasisAutoJNI(mNativePointer);
|
YogaNative.jni_YGNodeStyleSetFlexBasisAutoJNI(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setFlexBasisMaxContent() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetFlexBasisMaxContentJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFlexBasisFitContent() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetFlexBasisFitContentJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFlexBasisStretch() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetFlexBasisStretchJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public YogaValue getMargin(YogaEdge edge) {
|
public YogaValue getMargin(YogaEdge edge) {
|
||||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMarginJNI(mNativePointer, edge.intValue()));
|
return valueFromLong(YogaNative.jni_YGNodeStyleGetMarginJNI(mNativePointer, edge.intValue()));
|
||||||
}
|
}
|
||||||
@@ -453,18 +441,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
|||||||
YogaNative.jni_YGNodeStyleSetWidthAutoJNI(mNativePointer);
|
YogaNative.jni_YGNodeStyleSetWidthAutoJNI(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWidthMaxContent() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetWidthMaxContentJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWidthFitContent() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetWidthFitContentJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWidthStretch() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetWidthStretchJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public YogaValue getHeight() {
|
public YogaValue getHeight() {
|
||||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetHeightJNI(mNativePointer));
|
return valueFromLong(YogaNative.jni_YGNodeStyleGetHeightJNI(mNativePointer));
|
||||||
}
|
}
|
||||||
@@ -481,18 +457,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
|||||||
YogaNative.jni_YGNodeStyleSetHeightAutoJNI(mNativePointer);
|
YogaNative.jni_YGNodeStyleSetHeightAutoJNI(mNativePointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHeightMaxContent() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetHeightMaxContentJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHeightFitContent() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetHeightFitContentJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHeightStretch() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetHeightStretchJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public YogaValue getMinWidth() {
|
public YogaValue getMinWidth() {
|
||||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMinWidthJNI(mNativePointer));
|
return valueFromLong(YogaNative.jni_YGNodeStyleGetMinWidthJNI(mNativePointer));
|
||||||
}
|
}
|
||||||
@@ -505,18 +469,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
|||||||
YogaNative.jni_YGNodeStyleSetMinWidthPercentJNI(mNativePointer, percent);
|
YogaNative.jni_YGNodeStyleSetMinWidthPercentJNI(mNativePointer, percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMinWidthMaxContent() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetMinWidthMaxContentJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMinWidthFitContent() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetMinWidthFitContentJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMinWidthStretch() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetMinWidthStretchJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public YogaValue getMinHeight() {
|
public YogaValue getMinHeight() {
|
||||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMinHeightJNI(mNativePointer));
|
return valueFromLong(YogaNative.jni_YGNodeStyleGetMinHeightJNI(mNativePointer));
|
||||||
}
|
}
|
||||||
@@ -529,18 +481,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
|||||||
YogaNative.jni_YGNodeStyleSetMinHeightPercentJNI(mNativePointer, percent);
|
YogaNative.jni_YGNodeStyleSetMinHeightPercentJNI(mNativePointer, percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMinHeightMaxContent() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetMinHeightMaxContentJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMinHeightFitContent() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetMinHeightFitContentJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMinHeightStretch() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetMinHeightStretchJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public YogaValue getMaxWidth() {
|
public YogaValue getMaxWidth() {
|
||||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxWidthJNI(mNativePointer));
|
return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxWidthJNI(mNativePointer));
|
||||||
}
|
}
|
||||||
@@ -553,18 +493,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
|||||||
YogaNative.jni_YGNodeStyleSetMaxWidthPercentJNI(mNativePointer, percent);
|
YogaNative.jni_YGNodeStyleSetMaxWidthPercentJNI(mNativePointer, percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMaxWidthMaxContent() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetMaxWidthMaxContentJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxWidthFitContent() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetMaxWidthFitContentJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxWidthStretch() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetMaxWidthStretchJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public YogaValue getMaxHeight() {
|
public YogaValue getMaxHeight() {
|
||||||
return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxHeightJNI(mNativePointer));
|
return valueFromLong(YogaNative.jni_YGNodeStyleGetMaxHeightJNI(mNativePointer));
|
||||||
}
|
}
|
||||||
@@ -577,18 +505,6 @@ public abstract class YogaNodeJNIBase extends YogaNode implements Cloneable {
|
|||||||
YogaNative.jni_YGNodeStyleSetMaxHeightPercentJNI(mNativePointer, percent);
|
YogaNative.jni_YGNodeStyleSetMaxHeightPercentJNI(mNativePointer, percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMaxHeightMaxContent() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetMaxHeightMaxContentJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxHeightFitContent() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetMaxHeightFitContentJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMaxHeightStretch() {
|
|
||||||
YogaNative.jni_YGNodeStyleSetMaxHeightStretchJNI(mNativePointer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getAspectRatio() {
|
public float getAspectRatio() {
|
||||||
return YogaNative.jni_YGNodeStyleGetAspectRatioJNI(mNativePointer);
|
return YogaNative.jni_YGNodeStyleGetAspectRatioJNI(mNativePointer);
|
||||||
}
|
}
|
||||||
|
@@ -15,33 +15,15 @@ public interface YogaProps {
|
|||||||
|
|
||||||
void setWidthPercent(float percent);
|
void setWidthPercent(float percent);
|
||||||
|
|
||||||
void setWidthAuto();
|
|
||||||
|
|
||||||
void setWidthMaxContent();
|
|
||||||
|
|
||||||
void setWidthFitContent();
|
|
||||||
|
|
||||||
void setWidthStretch();
|
|
||||||
|
|
||||||
void setMinWidth(float minWidth);
|
void setMinWidth(float minWidth);
|
||||||
|
|
||||||
void setMinWidthPercent(float percent);
|
void setMinWidthPercent(float percent);
|
||||||
|
|
||||||
void setMinWidthMaxContent();
|
|
||||||
|
|
||||||
void setMinWidthFitContent();
|
|
||||||
|
|
||||||
void setMinWidthStretch();
|
|
||||||
|
|
||||||
void setMaxWidth(float maxWidth);
|
void setMaxWidth(float maxWidth);
|
||||||
|
|
||||||
void setMaxWidthPercent(float percent);
|
void setMaxWidthPercent(float percent);
|
||||||
|
|
||||||
void setMaxWidthMaxContent();
|
void setWidthAuto();
|
||||||
|
|
||||||
void setMaxWidthFitContent();
|
|
||||||
|
|
||||||
void setMaxWidthStretch();
|
|
||||||
|
|
||||||
/* Height properties */
|
/* Height properties */
|
||||||
|
|
||||||
@@ -49,33 +31,15 @@ public interface YogaProps {
|
|||||||
|
|
||||||
void setHeightPercent(float percent);
|
void setHeightPercent(float percent);
|
||||||
|
|
||||||
void setHeightAuto();
|
|
||||||
|
|
||||||
void setHeightMaxContent();
|
|
||||||
|
|
||||||
void setHeightFitContent();
|
|
||||||
|
|
||||||
void setHeightStretch();
|
|
||||||
|
|
||||||
void setMinHeight(float minHeight);
|
void setMinHeight(float minHeight);
|
||||||
|
|
||||||
void setMinHeightPercent(float percent);
|
void setMinHeightPercent(float percent);
|
||||||
|
|
||||||
void setMinHeightMaxContent();
|
|
||||||
|
|
||||||
void setMinHeightFitContent();
|
|
||||||
|
|
||||||
void setMinHeightStretch();
|
|
||||||
|
|
||||||
void setMaxHeight(float maxHeight);
|
void setMaxHeight(float maxHeight);
|
||||||
|
|
||||||
void setMaxHeightPercent(float percent);
|
void setMaxHeightPercent(float percent);
|
||||||
|
|
||||||
void setMaxHeightMaxContent();
|
void setHeightAuto();
|
||||||
|
|
||||||
void setMaxHeightFitContent();
|
|
||||||
|
|
||||||
void setMaxHeightStretch();
|
|
||||||
|
|
||||||
/* Margin properties */
|
/* Margin properties */
|
||||||
|
|
||||||
@@ -117,12 +81,6 @@ public interface YogaProps {
|
|||||||
|
|
||||||
void setFlexBasis(float flexBasis);
|
void setFlexBasis(float flexBasis);
|
||||||
|
|
||||||
void setFlexBasisMaxContent();
|
|
||||||
|
|
||||||
void setFlexBasisFitContent();
|
|
||||||
|
|
||||||
void setFlexBasisStretch();
|
|
||||||
|
|
||||||
void setFlexDirection(YogaFlexDirection direction);
|
void setFlexDirection(YogaFlexDirection direction);
|
||||||
|
|
||||||
void setFlexGrow(float flexGrow);
|
void setFlexGrow(float flexGrow);
|
||||||
|
@@ -13,10 +13,7 @@ public enum YogaUnit {
|
|||||||
UNDEFINED(0),
|
UNDEFINED(0),
|
||||||
POINT(1),
|
POINT(1),
|
||||||
PERCENT(2),
|
PERCENT(2),
|
||||||
AUTO(3),
|
AUTO(3);
|
||||||
MAX_CONTENT(4),
|
|
||||||
FIT_CONTENT(5),
|
|
||||||
STRETCH(6);
|
|
||||||
|
|
||||||
private final int mIntValue;
|
private final int mIntValue;
|
||||||
|
|
||||||
@@ -34,9 +31,6 @@ public enum YogaUnit {
|
|||||||
case 1: return POINT;
|
case 1: return POINT;
|
||||||
case 2: return PERCENT;
|
case 2: return PERCENT;
|
||||||
case 3: return AUTO;
|
case 3: return AUTO;
|
||||||
case 4: return MAX_CONTENT;
|
|
||||||
case 5: return FIT_CONTENT;
|
|
||||||
case 6: return STRETCH;
|
|
||||||
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
default: throw new IllegalArgumentException("Unknown enum value: " + value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -429,28 +429,6 @@ static void jni_YGNodeCopyStyleJNI(
|
|||||||
YGNodeStyleSet##name##Auto(_jlong2YGNodeRef(nativePointer)); \
|
YGNodeStyleSet##name##Auto(_jlong2YGNodeRef(nativePointer)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(name) \
|
|
||||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(name) \
|
|
||||||
YG_NODE_JNI_STYLE_UNIT_INTRINSIC(name)
|
|
||||||
|
|
||||||
#define YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(name) \
|
|
||||||
YG_NODE_JNI_STYLE_UNIT_PROP(name) \
|
|
||||||
YG_NODE_JNI_STYLE_UNIT_INTRINSIC(name)
|
|
||||||
|
|
||||||
#define YG_NODE_JNI_STYLE_UNIT_INTRINSIC(name) \
|
|
||||||
static void jni_YGNodeStyleSet##name##MaxContentJNI( \
|
|
||||||
JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \
|
|
||||||
YGNodeStyleSet##name##MaxContent(_jlong2YGNodeRef(nativePointer)); \
|
|
||||||
} \
|
|
||||||
static void jni_YGNodeStyleSet##name##FitContentJNI( \
|
|
||||||
JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \
|
|
||||||
YGNodeStyleSet##name##FitContent(_jlong2YGNodeRef(nativePointer)); \
|
|
||||||
} \
|
|
||||||
static void jni_YGNodeStyleSet##name##StretchJNI( \
|
|
||||||
JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer) { \
|
|
||||||
YGNodeStyleSet##name##Stretch(_jlong2YGNodeRef(nativePointer)); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \
|
#define YG_NODE_JNI_STYLE_EDGE_UNIT_PROP(name) \
|
||||||
static jlong jni_YGNodeStyleGet##name##JNI( \
|
static jlong jni_YGNodeStyleGet##name##JNI( \
|
||||||
JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint edge) { \
|
JNIEnv* /*env*/, jobject /*obj*/, jlong nativePointer, jint edge) { \
|
||||||
@@ -505,13 +483,13 @@ YG_NODE_JNI_STYLE_PROP(jfloat, float, Flex);
|
|||||||
YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexGrow);
|
YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexGrow);
|
||||||
YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexShrink);
|
YG_NODE_JNI_STYLE_PROP(jfloat, float, FlexShrink);
|
||||||
|
|
||||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(FlexBasis);
|
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(FlexBasis);
|
||||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(Width);
|
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(Width);
|
||||||
YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MinWidth);
|
YG_NODE_JNI_STYLE_UNIT_PROP(MinWidth);
|
||||||
YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MaxWidth);
|
YG_NODE_JNI_STYLE_UNIT_PROP(MaxWidth);
|
||||||
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO_INTRINSIC(Height);
|
YG_NODE_JNI_STYLE_UNIT_PROP_AUTO(Height);
|
||||||
YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MinHeight);
|
YG_NODE_JNI_STYLE_UNIT_PROP(MinHeight);
|
||||||
YG_NODE_JNI_STYLE_UNIT_PROP_INTRINSIC(MaxHeight);
|
YG_NODE_JNI_STYLE_UNIT_PROP(MaxHeight);
|
||||||
|
|
||||||
YG_NODE_JNI_STYLE_EDGE_UNIT_PROP_AUTO(Position);
|
YG_NODE_JNI_STYLE_EDGE_UNIT_PROP_AUTO(Position);
|
||||||
|
|
||||||
@@ -892,15 +870,6 @@ static JNINativeMethod methods[] = {
|
|||||||
{"jni_YGNodeStyleSetFlexBasisAutoJNI",
|
{"jni_YGNodeStyleSetFlexBasisAutoJNI",
|
||||||
"(J)V",
|
"(J)V",
|
||||||
(void*)jni_YGNodeStyleSetFlexBasisAutoJNI},
|
(void*)jni_YGNodeStyleSetFlexBasisAutoJNI},
|
||||||
{"jni_YGNodeStyleSetFlexBasisMaxContentJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetFlexBasisMaxContentJNI},
|
|
||||||
{"jni_YGNodeStyleSetFlexBasisFitContentJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetFlexBasisFitContentJNI},
|
|
||||||
{"jni_YGNodeStyleSetFlexBasisStretchJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetFlexBasisStretchJNI},
|
|
||||||
{"jni_YGNodeStyleGetMarginJNI",
|
{"jni_YGNodeStyleGetMarginJNI",
|
||||||
"(JI)J",
|
"(JI)J",
|
||||||
(void*)jni_YGNodeStyleGetMarginJNI},
|
(void*)jni_YGNodeStyleGetMarginJNI},
|
||||||
@@ -948,15 +917,6 @@ static JNINativeMethod methods[] = {
|
|||||||
{"jni_YGNodeStyleSetWidthAutoJNI",
|
{"jni_YGNodeStyleSetWidthAutoJNI",
|
||||||
"(J)V",
|
"(J)V",
|
||||||
(void*)jni_YGNodeStyleSetWidthAutoJNI},
|
(void*)jni_YGNodeStyleSetWidthAutoJNI},
|
||||||
{"jni_YGNodeStyleSetWidthMaxContentJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetWidthMaxContentJNI},
|
|
||||||
{"jni_YGNodeStyleSetWidthFitContentJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetWidthFitContentJNI},
|
|
||||||
{"jni_YGNodeStyleSetWidthStretchJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetWidthStretchJNI},
|
|
||||||
{"jni_YGNodeStyleGetHeightJNI", "(J)J", (void*)jni_YGNodeStyleGetHeightJNI},
|
{"jni_YGNodeStyleGetHeightJNI", "(J)J", (void*)jni_YGNodeStyleGetHeightJNI},
|
||||||
{"jni_YGNodeStyleSetHeightJNI",
|
{"jni_YGNodeStyleSetHeightJNI",
|
||||||
"(JF)V",
|
"(JF)V",
|
||||||
@@ -967,15 +927,6 @@ static JNINativeMethod methods[] = {
|
|||||||
{"jni_YGNodeStyleSetHeightAutoJNI",
|
{"jni_YGNodeStyleSetHeightAutoJNI",
|
||||||
"(J)V",
|
"(J)V",
|
||||||
(void*)jni_YGNodeStyleSetHeightAutoJNI},
|
(void*)jni_YGNodeStyleSetHeightAutoJNI},
|
||||||
{"jni_YGNodeStyleSetHeightMaxContentJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetHeightMaxContentJNI},
|
|
||||||
{"jni_YGNodeStyleSetHeightFitContentJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetHeightFitContentJNI},
|
|
||||||
{"jni_YGNodeStyleSetHeightStretchJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetHeightStretchJNI},
|
|
||||||
{"jni_YGNodeStyleGetMinWidthJNI",
|
{"jni_YGNodeStyleGetMinWidthJNI",
|
||||||
"(J)J",
|
"(J)J",
|
||||||
(void*)jni_YGNodeStyleGetMinWidthJNI},
|
(void*)jni_YGNodeStyleGetMinWidthJNI},
|
||||||
@@ -985,15 +936,6 @@ static JNINativeMethod methods[] = {
|
|||||||
{"jni_YGNodeStyleSetMinWidthPercentJNI",
|
{"jni_YGNodeStyleSetMinWidthPercentJNI",
|
||||||
"(JF)V",
|
"(JF)V",
|
||||||
(void*)jni_YGNodeStyleSetMinWidthPercentJNI},
|
(void*)jni_YGNodeStyleSetMinWidthPercentJNI},
|
||||||
{"jni_YGNodeStyleSetMinWidthMaxContentJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetMinWidthMaxContentJNI},
|
|
||||||
{"jni_YGNodeStyleSetMinWidthFitContentJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetMinWidthFitContentJNI},
|
|
||||||
{"jni_YGNodeStyleSetMinWidthStretchJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetMinWidthStretchJNI},
|
|
||||||
{"jni_YGNodeStyleGetMinHeightJNI",
|
{"jni_YGNodeStyleGetMinHeightJNI",
|
||||||
"(J)J",
|
"(J)J",
|
||||||
(void*)jni_YGNodeStyleGetMinHeightJNI},
|
(void*)jni_YGNodeStyleGetMinHeightJNI},
|
||||||
@@ -1003,15 +945,6 @@ static JNINativeMethod methods[] = {
|
|||||||
{"jni_YGNodeStyleSetMinHeightPercentJNI",
|
{"jni_YGNodeStyleSetMinHeightPercentJNI",
|
||||||
"(JF)V",
|
"(JF)V",
|
||||||
(void*)jni_YGNodeStyleSetMinHeightPercentJNI},
|
(void*)jni_YGNodeStyleSetMinHeightPercentJNI},
|
||||||
{"jni_YGNodeStyleSetMinHeightMaxContentJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetMinHeightMaxContentJNI},
|
|
||||||
{"jni_YGNodeStyleSetMinHeightFitContentJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetMinHeightFitContentJNI},
|
|
||||||
{"jni_YGNodeStyleSetMinHeightStretchJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetMinHeightStretchJNI},
|
|
||||||
{"jni_YGNodeStyleGetMaxWidthJNI",
|
{"jni_YGNodeStyleGetMaxWidthJNI",
|
||||||
"(J)J",
|
"(J)J",
|
||||||
(void*)jni_YGNodeStyleGetMaxWidthJNI},
|
(void*)jni_YGNodeStyleGetMaxWidthJNI},
|
||||||
@@ -1021,15 +954,6 @@ static JNINativeMethod methods[] = {
|
|||||||
{"jni_YGNodeStyleSetMaxWidthPercentJNI",
|
{"jni_YGNodeStyleSetMaxWidthPercentJNI",
|
||||||
"(JF)V",
|
"(JF)V",
|
||||||
(void*)jni_YGNodeStyleSetMaxWidthPercentJNI},
|
(void*)jni_YGNodeStyleSetMaxWidthPercentJNI},
|
||||||
{"jni_YGNodeStyleSetMaxWidthMaxContentJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetMaxWidthMaxContentJNI},
|
|
||||||
{"jni_YGNodeStyleSetMaxWidthFitContentJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetMaxWidthFitContentJNI},
|
|
||||||
{"jni_YGNodeStyleSetMaxWidthStretchJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetMaxWidthStretchJNI},
|
|
||||||
{"jni_YGNodeStyleGetMaxHeightJNI",
|
{"jni_YGNodeStyleGetMaxHeightJNI",
|
||||||
"(J)J",
|
"(J)J",
|
||||||
(void*)jni_YGNodeStyleGetMaxHeightJNI},
|
(void*)jni_YGNodeStyleGetMaxHeightJNI},
|
||||||
@@ -1039,15 +963,6 @@ static JNINativeMethod methods[] = {
|
|||||||
{"jni_YGNodeStyleSetMaxHeightPercentJNI",
|
{"jni_YGNodeStyleSetMaxHeightPercentJNI",
|
||||||
"(JF)V",
|
"(JF)V",
|
||||||
(void*)jni_YGNodeStyleSetMaxHeightPercentJNI},
|
(void*)jni_YGNodeStyleSetMaxHeightPercentJNI},
|
||||||
{"jni_YGNodeStyleSetMaxHeightMaxContentJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetMaxHeightMaxContentJNI},
|
|
||||||
{"jni_YGNodeStyleSetMaxHeightFitContentJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetMaxHeightFitContentJNI},
|
|
||||||
{"jni_YGNodeStyleSetMaxHeightStretchJNI",
|
|
||||||
"(J)V",
|
|
||||||
(void*)jni_YGNodeStyleSetMaxHeightStretchJNI},
|
|
||||||
{"jni_YGNodeStyleGetAspectRatioJNI",
|
{"jni_YGNodeStyleGetAspectRatioJNI",
|
||||||
"(J)F",
|
"(J)F",
|
||||||
(void*)jni_YGNodeStyleGetAspectRatioJNI},
|
(void*)jni_YGNodeStyleGetAspectRatioJNI},
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "yoga-layout",
|
"name": "yoga-layout",
|
||||||
"version": "0.0.0",
|
"version": "3.2.0",
|
||||||
"description": "An embeddable and performant flexbox layout engine with bindings for multiple languages",
|
"description": "An embeddable and performant flexbox layout engine with bindings for multiple languages",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": "Meta Open Source",
|
"author": "Meta Open Source",
|
||||||
|
@@ -160,18 +160,6 @@ void Node::setFlexBasisAuto() {
|
|||||||
YGNodeStyleSetFlexBasisAuto(m_node);
|
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) {
|
void Node::setFlexGrow(double flexGrow) {
|
||||||
YGNodeStyleSetFlexGrow(m_node, flexGrow);
|
YGNodeStyleSetFlexGrow(m_node, flexGrow);
|
||||||
}
|
}
|
||||||
@@ -192,18 +180,6 @@ void Node::setWidthAuto() {
|
|||||||
YGNodeStyleSetWidthAuto(m_node);
|
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) {
|
void Node::setHeight(double height) {
|
||||||
YGNodeStyleSetHeight(m_node, height);
|
YGNodeStyleSetHeight(m_node, height);
|
||||||
}
|
}
|
||||||
@@ -216,18 +192,6 @@ void Node::setHeightAuto() {
|
|||||||
YGNodeStyleSetHeightAuto(m_node);
|
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) {
|
void Node::setMinWidth(double minWidth) {
|
||||||
YGNodeStyleSetMinWidth(m_node, minWidth);
|
YGNodeStyleSetMinWidth(m_node, minWidth);
|
||||||
}
|
}
|
||||||
@@ -236,18 +200,6 @@ void Node::setMinWidthPercent(double minWidth) {
|
|||||||
YGNodeStyleSetMinWidthPercent(m_node, 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) {
|
void Node::setMinHeight(double minHeight) {
|
||||||
YGNodeStyleSetMinHeight(m_node, minHeight);
|
YGNodeStyleSetMinHeight(m_node, minHeight);
|
||||||
}
|
}
|
||||||
@@ -256,18 +208,6 @@ void Node::setMinHeightPercent(double minHeight) {
|
|||||||
YGNodeStyleSetMinHeightPercent(m_node, 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) {
|
void Node::setMaxWidth(double maxWidth) {
|
||||||
YGNodeStyleSetMaxWidth(m_node, maxWidth);
|
YGNodeStyleSetMaxWidth(m_node, maxWidth);
|
||||||
}
|
}
|
||||||
@@ -276,18 +216,6 @@ void Node::setMaxWidthPercent(double maxWidth) {
|
|||||||
YGNodeStyleSetMaxWidthPercent(m_node, 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) {
|
void Node::setMaxHeight(double maxHeight) {
|
||||||
YGNodeStyleSetMaxHeight(m_node, maxHeight);
|
YGNodeStyleSetMaxHeight(m_node, maxHeight);
|
||||||
}
|
}
|
||||||
@@ -296,18 +224,6 @@ void Node::setMaxHeightPercent(double maxHeight) {
|
|||||||
YGNodeStyleSetMaxHeightPercent(m_node, 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) {
|
void Node::setAspectRatio(double aspectRatio) {
|
||||||
YGNodeStyleSetAspectRatio(m_node, aspectRatio);
|
YGNodeStyleSetAspectRatio(m_node, aspectRatio);
|
||||||
}
|
}
|
||||||
|
@@ -97,46 +97,25 @@ class Node {
|
|||||||
void setFlexBasis(double flexBasis);
|
void setFlexBasis(double flexBasis);
|
||||||
void setFlexBasisPercent(double flexBasis);
|
void setFlexBasisPercent(double flexBasis);
|
||||||
void setFlexBasisAuto();
|
void setFlexBasisAuto();
|
||||||
void setFlexBasisMaxContent();
|
|
||||||
void setFlexBasisFitContent();
|
|
||||||
void setFlexBasisStretch();
|
|
||||||
void setFlexGrow(double flexGrow);
|
void setFlexGrow(double flexGrow);
|
||||||
void setFlexShrink(double flexShrink);
|
void setFlexShrink(double flexShrink);
|
||||||
|
|
||||||
void setWidth(double width);
|
void setWidth(double width);
|
||||||
void setWidthPercent(double width);
|
void setWidthPercent(double width);
|
||||||
void setWidthAuto();
|
void setWidthAuto();
|
||||||
void setWidthMaxContent();
|
|
||||||
void setWidthFitContent();
|
|
||||||
void setWidthStretch();
|
|
||||||
void setHeight(double height);
|
void setHeight(double height);
|
||||||
void setHeightPercent(double height);
|
void setHeightPercent(double height);
|
||||||
void setHeightAuto();
|
void setHeightAuto();
|
||||||
void setHeightMaxContent();
|
|
||||||
void setHeightFitContent();
|
|
||||||
void setHeightStretch();
|
|
||||||
|
|
||||||
void setMinWidth(double minWidth);
|
void setMinWidth(double minWidth);
|
||||||
void setMinWidthPercent(double minWidth);
|
void setMinWidthPercent(double minWidth);
|
||||||
void setMinWidthMaxContent();
|
|
||||||
void setMinWidthFitContent();
|
|
||||||
void setMinWidthStretch();
|
|
||||||
void setMinHeight(double minHeight);
|
void setMinHeight(double minHeight);
|
||||||
void setMinHeightPercent(double minHeight);
|
void setMinHeightPercent(double minHeight);
|
||||||
void setMinHeightMaxContent();
|
|
||||||
void setMinHeightFitContent();
|
|
||||||
void setMinHeightStretch();
|
|
||||||
|
|
||||||
void setMaxWidth(double maxWidth);
|
void setMaxWidth(double maxWidth);
|
||||||
void setMaxWidthPercent(double maxWidth);
|
void setMaxWidthPercent(double maxWidth);
|
||||||
void setMaxWidthMaxContent();
|
|
||||||
void setMaxWidthFitContent();
|
|
||||||
void setMaxWidthStretch();
|
|
||||||
void setMaxHeight(double maxHeight);
|
void setMaxHeight(double maxHeight);
|
||||||
void setMaxHeightPercent(double maxHeight);
|
void setMaxHeightPercent(double maxHeight);
|
||||||
void setMaxHeightMaxContent();
|
|
||||||
void setMaxHeightFitContent();
|
|
||||||
void setMaxHeightStretch();
|
|
||||||
|
|
||||||
void setAspectRatio(double aspectRatio);
|
void setAspectRatio(double aspectRatio);
|
||||||
|
|
||||||
|
@@ -90,46 +90,25 @@ EMSCRIPTEN_BINDINGS(YOGA_LAYOUT) {
|
|||||||
.function("setFlexBasis", &Node::setFlexBasis)
|
.function("setFlexBasis", &Node::setFlexBasis)
|
||||||
.function("setFlexBasisPercent", &Node::setFlexBasisPercent)
|
.function("setFlexBasisPercent", &Node::setFlexBasisPercent)
|
||||||
.function("setFlexBasisAuto", &Node::setFlexBasisAuto)
|
.function("setFlexBasisAuto", &Node::setFlexBasisAuto)
|
||||||
.function("setFlexBasisMaxContent", &Node::setFlexBasisMaxContent)
|
|
||||||
.function("setFlexBasisFitContent", &Node::setFlexBasisFitContent)
|
|
||||||
.function("setFlexBasisStretch", &Node::setFlexBasisStretch)
|
|
||||||
.function("setFlexGrow", &Node::setFlexGrow)
|
.function("setFlexGrow", &Node::setFlexGrow)
|
||||||
.function("setFlexShrink", &Node::setFlexShrink)
|
.function("setFlexShrink", &Node::setFlexShrink)
|
||||||
|
|
||||||
.function("setWidth", &Node::setWidth)
|
.function("setWidth", &Node::setWidth)
|
||||||
.function("setWidthPercent", &Node::setWidthPercent)
|
.function("setWidthPercent", &Node::setWidthPercent)
|
||||||
.function("setWidthAuto", &Node::setWidthAuto)
|
.function("setWidthAuto", &Node::setWidthAuto)
|
||||||
.function("setWidthMaxContent", &Node::setWidthMaxContent)
|
|
||||||
.function("setWidthFitContent", &Node::setWidthFitContent)
|
|
||||||
.function("setWidthStretch", &Node::setWidthStretch)
|
|
||||||
.function("setHeight", &Node::setHeight)
|
.function("setHeight", &Node::setHeight)
|
||||||
.function("setHeightPercent", &Node::setHeightPercent)
|
.function("setHeightPercent", &Node::setHeightPercent)
|
||||||
.function("setHeightAuto", &Node::setHeightAuto)
|
.function("setHeightAuto", &Node::setHeightAuto)
|
||||||
.function("setHeightMaxContent", &Node::setHeightMaxContent)
|
|
||||||
.function("setHeightFitContent", &Node::setHeightFitContent)
|
|
||||||
.function("setHeightStretch", &Node::setHeightStretch)
|
|
||||||
|
|
||||||
.function("setMinWidth", &Node::setMinWidth)
|
.function("setMinWidth", &Node::setMinWidth)
|
||||||
.function("setMinWidthPercent", &Node::setMinWidthPercent)
|
.function("setMinWidthPercent", &Node::setMinWidthPercent)
|
||||||
.function("setMinWidthMaxContent", &Node::setMinWidthMaxContent)
|
|
||||||
.function("setMinWidthFitContent", &Node::setMinWidthFitContent)
|
|
||||||
.function("setMinWidthStretch", &Node::setMinWidthStretch)
|
|
||||||
.function("setMinHeight", &Node::setMinHeight)
|
.function("setMinHeight", &Node::setMinHeight)
|
||||||
.function("setMinHeightPercent", &Node::setMinHeightPercent)
|
.function("setMinHeightPercent", &Node::setMinHeightPercent)
|
||||||
.function("setMinHeightMaxContent", &Node::setMinHeightMaxContent)
|
|
||||||
.function("setMinHeightFitContent", &Node::setMinHeightFitContent)
|
|
||||||
.function("setMinHeightStretch", &Node::setMinHeightStretch)
|
|
||||||
|
|
||||||
.function("setMaxWidth", &Node::setMaxWidth)
|
.function("setMaxWidth", &Node::setMaxWidth)
|
||||||
.function("setMaxWidthPercent", &Node::setMaxWidthPercent)
|
.function("setMaxWidthPercent", &Node::setMaxWidthPercent)
|
||||||
.function("setMaxWidthMaxContent", &Node::setMaxWidthMaxContent)
|
|
||||||
.function("setMaxWidthFitContent", &Node::setMaxWidthFitContent)
|
|
||||||
.function("setMaxWidthStretch", &Node::setMaxWidthStretch)
|
|
||||||
.function("setMaxHeight", &Node::setMaxHeight)
|
.function("setMaxHeight", &Node::setMaxHeight)
|
||||||
.function("setMaxHeightPercent", &Node::setMaxHeightPercent)
|
.function("setMaxHeightPercent", &Node::setMaxHeightPercent)
|
||||||
.function("setMaxHeightMaxContent", &Node::setMaxHeightMaxContent)
|
|
||||||
.function("setMaxHeightFitContent", &Node::setMaxHeightFitContent)
|
|
||||||
.function("setMaxHeightStretch", &Node::setMaxHeightStretch)
|
|
||||||
|
|
||||||
.function("setBoxSizing", &Node::setBoxSizing)
|
.function("setBoxSizing", &Node::setBoxSizing)
|
||||||
|
|
||||||
|
@@ -125,9 +125,6 @@ export enum Unit {
|
|||||||
Point = 1,
|
Point = 1,
|
||||||
Percent = 2,
|
Percent = 2,
|
||||||
Auto = 3,
|
Auto = 3,
|
||||||
MaxContent = 4,
|
|
||||||
FitContent = 5,
|
|
||||||
Stretch = 6,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum Wrap {
|
export enum Wrap {
|
||||||
@@ -206,9 +203,6 @@ const constants = {
|
|||||||
UNIT_POINT: Unit.Point,
|
UNIT_POINT: Unit.Point,
|
||||||
UNIT_PERCENT: Unit.Percent,
|
UNIT_PERCENT: Unit.Percent,
|
||||||
UNIT_AUTO: Unit.Auto,
|
UNIT_AUTO: Unit.Auto,
|
||||||
UNIT_MAX_CONTENT: Unit.MaxContent,
|
|
||||||
UNIT_FIT_CONTENT: Unit.FitContent,
|
|
||||||
UNIT_STRETCH: Unit.Stretch,
|
|
||||||
WRAP_NO_WRAP: Wrap.NoWrap,
|
WRAP_NO_WRAP: Wrap.NoWrap,
|
||||||
WRAP_WRAP: Wrap.Wrap,
|
WRAP_WRAP: Wrap.Wrap,
|
||||||
WRAP_WRAP_REVERSE: Wrap.WrapReverse,
|
WRAP_WRAP_REVERSE: Wrap.WrapReverse,
|
||||||
|
@@ -134,41 +134,17 @@ export type Node = {
|
|||||||
setDirection(direction: Direction): void;
|
setDirection(direction: Direction): void;
|
||||||
setDisplay(display: Display): void;
|
setDisplay(display: Display): void;
|
||||||
setFlex(flex: number | undefined): void;
|
setFlex(flex: number | undefined): void;
|
||||||
setFlexBasis(
|
setFlexBasis(flexBasis: number | 'auto' | `${number}%` | undefined): void;
|
||||||
flexBasis:
|
|
||||||
| number
|
|
||||||
| 'auto'
|
|
||||||
| 'fit-content'
|
|
||||||
| 'max-content'
|
|
||||||
| 'stretch'
|
|
||||||
| `${number}%`
|
|
||||||
| undefined,
|
|
||||||
): void;
|
|
||||||
setFlexBasisPercent(flexBasis: number | undefined): void;
|
setFlexBasisPercent(flexBasis: number | undefined): void;
|
||||||
setFlexBasisAuto(): void;
|
setFlexBasisAuto(): void;
|
||||||
setFlexBasisFitContent(): void;
|
|
||||||
setFlexBasisMaxContent(): void;
|
|
||||||
setFlexBasisStretch(): void;
|
|
||||||
setFlexDirection(flexDirection: FlexDirection): void;
|
setFlexDirection(flexDirection: FlexDirection): void;
|
||||||
setFlexGrow(flexGrow: number | undefined): void;
|
setFlexGrow(flexGrow: number | undefined): void;
|
||||||
setFlexShrink(flexShrink: number | undefined): void;
|
setFlexShrink(flexShrink: number | undefined): void;
|
||||||
setFlexWrap(flexWrap: Wrap): void;
|
setFlexWrap(flexWrap: Wrap): void;
|
||||||
setHeight(
|
setHeight(height: number | 'auto' | `${number}%` | undefined): void;
|
||||||
height:
|
|
||||||
| number
|
|
||||||
| 'auto'
|
|
||||||
| 'fit-content'
|
|
||||||
| 'max-content'
|
|
||||||
| 'stretch'
|
|
||||||
| `${number}%`
|
|
||||||
| undefined,
|
|
||||||
): void;
|
|
||||||
setIsReferenceBaseline(isReferenceBaseline: boolean): void;
|
setIsReferenceBaseline(isReferenceBaseline: boolean): void;
|
||||||
setHeightAuto(): void;
|
setHeightAuto(): void;
|
||||||
setHeightFitContent(): void;
|
|
||||||
setHeightMaxContent(): void;
|
|
||||||
setHeightPercent(height: number | undefined): void;
|
setHeightPercent(height: number | undefined): void;
|
||||||
setHeightStretch(): void;
|
|
||||||
setJustifyContent(justifyContent: Justify): void;
|
setJustifyContent(justifyContent: Justify): void;
|
||||||
setGap(gutter: Gutter, gapLength: number | `${number}%` | undefined): Value;
|
setGap(gutter: Gutter, gapLength: number | `${number}%` | undefined): Value;
|
||||||
setGapPercent(gutter: Gutter, gapLength: number | undefined): Value;
|
setGapPercent(gutter: Gutter, gapLength: number | undefined): Value;
|
||||||
@@ -178,60 +154,16 @@ export type Node = {
|
|||||||
): void;
|
): void;
|
||||||
setMarginAuto(edge: Edge): void;
|
setMarginAuto(edge: Edge): void;
|
||||||
setMarginPercent(edge: Edge, margin: number | undefined): void;
|
setMarginPercent(edge: Edge, margin: number | undefined): void;
|
||||||
setMaxHeight(
|
setMaxHeight(maxHeight: number | `${number}%` | undefined): void;
|
||||||
maxHeight:
|
|
||||||
| number
|
|
||||||
| 'fit-content'
|
|
||||||
| 'max-content'
|
|
||||||
| 'stretch'
|
|
||||||
| `${number}%`
|
|
||||||
| undefined,
|
|
||||||
): void;
|
|
||||||
setMaxHeightFitContent(): void;
|
|
||||||
setMaxHeightMaxContent(): void;
|
|
||||||
setMaxHeightPercent(maxHeight: number | undefined): void;
|
setMaxHeightPercent(maxHeight: number | undefined): void;
|
||||||
setMaxHeightStretch(): void;
|
setMaxWidth(maxWidth: number | `${number}%` | undefined): void;
|
||||||
setMaxWidth(
|
|
||||||
maxWidth:
|
|
||||||
| number
|
|
||||||
| 'fit-content'
|
|
||||||
| 'max-content'
|
|
||||||
| 'stretch'
|
|
||||||
| `${number}%`
|
|
||||||
| undefined,
|
|
||||||
): void;
|
|
||||||
setMaxWidthFitContent(): void;
|
|
||||||
setMaxWidthMaxContent(): void;
|
|
||||||
setMaxWidthPercent(maxWidth: number | undefined): void;
|
setMaxWidthPercent(maxWidth: number | undefined): void;
|
||||||
setMaxWidthStretch(): void;
|
|
||||||
setDirtiedFunc(dirtiedFunc: DirtiedFunction | null): void;
|
setDirtiedFunc(dirtiedFunc: DirtiedFunction | null): void;
|
||||||
setMeasureFunc(measureFunc: MeasureFunction | null): void;
|
setMeasureFunc(measureFunc: MeasureFunction | null): void;
|
||||||
setMinHeight(
|
setMinHeight(minHeight: number | `${number}%` | undefined): void;
|
||||||
minHeight:
|
|
||||||
| number
|
|
||||||
| 'fit-content'
|
|
||||||
| 'max-content'
|
|
||||||
| 'stretch'
|
|
||||||
| `${number}%`
|
|
||||||
| undefined,
|
|
||||||
): void;
|
|
||||||
setMinHeightFitContent(): void;
|
|
||||||
setMinHeightMaxContent(): void;
|
|
||||||
setMinHeightPercent(minHeight: number | undefined): void;
|
setMinHeightPercent(minHeight: number | undefined): void;
|
||||||
setMinHeightStretch(): void;
|
setMinWidth(minWidth: number | `${number}%` | undefined): void;
|
||||||
setMinWidth(
|
|
||||||
minWidth:
|
|
||||||
| number
|
|
||||||
| 'fit-content'
|
|
||||||
| 'max-content'
|
|
||||||
| 'stretch'
|
|
||||||
| `${number}%`
|
|
||||||
| undefined,
|
|
||||||
): void;
|
|
||||||
setMinWidthFitContent(): void;
|
|
||||||
setMinWidthMaxContent(): void;
|
|
||||||
setMinWidthPercent(minWidth: number | undefined): void;
|
setMinWidthPercent(minWidth: number | undefined): void;
|
||||||
setMinWidthStretch(): void;
|
|
||||||
setOverflow(overflow: Overflow): void;
|
setOverflow(overflow: Overflow): void;
|
||||||
setPadding(edge: Edge, padding: number | `${number}%` | undefined): void;
|
setPadding(edge: Edge, padding: number | `${number}%` | undefined): void;
|
||||||
setPaddingPercent(edge: Edge, padding: number | undefined): void;
|
setPaddingPercent(edge: Edge, padding: number | undefined): void;
|
||||||
@@ -240,21 +172,9 @@ export type Node = {
|
|||||||
setPositionType(positionType: PositionType): void;
|
setPositionType(positionType: PositionType): void;
|
||||||
setPositionAuto(edge: Edge): void;
|
setPositionAuto(edge: Edge): void;
|
||||||
setBoxSizing(boxSizing: BoxSizing): void;
|
setBoxSizing(boxSizing: BoxSizing): void;
|
||||||
setWidth(
|
setWidth(width: number | 'auto' | `${number}%` | undefined): void;
|
||||||
width:
|
|
||||||
| number
|
|
||||||
| 'auto'
|
|
||||||
| 'fit-content'
|
|
||||||
| 'max-content'
|
|
||||||
| 'stretch'
|
|
||||||
| `${number}%`
|
|
||||||
| undefined,
|
|
||||||
): void;
|
|
||||||
setWidthAuto(): void;
|
setWidthAuto(): void;
|
||||||
setWidthFitContent(): void;
|
|
||||||
setWidthMaxContent(): void;
|
|
||||||
setWidthPercent(width: number | undefined): void;
|
setWidthPercent(width: number | undefined): void;
|
||||||
setWidthStretch(): void;
|
|
||||||
unsetDirtiedFunc(): void;
|
unsetDirtiedFunc(): void;
|
||||||
unsetMeasureFunc(): void;
|
unsetMeasureFunc(): void;
|
||||||
setAlwaysFormsContainingBlock(alwaysFormsContainingBlock: boolean): void;
|
setAlwaysFormsContainingBlock(alwaysFormsContainingBlock: boolean): void;
|
||||||
@@ -300,9 +220,6 @@ export default function wrapAssembly(lib: any): Yoga {
|
|||||||
[Unit.Point]: lib.Node.prototype[fnName],
|
[Unit.Point]: lib.Node.prototype[fnName],
|
||||||
[Unit.Percent]: lib.Node.prototype[`${fnName}Percent`],
|
[Unit.Percent]: lib.Node.prototype[`${fnName}Percent`],
|
||||||
[Unit.Auto]: lib.Node.prototype[`${fnName}Auto`],
|
[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) {
|
patch(lib.Node.prototype, fnName, function (original, ...args) {
|
||||||
@@ -315,15 +232,6 @@ export default function wrapAssembly(lib: any): Yoga {
|
|||||||
if (value === 'auto') {
|
if (value === 'auto') {
|
||||||
unit = Unit.Auto;
|
unit = Unit.Auto;
|
||||||
asNumber = undefined;
|
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') {
|
} else if (typeof value === 'object') {
|
||||||
unit = value.unit;
|
unit = value.unit;
|
||||||
asNumber = value.valueOf();
|
asNumber = value.valueOf();
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -128,19 +128,4 @@ TEST(StyleValuePool, store_undefined_after_large_int) {
|
|||||||
EXPECT_EQ(pool.getLength(handle), StyleLength::undefined());
|
EXPECT_EQ(pool.getLength(handle), StyleLength::undefined());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(StyleValuePool, store_keywords) {
|
|
||||||
StyleValuePool pool;
|
|
||||||
StyleValueHandle handleMaxContent;
|
|
||||||
StyleValueHandle handleFitContent;
|
|
||||||
StyleValueHandle handleStretch;
|
|
||||||
|
|
||||||
pool.store(handleMaxContent, StyleSizeLength::ofMaxContent());
|
|
||||||
pool.store(handleFitContent, StyleSizeLength::ofFitContent());
|
|
||||||
pool.store(handleStretch, StyleSizeLength::ofStretch());
|
|
||||||
|
|
||||||
EXPECT_EQ(pool.getSize(handleMaxContent), StyleSizeLength::ofMaxContent());
|
|
||||||
EXPECT_EQ(pool.getSize(handleFitContent), StyleSizeLength::ofFitContent());
|
|
||||||
EXPECT_EQ(pool.getSize(handleStretch), StyleSizeLength::ofStretch());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace facebook::yoga
|
} // namespace facebook::yoga
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -27,7 +27,7 @@
|
|||||||
"react": "^18.3.0",
|
"react": "^18.3.0",
|
||||||
"react-dom": "^18.3.0",
|
"react-dom": "^18.3.0",
|
||||||
"react-live": "^4.1.5",
|
"react-live": "^4.1.5",
|
||||||
"yoga-layout": "0.0.0"
|
"yoga-layout": "3.2.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@docusaurus/module-type-aliases": "3.6.0",
|
"@docusaurus/module-type-aliases": "3.6.0",
|
||||||
|
@@ -245,12 +245,6 @@ const char* YGUnitToString(const YGUnit value) {
|
|||||||
return "percent";
|
return "percent";
|
||||||
case YGUnitAuto:
|
case YGUnitAuto:
|
||||||
return "auto";
|
return "auto";
|
||||||
case YGUnitMaxContent:
|
|
||||||
return "max-content";
|
|
||||||
case YGUnitFitContent:
|
|
||||||
return "fit-content";
|
|
||||||
case YGUnitStretch:
|
|
||||||
return "stretch";
|
|
||||||
}
|
}
|
||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
@@ -131,10 +131,7 @@ YG_ENUM_DECL(
|
|||||||
YGUnitUndefined,
|
YGUnitUndefined,
|
||||||
YGUnitPoint,
|
YGUnitPoint,
|
||||||
YGUnitPercent,
|
YGUnitPercent,
|
||||||
YGUnitAuto,
|
YGUnitAuto)
|
||||||
YGUnitMaxContent,
|
|
||||||
YGUnitFitContent,
|
|
||||||
YGUnitStretch)
|
|
||||||
|
|
||||||
YG_ENUM_DECL(
|
YG_ENUM_DECL(
|
||||||
YGWrap,
|
YGWrap,
|
||||||
|
@@ -177,34 +177,19 @@ float YGNodeStyleGetFlexShrink(const YGNodeConstRef nodeRef) {
|
|||||||
|
|
||||||
void YGNodeStyleSetFlexBasis(const YGNodeRef node, const float flexBasis) {
|
void YGNodeStyleSetFlexBasis(const YGNodeRef node, const float flexBasis) {
|
||||||
updateStyle<&Style::flexBasis, &Style::setFlexBasis>(
|
updateStyle<&Style::flexBasis, &Style::setFlexBasis>(
|
||||||
node, StyleSizeLength::points(flexBasis));
|
node, StyleLength::points(flexBasis));
|
||||||
}
|
}
|
||||||
|
|
||||||
void YGNodeStyleSetFlexBasisPercent(
|
void YGNodeStyleSetFlexBasisPercent(
|
||||||
const YGNodeRef node,
|
const YGNodeRef node,
|
||||||
const float flexBasisPercent) {
|
const float flexBasisPercent) {
|
||||||
updateStyle<&Style::flexBasis, &Style::setFlexBasis>(
|
updateStyle<&Style::flexBasis, &Style::setFlexBasis>(
|
||||||
node, StyleSizeLength::percent(flexBasisPercent));
|
node, StyleLength::percent(flexBasisPercent));
|
||||||
}
|
}
|
||||||
|
|
||||||
void YGNodeStyleSetFlexBasisAuto(const YGNodeRef node) {
|
void YGNodeStyleSetFlexBasisAuto(const YGNodeRef node) {
|
||||||
updateStyle<&Style::flexBasis, &Style::setFlexBasis>(
|
updateStyle<&Style::flexBasis, &Style::setFlexBasis>(
|
||||||
node, StyleSizeLength::ofAuto());
|
node, StyleLength::ofAuto());
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetFlexBasisMaxContent(const YGNodeRef node) {
|
|
||||||
updateStyle<&Style::flexBasis, &Style::setFlexBasis>(
|
|
||||||
node, StyleSizeLength::ofMaxContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetFlexBasisFitContent(const YGNodeRef node) {
|
|
||||||
updateStyle<&Style::flexBasis, &Style::setFlexBasis>(
|
|
||||||
node, StyleSizeLength::ofFitContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetFlexBasisStretch(const YGNodeRef node) {
|
|
||||||
updateStyle<&Style::flexBasis, &Style::setFlexBasis>(
|
|
||||||
node, StyleSizeLength::ofStretch());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
YGValue YGNodeStyleGetFlexBasis(const YGNodeConstRef node) {
|
YGValue YGNodeStyleGetFlexBasis(const YGNodeConstRef node) {
|
||||||
@@ -323,32 +308,17 @@ YGBoxSizing YGNodeStyleGetBoxSizing(const YGNodeConstRef node) {
|
|||||||
|
|
||||||
void YGNodeStyleSetWidth(YGNodeRef node, float points) {
|
void YGNodeStyleSetWidth(YGNodeRef node, float points) {
|
||||||
updateStyle<&Style::dimension, &Style::setDimension>(
|
updateStyle<&Style::dimension, &Style::setDimension>(
|
||||||
node, Dimension::Width, StyleSizeLength::points(points));
|
node, Dimension::Width, StyleLength::points(points));
|
||||||
}
|
}
|
||||||
|
|
||||||
void YGNodeStyleSetWidthPercent(YGNodeRef node, float percent) {
|
void YGNodeStyleSetWidthPercent(YGNodeRef node, float percent) {
|
||||||
updateStyle<&Style::dimension, &Style::setDimension>(
|
updateStyle<&Style::dimension, &Style::setDimension>(
|
||||||
node, Dimension::Width, StyleSizeLength::percent(percent));
|
node, Dimension::Width, StyleLength::percent(percent));
|
||||||
}
|
}
|
||||||
|
|
||||||
void YGNodeStyleSetWidthAuto(YGNodeRef node) {
|
void YGNodeStyleSetWidthAuto(YGNodeRef node) {
|
||||||
updateStyle<&Style::dimension, &Style::setDimension>(
|
updateStyle<&Style::dimension, &Style::setDimension>(
|
||||||
node, Dimension::Width, StyleSizeLength::ofAuto());
|
node, Dimension::Width, StyleLength::ofAuto());
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetWidthMaxContent(YGNodeRef node) {
|
|
||||||
updateStyle<&Style::dimension, &Style::setDimension>(
|
|
||||||
node, Dimension::Width, StyleSizeLength::ofMaxContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetWidthFitContent(YGNodeRef node) {
|
|
||||||
updateStyle<&Style::dimension, &Style::setDimension>(
|
|
||||||
node, Dimension::Width, StyleSizeLength::ofFitContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetWidthStretch(YGNodeRef node) {
|
|
||||||
updateStyle<&Style::dimension, &Style::setDimension>(
|
|
||||||
node, Dimension::Width, StyleSizeLength::ofStretch());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
YGValue YGNodeStyleGetWidth(YGNodeConstRef node) {
|
YGValue YGNodeStyleGetWidth(YGNodeConstRef node) {
|
||||||
@@ -357,32 +327,17 @@ YGValue YGNodeStyleGetWidth(YGNodeConstRef node) {
|
|||||||
|
|
||||||
void YGNodeStyleSetHeight(YGNodeRef node, float points) {
|
void YGNodeStyleSetHeight(YGNodeRef node, float points) {
|
||||||
updateStyle<&Style::dimension, &Style::setDimension>(
|
updateStyle<&Style::dimension, &Style::setDimension>(
|
||||||
node, Dimension::Height, StyleSizeLength::points(points));
|
node, Dimension::Height, StyleLength::points(points));
|
||||||
}
|
}
|
||||||
|
|
||||||
void YGNodeStyleSetHeightPercent(YGNodeRef node, float percent) {
|
void YGNodeStyleSetHeightPercent(YGNodeRef node, float percent) {
|
||||||
updateStyle<&Style::dimension, &Style::setDimension>(
|
updateStyle<&Style::dimension, &Style::setDimension>(
|
||||||
node, Dimension::Height, StyleSizeLength::percent(percent));
|
node, Dimension::Height, StyleLength::percent(percent));
|
||||||
}
|
}
|
||||||
|
|
||||||
void YGNodeStyleSetHeightAuto(YGNodeRef node) {
|
void YGNodeStyleSetHeightAuto(YGNodeRef node) {
|
||||||
updateStyle<&Style::dimension, &Style::setDimension>(
|
updateStyle<&Style::dimension, &Style::setDimension>(
|
||||||
node, Dimension::Height, StyleSizeLength::ofAuto());
|
node, Dimension::Height, StyleLength::ofAuto());
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetHeightMaxContent(YGNodeRef node) {
|
|
||||||
updateStyle<&Style::dimension, &Style::setDimension>(
|
|
||||||
node, Dimension::Height, StyleSizeLength::ofMaxContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetHeightFitContent(YGNodeRef node) {
|
|
||||||
updateStyle<&Style::dimension, &Style::setDimension>(
|
|
||||||
node, Dimension::Height, StyleSizeLength::ofFitContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetHeightStretch(YGNodeRef node) {
|
|
||||||
updateStyle<&Style::dimension, &Style::setDimension>(
|
|
||||||
node, Dimension::Height, StyleSizeLength::ofStretch());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
YGValue YGNodeStyleGetHeight(YGNodeConstRef node) {
|
YGValue YGNodeStyleGetHeight(YGNodeConstRef node) {
|
||||||
@@ -391,27 +346,12 @@ YGValue YGNodeStyleGetHeight(YGNodeConstRef node) {
|
|||||||
|
|
||||||
void YGNodeStyleSetMinWidth(const YGNodeRef node, const float minWidth) {
|
void YGNodeStyleSetMinWidth(const YGNodeRef node, const float minWidth) {
|
||||||
updateStyle<&Style::minDimension, &Style::setMinDimension>(
|
updateStyle<&Style::minDimension, &Style::setMinDimension>(
|
||||||
node, Dimension::Width, StyleSizeLength::points(minWidth));
|
node, Dimension::Width, StyleLength::points(minWidth));
|
||||||
}
|
}
|
||||||
|
|
||||||
void YGNodeStyleSetMinWidthPercent(const YGNodeRef node, const float minWidth) {
|
void YGNodeStyleSetMinWidthPercent(const YGNodeRef node, const float minWidth) {
|
||||||
updateStyle<&Style::minDimension, &Style::setMinDimension>(
|
updateStyle<&Style::minDimension, &Style::setMinDimension>(
|
||||||
node, Dimension::Width, StyleSizeLength::percent(minWidth));
|
node, Dimension::Width, StyleLength::percent(minWidth));
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetMinWidthMaxContent(const YGNodeRef node) {
|
|
||||||
updateStyle<&Style::minDimension, &Style::setMinDimension>(
|
|
||||||
node, Dimension::Width, StyleSizeLength::ofMaxContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetMinWidthFitContent(const YGNodeRef node) {
|
|
||||||
updateStyle<&Style::minDimension, &Style::setMinDimension>(
|
|
||||||
node, Dimension::Width, StyleSizeLength::ofFitContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetMinWidthStretch(const YGNodeRef node) {
|
|
||||||
updateStyle<&Style::minDimension, &Style::setMinDimension>(
|
|
||||||
node, Dimension::Width, StyleSizeLength::ofStretch());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
YGValue YGNodeStyleGetMinWidth(const YGNodeConstRef node) {
|
YGValue YGNodeStyleGetMinWidth(const YGNodeConstRef node) {
|
||||||
@@ -420,29 +360,14 @@ YGValue YGNodeStyleGetMinWidth(const YGNodeConstRef node) {
|
|||||||
|
|
||||||
void YGNodeStyleSetMinHeight(const YGNodeRef node, const float minHeight) {
|
void YGNodeStyleSetMinHeight(const YGNodeRef node, const float minHeight) {
|
||||||
updateStyle<&Style::minDimension, &Style::setMinDimension>(
|
updateStyle<&Style::minDimension, &Style::setMinDimension>(
|
||||||
node, Dimension::Height, StyleSizeLength::points(minHeight));
|
node, Dimension::Height, StyleLength::points(minHeight));
|
||||||
}
|
}
|
||||||
|
|
||||||
void YGNodeStyleSetMinHeightPercent(
|
void YGNodeStyleSetMinHeightPercent(
|
||||||
const YGNodeRef node,
|
const YGNodeRef node,
|
||||||
const float minHeight) {
|
const float minHeight) {
|
||||||
updateStyle<&Style::minDimension, &Style::setMinDimension>(
|
updateStyle<&Style::minDimension, &Style::setMinDimension>(
|
||||||
node, Dimension::Height, StyleSizeLength::percent(minHeight));
|
node, Dimension::Height, StyleLength::percent(minHeight));
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetMinHeightMaxContent(const YGNodeRef node) {
|
|
||||||
updateStyle<&Style::minDimension, &Style::setMinDimension>(
|
|
||||||
node, Dimension::Height, StyleSizeLength::ofMaxContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetMinHeightFitContent(const YGNodeRef node) {
|
|
||||||
updateStyle<&Style::minDimension, &Style::setMinDimension>(
|
|
||||||
node, Dimension::Height, StyleSizeLength::ofFitContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetMinHeightStretch(const YGNodeRef node) {
|
|
||||||
updateStyle<&Style::minDimension, &Style::setMinDimension>(
|
|
||||||
node, Dimension::Height, StyleSizeLength::ofStretch());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
YGValue YGNodeStyleGetMinHeight(const YGNodeConstRef node) {
|
YGValue YGNodeStyleGetMinHeight(const YGNodeConstRef node) {
|
||||||
@@ -451,27 +376,12 @@ YGValue YGNodeStyleGetMinHeight(const YGNodeConstRef node) {
|
|||||||
|
|
||||||
void YGNodeStyleSetMaxWidth(const YGNodeRef node, const float maxWidth) {
|
void YGNodeStyleSetMaxWidth(const YGNodeRef node, const float maxWidth) {
|
||||||
updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
|
updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
|
||||||
node, Dimension::Width, StyleSizeLength::points(maxWidth));
|
node, Dimension::Width, StyleLength::points(maxWidth));
|
||||||
}
|
}
|
||||||
|
|
||||||
void YGNodeStyleSetMaxWidthPercent(const YGNodeRef node, const float maxWidth) {
|
void YGNodeStyleSetMaxWidthPercent(const YGNodeRef node, const float maxWidth) {
|
||||||
updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
|
updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
|
||||||
node, Dimension::Width, StyleSizeLength::percent(maxWidth));
|
node, Dimension::Width, StyleLength::percent(maxWidth));
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetMaxWidthMaxContent(const YGNodeRef node) {
|
|
||||||
updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
|
|
||||||
node, Dimension::Width, StyleSizeLength::ofMaxContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetMaxWidthFitContent(const YGNodeRef node) {
|
|
||||||
updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
|
|
||||||
node, Dimension::Width, StyleSizeLength::ofFitContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetMaxWidthStretch(const YGNodeRef node) {
|
|
||||||
updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
|
|
||||||
node, Dimension::Width, StyleSizeLength::ofStretch());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
YGValue YGNodeStyleGetMaxWidth(const YGNodeConstRef node) {
|
YGValue YGNodeStyleGetMaxWidth(const YGNodeConstRef node) {
|
||||||
@@ -480,29 +390,14 @@ YGValue YGNodeStyleGetMaxWidth(const YGNodeConstRef node) {
|
|||||||
|
|
||||||
void YGNodeStyleSetMaxHeight(const YGNodeRef node, const float maxHeight) {
|
void YGNodeStyleSetMaxHeight(const YGNodeRef node, const float maxHeight) {
|
||||||
updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
|
updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
|
||||||
node, Dimension::Height, StyleSizeLength::points(maxHeight));
|
node, Dimension::Height, StyleLength::points(maxHeight));
|
||||||
}
|
}
|
||||||
|
|
||||||
void YGNodeStyleSetMaxHeightPercent(
|
void YGNodeStyleSetMaxHeightPercent(
|
||||||
const YGNodeRef node,
|
const YGNodeRef node,
|
||||||
const float maxHeight) {
|
const float maxHeight) {
|
||||||
updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
|
updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
|
||||||
node, Dimension::Height, StyleSizeLength::percent(maxHeight));
|
node, Dimension::Height, StyleLength::percent(maxHeight));
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetMaxHeightMaxContent(const YGNodeRef node) {
|
|
||||||
updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
|
|
||||||
node, Dimension::Height, StyleSizeLength::ofMaxContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetMaxHeightFitContent(const YGNodeRef node) {
|
|
||||||
updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
|
|
||||||
node, Dimension::Height, StyleSizeLength::ofFitContent());
|
|
||||||
}
|
|
||||||
|
|
||||||
void YGNodeStyleSetMaxHeightStretch(const YGNodeRef node) {
|
|
||||||
updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
|
|
||||||
node, Dimension::Height, StyleSizeLength::ofStretch());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
YGValue YGNodeStyleGetMaxHeight(const YGNodeConstRef node) {
|
YGValue YGNodeStyleGetMaxHeight(const YGNodeConstRef node) {
|
||||||
|
@@ -64,9 +64,6 @@ YG_EXPORT float YGNodeStyleGetFlexShrink(YGNodeConstRef node);
|
|||||||
YG_EXPORT void YGNodeStyleSetFlexBasis(YGNodeRef node, float flexBasis);
|
YG_EXPORT void YGNodeStyleSetFlexBasis(YGNodeRef node, float flexBasis);
|
||||||
YG_EXPORT void YGNodeStyleSetFlexBasisPercent(YGNodeRef node, float flexBasis);
|
YG_EXPORT void YGNodeStyleSetFlexBasisPercent(YGNodeRef node, float flexBasis);
|
||||||
YG_EXPORT void YGNodeStyleSetFlexBasisAuto(YGNodeRef node);
|
YG_EXPORT void YGNodeStyleSetFlexBasisAuto(YGNodeRef node);
|
||||||
YG_EXPORT void YGNodeStyleSetFlexBasisMaxContent(YGNodeRef node);
|
|
||||||
YG_EXPORT void YGNodeStyleSetFlexBasisFitContent(YGNodeRef node);
|
|
||||||
YG_EXPORT void YGNodeStyleSetFlexBasisStretch(YGNodeRef node);
|
|
||||||
YG_EXPORT YGValue YGNodeStyleGetFlexBasis(YGNodeConstRef node);
|
YG_EXPORT YGValue YGNodeStyleGetFlexBasis(YGNodeConstRef node);
|
||||||
|
|
||||||
YG_EXPORT void
|
YG_EXPORT void
|
||||||
@@ -104,45 +101,27 @@ YG_EXPORT YGBoxSizing YGNodeStyleGetBoxSizing(YGNodeConstRef node);
|
|||||||
YG_EXPORT void YGNodeStyleSetWidth(YGNodeRef node, float width);
|
YG_EXPORT void YGNodeStyleSetWidth(YGNodeRef node, float width);
|
||||||
YG_EXPORT void YGNodeStyleSetWidthPercent(YGNodeRef node, float width);
|
YG_EXPORT void YGNodeStyleSetWidthPercent(YGNodeRef node, float width);
|
||||||
YG_EXPORT void YGNodeStyleSetWidthAuto(YGNodeRef node);
|
YG_EXPORT void YGNodeStyleSetWidthAuto(YGNodeRef node);
|
||||||
YG_EXPORT void YGNodeStyleSetWidthMaxContent(YGNodeRef node);
|
|
||||||
YG_EXPORT void YGNodeStyleSetWidthFitContent(YGNodeRef node);
|
|
||||||
YG_EXPORT void YGNodeStyleSetWidthStretch(YGNodeRef node);
|
|
||||||
YG_EXPORT YGValue YGNodeStyleGetWidth(YGNodeConstRef node);
|
YG_EXPORT YGValue YGNodeStyleGetWidth(YGNodeConstRef node);
|
||||||
|
|
||||||
YG_EXPORT void YGNodeStyleSetHeight(YGNodeRef node, float height);
|
YG_EXPORT void YGNodeStyleSetHeight(YGNodeRef node, float height);
|
||||||
YG_EXPORT void YGNodeStyleSetHeightPercent(YGNodeRef node, float height);
|
YG_EXPORT void YGNodeStyleSetHeightPercent(YGNodeRef node, float height);
|
||||||
YG_EXPORT void YGNodeStyleSetHeightAuto(YGNodeRef node);
|
YG_EXPORT void YGNodeStyleSetHeightAuto(YGNodeRef node);
|
||||||
YG_EXPORT void YGNodeStyleSetHeightMaxContent(YGNodeRef node);
|
|
||||||
YG_EXPORT void YGNodeStyleSetHeightFitContent(YGNodeRef node);
|
|
||||||
YG_EXPORT void YGNodeStyleSetHeightStretch(YGNodeRef node);
|
|
||||||
YG_EXPORT YGValue YGNodeStyleGetHeight(YGNodeConstRef node);
|
YG_EXPORT YGValue YGNodeStyleGetHeight(YGNodeConstRef node);
|
||||||
|
|
||||||
YG_EXPORT void YGNodeStyleSetMinWidth(YGNodeRef node, float minWidth);
|
YG_EXPORT void YGNodeStyleSetMinWidth(YGNodeRef node, float minWidth);
|
||||||
YG_EXPORT void YGNodeStyleSetMinWidthPercent(YGNodeRef node, float minWidth);
|
YG_EXPORT void YGNodeStyleSetMinWidthPercent(YGNodeRef node, float minWidth);
|
||||||
YG_EXPORT void YGNodeStyleSetMinWidthMaxContent(YGNodeRef node);
|
|
||||||
YG_EXPORT void YGNodeStyleSetMinWidthFitContent(YGNodeRef node);
|
|
||||||
YG_EXPORT void YGNodeStyleSetMinWidthStretch(YGNodeRef node);
|
|
||||||
YG_EXPORT YGValue YGNodeStyleGetMinWidth(YGNodeConstRef node);
|
YG_EXPORT YGValue YGNodeStyleGetMinWidth(YGNodeConstRef node);
|
||||||
|
|
||||||
YG_EXPORT void YGNodeStyleSetMinHeight(YGNodeRef node, float minHeight);
|
YG_EXPORT void YGNodeStyleSetMinHeight(YGNodeRef node, float minHeight);
|
||||||
YG_EXPORT void YGNodeStyleSetMinHeightPercent(YGNodeRef node, float minHeight);
|
YG_EXPORT void YGNodeStyleSetMinHeightPercent(YGNodeRef node, float minHeight);
|
||||||
YG_EXPORT void YGNodeStyleSetMinHeightMaxContent(YGNodeRef node);
|
|
||||||
YG_EXPORT void YGNodeStyleSetMinHeightFitContent(YGNodeRef node);
|
|
||||||
YG_EXPORT void YGNodeStyleSetMinHeightStretch(YGNodeRef node);
|
|
||||||
YG_EXPORT YGValue YGNodeStyleGetMinHeight(YGNodeConstRef node);
|
YG_EXPORT YGValue YGNodeStyleGetMinHeight(YGNodeConstRef node);
|
||||||
|
|
||||||
YG_EXPORT void YGNodeStyleSetMaxWidth(YGNodeRef node, float maxWidth);
|
YG_EXPORT void YGNodeStyleSetMaxWidth(YGNodeRef node, float maxWidth);
|
||||||
YG_EXPORT void YGNodeStyleSetMaxWidthPercent(YGNodeRef node, float maxWidth);
|
YG_EXPORT void YGNodeStyleSetMaxWidthPercent(YGNodeRef node, float maxWidth);
|
||||||
YG_EXPORT void YGNodeStyleSetMaxWidthMaxContent(YGNodeRef node);
|
|
||||||
YG_EXPORT void YGNodeStyleSetMaxWidthFitContent(YGNodeRef node);
|
|
||||||
YG_EXPORT void YGNodeStyleSetMaxWidthStretch(YGNodeRef node);
|
|
||||||
YG_EXPORT YGValue YGNodeStyleGetMaxWidth(YGNodeConstRef node);
|
YG_EXPORT YGValue YGNodeStyleGetMaxWidth(YGNodeConstRef node);
|
||||||
|
|
||||||
YG_EXPORT void YGNodeStyleSetMaxHeight(YGNodeRef node, float maxHeight);
|
YG_EXPORT void YGNodeStyleSetMaxHeight(YGNodeRef node, float maxHeight);
|
||||||
YG_EXPORT void YGNodeStyleSetMaxHeightPercent(YGNodeRef node, float maxHeight);
|
YG_EXPORT void YGNodeStyleSetMaxHeightPercent(YGNodeRef node, float maxHeight);
|
||||||
YG_EXPORT void YGNodeStyleSetMaxHeightMaxContent(YGNodeRef node);
|
|
||||||
YG_EXPORT void YGNodeStyleSetMaxHeightFitContent(YGNodeRef node);
|
|
||||||
YG_EXPORT void YGNodeStyleSetMaxHeightStretch(YGNodeRef node);
|
|
||||||
YG_EXPORT YGValue YGNodeStyleGetMaxHeight(YGNodeConstRef node);
|
YG_EXPORT YGValue YGNodeStyleGetMaxHeight(YGNodeConstRef node);
|
||||||
|
|
||||||
YG_EXPORT void YGNodeStyleSetAspectRatio(YGNodeRef node, float aspectRatio);
|
YG_EXPORT void YGNodeStyleSetAspectRatio(YGNodeRef node, float aspectRatio);
|
||||||
|
@@ -65,9 +65,6 @@ inline bool operator==(const YGValue& lhs, const YGValue& rhs) {
|
|||||||
switch (lhs.unit) {
|
switch (lhs.unit) {
|
||||||
case YGUnitUndefined:
|
case YGUnitUndefined:
|
||||||
case YGUnitAuto:
|
case YGUnitAuto:
|
||||||
case YGUnitFitContent:
|
|
||||||
case YGUnitMaxContent:
|
|
||||||
case YGUnitStretch:
|
|
||||||
return true;
|
return true;
|
||||||
case YGUnitPoint:
|
case YGUnitPoint:
|
||||||
case YGUnitPercent:
|
case YGUnitPercent:
|
||||||
|
@@ -741,7 +741,7 @@ static float distributeFreeSpaceSecondPass(
|
|||||||
marginCross;
|
marginCross;
|
||||||
const bool isLoosePercentageMeasurement =
|
const bool isLoosePercentageMeasurement =
|
||||||
currentLineChild->getProcessedDimension(dimension(crossAxis))
|
currentLineChild->getProcessedDimension(dimension(crossAxis))
|
||||||
.isPercent() &&
|
.unit() == Unit::Percent &&
|
||||||
sizingModeCrossDim != SizingMode::StretchFit;
|
sizingModeCrossDim != SizingMode::StretchFit;
|
||||||
childCrossSizingMode =
|
childCrossSizingMode =
|
||||||
yoga::isUndefined(childCrossSize) || isLoosePercentageMeasurement
|
yoga::isUndefined(childCrossSize) || isLoosePercentageMeasurement
|
||||||
|
@@ -20,14 +20,11 @@ enum class Unit : uint8_t {
|
|||||||
Point = YGUnitPoint,
|
Point = YGUnitPoint,
|
||||||
Percent = YGUnitPercent,
|
Percent = YGUnitPercent,
|
||||||
Auto = YGUnitAuto,
|
Auto = YGUnitAuto,
|
||||||
MaxContent = YGUnitMaxContent,
|
|
||||||
FitContent = YGUnitFitContent,
|
|
||||||
Stretch = YGUnitStretch,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
constexpr int32_t ordinalCount<Unit>() {
|
constexpr int32_t ordinalCount<Unit>() {
|
||||||
return 7;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr Unit scopedEnum(YGUnit unscoped) {
|
constexpr Unit scopedEnum(YGUnit unscoped) {
|
||||||
|
@@ -314,16 +314,16 @@ void Node::setPosition(
|
|||||||
crossAxisTrailingEdge);
|
crossAxisTrailingEdge);
|
||||||
}
|
}
|
||||||
|
|
||||||
Style::SizeLength Node::processFlexBasis() const {
|
Style::Length Node::processFlexBasis() const {
|
||||||
Style::SizeLength flexBasis = style_.flexBasis();
|
Style::Length flexBasis = style_.flexBasis();
|
||||||
if (!flexBasis.isAuto() && !flexBasis.isUndefined()) {
|
if (flexBasis.unit() != Unit::Auto && flexBasis.unit() != Unit::Undefined) {
|
||||||
return flexBasis;
|
return flexBasis;
|
||||||
}
|
}
|
||||||
if (style_.flex().isDefined() && style_.flex().unwrap() > 0.0f) {
|
if (style_.flex().isDefined() && style_.flex().unwrap() > 0.0f) {
|
||||||
return config_->useWebDefaults() ? StyleSizeLength::ofAuto()
|
return config_->useWebDefaults() ? StyleLength::ofAuto()
|
||||||
: StyleSizeLength::points(0);
|
: StyleLength::points(0);
|
||||||
}
|
}
|
||||||
return StyleSizeLength::ofAuto();
|
return StyleLength::ofAuto();
|
||||||
}
|
}
|
||||||
|
|
||||||
FloatOptional Node::resolveFlexBasis(
|
FloatOptional Node::resolveFlexBasis(
|
||||||
|
@@ -172,7 +172,7 @@ class YG_EXPORT Node : public ::YGNode {
|
|||||||
return isDirty_;
|
return isDirty_;
|
||||||
}
|
}
|
||||||
|
|
||||||
Style::SizeLength getProcessedDimension(Dimension dimension) const {
|
Style::Length getProcessedDimension(Dimension dimension) const {
|
||||||
return processedDimensions_[static_cast<size_t>(dimension)];
|
return processedDimensions_[static_cast<size_t>(dimension)];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,7 +268,7 @@ class YG_EXPORT Node : public ::YGNode {
|
|||||||
void setPosition(Direction direction, float ownerWidth, float ownerHeight);
|
void setPosition(Direction direction, float ownerWidth, float ownerHeight);
|
||||||
|
|
||||||
// Other methods
|
// Other methods
|
||||||
Style::SizeLength processFlexBasis() const;
|
Style::Length processFlexBasis() const;
|
||||||
FloatOptional resolveFlexBasis(
|
FloatOptional resolveFlexBasis(
|
||||||
Direction direction,
|
Direction direction,
|
||||||
FlexDirection flexDirection,
|
FlexDirection flexDirection,
|
||||||
@@ -322,8 +322,8 @@ class YG_EXPORT Node : public ::YGNode {
|
|||||||
Node* owner_ = nullptr;
|
Node* owner_ = nullptr;
|
||||||
std::vector<Node*> children_;
|
std::vector<Node*> children_;
|
||||||
const Config* config_;
|
const Config* config_;
|
||||||
std::array<Style::SizeLength, 2> processedDimensions_{
|
std::array<Style::Length, 2> processedDimensions_{
|
||||||
{StyleSizeLength::undefined(), StyleSizeLength::undefined()}};
|
{StyleLength::undefined(), StyleLength::undefined()}};
|
||||||
};
|
};
|
||||||
|
|
||||||
inline Node* resolveRef(const YGNodeRef ref) {
|
inline Node* resolveRef(const YGNodeRef ref) {
|
||||||
|
@@ -30,7 +30,6 @@
|
|||||||
#include <yoga/enums/Wrap.h>
|
#include <yoga/enums/Wrap.h>
|
||||||
#include <yoga/numeric/FloatOptional.h>
|
#include <yoga/numeric/FloatOptional.h>
|
||||||
#include <yoga/style/StyleLength.h>
|
#include <yoga/style/StyleLength.h>
|
||||||
#include <yoga/style/StyleSizeLength.h>
|
|
||||||
#include <yoga/style/StyleValuePool.h>
|
#include <yoga/style/StyleValuePool.h>
|
||||||
|
|
||||||
namespace facebook::yoga {
|
namespace facebook::yoga {
|
||||||
@@ -38,7 +37,6 @@ namespace facebook::yoga {
|
|||||||
class YG_EXPORT Style {
|
class YG_EXPORT Style {
|
||||||
public:
|
public:
|
||||||
using Length = StyleLength;
|
using Length = StyleLength;
|
||||||
using SizeLength = StyleSizeLength;
|
|
||||||
|
|
||||||
static constexpr float DefaultFlexGrow = 0.0f;
|
static constexpr float DefaultFlexGrow = 0.0f;
|
||||||
static constexpr float DefaultFlexShrink = 0.0f;
|
static constexpr float DefaultFlexShrink = 0.0f;
|
||||||
@@ -135,10 +133,10 @@ class YG_EXPORT Style {
|
|||||||
pool_.store(flexShrink_, value);
|
pool_.store(flexShrink_, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Style::SizeLength flexBasis() const {
|
Style::Length flexBasis() const {
|
||||||
return pool_.getSize(flexBasis_);
|
return pool_.getLength(flexBasis_);
|
||||||
}
|
}
|
||||||
void setFlexBasis(Style::SizeLength value) {
|
void setFlexBasis(Style::Length value) {
|
||||||
pool_.store(flexBasis_, value);
|
pool_.store(flexBasis_, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,17 +175,17 @@ class YG_EXPORT Style {
|
|||||||
pool_.store(gap_[yoga::to_underlying(gutter)], value);
|
pool_.store(gap_[yoga::to_underlying(gutter)], value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Style::SizeLength dimension(Dimension axis) const {
|
Style::Length dimension(Dimension axis) const {
|
||||||
return pool_.getSize(dimensions_[yoga::to_underlying(axis)]);
|
return pool_.getLength(dimensions_[yoga::to_underlying(axis)]);
|
||||||
}
|
}
|
||||||
void setDimension(Dimension axis, Style::SizeLength value) {
|
void setDimension(Dimension axis, Style::Length value) {
|
||||||
pool_.store(dimensions_[yoga::to_underlying(axis)], value);
|
pool_.store(dimensions_[yoga::to_underlying(axis)], value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Style::SizeLength minDimension(Dimension axis) const {
|
Style::Length minDimension(Dimension axis) const {
|
||||||
return pool_.getSize(minDimensions_[yoga::to_underlying(axis)]);
|
return pool_.getLength(minDimensions_[yoga::to_underlying(axis)]);
|
||||||
}
|
}
|
||||||
void setMinDimension(Dimension axis, Style::SizeLength value) {
|
void setMinDimension(Dimension axis, Style::Length value) {
|
||||||
pool_.store(minDimensions_[yoga::to_underlying(axis)], value);
|
pool_.store(minDimensions_[yoga::to_underlying(axis)], value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,10 +207,10 @@ class YG_EXPORT Style {
|
|||||||
: FloatOptional{0.0});
|
: FloatOptional{0.0});
|
||||||
}
|
}
|
||||||
|
|
||||||
Style::SizeLength maxDimension(Dimension axis) const {
|
Style::Length maxDimension(Dimension axis) const {
|
||||||
return pool_.getSize(maxDimensions_[yoga::to_underlying(axis)]);
|
return pool_.getLength(maxDimensions_[yoga::to_underlying(axis)]);
|
||||||
}
|
}
|
||||||
void setMaxDimension(Dimension axis, Style::SizeLength value) {
|
void setMaxDimension(Dimension axis, Style::Length value) {
|
||||||
pool_.store(maxDimensions_[yoga::to_underlying(axis)], value);
|
pool_.store(maxDimensions_[yoga::to_underlying(axis)], value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,11 +19,13 @@ namespace facebook::yoga {
|
|||||||
* 3. A CSS <length-percentage> value:
|
* 3. A CSS <length-percentage> value:
|
||||||
* a. <length> value (e.g. 10px)
|
* a. <length> value (e.g. 10px)
|
||||||
* b. <percentage> value of a reference <length>
|
* b. <percentage> value of a reference <length>
|
||||||
|
* 4. (soon) A math function which returns a <length-percentage> value
|
||||||
*
|
*
|
||||||
* References:
|
* References:
|
||||||
* 1. https://www.w3.org/TR/css-values-4/#lengths
|
* 1. https://www.w3.org/TR/css-values-4/#lengths
|
||||||
* 2. https://www.w3.org/TR/css-values-4/#percentage-value
|
* 2. https://www.w3.org/TR/css-values-4/#percentage-value
|
||||||
* 3. https://www.w3.org/TR/css-values-4/#mixed-percentages
|
* 3. https://www.w3.org/TR/css-values-4/#mixed-percentages
|
||||||
|
* 4. https://www.w3.org/TR/css-values-4/#math
|
||||||
*/
|
*/
|
||||||
class StyleLength {
|
class StyleLength {
|
||||||
public:
|
public:
|
||||||
@@ -57,14 +59,6 @@ class StyleLength {
|
|||||||
return unit_ == Unit::Undefined;
|
return unit_ == Unit::Undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool isPoints() const {
|
|
||||||
return unit_ == Unit::Point;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool isPercent() const {
|
|
||||||
return unit_ == Unit::Percent;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool isDefined() const {
|
constexpr bool isDefined() const {
|
||||||
return !isUndefined();
|
return !isUndefined();
|
||||||
}
|
}
|
||||||
@@ -73,6 +67,10 @@ class StyleLength {
|
|||||||
return value_;
|
return value_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr Unit unit() const {
|
||||||
|
return unit_;
|
||||||
|
}
|
||||||
|
|
||||||
constexpr FloatOptional resolve(float referenceLength) {
|
constexpr FloatOptional resolve(float referenceLength) {
|
||||||
switch (unit_) {
|
switch (unit_) {
|
||||||
case Unit::Point:
|
case Unit::Point:
|
||||||
@@ -92,11 +90,6 @@ class StyleLength {
|
|||||||
return value_ == rhs.value_ && unit_ == rhs.unit_;
|
return value_ == rhs.value_ && unit_ == rhs.unit_;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr bool inexactEquals(const StyleLength& other) const {
|
|
||||||
return unit_ == other.unit_ &&
|
|
||||||
facebook::yoga::inexactEquals(value_, other.value_);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// We intentionally do not allow direct construction using value and unit, to
|
// We intentionally do not allow direct construction using value and unit, to
|
||||||
// avoid invalid, or redundant combinations.
|
// avoid invalid, or redundant combinations.
|
||||||
@@ -108,7 +101,7 @@ class StyleLength {
|
|||||||
};
|
};
|
||||||
|
|
||||||
inline bool inexactEquals(const StyleLength& a, const StyleLength& b) {
|
inline bool inexactEquals(const StyleLength& a, const StyleLength& b) {
|
||||||
return a.inexactEquals(b);
|
return a.unit() == b.unit() && inexactEquals(a.value(), b.value());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace facebook::yoga
|
} // namespace facebook::yoga
|
||||||
|
@@ -1,139 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <yoga/enums/Unit.h>
|
|
||||||
#include <yoga/numeric/FloatOptional.h>
|
|
||||||
|
|
||||||
namespace facebook::yoga {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class represents a CSS Value for sizes (e.g. width, height, min-width,
|
|
||||||
* etc.). It may be one of:
|
|
||||||
* 1. Undefined
|
|
||||||
* 2. A keyword (e.g. auto, max-content, stretch, etc.)
|
|
||||||
* 3. A CSS <length-percentage> value:
|
|
||||||
* a. <length> value (e.g. 10px)
|
|
||||||
* b. <percentage> value of a reference <length>
|
|
||||||
*
|
|
||||||
* References:
|
|
||||||
* 1. https://www.w3.org/TR/css-values-4/#lengths
|
|
||||||
* 2. https://www.w3.org/TR/css-values-4/#percentage-value
|
|
||||||
* 3. https://www.w3.org/TR/css-values-4/#mixed-percentages
|
|
||||||
*/
|
|
||||||
class StyleSizeLength {
|
|
||||||
public:
|
|
||||||
constexpr StyleSizeLength() = default;
|
|
||||||
|
|
||||||
constexpr static StyleSizeLength points(float value) {
|
|
||||||
return yoga::isUndefined(value) || yoga::isinf(value)
|
|
||||||
? undefined()
|
|
||||||
: StyleSizeLength{FloatOptional{value}, Unit::Point};
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr static StyleSizeLength percent(float value) {
|
|
||||||
return yoga::isUndefined(value) || yoga::isinf(value)
|
|
||||||
? undefined()
|
|
||||||
: StyleSizeLength{FloatOptional{value}, Unit::Percent};
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr static StyleSizeLength ofAuto() {
|
|
||||||
return StyleSizeLength{{}, Unit::Auto};
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr static StyleSizeLength ofMaxContent() {
|
|
||||||
return StyleSizeLength{{}, Unit::MaxContent};
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr static StyleSizeLength ofFitContent() {
|
|
||||||
return StyleSizeLength{{}, Unit::FitContent};
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr static StyleSizeLength ofStretch() {
|
|
||||||
return StyleSizeLength{{}, Unit::Stretch};
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr static StyleSizeLength undefined() {
|
|
||||||
return StyleSizeLength{{}, Unit::Undefined};
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool isAuto() const {
|
|
||||||
return unit_ == Unit::Auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool isMaxContent() const {
|
|
||||||
return unit_ == Unit::MaxContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool isFitContent() const {
|
|
||||||
return unit_ == Unit::FitContent;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool isStretch() const {
|
|
||||||
return unit_ == Unit::Stretch;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool isUndefined() const {
|
|
||||||
return unit_ == Unit::Undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool isDefined() const {
|
|
||||||
return !isUndefined();
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool isPoints() const {
|
|
||||||
return unit_ == Unit::Point;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool isPercent() const {
|
|
||||||
return unit_ == Unit::Percent;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr FloatOptional value() const {
|
|
||||||
return value_;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr FloatOptional resolve(float referenceLength) {
|
|
||||||
switch (unit_) {
|
|
||||||
case Unit::Point:
|
|
||||||
return value_;
|
|
||||||
case Unit::Percent:
|
|
||||||
return FloatOptional{value_.unwrap() * referenceLength * 0.01f};
|
|
||||||
default:
|
|
||||||
return FloatOptional{};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit constexpr operator YGValue() const {
|
|
||||||
return YGValue{value_.unwrap(), unscopedEnum(unit_)};
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool operator==(const StyleSizeLength& rhs) const {
|
|
||||||
return value_ == rhs.value_ && unit_ == rhs.unit_;
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool inexactEquals(const StyleSizeLength& other) const {
|
|
||||||
return unit_ == other.unit_ &&
|
|
||||||
facebook::yoga::inexactEquals(value_, other.value_);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
// We intentionally do not allow direct construction using value and unit, to
|
|
||||||
// avoid invalid, or redundant combinations.
|
|
||||||
constexpr StyleSizeLength(FloatOptional value, Unit unit)
|
|
||||||
: value_(value), unit_(unit) {}
|
|
||||||
|
|
||||||
FloatOptional value_{};
|
|
||||||
Unit unit_{Unit::Undefined};
|
|
||||||
};
|
|
||||||
|
|
||||||
inline bool inexactEquals(const StyleSizeLength& a, const StyleSizeLength& b) {
|
|
||||||
return a.inexactEquals(b);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace facebook::yoga
|
|
@@ -62,16 +62,8 @@ class StyleValueHandle {
|
|||||||
Percent,
|
Percent,
|
||||||
Number,
|
Number,
|
||||||
Auto,
|
Auto,
|
||||||
Keyword
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Intentionally leaving out auto as a fast path
|
|
||||||
enum class Keyword : uint8_t { MaxContent, FitContent, Stretch };
|
|
||||||
|
|
||||||
constexpr bool isKeyword(Keyword keyword) const {
|
|
||||||
return type() == Type::Keyword && value() == static_cast<uint16_t>(keyword);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr Type type() const {
|
constexpr Type type() const {
|
||||||
return static_cast<Type>(repr_ & kHandleTypeMask);
|
return static_cast<Type>(repr_ & kHandleTypeMask);
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,6 @@
|
|||||||
#include <yoga/numeric/FloatOptional.h>
|
#include <yoga/numeric/FloatOptional.h>
|
||||||
#include <yoga/style/SmallValueBuffer.h>
|
#include <yoga/style/SmallValueBuffer.h>
|
||||||
#include <yoga/style/StyleLength.h>
|
#include <yoga/style/StyleLength.h>
|
||||||
#include <yoga/style/StyleSizeLength.h>
|
|
||||||
#include <yoga/style/StyleValueHandle.h>
|
#include <yoga/style/StyleValueHandle.h>
|
||||||
|
|
||||||
namespace facebook::yoga {
|
namespace facebook::yoga {
|
||||||
@@ -33,30 +32,13 @@ class StyleValuePool {
|
|||||||
} else if (length.isAuto()) {
|
} else if (length.isAuto()) {
|
||||||
handle.setType(StyleValueHandle::Type::Auto);
|
handle.setType(StyleValueHandle::Type::Auto);
|
||||||
} else {
|
} else {
|
||||||
auto type = length.isPoints() ? StyleValueHandle::Type::Point
|
auto type = length.unit() == Unit::Point
|
||||||
|
? StyleValueHandle::Type::Point
|
||||||
: StyleValueHandle::Type::Percent;
|
: StyleValueHandle::Type::Percent;
|
||||||
storeValue(handle, length.value().unwrap(), type);
|
storeValue(handle, length.value().unwrap(), type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void store(StyleValueHandle& handle, StyleSizeLength sizeValue) {
|
|
||||||
if (sizeValue.isUndefined()) {
|
|
||||||
handle.setType(StyleValueHandle::Type::Undefined);
|
|
||||||
} else if (sizeValue.isAuto()) {
|
|
||||||
handle.setType(StyleValueHandle::Type::Auto);
|
|
||||||
} else if (sizeValue.isMaxContent()) {
|
|
||||||
storeKeyword(handle, StyleValueHandle::Keyword::MaxContent);
|
|
||||||
} else if (sizeValue.isStretch()) {
|
|
||||||
storeKeyword(handle, StyleValueHandle::Keyword::Stretch);
|
|
||||||
} else if (sizeValue.isFitContent()) {
|
|
||||||
storeKeyword(handle, StyleValueHandle::Keyword::FitContent);
|
|
||||||
} else {
|
|
||||||
auto type = sizeValue.isPoints() ? StyleValueHandle::Type::Point
|
|
||||||
: StyleValueHandle::Type::Percent;
|
|
||||||
storeValue(handle, sizeValue.value().unwrap(), type);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void store(StyleValueHandle& handle, FloatOptional number) {
|
void store(StyleValueHandle& handle, FloatOptional number) {
|
||||||
if (number.isUndefined()) {
|
if (number.isUndefined()) {
|
||||||
handle.setType(StyleValueHandle::Type::Undefined);
|
handle.setType(StyleValueHandle::Type::Undefined);
|
||||||
@@ -84,31 +66,6 @@ class StyleValuePool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StyleSizeLength getSize(StyleValueHandle handle) const {
|
|
||||||
if (handle.isUndefined()) {
|
|
||||||
return StyleSizeLength::undefined();
|
|
||||||
} else if (handle.isAuto()) {
|
|
||||||
return StyleSizeLength::ofAuto();
|
|
||||||
} else if (handle.isKeyword(StyleValueHandle::Keyword::MaxContent)) {
|
|
||||||
return StyleSizeLength::ofMaxContent();
|
|
||||||
} else if (handle.isKeyword(StyleValueHandle::Keyword::FitContent)) {
|
|
||||||
return StyleSizeLength::ofFitContent();
|
|
||||||
} else if (handle.isKeyword(StyleValueHandle::Keyword::Stretch)) {
|
|
||||||
return StyleSizeLength::ofStretch();
|
|
||||||
} else {
|
|
||||||
assert(
|
|
||||||
handle.type() == StyleValueHandle::Type::Point ||
|
|
||||||
handle.type() == StyleValueHandle::Type::Percent);
|
|
||||||
float value = (handle.isValueIndexed())
|
|
||||||
? std::bit_cast<float>(buffer_.get32(handle.value()))
|
|
||||||
: unpackInlineInteger(handle.value());
|
|
||||||
|
|
||||||
return handle.type() == StyleValueHandle::Type::Point
|
|
||||||
? StyleSizeLength::points(value)
|
|
||||||
: StyleSizeLength::percent(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FloatOptional getNumber(StyleValueHandle handle) const {
|
FloatOptional getNumber(StyleValueHandle handle) const {
|
||||||
if (handle.isUndefined()) {
|
if (handle.isUndefined()) {
|
||||||
return FloatOptional{};
|
return FloatOptional{};
|
||||||
@@ -141,20 +98,6 @@ class StyleValuePool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void storeKeyword(
|
|
||||||
StyleValueHandle& handle,
|
|
||||||
StyleValueHandle::Keyword keyword) {
|
|
||||||
handle.setType(StyleValueHandle::Type::Keyword);
|
|
||||||
|
|
||||||
if (handle.isValueIndexed()) {
|
|
||||||
auto newIndex =
|
|
||||||
buffer_.replace(handle.value(), static_cast<uint32_t>(keyword));
|
|
||||||
handle.setValue(newIndex);
|
|
||||||
} else {
|
|
||||||
handle.setValue(static_cast<uint16_t>(keyword));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static constexpr bool isIntegerPackable(float f) {
|
static constexpr bool isIntegerPackable(float f) {
|
||||||
constexpr uint16_t kMaxInlineAbsValue = (1 << 11) - 1;
|
constexpr uint16_t kMaxInlineAbsValue = (1 << 11) - 1;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user