Remove yoga::Style::BitfieldRef (#1459)

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

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

Removes the last of the non setter-style style setters.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D51155925

fbshipit-source-id: 2921c87d95ad36495b7013e592d5169015321545
This commit is contained in:
Nick Gerleman
2023-11-27 21:20:20 -08:00
committed by Facebook GitHub Bot
parent ed6e91479c
commit 9b0fd09ec6
3 changed files with 89 additions and 130 deletions

View File

@@ -14,54 +14,26 @@ using namespace facebook::yoga;
namespace { namespace {
template <typename T, typename NeedsUpdate, typename Update>
void updateStyle(
yoga::Node* node,
T value,
NeedsUpdate&& needsUpdate,
Update&& update) {
if (needsUpdate(node->getStyle(), value)) {
update(node->getStyle(), value);
node->markDirtyAndPropagate();
}
}
template <typename Ref, typename ValueT>
void updateStyle(YGNodeRef node, Ref (Style::*prop)(), ValueT value) {
updateStyle(
resolveRef(node),
value,
[prop](Style& s, ValueT x) { return (s.*prop)() != x; },
[prop](Style& s, ValueT x) { (s.*prop)() = x; });
}
template <auto GetterT, auto SetterT, typename ValueT> template <auto GetterT, auto SetterT, typename ValueT>
void updateStyle(YGNodeRef node, ValueT value) { void updateStyle(YGNodeRef node, ValueT value) {
updateStyle( auto& style = resolveRef(node)->getStyle();
resolveRef(node), if ((style.*GetterT)() != value) {
value, (style.*SetterT)(value);
[](Style& s, ValueT x) { return (s.*GetterT)() != x; }, resolveRef(node)->markDirtyAndPropagate();
[](Style& s, ValueT x) { (s.*SetterT)(x); }); }
} }
template <auto GetterT, auto SetterT, typename IdxT, typename ValueT> template <auto GetterT, auto SetterT, typename IdxT, typename ValueT>
void updateIndexedStyleProp(YGNodeRef node, IdxT idx, ValueT value) { void updateStyle(YGNodeRef node, IdxT idx, ValueT value) {
updateStyle( auto& style = resolveRef(node)->getStyle();
resolveRef(node), if ((style.*GetterT)(idx) != value) {
value, (style.*SetterT)(idx, value);
[idx](Style& s, ValueT x) { return (s.*GetterT)(idx) != x; }, resolveRef(node)->markDirtyAndPropagate();
[idx](Style& s, ValueT x) { (s.*SetterT)(idx, x); }); }
} }
} // namespace } // namespace
// MSVC has trouble inferring the return type of pointer to member functions
// with const and non-const overloads, instead of preferring the non-const
// overload like clang and GCC. For the purposes of updateStyle(), we can help
// MSVC by specifying that return type explicitly. In combination with
// decltype, MSVC will prefer the non-const version.
#define MSVC_HINT(PROP) decltype(Style{}.PROP())
void YGNodeCopyStyle( void YGNodeCopyStyle(
const YGNodeRef dstNodeRef, const YGNodeRef dstNodeRef,
const YGNodeConstRef srcNodeRef) { const YGNodeConstRef srcNodeRef) {
@@ -75,7 +47,7 @@ void YGNodeCopyStyle(
} }
void YGNodeStyleSetDirection(const YGNodeRef node, const YGDirection value) { void YGNodeStyleSetDirection(const YGNodeRef node, const YGDirection value) {
updateStyle<MSVC_HINT(direction)>(node, &Style::direction, scopedEnum(value)); updateStyle<&Style::direction, &Style::setDirection>(node, scopedEnum(value));
} }
YGDirection YGNodeStyleGetDirection(const YGNodeConstRef node) { YGDirection YGNodeStyleGetDirection(const YGNodeConstRef node) {
@@ -85,8 +57,8 @@ YGDirection YGNodeStyleGetDirection(const YGNodeConstRef node) {
void YGNodeStyleSetFlexDirection( void YGNodeStyleSetFlexDirection(
const YGNodeRef node, const YGNodeRef node,
const YGFlexDirection flexDirection) { const YGFlexDirection flexDirection) {
updateStyle<MSVC_HINT(flexDirection)>( updateStyle<&Style::flexDirection, &Style::setFlexDirection>(
node, &Style::flexDirection, scopedEnum(flexDirection)); node, scopedEnum(flexDirection));
} }
YGFlexDirection YGNodeStyleGetFlexDirection(const YGNodeConstRef node) { YGFlexDirection YGNodeStyleGetFlexDirection(const YGNodeConstRef node) {
@@ -96,8 +68,8 @@ YGFlexDirection YGNodeStyleGetFlexDirection(const YGNodeConstRef node) {
void YGNodeStyleSetJustifyContent( void YGNodeStyleSetJustifyContent(
const YGNodeRef node, const YGNodeRef node,
const YGJustify justifyContent) { const YGJustify justifyContent) {
updateStyle<MSVC_HINT(justifyContent)>( updateStyle<&Style::justifyContent, &Style::setJustifyContent>(
node, &Style::justifyContent, scopedEnum(justifyContent)); node, scopedEnum(justifyContent));
} }
YGJustify YGNodeStyleGetJustifyContent(const YGNodeConstRef node) { YGJustify YGNodeStyleGetJustifyContent(const YGNodeConstRef node) {
@@ -107,8 +79,8 @@ YGJustify YGNodeStyleGetJustifyContent(const YGNodeConstRef node) {
void YGNodeStyleSetAlignContent( void YGNodeStyleSetAlignContent(
const YGNodeRef node, const YGNodeRef node,
const YGAlign alignContent) { const YGAlign alignContent) {
updateStyle<MSVC_HINT(alignContent)>( updateStyle<&Style::alignContent, &Style::setAlignContent>(
node, &Style::alignContent, scopedEnum(alignContent)); node, scopedEnum(alignContent));
} }
YGAlign YGNodeStyleGetAlignContent(const YGNodeConstRef node) { YGAlign YGNodeStyleGetAlignContent(const YGNodeConstRef node) {
@@ -116,8 +88,8 @@ YGAlign YGNodeStyleGetAlignContent(const YGNodeConstRef node) {
} }
void YGNodeStyleSetAlignItems(const YGNodeRef node, const YGAlign alignItems) { void YGNodeStyleSetAlignItems(const YGNodeRef node, const YGAlign alignItems) {
updateStyle<MSVC_HINT(alignItems)>( updateStyle<&Style::alignItems, &Style::setAlignItems>(
node, &Style::alignItems, scopedEnum(alignItems)); node, scopedEnum(alignItems));
} }
YGAlign YGNodeStyleGetAlignItems(const YGNodeConstRef node) { YGAlign YGNodeStyleGetAlignItems(const YGNodeConstRef node) {
@@ -125,8 +97,8 @@ YGAlign YGNodeStyleGetAlignItems(const YGNodeConstRef node) {
} }
void YGNodeStyleSetAlignSelf(const YGNodeRef node, const YGAlign alignSelf) { void YGNodeStyleSetAlignSelf(const YGNodeRef node, const YGAlign alignSelf) {
updateStyle<MSVC_HINT(alignSelf)>( updateStyle<&Style::alignSelf, &Style::setAlignSelf>(
node, &Style::alignSelf, scopedEnum(alignSelf)); node, scopedEnum(alignSelf));
} }
YGAlign YGNodeStyleGetAlignSelf(const YGNodeConstRef node) { YGAlign YGNodeStyleGetAlignSelf(const YGNodeConstRef node) {
@@ -136,8 +108,8 @@ YGAlign YGNodeStyleGetAlignSelf(const YGNodeConstRef node) {
void YGNodeStyleSetPositionType( void YGNodeStyleSetPositionType(
const YGNodeRef node, const YGNodeRef node,
const YGPositionType positionType) { const YGPositionType positionType) {
updateStyle<MSVC_HINT(positionType)>( updateStyle<&Style::positionType, &Style::setPositionType>(
node, &Style::positionType, scopedEnum(positionType)); node, scopedEnum(positionType));
} }
YGPositionType YGNodeStyleGetPositionType(const YGNodeConstRef node) { YGPositionType YGNodeStyleGetPositionType(const YGNodeConstRef node) {
@@ -145,8 +117,8 @@ YGPositionType YGNodeStyleGetPositionType(const YGNodeConstRef node) {
} }
void YGNodeStyleSetFlexWrap(const YGNodeRef node, const YGWrap flexWrap) { void YGNodeStyleSetFlexWrap(const YGNodeRef node, const YGWrap flexWrap) {
updateStyle<MSVC_HINT(flexWrap)>( updateStyle<&Style::flexWrap, &Style::setFlexWrap>(
node, &Style::flexWrap, scopedEnum(flexWrap)); node, scopedEnum(flexWrap));
} }
YGWrap YGNodeStyleGetFlexWrap(const YGNodeConstRef node) { YGWrap YGNodeStyleGetFlexWrap(const YGNodeConstRef node) {
@@ -154,8 +126,8 @@ YGWrap YGNodeStyleGetFlexWrap(const YGNodeConstRef node) {
} }
void YGNodeStyleSetOverflow(const YGNodeRef node, const YGOverflow overflow) { void YGNodeStyleSetOverflow(const YGNodeRef node, const YGOverflow overflow) {
updateStyle<MSVC_HINT(overflow)>( updateStyle<&Style::overflow, &Style::setOverflow>(
node, &Style::overflow, scopedEnum(overflow)); node, scopedEnum(overflow));
} }
YGOverflow YGNodeStyleGetOverflow(const YGNodeConstRef node) { YGOverflow YGNodeStyleGetOverflow(const YGNodeConstRef node) {
@@ -163,7 +135,7 @@ YGOverflow YGNodeStyleGetOverflow(const YGNodeConstRef node) {
} }
void YGNodeStyleSetDisplay(const YGNodeRef node, const YGDisplay display) { void YGNodeStyleSetDisplay(const YGNodeRef node, const YGDisplay display) {
updateStyle<MSVC_HINT(display)>(node, &Style::display, scopedEnum(display)); updateStyle<&Style::display, &Style::setDisplay>(node, scopedEnum(display));
} }
YGDisplay YGNodeStyleGetDisplay(const YGNodeConstRef node) { YGDisplay YGNodeStyleGetDisplay(const YGNodeConstRef node) {
@@ -231,12 +203,12 @@ YGValue YGNodeStyleGetFlexBasis(const YGNodeConstRef node) {
} }
void YGNodeStyleSetPosition(YGNodeRef node, YGEdge edge, float points) { void YGNodeStyleSetPosition(YGNodeRef node, YGEdge edge, float points) {
updateIndexedStyleProp<&Style::position, &Style::setPosition>( updateStyle<&Style::position, &Style::setPosition>(
node, scopedEnum(edge), value::points(points)); node, scopedEnum(edge), value::points(points));
} }
void YGNodeStyleSetPositionPercent(YGNodeRef node, YGEdge edge, float percent) { void YGNodeStyleSetPositionPercent(YGNodeRef node, YGEdge edge, float percent) {
updateIndexedStyleProp<&Style::position, &Style::setPosition>( updateStyle<&Style::position, &Style::setPosition>(
node, scopedEnum(edge), value::percent(percent)); node, scopedEnum(edge), value::percent(percent));
} }
@@ -245,17 +217,17 @@ YGValue YGNodeStyleGetPosition(YGNodeConstRef node, YGEdge edge) {
} }
void YGNodeStyleSetMargin(YGNodeRef node, YGEdge edge, float points) { void YGNodeStyleSetMargin(YGNodeRef node, YGEdge edge, float points) {
updateIndexedStyleProp<&Style::margin, &Style::setMargin>( updateStyle<&Style::margin, &Style::setMargin>(
node, scopedEnum(edge), value::points(points)); node, scopedEnum(edge), value::points(points));
} }
void YGNodeStyleSetMarginPercent(YGNodeRef node, YGEdge edge, float percent) { void YGNodeStyleSetMarginPercent(YGNodeRef node, YGEdge edge, float percent) {
updateIndexedStyleProp<&Style::margin, &Style::setMargin>( updateStyle<&Style::margin, &Style::setMargin>(
node, scopedEnum(edge), value::percent(percent)); node, scopedEnum(edge), value::percent(percent));
} }
void YGNodeStyleSetMarginAuto(YGNodeRef node, YGEdge edge) { void YGNodeStyleSetMarginAuto(YGNodeRef node, YGEdge edge) {
updateIndexedStyleProp<&Style::margin, &Style::setMargin>( updateStyle<&Style::margin, &Style::setMargin>(
node, scopedEnum(edge), value::ofAuto()); node, scopedEnum(edge), value::ofAuto());
} }
@@ -264,12 +236,12 @@ YGValue YGNodeStyleGetMargin(YGNodeConstRef node, YGEdge edge) {
} }
void YGNodeStyleSetPadding(YGNodeRef node, YGEdge edge, float points) { void YGNodeStyleSetPadding(YGNodeRef node, YGEdge edge, float points) {
updateIndexedStyleProp<&Style::padding, &Style::setPadding>( updateStyle<&Style::padding, &Style::setPadding>(
node, scopedEnum(edge), value::points(points)); node, scopedEnum(edge), value::points(points));
} }
void YGNodeStyleSetPaddingPercent(YGNodeRef node, YGEdge edge, float percent) { void YGNodeStyleSetPaddingPercent(YGNodeRef node, YGEdge edge, float percent) {
updateIndexedStyleProp<&Style::padding, &Style::setPadding>( updateStyle<&Style::padding, &Style::setPadding>(
node, scopedEnum(edge), value::percent(percent)); node, scopedEnum(edge), value::percent(percent));
} }
@@ -281,7 +253,7 @@ void YGNodeStyleSetBorder(
const YGNodeRef node, const YGNodeRef node,
const YGEdge edge, const YGEdge edge,
const float border) { const float border) {
updateIndexedStyleProp<&Style::border, &Style::setBorder>( updateStyle<&Style::border, &Style::setBorder>(
node, scopedEnum(edge), value::points(border)); node, scopedEnum(edge), value::points(border));
} }
@@ -298,7 +270,7 @@ void YGNodeStyleSetGap(
const YGNodeRef node, const YGNodeRef node,
const YGGutter gutter, const YGGutter gutter,
const float gapLength) { const float gapLength) {
updateIndexedStyleProp<&Style::gap, &Style::setGap>( updateStyle<&Style::gap, &Style::setGap>(
node, scopedEnum(gutter), value::points(gapLength)); node, scopedEnum(gutter), value::points(gapLength));
} }
@@ -322,17 +294,17 @@ float YGNodeStyleGetAspectRatio(const YGNodeConstRef node) {
} }
void YGNodeStyleSetWidth(YGNodeRef node, float points) { void YGNodeStyleSetWidth(YGNodeRef node, float points) {
updateIndexedStyleProp<&Style::dimension, &Style::setDimension>( updateStyle<&Style::dimension, &Style::setDimension>(
node, Dimension::Width, value::points(points)); node, Dimension::Width, value::points(points));
} }
void YGNodeStyleSetWidthPercent(YGNodeRef node, float percent) { void YGNodeStyleSetWidthPercent(YGNodeRef node, float percent) {
updateIndexedStyleProp<&Style::dimension, &Style::setDimension>( updateStyle<&Style::dimension, &Style::setDimension>(
node, Dimension::Width, value::percent(percent)); node, Dimension::Width, value::percent(percent));
} }
void YGNodeStyleSetWidthAuto(YGNodeRef node) { void YGNodeStyleSetWidthAuto(YGNodeRef node) {
updateIndexedStyleProp<&Style::dimension, &Style::setDimension>( updateStyle<&Style::dimension, &Style::setDimension>(
node, Dimension::Width, value::ofAuto()); node, Dimension::Width, value::ofAuto());
} }
@@ -341,17 +313,17 @@ YGValue YGNodeStyleGetWidth(YGNodeConstRef node) {
} }
void YGNodeStyleSetHeight(YGNodeRef node, float points) { void YGNodeStyleSetHeight(YGNodeRef node, float points) {
updateIndexedStyleProp<&Style::dimension, &Style::setDimension>( updateStyle<&Style::dimension, &Style::setDimension>(
node, Dimension::Height, value::points(points)); node, Dimension::Height, value::points(points));
} }
void YGNodeStyleSetHeightPercent(YGNodeRef node, float percent) { void YGNodeStyleSetHeightPercent(YGNodeRef node, float percent) {
updateIndexedStyleProp<&Style::dimension, &Style::setDimension>( updateStyle<&Style::dimension, &Style::setDimension>(
node, Dimension::Height, value::percent(percent)); node, Dimension::Height, value::percent(percent));
} }
void YGNodeStyleSetHeightAuto(YGNodeRef node) { void YGNodeStyleSetHeightAuto(YGNodeRef node) {
updateIndexedStyleProp<&Style::dimension, &Style::setDimension>( updateStyle<&Style::dimension, &Style::setDimension>(
node, Dimension::Height, value::ofAuto()); node, Dimension::Height, value::ofAuto());
} }
@@ -360,12 +332,12 @@ YGValue YGNodeStyleGetHeight(YGNodeConstRef node) {
} }
void YGNodeStyleSetMinWidth(const YGNodeRef node, const float minWidth) { void YGNodeStyleSetMinWidth(const YGNodeRef node, const float minWidth) {
updateIndexedStyleProp<&Style::minDimension, &Style::setMinDimension>( updateStyle<&Style::minDimension, &Style::setMinDimension>(
node, Dimension::Width, value::points(minWidth)); node, Dimension::Width, value::points(minWidth));
} }
void YGNodeStyleSetMinWidthPercent(const YGNodeRef node, const float minWidth) { void YGNodeStyleSetMinWidthPercent(const YGNodeRef node, const float minWidth) {
updateIndexedStyleProp<&Style::minDimension, &Style::setMinDimension>( updateStyle<&Style::minDimension, &Style::setMinDimension>(
node, Dimension::Width, value::percent(minWidth)); node, Dimension::Width, value::percent(minWidth));
} }
@@ -374,14 +346,14 @@ YGValue YGNodeStyleGetMinWidth(const YGNodeConstRef node) {
} }
void YGNodeStyleSetMinHeight(const YGNodeRef node, const float minHeight) { void YGNodeStyleSetMinHeight(const YGNodeRef node, const float minHeight) {
updateIndexedStyleProp<&Style::minDimension, &Style::setMinDimension>( updateStyle<&Style::minDimension, &Style::setMinDimension>(
node, Dimension::Height, value::points(minHeight)); node, Dimension::Height, value::points(minHeight));
} }
void YGNodeStyleSetMinHeightPercent( void YGNodeStyleSetMinHeightPercent(
const YGNodeRef node, const YGNodeRef node,
const float minHeight) { const float minHeight) {
updateIndexedStyleProp<&Style::minDimension, &Style::setMinDimension>( updateStyle<&Style::minDimension, &Style::setMinDimension>(
node, Dimension::Height, value::percent(minHeight)); node, Dimension::Height, value::percent(minHeight));
} }
@@ -390,12 +362,12 @@ YGValue YGNodeStyleGetMinHeight(const YGNodeConstRef node) {
} }
void YGNodeStyleSetMaxWidth(const YGNodeRef node, const float maxWidth) { void YGNodeStyleSetMaxWidth(const YGNodeRef node, const float maxWidth) {
updateIndexedStyleProp<&Style::maxDimension, &Style::setMaxDimension>( updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
node, Dimension::Width, value::points(maxWidth)); node, Dimension::Width, value::points(maxWidth));
} }
void YGNodeStyleSetMaxWidthPercent(const YGNodeRef node, const float maxWidth) { void YGNodeStyleSetMaxWidthPercent(const YGNodeRef node, const float maxWidth) {
updateIndexedStyleProp<&Style::maxDimension, &Style::setMaxDimension>( updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
node, Dimension::Width, value::percent(maxWidth)); node, Dimension::Width, value::percent(maxWidth));
} }
@@ -404,14 +376,14 @@ YGValue YGNodeStyleGetMaxWidth(const YGNodeConstRef node) {
} }
void YGNodeStyleSetMaxHeight(const YGNodeRef node, const float maxHeight) { void YGNodeStyleSetMaxHeight(const YGNodeRef node, const float maxHeight) {
updateIndexedStyleProp<&Style::maxDimension, &Style::setMaxDimension>( updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
node, Dimension::Height, value::points(maxHeight)); node, Dimension::Height, value::points(maxHeight));
} }
void YGNodeStyleSetMaxHeightPercent( void YGNodeStyleSetMaxHeightPercent(
const YGNodeRef node, const YGNodeRef node,
const float maxHeight) { const float maxHeight) {
updateIndexedStyleProp<&Style::maxDimension, &Style::setMaxDimension>( updateStyle<&Style::maxDimension, &Style::setMaxDimension>(
node, Dimension::Height, value::percent(maxHeight)); node, Dimension::Height, value::percent(maxHeight));
} }

View File

@@ -61,8 +61,8 @@ class YG_EXPORT Node : public ::YGNode {
Direction direction) const; Direction direction) const;
void useWebDefaults() { void useWebDefaults() {
style_.flexDirection() = FlexDirection::Row; style_.setFlexDirection(FlexDirection::Row);
style_.alignContent() = Align::Stretch; style_.setAlignContent(Align::Stretch);
} }
template <auto Field> template <auto Field>

View File

@@ -55,22 +55,9 @@ class YG_EXPORT Style {
static constexpr float DefaultFlexShrink = 0.0f; static constexpr float DefaultFlexShrink = 0.0f;
static constexpr float WebDefaultFlexShrink = 1.0f; static constexpr float WebDefaultFlexShrink = 1.0f;
template <typename T>
struct BitfieldRef {
Style& style;
uint8_t offset;
operator T() const {
return getEnumData<T>(style.flags, offset);
}
BitfieldRef<T>& operator=(T x) {
setEnumData<T>(style.flags, offset, x);
return *this;
}
};
Style() { Style() {
alignContent() = Align::FlexStart; setAlignContent(Align::FlexStart);
alignItems() = Align::Stretch; setAlignItems(Align::Stretch);
} }
~Style() = default; ~Style() = default;
@@ -99,7 +86,7 @@ class YG_EXPORT Style {
static constexpr uint8_t displayOffset = static constexpr uint8_t displayOffset =
overflowOffset + minimumBitCount<Overflow>(); overflowOffset + minimumBitCount<Overflow>();
uint32_t flags = 0; uint32_t flags_ = 0;
FloatOptional flex_ = {}; FloatOptional flex_ = {};
FloatOptional flexGrow_ = {}; FloatOptional flexGrow_ = {};
@@ -118,73 +105,73 @@ class YG_EXPORT Style {
public: public:
Direction direction() const { Direction direction() const {
return getEnumData<Direction>(flags, directionOffset); return getEnumData<Direction>(flags_, directionOffset);
} }
BitfieldRef<Direction> direction() { void setDirection(Direction value) {
return {*this, directionOffset}; setEnumData<Direction>(flags_, directionOffset, value);
} }
FlexDirection flexDirection() const { FlexDirection flexDirection() const {
return getEnumData<FlexDirection>(flags, flexdirectionOffset); return getEnumData<FlexDirection>(flags_, flexdirectionOffset);
} }
BitfieldRef<FlexDirection> flexDirection() { void setFlexDirection(FlexDirection value) {
return {*this, flexdirectionOffset}; setEnumData<FlexDirection>(flags_, flexdirectionOffset, value);
} }
Justify justifyContent() const { Justify justifyContent() const {
return getEnumData<Justify>(flags, justifyContentOffset); return getEnumData<Justify>(flags_, justifyContentOffset);
} }
BitfieldRef<Justify> justifyContent() { void setJustifyContent(Justify value) {
return {*this, justifyContentOffset}; setEnumData<Justify>(flags_, justifyContentOffset, value);
} }
Align alignContent() const { Align alignContent() const {
return getEnumData<Align>(flags, alignContentOffset); return getEnumData<Align>(flags_, alignContentOffset);
} }
BitfieldRef<Align> alignContent() { void setAlignContent(Align value) {
return {*this, alignContentOffset}; setEnumData<Align>(flags_, alignContentOffset, value);
} }
Align alignItems() const { Align alignItems() const {
return getEnumData<Align>(flags, alignItemsOffset); return getEnumData<Align>(flags_, alignItemsOffset);
} }
BitfieldRef<Align> alignItems() { void setAlignItems(Align value) {
return {*this, alignItemsOffset}; setEnumData<Align>(flags_, alignItemsOffset, value);
} }
Align alignSelf() const { Align alignSelf() const {
return getEnumData<Align>(flags, alignSelfOffset); return getEnumData<Align>(flags_, alignSelfOffset);
} }
BitfieldRef<Align> alignSelf() { void setAlignSelf(Align value) {
return {*this, alignSelfOffset}; setEnumData<Align>(flags_, alignSelfOffset, value);
} }
PositionType positionType() const { PositionType positionType() const {
return getEnumData<PositionType>(flags, positionTypeOffset); return getEnumData<PositionType>(flags_, positionTypeOffset);
} }
BitfieldRef<PositionType> positionType() { void setPositionType(PositionType value) {
return {*this, positionTypeOffset}; setEnumData<PositionType>(flags_, positionTypeOffset, value);
} }
Wrap flexWrap() const { Wrap flexWrap() const {
return getEnumData<Wrap>(flags, flexWrapOffset); return getEnumData<Wrap>(flags_, flexWrapOffset);
} }
BitfieldRef<Wrap> flexWrap() { void setFlexWrap(Wrap value) {
return {*this, flexWrapOffset}; setEnumData<Wrap>(flags_, flexWrapOffset, value);
} }
Overflow overflow() const { Overflow overflow() const {
return getEnumData<Overflow>(flags, overflowOffset); return getEnumData<Overflow>(flags_, overflowOffset);
} }
BitfieldRef<Overflow> overflow() { void setOverflow(Overflow value) {
return {*this, overflowOffset}; setEnumData<Overflow>(flags_, overflowOffset, value);
} }
Display display() const { Display display() const {
return getEnumData<Display>(flags, displayOffset); return getEnumData<Display>(flags_, displayOffset);
} }
BitfieldRef<Display> display() { void setDisplay(Display value) {
return {*this, displayOffset}; setEnumData<Display>(flags_, displayOffset, value);
} }
FloatOptional flex() const { FloatOptional flex() const {
@@ -295,7 +282,7 @@ class YG_EXPORT Style {
} }
bool operator==(const Style& other) const { bool operator==(const Style& other) const {
return flags == other.flags && inexactEquals(flex_, other.flex_) && return flags_ == other.flags_ && inexactEquals(flex_, other.flex_) &&
inexactEquals(flexGrow_, other.flexGrow_) && inexactEquals(flexGrow_, other.flexGrow_) &&
inexactEquals(flexShrink_, other.flexShrink_) && inexactEquals(flexShrink_, other.flexShrink_) &&
inexactEquals(flexBasis_, other.flexBasis_) && inexactEquals(flexBasis_, other.flexBasis_) &&