diff --git a/ReactCommon/yoga/yoga/YGConfig.h b/ReactCommon/yoga/yoga/YGConfig.h index 941e0dcd2..b5f3c5fd7 100644 --- a/ReactCommon/yoga/yoga/YGConfig.h +++ b/ReactCommon/yoga/yoga/YGConfig.h @@ -6,6 +6,7 @@ * */ #pragma once +#include "YGMarker.h" #include "Yoga-internal.h" #include "Yoga.h" @@ -14,11 +15,12 @@ struct YGConfig { bool useWebDefaults = false; bool useLegacyStretchBehaviour = false; bool shouldDiffLayoutWithoutLegacyStretchBehaviour = false; + bool printTree = false; float pointScaleFactor = 1.0f; YGLogger logger; YGCloneNodeFunc cloneNodeCallback = nullptr; void* context = nullptr; - bool printTree = false; + YGMarkerCallbacks markerCallbacks = {nullptr, nullptr}; YGConfig(YGLogger logger); }; diff --git a/ReactCommon/yoga/yoga/YGMarker.h b/ReactCommon/yoga/yoga/YGMarker.h new file mode 100644 index 000000000..00c582abd --- /dev/null +++ b/ReactCommon/yoga/yoga/YGMarker.h @@ -0,0 +1,32 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#pragma once + +#include "YGMacros.h" + +YG_EXTERN_C_BEGIN + +typedef struct YGNode* YGNodeRef; + +typedef YG_ENUM_BEGIN(YGMarkerType) {} +YG_ENUM_END(YGMarkerType); + +typedef union { + int unused; +} YGMarkerData; + +typedef struct { + // accepts marker type, a node ref, and marker data (depends on marker type) + // can return a handle or id that Yoga will pass to endMarker + void* (*startMarker)(YGMarkerType, YGNodeRef, YGMarkerData); + // accepts marker type, a node ref, marker data, and marker id as returned + // by startMarker + void (*endMarker)(YGMarkerType, YGNodeRef, YGMarkerData, void* id); +} YGMarkerCallbacks; + +YG_EXTERN_C_END