From c9a4de22db039ab2b5e8126e2b26c1584dbf5ad8 Mon Sep 17 00:00:00 2001 From: Joe Vilches Date: Fri, 9 Feb 2024 16:44:32 -0800 Subject: [PATCH] Support for (de)serializing node state Summary: X-link: https://github.com/facebook/yoga/pull/1570 X-link: https://github.com/facebook/react-native/pull/42751 tsia. Need node state Changelog: [Internal] Reviewed By: NickGerleman Differential Revision: D53206323 fbshipit-source-id: eb48c3873536eb52c8ffcce8005725da274e5373 --- lib/yoga/src/main/cpp/yoga/YGNode.cpp | 4 ++++ lib/yoga/src/main/cpp/yoga/YGNode.h | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/yoga/src/main/cpp/yoga/YGNode.cpp b/lib/yoga/src/main/cpp/yoga/YGNode.cpp index d3265e0149e..57f0473b05e 100644 --- a/lib/yoga/src/main/cpp/yoga/YGNode.cpp +++ b/lib/yoga/src/main/cpp/yoga/YGNode.cpp @@ -329,6 +329,10 @@ void YGNodeSetAlwaysFormsContainingBlock( resolveRef(node)->setAlwaysFormsContainingBlock(alwaysFormsContainingBlock); } +bool YGNodeGetAlwaysFormsContainingBlock(YGNodeConstRef node) { + return resolveRef(node)->alwaysFormsContainingBlock(); +} + // TODO: This leaks internal details to the public API. Remove after removing // ComponentKit usage of it. bool YGNodeCanUseCachedMeasurement( diff --git a/lib/yoga/src/main/cpp/yoga/YGNode.h b/lib/yoga/src/main/cpp/yoga/YGNode.h index e6f233acea5..448000ebd71 100644 --- a/lib/yoga/src/main/cpp/yoga/YGNode.h +++ b/lib/yoga/src/main/cpp/yoga/YGNode.h @@ -273,6 +273,14 @@ YG_EXPORT void YGNodeSetAlwaysFormsContainingBlock( YGNodeRef node, bool alwaysFormsContainingBlock); +/** + * Whether the node will always form a containing block for any descendant. This + * can happen in situation where the client implements something like a + * transform that can affect containing blocks but is not handled by Yoga + * directly. + */ +YG_EXPORT bool YGNodeGetAlwaysFormsContainingBlock(YGNodeConstRef node); + /** * @deprecated */