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 #39598

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
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ - (void)setUp
auto &props = *sharedProps;
props.layoutConstraints = LayoutConstraints{{0, 0}, {500, 500}};
auto &yogaStyle = props.yogaStyle;
yogaStyle.setDimension(YGDimensionWidth, yoga::CompactValue::of<YGUnitPoint>(200));
yogaStyle.setDimension(YGDimensionHeight, yoga::CompactValue::of<YGUnitPoint>(200));
yogaStyle.setDimension(yoga::Dimension::Width, yoga::CompactValue::of<YGUnitPoint>(200));
yogaStyle.setDimension(yoga::Dimension::Height, yoga::CompactValue::of<YGUnitPoint>(200));
return sharedProps;
})
.children({
Expand All @@ -136,8 +136,8 @@ - (void)setUp
yogaStyle.positionType() = yoga::PositionType::Absolute;
yogaStyle.position()[YGEdgeLeft] = YGValue{0, YGUnitPoint};
yogaStyle.position()[YGEdgeTop] = YGValue{0, YGUnitPoint};
yogaStyle.setDimension(YGDimensionWidth, yoga::CompactValue::of<YGUnitPoint>(200));
yogaStyle.setDimension(YGDimensionHeight, yoga::CompactValue::of<YGUnitPoint>(200));
yogaStyle.setDimension(yoga::Dimension::Width, yoga::CompactValue::of<YGUnitPoint>(200));
yogaStyle.setDimension(yoga::Dimension::Height, yoga::CompactValue::of<YGUnitPoint>(200));
return sharedProps;
})
.children({
Expand Down Expand Up @@ -216,8 +216,8 @@ - (void)setUp
yogaStyle.positionType() = yoga::PositionType::Absolute;
yogaStyle.position()[YGEdgeLeft] = YGValue{0, YGUnitPoint};
yogaStyle.position()[YGEdgeTop] = YGValue{30, YGUnitPoint};
yogaStyle.setDimension(YGDimensionWidth, yoga::CompactValue::of<YGUnitPoint>(200));
yogaStyle.setDimension(YGDimensionHeight, yoga::CompactValue::of<YGUnitPoint>(50));
yogaStyle.setDimension(yoga::Dimension::Width, yoga::CompactValue::of<YGUnitPoint>(200));
yogaStyle.setDimension(yoga::Dimension::Height, yoga::CompactValue::of<YGUnitPoint>(50));
return sharedProps;
})
.children({
Expand Down Expand Up @@ -260,8 +260,8 @@ - (void)setUp
yogaStyle.positionType() = yoga::PositionType::Absolute;
yogaStyle.position()[YGEdgeLeft] = YGValue{0, YGUnitPoint};
yogaStyle.position()[YGEdgeTop] = YGValue{90, YGUnitPoint};
yogaStyle.setDimension(YGDimensionWidth, yoga::CompactValue::of<YGUnitPoint>(200));
yogaStyle.setDimension(YGDimensionHeight, yoga::CompactValue::of<YGUnitPoint>(50));
yogaStyle.setDimension(yoga::Dimension::Width, yoga::CompactValue::of<YGUnitPoint>(200));
yogaStyle.setDimension(yoga::Dimension::Height, yoga::CompactValue::of<YGUnitPoint>(50));
return sharedProps;
})
.children({
Expand Down Expand Up @@ -418,8 +418,8 @@ - (void)testEntireParagraphLink
auto &props = *sharedProps;
props.layoutConstraints = LayoutConstraints{{0, 0}, {500, 500}};
auto &yogaStyle = props.yogaStyle;
yogaStyle.setDimension(YGDimensionWidth, yoga::CompactValue::of<YGUnitPoint>(200));
yogaStyle.setDimension(YGDimensionHeight, yoga::CompactValue::of<YGUnitPoint>(200));
yogaStyle.setDimension(yoga::Dimension::Width, yoga::CompactValue::of<YGUnitPoint>(200));
yogaStyle.setDimension(yoga::Dimension::Height, yoga::CompactValue::of<YGUnitPoint>(200));
return sharedProps;
})
.children({
Expand All @@ -434,8 +434,8 @@ - (void)testEntireParagraphLink
yogaStyle.positionType() = yoga::PositionType::Absolute;
yogaStyle.position()[YGEdgeLeft] = YGValue{0, YGUnitPoint};
yogaStyle.position()[YGEdgeTop] = YGValue{0, YGUnitPoint};
yogaStyle.setDimension(YGDimensionWidth, yoga::CompactValue::of<YGUnitPoint>(200));
yogaStyle.setDimension(YGDimensionHeight, yoga::CompactValue::of<YGUnitPoint>(20));
yogaStyle.setDimension(yoga::Dimension::Width, yoga::CompactValue::of<YGUnitPoint>(200));
yogaStyle.setDimension(yoga::Dimension::Height, yoga::CompactValue::of<YGUnitPoint>(20));
return sharedProps;
})
.children({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,11 @@ void YogaLayoutableShadowNode::setSize(Size size) const {

auto style = yogaNode_.getStyle();
style.setDimension(
YGDimensionWidth, yoga::CompactValue::ofMaybe<YGUnitPoint>(size.width));
yoga::Dimension::Width,
yoga::CompactValue::ofMaybe<YGUnitPoint>(size.width));
style.setDimension(
YGDimensionHeight, yoga::CompactValue::ofMaybe<YGUnitPoint>(size.height));
yoga::Dimension::Height,
yoga::CompactValue::ofMaybe<YGUnitPoint>(size.height));
yogaNode_.setStyle(style);
yogaNode_.setDirty(true);
}
Expand Down Expand Up @@ -631,19 +633,19 @@ void YogaLayoutableShadowNode::layoutTree(
auto ownerHeight = yogaFloatFromFloat(maximumSize.height);

yogaStyle.setMaxDimension(
YGDimensionWidth,
yoga::Dimension::Width,
yoga::CompactValue::ofMaybe<YGUnitPoint>(maximumSize.width));

yogaStyle.setMaxDimension(
YGDimensionHeight,
yoga::Dimension::Height,
yoga::CompactValue::ofMaybe<YGUnitPoint>(maximumSize.height));

yogaStyle.setMinDimension(
YGDimensionWidth,
yoga::Dimension::Width,
yoga::CompactValue::ofMaybe<YGUnitPoint>(minimumSize.width));

yogaStyle.setMinDimension(
YGDimensionHeight,
yoga::Dimension::Height,
yoga::CompactValue::ofMaybe<YGUnitPoint>(minimumSize.height));

auto direction =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ static inline T const getFieldValue(

#define REBUILD_FIELD_YG_DIMENSION(field, setter, widthStr, heightStr) \
REBUILD_YG_FIELD_SWITCH_CASE_INDEXED_SETTER( \
field, setter, YGDimensionWidth, widthStr); \
field, setter, yoga::Dimension::Width, widthStr); \
REBUILD_YG_FIELD_SWITCH_CASE_INDEXED_SETTER( \
field, setter, YGDimensionHeight, heightStr);
field, setter, yoga::Dimension::Height, heightStr);

