diff --git a/ReactCommon/yoga/yoga/Yoga.cpp b/ReactCommon/yoga/yoga/Yoga.cpp index 41de51197e747e..1821c86794a05e 100644 --- a/ReactCommon/yoga/yoga/Yoga.cpp +++ b/ReactCommon/yoga/yoga/Yoga.cpp @@ -582,7 +582,10 @@ void updateIndexedStyleProp( YOGA_EXPORT void YGNodeStyleSetDirection( const YGNodeRef node, const YGDirection value) { - updateStyle(node, &YGStyle::direction, value); + if (node->getStyle().direction() != value) { + node->getStyle().direction() = value; + node->markDirtyAndPropogate(); + } } YOGA_EXPORT YGDirection YGNodeStyleGetDirection(const YGNodeConstRef node) { return node->getStyle().direction(); @@ -591,8 +594,10 @@ YOGA_EXPORT YGDirection YGNodeStyleGetDirection(const YGNodeConstRef node) { YOGA_EXPORT void YGNodeStyleSetFlexDirection( const YGNodeRef node, const YGFlexDirection flexDirection) { - updateStyle( - node, &YGStyle::flexDirection, flexDirection); + if (node->getStyle().flexDirection() != flexDirection) { + node->getStyle().flexDirection() = flexDirection; + node->markDirtyAndPropogate(); + } } YOGA_EXPORT YGFlexDirection YGNodeStyleGetFlexDirection(const YGNodeConstRef node) { @@ -602,8 +607,10 @@ YGNodeStyleGetFlexDirection(const YGNodeConstRef node) { YOGA_EXPORT void YGNodeStyleSetJustifyContent( const YGNodeRef node, const YGJustify justifyContent) { - updateStyle( - node, &YGStyle::justifyContent, justifyContent); + if (node->getStyle().justifyContent() != justifyContent) { + node->getStyle().justifyContent() = justifyContent; + node->markDirtyAndPropogate(); + } } YOGA_EXPORT YGJustify YGNodeStyleGetJustifyContent(const YGNodeConstRef node) { return node->getStyle().justifyContent(); @@ -612,8 +619,10 @@ YOGA_EXPORT YGJustify YGNodeStyleGetJustifyContent(const YGNodeConstRef node) { YOGA_EXPORT void YGNodeStyleSetAlignContent( const YGNodeRef node, const YGAlign alignContent) { - updateStyle( - node, &YGStyle::alignContent, alignContent); + if (node->getStyle().alignContent() != alignContent) { + node->getStyle().alignContent() = alignContent; + node->markDirtyAndPropogate(); + } } YOGA_EXPORT YGAlign YGNodeStyleGetAlignContent(const YGNodeConstRef node) { return node->getStyle().alignContent(); @@ -622,7 +631,10 @@ YOGA_EXPORT YGAlign YGNodeStyleGetAlignContent(const YGNodeConstRef node) { YOGA_EXPORT void YGNodeStyleSetAlignItems( const YGNodeRef node, const YGAlign alignItems) { - updateStyle(node, &YGStyle::alignItems, alignItems); + if (node->getStyle().alignItems() != alignItems) { + node->getStyle().alignItems() = alignItems; + node->markDirtyAndPropogate(); + } } YOGA_EXPORT YGAlign YGNodeStyleGetAlignItems(const YGNodeConstRef node) { return node->getStyle().alignItems(); @@ -631,7 +643,10 @@ YOGA_EXPORT YGAlign YGNodeStyleGetAlignItems(const YGNodeConstRef node) { YOGA_EXPORT void YGNodeStyleSetAlignSelf( const YGNodeRef node, const YGAlign alignSelf) { - updateStyle(node, &YGStyle::alignSelf, alignSelf); + if (node->getStyle().alignSelf() != alignSelf) { + node->getStyle().alignSelf() = alignSelf; + node->markDirtyAndPropogate(); + } } YOGA_EXPORT YGAlign YGNodeStyleGetAlignSelf(const YGNodeConstRef node) { return node->getStyle().alignSelf(); @@ -640,8 +655,10 @@ YOGA_EXPORT YGAlign YGNodeStyleGetAlignSelf(const YGNodeConstRef node) { YOGA_EXPORT void YGNodeStyleSetPositionType( const YGNodeRef node, const YGPositionType positionType) { - updateStyle( - node, &YGStyle::positionType, positionType); + if (node->getStyle().positionType() != positionType) { + node->getStyle().positionType() = positionType; + node->markDirtyAndPropogate(); + } } YOGA_EXPORT YGPositionType YGNodeStyleGetPositionType(const YGNodeConstRef node) { @@ -651,7 +668,10 @@ YGNodeStyleGetPositionType(const YGNodeConstRef node) { YOGA_EXPORT void YGNodeStyleSetFlexWrap( const YGNodeRef node, const YGWrap flexWrap) { - updateStyle(node, &YGStyle::flexWrap, flexWrap); + if (node->getStyle().flexWrap() != flexWrap) { + node->getStyle().flexWrap() = flexWrap; + node->markDirtyAndPropogate(); + } } YOGA_EXPORT YGWrap YGNodeStyleGetFlexWrap(const YGNodeConstRef node) { return node->getStyle().flexWrap(); @@ -660,7 +680,10 @@ YOGA_EXPORT YGWrap YGNodeStyleGetFlexWrap(const YGNodeConstRef node) { YOGA_EXPORT void YGNodeStyleSetOverflow( const YGNodeRef node, const YGOverflow overflow) { - updateStyle(node, &YGStyle::overflow, overflow); + if (node->getStyle().overflow() != overflow) { + node->getStyle().overflow() = overflow; + node->markDirtyAndPropogate(); + } } YOGA_EXPORT YGOverflow YGNodeStyleGetOverflow(const YGNodeConstRef node) { return node->getStyle().overflow(); @@ -669,7 +692,10 @@ YOGA_EXPORT YGOverflow YGNodeStyleGetOverflow(const YGNodeConstRef node) { YOGA_EXPORT void YGNodeStyleSetDisplay( const YGNodeRef node, const YGDisplay display) { - updateStyle(node, &YGStyle::display, display); + if (node->getStyle().display() != display) { + node->getStyle().display() = display; + node->markDirtyAndPropogate(); + } } YOGA_EXPORT YGDisplay YGNodeStyleGetDisplay(const YGNodeConstRef node) { return node->getStyle().display();