Use Bitfield in YGLayout

Summary: Replaces the usage of C++ bitfields with our portable `Bitfield` class.

Reviewed By: SidharthGuglani

Differential Revision: D16656361

fbshipit-source-id: 05f679e2e994e109b2bd1090c879d6850fabdc40
This commit is contained in:
David Aurelio
2019-08-07 16:17:00 -07:00
committed by Facebook Github Bot
parent 884e064a99
commit 72cefead02
4 changed files with 51 additions and 27 deletions

View File

@@ -892,7 +892,7 @@ YGValue YGNodeStyleGetMaxHeight(const YGNodeConstRef node) {
"Cannot get layout properties of multi-edge shorthands"); \
\
if (edge == YGEdgeStart) { \
if (node->getLayout().direction == YGDirectionRTL) { \
if (node->getLayout().direction() == YGDirectionRTL) { \
return node->getLayout().instanceName[YGEdgeRight]; \
} else { \
return node->getLayout().instanceName[YGEdgeLeft]; \
@@ -900,7 +900,7 @@ YGValue YGNodeStyleGetMaxHeight(const YGNodeConstRef node) {
} \
\
if (edge == YGEdgeEnd) { \
if (node->getLayout().direction == YGDirectionRTL) { \
if (node->getLayout().direction() == YGDirectionRTL) { \
return node->getLayout().instanceName[YGEdgeLeft]; \
} else { \
return node->getLayout().instanceName[YGEdgeRight]; \
@@ -916,15 +916,15 @@ YG_NODE_LAYOUT_PROPERTY_IMPL(float, Right, position[YGEdgeRight]);
YG_NODE_LAYOUT_PROPERTY_IMPL(float, Bottom, position[YGEdgeBottom]);
YG_NODE_LAYOUT_PROPERTY_IMPL(float, Width, dimensions[YGDimensionWidth]);
YG_NODE_LAYOUT_PROPERTY_IMPL(float, Height, dimensions[YGDimensionHeight]);
YG_NODE_LAYOUT_PROPERTY_IMPL(YGDirection, Direction, direction);
YG_NODE_LAYOUT_PROPERTY_IMPL(bool, HadOverflow, hadOverflow);
YG_NODE_LAYOUT_PROPERTY_IMPL(YGDirection, Direction, direction());
YG_NODE_LAYOUT_PROPERTY_IMPL(bool, HadOverflow, hadOverflow());
YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Margin, margin);
YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Border, border);
YG_NODE_LAYOUT_RESOLVED_PROPERTY_IMPL(float, Padding, padding);
bool YGNodeLayoutGetDidLegacyStretchFlagAffectLayout(const YGNodeRef node) {
return node->getLayout().doesLegacyStretchFlagAffectsLayout;
return node->getLayout().doesLegacyStretchFlagAffectsLayout();
}
uint32_t gCurrentGenerationCount = 0;
@@ -2199,7 +2199,7 @@ static float YGDistributeFreeSpaceSecondPass(
currentRelativeChild,
childWidth,
childHeight,
node->getLayout().direction,
node->getLayout().direction(),
childWidthMeasureMode,
childHeightMeasureMode,
availableInnerWidth,
@@ -2213,8 +2213,8 @@ static float YGDistributeFreeSpaceSecondPass(
depth,
generationCount);
node->setLayoutHadOverflow(
node->getLayout().hadOverflow |
currentRelativeChild->getLayout().hadOverflow);
node->getLayout().hadOverflow() |
currentRelativeChild->getLayout().hadOverflow());
}
return deltaFreeSpace;
}
@@ -2973,7 +2973,7 @@ static void YGNodelayoutImpl(
}
node->setLayoutHadOverflow(
node->getLayout().hadOverflow |
node->getLayout().hadOverflow() |
(collectedFlexItemsValues.remainingFreeSpace < 0));
// STEP 6: MAIN-AXIS JUSTIFICATION & CROSS-AXIS SIZE DETERMINATION
@@ -4152,7 +4152,7 @@ void YGNodeCalculateLayoutWithContext(
0, // tree root
gCurrentGenerationCount)) {
node->setPosition(
node->getLayout().direction, ownerWidth, ownerHeight, ownerWidth);
node->getLayout().direction(), ownerWidth, ownerHeight, ownerWidth);
YGRoundToPixelGrid(node, node->getConfig()->pointScaleFactor, 0.0f, 0.0f);
#ifdef DEBUG
@@ -4202,7 +4202,7 @@ void YGNodeCalculateLayoutWithContext(
0, // tree root
gCurrentGenerationCount)) {
nodeWithoutLegacyFlag->setPosition(
nodeWithoutLegacyFlag->getLayout().direction,
nodeWithoutLegacyFlag->getLayout().direction(),
ownerWidth,
ownerHeight,
ownerWidth);