Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C++ style enums 16/N: Dimension #1403

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions yoga/Yoga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,97 +662,97 @@ void YGNodeStyleSetAspectRatio(const YGNodeRef node, const float aspectRatio) {
void YGNodeStyleSetWidth(YGNodeRef node, float points) {
auto value = CompactValue::ofMaybe<YGUnitPoint>(points);
updateIndexedStyleProp<&Style::dimension, &Style::setDimension>(
node, YGDimensionWidth, value);
node, Dimension::Width, value);
}
void YGNodeStyleSetWidthPercent(YGNodeRef node, float percent) {
auto value = CompactValue::ofMaybe<YGUnitPercent>(percent);
updateIndexedStyleProp<&Style::dimension, &Style::setDimension>(
node, YGDimensionWidth, value);
node, Dimension::Width, value);
}
void YGNodeStyleSetWidthAuto(YGNodeRef node) {
updateIndexedStyleProp<&Style::dimension, &Style::setDimension>(
node, YGDimensionWidth, CompactValue::ofAuto());
node, Dimension::Width, CompactValue::ofAuto());
}
YGValue YGNodeStyleGetWidth(YGNodeConstRef node) {
return resolveRef(node)->getStyle().dimension(YGDimensionWidth);
return resolveRef(node)->getStyle().dimension(Dimension::Width);
}

void YGNodeStyleSetHeight(YGNodeRef node, float points) {
auto value = CompactValue::ofMaybe<YGUnitPoint>(points);
updateIndexedStyleProp<&Style::dimension, &Style::setDimension>(
node, YGDimensionHeight, value);
node, Dimension::Height, value);
}
void YGNodeStyleSetHeightPercent(YGNodeRef node, float percent) {
auto value = CompactValue::ofMaybe<YGUnitPercent>(percent);
updateIndexedStyleProp<&Style::dimension, &Style::setDimension>(
node, YGDimensionHeight, value);
node, Dimension::Height, value);
}
void YGNodeStyleSetHeightAuto(YGNodeRef node) {
updateIndexedStyleProp<&Style::dimension, &Style::setDimension>(
node, YGDimensionHeight, CompactValue::ofAuto());
node, Dimension::Height, CompactValue::ofAuto());
}
YGValue YGNodeStyleGetHeight(YGNodeConstRef node) {
return resolveRef(node)->getStyle().dimension(YGDimensionHeight);
return resolveRef(node)->getStyle().dimension(Dimension::Height);
}

void YGNodeStyleSetMinWidth(const YGNodeRef node, const float minWidth) {
auto value = CompactValue::ofMaybe<YGUnitPoint>(minWidth);
updateIndexedStyleProp<&Style::minDimension, &Style::setMinDimension>(
node, YGDimensionWidth, value);
node, Dimension::Width, value);
}
void YGNodeStyleSetMinWidthPercent(const YGNodeRef node, const float minWidth) {
auto value = CompactValue::ofMaybe<YGUnitPercent>(minWidth);
updateIndexedStyleProp<&Style::minDimension, &Style::setMinDimension>(
node, YGDimensionWidth, value);
node, Dimension::Width, value);
}
YGValue YGNodeStyleGetMinWidth(const YGNodeConstRef node) {
return resolveRef(node)->getStyle().minDimension(YGDimensionWidth);
return resolveRef(node)->getStyle().minDimension(Dimension::Width);
}

void YGNodeStyleSetMinHeight(const YGNodeRef node, const float minHeight) {
auto value = CompactValue::ofMaybe<YGUnitPoint>(minHeight);
updateIndexedStyleProp<&Style::minDimension, &Style::setMinDimension>(
node, YGDimensionHeight, value);
node, Dimension::Height, value);
}
void YGNodeStyleSetMinHeightPercent(
const YGNodeRef node,
const float minHeight) {
auto value = CompactValue::ofMaybe<YGUnitPercent>(minHeight);
updateIndexedStyleProp<&Style::minDimension, &Style::setMinDimension>(
node, YGDimensionHeight, value);
node, Dimension::Height, value);
}
YGValue YGNodeStyleGetMinHeight(const YGNodeConstRef node) {
return resolveRef(node)->getStyle().minDimension(YGDimensionHeight);
return resolveRef(node)->getStyle().minDimension(Dimension::Height);
}