#define REBUILD_FIELD_YG_GUTTER(field, rowGapStr, columnGapStr, gapStr) \
REBUILD_YG_FIELD_SWITCH_CASE_INDEXED(field, YGGutterRow, rowGapStr); \
Expand Down Expand Up @@ -349,28 +349,28 @@ SharedDebugStringConvertibleList YogaStylableProps::getDebugProps() const {
"border", yogaStyle.border(), defaultYogaStyle.border()),
debugStringConvertibleItem(
"width",
yogaStyle.dimension(YGDimensionWidth),
defaultYogaStyle.dimension(YGDimensionWidth)),
yogaStyle.dimension(yoga::Dimension::Width),
defaultYogaStyle.dimension(yoga::Dimension::Width)),
debugStringConvertibleItem(
"height",
yogaStyle.dimension(YGDimensionHeight),
defaultYogaStyle.dimension(YGDimensionHeight)),
yogaStyle.dimension(yoga::Dimension::Height),
defaultYogaStyle.dimension(yoga::Dimension::Height)),
debugStringConvertibleItem(
"minWidth",
yogaStyle.minDimension(YGDimensionWidth),
defaultYogaStyle.minDimension(YGDimensionWidth)),
yogaStyle.minDimension(yoga::Dimension::Width),
defaultYogaStyle.minDimension(yoga::Dimension::Width)),
debugStringConvertibleItem(
"minHeight",
yogaStyle.minDimension(YGDimensionHeight),
defaultYogaStyle.minDimension(YGDimensionHeight)),
yogaStyle.minDimension(yoga::Dimension::Height),
defaultYogaStyle.minDimension(yoga::Dimension::Height)),
debugStringConvertibleItem(
"maxWidth",
yogaStyle.maxDimension(YGDimensionWidth),
defaultYogaStyle.maxDimension(YGDimensionWidth)),
yogaStyle.maxDimension(yoga::Dimension::Width),
defaultYogaStyle.maxDimension(yoga::Dimension::Width)),
debugStringConvertibleItem(
"maxHeight",
yogaStyle.maxDimension(YGDimensionHeight),
defaultYogaStyle.maxDimension(YGDimensionHeight)),
yogaStyle.maxDimension(yoga::Dimension::Height),
defaultYogaStyle.maxDimension(yoga::Dimension::Height)),
debugStringConvertibleItem(
"aspectRatio",
yogaStyle.aspectRatio(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,54 +274,54 @@ static inline yoga::Style convertRawProp(
yogaStyle.border());

yogaStyle.setDimension(
YGDimensionWidth,
yoga::Dimension::Width,
convertRawProp(
context,
rawProps,
"width",
sourceValue.dimension(YGDimensionWidth),
sourceValue.dimension(yoga::Dimension::Width),
{}));
yogaStyle.setDimension(
YGDimensionHeight,
yoga::Dimension::Height,
convertRawProp(
context,
rawProps,
"height",
sourceValue.dimension(YGDimensionHeight),
sourceValue.dimension(yoga::Dimension::Height),
{}));

yogaStyle.setMinDimension(
YGDimensionWidth,
yoga::Dimension::Width,
convertRawProp(
context,
rawProps,
"minWidth",
sourceValue.minDimension(YGDimensionWidth),
sourceValue.minDimension(yoga::Dimension::Width),
{}));
yogaStyle.setMinDimension(
YGDimensionHeight,
yoga::Dimension::Height,
convertRawProp(
context,
rawProps,
"minHeight",
sourceValue.minDimension(YGDimensionHeight),
sourceValue.minDimension(yoga::Dimension::Height),
{}));

yogaStyle.setMaxDimension(
YGDimensionWidth,
yoga::Dimension::Width,
convertRawProp(
context,
rawProps,
"maxWidth",
sourceValue.maxDimension(YGDimensionWidth),
sourceValue.maxDimension(yoga::Dimension::Width),
{}));
yogaStyle.setMaxDimension(
YGDimensionHeight,
yoga::Dimension::Height,
convertRawProp(
context,
rawProps,
"maxHeight",
sourceValue.maxDimension(YGDimensionHeight),
sourceValue.maxDimension(yoga::Dimension::Height),
{}));

yogaStyle.aspectRatio() = convertRawProp(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class LayoutTest : public ::testing::Test {
auto &props = *sharedProps;
props.layoutConstraints = LayoutConstraints{{0,0}, {500, 500}};
auto &yogaStyle = props.yogaStyle;
yogaStyle.setDimension(YGDimensionWidth, yoga::CompactValue::of<YGUnitPoint>(200));
yogaStyle.setDimension(YGDimensionHeight, yoga::CompactValue::of<YGUnitPoint>(200));
yogaStyle.setDimension(yoga::Dimension::Width, yoga::CompactValue::of<YGUnitPoint>(200));
yogaStyle.setDimension(yoga::Dimension::Height, yoga::CompactValue::of<YGUnitPoint>(200));
return sharedProps;
})
.children({
Expand All @@ -90,8 +90,8 @@ class LayoutTest : public ::testing::Test {
auto &props = *sharedProps;
auto &yogaStyle = props.yogaStyle;
yogaStyle.positionType() = yoga::PositionType::Absolute;
yogaStyle.setDimension(YGDimensionWidth, yoga::CompactValue::of<YGUnitPoint>(50));
yogaStyle.setDimension(YGDimensionHeight, yoga::CompactValue::of<YGUnitPoint>(50));
yogaStyle.setDimension(yoga::Dimension::Width, yoga::CompactValue::of<YGUnitPoint>(50));
yogaStyle.setDimension(yoga::Dimension::Height, yoga::CompactValue::of<YGUnitPoint>(50));
return sharedProps;
})
.children({
Expand All @@ -105,8 +105,8 @@ class LayoutTest : public ::testing::Test {
yogaStyle.positionType() = yoga::PositionType::Absolute;
yogaStyle.position()[YGEdgeLeft] = YGValue{10, YGUnitPoint};
yogaStyle.position()[YGEdgeTop] = YGValue{10, YGUnitPoint};
yogaStyle.setDimension(YGDimensionWidth, yoga::CompactValue::of<YGUnitPoint>(30));
yogaStyle.setDimension(YGDimensionHeight, yoga::CompactValue::of<YGUnitPoint>(90));
yogaStyle.setDimension(yoga::Dimension::Width, yoga::CompactValue::of<YGUnitPoint>(30));
yogaStyle.setDimension(yoga::Dimension::Height, yoga::CompactValue::of<YGUnitPoint>(90));

if (testCase == TRANSFORM_SCALE) {
props.transform = props.transform * Transform::Scale(2, 2, 1);
Expand Down Expand Up @@ -138,8 +138,8 @@ class LayoutTest : public ::testing::Test {
yogaStyle.positionType() = yoga::PositionType::Absolute;
yogaStyle.position()[YGEdgeLeft] = YGValue{10, YGUnitPoint};
yogaStyle.position()[YGEdgeTop] = YGValue{10, YGUnitPoint};
yogaStyle.setDimension(YGDimensionWidth, yoga::CompactValue::of<YGUnitPoint>(110));
yogaStyle.setDimension(YGDimensionHeight, yoga::CompactValue::of<YGUnitPoint>(20));
yogaStyle.setDimension(yoga::Dimension::Width, yoga::CompactValue::of<YGUnitPoint>(110));
yogaStyle.setDimension(yoga::Dimension::Height, yoga::CompactValue::of<YGUnitPoint>(20));
return sharedProps;
})
.children({
Expand All @@ -153,8 +153,8 @@ class LayoutTest : public ::testing::Test {
yogaStyle.positionType() = yoga::PositionType::Absolute;
yogaStyle.position()[YGEdgeLeft] = YGValue{70, YGUnitPoint};
yogaStyle.position()[YGEdgeTop] = YGValue{-50, YGUnitPoint};
yogaStyle.setDimension(YGDimensionWidth, yoga::CompactValue::of<YGUnitPoint>(30));
yogaStyle.setDimension(YGDimensionHeight, yoga::CompactValue::of<YGUnitPoint>(60));
yogaStyle.setDimension(yoga::Dimension::Width, yoga::CompactValue::of<YGUnitPoint>(30));
yogaStyle.setDimension(yoga::Dimension::Height, yoga::CompactValue::of<YGUnitPoint>(60));
return sharedProps;
})
}),
Expand All @@ -168,8 +168,8 @@ class LayoutTest : public ::testing::Test {
yogaStyle.positionType() = yoga::PositionType::Absolute;
yogaStyle.position()[YGEdgeLeft] = YGValue{-60, YGUnitPoint};
yogaStyle.position()[YGEdgeTop] = YGValue{50, YGUnitPoint};
yogaStyle.setDimension(YGDimensionWidth, yoga::CompactValue::of<YGUnitPoint>(70));
yogaStyle.setDimension(YGDimensionHeight, yoga::CompactValue::of<YGUnitPoint>(20));
yogaStyle.setDimension(yoga::Dimension::Width, yoga::CompactValue::of<YGUnitPoint>(70));
yogaStyle.setDimension(yoga::Dimension::Height, yoga::CompactValue::of<YGUnitPoint>(20));
return sharedProps;
})
})
Expand Down
Loading