Skip to content

Commit

Permalink
Remove layoutContext Threading
Browse files Browse the repository at this point in the history
Summary: kill_with_fire_flamethrower

Differential Revision: D49179244

fbshipit-source-id: d93e30f8c5db8e1dbe67eca843d1055f444c418b
  • Loading branch information
NickGerleman authored and facebook-github-bot committed Sep 12, 2023
1 parent 045d7fe commit fad9f45
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 287 deletions.
7 changes: 0 additions & 7 deletions packages/react-native/ReactCommon/yoga/yoga/Yoga-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@

YG_EXTERN_C_BEGIN

YG_EXPORT void YGNodeCalculateLayoutWithContext(
YGNodeRef node,
float availableWidth,
float availableHeight,
YGDirection ownerDirection,
void* layoutContext);

// Deallocates a Yoga Node. Unlike YGNodeFree, does not remove the node from
// its parent or children.
YG_EXPORT void YGNodeDeallocate(YGNodeRef node);
Expand Down
16 changes: 3 additions & 13 deletions packages/react-native/ReactCommon/yoga/yoga/Yoga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void YGNodeSetBaselineFunc(YGNodeRef node, YGBaselineFunc baselineFunc) {
}

YGDirtiedFunc YGNodeGetDirtiedFunc(YGNodeConstRef node) {
return resolveRef(node)->getDirtied();
return resolveRef(node)->getDirtiedFunc();
}

void YGNodeSetDirtiedFunc(YGNodeRef node, YGDirtiedFunc dirtiedFunc) {
Expand Down Expand Up @@ -805,7 +805,7 @@ void YGNodePrint(const YGNodeConstRef nodeRef, const YGPrintOptions options) {
const auto node = resolveRef(nodeRef);
std::string str;
yoga::nodeToString(str, node, options, 0);
yoga::log(node, YGLogLevelDebug, nullptr, str.c_str());
yoga::log(node, YGLogLevelDebug, str.c_str());
}
#endif

Expand Down Expand Up @@ -927,16 +927,6 @@ void YGNodeCalculateLayout(
const float ownerWidth,
const float ownerHeight,
const YGDirection ownerDirection) {
YGNodeCalculateLayoutWithContext(
node, ownerWidth, ownerHeight, ownerDirection, nullptr);
}

void YGNodeCalculateLayoutWithContext(
const YGNodeRef node,
const float ownerWidth,
const float ownerHeight,
const YGDirection ownerDirection,
void* layoutContext) {
yoga::calculateLayout(
resolveRef(node), ownerWidth, ownerHeight, ownerDirection, layoutContext);
resolveRef(node), ownerWidth, ownerHeight, ownerDirection);
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,14 @@

namespace facebook::yoga {

float calculateBaseline(const yoga::Node* node, void* layoutContext) {
float calculateBaseline(const yoga::Node* node) {
if (node->hasBaselineFunc()) {

Event::publish<Event::NodeBaselineStart>(node);

const float baseline = node->baseline(
node->getLayout().measuredDimensions[YGDimensionWidth],
node->getLayout().measuredDimensions[YGDimensionHeight],
layoutContext);
node->getLayout().measuredDimensions[YGDimensionHeight]);

Event::publish<Event::NodeBaselineEnd>(node);

Expand Down Expand Up @@ -58,7 +57,7 @@ float calculateBaseline(const yoga::Node* node, void* layoutContext) {
return node->getLayout().measuredDimensions[YGDimensionHeight];
}

const float baseline = calculateBaseline(baselineChild, layoutContext);
const float baseline = calculateBaseline(baselineChild);
return baseline + baselineChild->getLayout().position[YGEdgeTop];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace facebook::yoga {

// Calculate baseline represented as an offset from the top edge of the node.
float calculateBaseline(const yoga::Node* node, void* layoutContext);
float calculateBaseline(const yoga::Node* node);

// Whether any of the children of this node participate in baseline alignment
bool isBaselineLayout(const yoga::Node* node);
Expand Down
Loading

0 comments on commit fad9f45

Please sign in to comment.