void YGNodeStyleSetMaxWidth(const YGNodeRef node, const float maxWidth) {
auto value = CompactValue::ofMaybe<YGUnitPoint>(maxWidth);
updateIndexedStyleProp<&Style::maxDimension, &Style::setMaxDimension>(
node, YGDimensionWidth, value);
node, Dimension::Width, value);
}
void YGNodeStyleSetMaxWidthPercent(const YGNodeRef node, const float maxWidth) {
auto value = CompactValue::ofMaybe<YGUnitPercent>(maxWidth);
updateIndexedStyleProp<&Style::maxDimension, &Style::setMaxDimension>(
node, YGDimensionWidth, value);
node, Dimension::Width, value);
}
YGValue YGNodeStyleGetMaxWidth(const YGNodeConstRef node) {
return resolveRef(node)->getStyle().maxDimension(YGDimensionWidth);
return resolveRef(node)->getStyle().maxDimension(Dimension::Width);
}

void YGNodeStyleSetMaxHeight(const YGNodeRef node, const float maxHeight) {
auto value = CompactValue::ofMaybe<YGUnitPoint>(maxHeight);
updateIndexedStyleProp<&Style::maxDimension, &Style::setMaxDimension>(
node, YGDimensionHeight, value);
node, Dimension::Height, value);
}
void YGNodeStyleSetMaxHeightPercent(
const YGNodeRef node,
const float maxHeight) {
auto value = CompactValue::ofMaybe<YGUnitPercent>(maxHeight);
updateIndexedStyleProp<&Style::maxDimension, &Style::setMaxDimension>(
node, YGDimensionHeight, value);
node, Dimension::Height, value);
}
YGValue YGNodeStyleGetMaxHeight(const YGNodeConstRef node) {
return resolveRef(node)->getStyle().maxDimension(YGDimensionHeight);
return resolveRef(node)->getStyle().maxDimension(Dimension::Height);
}

namespace {
Expand Down Expand Up @@ -805,11 +805,11 @@ float YGNodeLayoutGetBottom(const YGNodeConstRef node) {
}

float YGNodeLayoutGetWidth(const YGNodeConstRef node) {
return resolveRef(node)->getLayout().dimension(YGDimensionWidth);
return resolveRef(node)->getLayout().dimension(Dimension::Width);
}

float YGNodeLayoutGetHeight(const YGNodeConstRef node) {
return resolveRef(node)->getLayout().dimension(YGDimensionHeight);
return resolveRef(node)->getLayout().dimension(Dimension::Height);
}

YGDirection YGNodeLayoutGetDirection(const YGNodeConstRef node) {
Expand Down
6 changes: 3 additions & 3 deletions yoga/algorithm/Baseline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ float calculateBaseline(const yoga::Node* node) {
Event::publish<Event::NodeBaselineStart>(node);

const float baseline = node->baseline(
node->getLayout().measuredDimension(YGDimensionWidth),
node->getLayout().measuredDimension(YGDimensionHeight));
node->getLayout().measuredDimension(Dimension::Width),
node->getLayout().measuredDimension(Dimension::Height));

Event::publish<Event::NodeBaselineEnd>(node);

Expand Down Expand Up @@ -53,7 +53,7 @@ float calculateBaseline(const yoga::Node* node) {
}

if (baselineChild == nullptr) {
return node->getLayout().measuredDimension(YGDimensionHeight);
return node->getLayout().measuredDimension(Dimension::Height);
}

const float baseline = calculateBaseline(baselineChild);
Expand Down
9 changes: 5 additions & 4 deletions yoga/algorithm/BoundAxis.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <yoga/algorithm/FlexDirection.h>
#include <yoga/algorithm/ResolveValue.h>
#include <yoga/enums/Dimension.h>
#include <yoga/enums/FlexDirection.h>
#include <yoga/node/Node.h>
#include <yoga/numeric/Comparison.h>
Expand All @@ -35,14 +36,14 @@ inline FloatOptional boundAxisWithinMinAndMax(

if (isColumn(axis)) {
min = yoga::resolveValue(
node->getStyle().minDimension(YGDimensionHeight), axisSize);
node->getStyle().minDimension(Dimension::Height), axisSize);
max = yoga::resolveValue(
node->getStyle().maxDimension(YGDimensionHeight), axisSize);
node->getStyle().maxDimension(Dimension::Height), axisSize);
} else if (isRow(axis)) {
min = yoga::resolveValue(
node->getStyle().minDimension(YGDimensionWidth), axisSize);
node->getStyle().minDimension(Dimension::Width), axisSize);
max = yoga::resolveValue(
node->getStyle().maxDimension(YGDimensionWidth), axisSize);
node->getStyle().maxDimension(Dimension::Width), axisSize);
}

if (max >= FloatOptional{0} && value > max) {
Expand Down
Loading
Loading