YGEdge -> yoga::Edge (#1461)

Summary:
X-link: https://github.com/facebook/react-native/pull/41391

Pull Request resolved: https://github.com/facebook/yoga/pull/1461

Converts usages of `YGEdge` within internal APIs to `yoga::Edge` scoped enum.

With the exception of YGUnit which is in its own state of transition, this is the last public yoga enum to need to be moved to scoped enum form for usages internal to the Yoga public API.

Changelog: [internal]

Reviewed By: rshest

Differential Revision: D51152779

fbshipit-source-id: 06554f67bfd7709cbc24fdd9a5474e897e9e95d8
This commit is contained in:
Nick Gerleman
2023-11-25 20:41:22 -08:00
committed by Facebook GitHub Bot
parent a121483e81
commit 325ccea068
12 changed files with 243 additions and 211 deletions

View File

@@ -223,49 +223,49 @@ YGValue YGNodeStyleGetFlexBasis(const YGNodeConstRef node) {
void YGNodeStyleSetPosition(YGNodeRef node, YGEdge edge, float points) {
updateIndexedStyleProp<&Style::position, &Style::setPosition>(
node, edge, value::points(points));
node, scopedEnum(edge), value::points(points));
}
void YGNodeStyleSetPositionPercent(YGNodeRef node, YGEdge edge, float percent) {
updateIndexedStyleProp<&Style::position, &Style::setPosition>(
node, edge, value::percent(percent));
node, scopedEnum(edge), value::percent(percent));
}
YGValue YGNodeStyleGetPosition(YGNodeConstRef node, YGEdge edge) {
return resolveRef(node)->getStyle().position(edge);
return resolveRef(node)->getStyle().position(scopedEnum(edge));
}
void YGNodeStyleSetMargin(YGNodeRef node, YGEdge edge, float points) {
updateIndexedStyleProp<&Style::margin, &Style::setMargin>(
node, edge, value::points(points));
node, scopedEnum(edge), value::points(points));
}
void YGNodeStyleSetMarginPercent(YGNodeRef node, YGEdge edge, float percent) {
updateIndexedStyleProp<&Style::margin, &Style::setMargin>(
node, edge, value::percent(percent));
node, scopedEnum(edge), value::percent(percent));
}
void YGNodeStyleSetMarginAuto(YGNodeRef node, YGEdge edge) {
updateIndexedStyleProp<&Style::margin, &Style::setMargin>(
node, edge, value::ofAuto());
node, scopedEnum(edge), value::ofAuto());
}
YGValue YGNodeStyleGetMargin(YGNodeConstRef node, YGEdge edge) {
return resolveRef(node)->getStyle().margin(edge);
return resolveRef(node)->getStyle().margin(scopedEnum(edge));
}
void YGNodeStyleSetPadding(YGNodeRef node, YGEdge edge, float points) {
updateIndexedStyleProp<&Style::padding, &Style::setPadding>(
node, edge, value::points(points));
node, scopedEnum(edge), value::points(points));
}
void YGNodeStyleSetPaddingPercent(YGNodeRef node, YGEdge edge, float percent) {
updateIndexedStyleProp<&Style::padding, &Style::setPadding>(
node, edge, value::percent(percent));
node, scopedEnum(edge), value::percent(percent));
}
YGValue YGNodeStyleGetPadding(YGNodeConstRef node, YGEdge edge) {
return resolveRef(node)->getStyle().padding(edge);
return resolveRef(node)->getStyle().padding(scopedEnum(edge));
}
void YGNodeStyleSetBorder(
@@ -273,11 +273,11 @@ void YGNodeStyleSetBorder(
const YGEdge edge,
const float border) {
updateIndexedStyleProp<&Style::border, &Style::setBorder>(
node, edge, value::points(border));
node, scopedEnum(edge), value::points(border));
}
float YGNodeStyleGetBorder(const YGNodeConstRef node, const YGEdge edge) {
auto border = resolveRef(node)->getStyle().border(edge);
auto border = resolveRef(node)->getStyle().border(scopedEnum(edge));
if (border.isUndefined() || border.isAuto()) {
return YGUndefined;
}