CompactValue -> Style::Length (#1458)
Summary: X-link: https://github.com/facebook/react-native/pull/41392 Pull Request resolved: https://github.com/facebook/yoga/pull/1458 We're moving `CompactValue` to be an internal detail of `yoga::Style`, where users outside of the style will be dealing with a resolved/non-compact representation. This change renames usages of `CompactValue` to `Style::Length`, which will be Yoga's representation for CSS input lengths. Right now one is just a type alias of the other, but this will let us change the internals of CompactValue with the rest of the world looking the same. A few factory functions are added to `yoga::value` for creating CSS values. There are some shenanigans around how we want to represent CSS pixels (one YGUnitPoint), when we also end up adding CSS points (slightly larger than one YGUnitPoint). For now, I reused `point` until making other changes. Changelog: [Internal] Reviewed By: yungsters Differential Revision: D51000389 fbshipit-source-id: 00f55e72bfb8aa291b53308f8a62ac8797be490f
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a822f2635e
commit
aca02406ef
@@ -304,20 +304,11 @@ TEST(YogaTest, dedicated_unit_factories) {
|
||||
ASSERT_EQ(
|
||||
CompactValue::of<YGUnitPercent>(123.456f),
|
||||
CompactValue(YGValue{123.456f, YGUnitPercent}));
|
||||
}
|
||||
|
||||
TEST(YogaTest, dedicated_unit_maybe_factories) {
|
||||
ASSERT_EQ(
|
||||
CompactValue::ofMaybe<YGUnitPoint>(-9876.5f),
|
||||
CompactValue(YGValue{-9876.5f, YGUnitPoint}));
|
||||
ASSERT_EQ(
|
||||
CompactValue::ofMaybe<YGUnitPoint>(YGUndefined),
|
||||
CompactValue::of<YGUnitPoint>(YGUndefined),
|
||||
CompactValue(YGValueUndefined));
|
||||
ASSERT_EQ(
|
||||
CompactValue::ofMaybe<YGUnitPercent>(123.456f),
|
||||
CompactValue(YGValue{123.456f, YGUnitPercent}));
|
||||
ASSERT_EQ(
|
||||
CompactValue::ofMaybe<YGUnitPercent>(YGUndefined),
|
||||
CompactValue::of<YGUnitPercent>(YGUndefined),
|
||||
CompactValue(YGValueUndefined));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user