diff --git a/yoga/YGMarker.h b/yoga/YGMarker.h index 625adc2c..d9bb1277 100644 --- a/yoga/YGMarker.h +++ b/yoga/YGMarker.h @@ -25,6 +25,7 @@ typedef struct { int maxMeasureCache; int cachedLayouts; int cachedMeasures; + int measureCallbacks; } YGMarkerLayoutData; typedef struct { diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index 1fa81110..cbdb9561 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -1581,6 +1581,7 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions( const YGMeasureMode heightMeasureMode, const float ownerWidth, const float ownerHeight, + YGMarkerLayoutData& layoutMarkerData, void* const layoutContext) { YGAssertWithNode( node, @@ -1634,6 +1635,7 @@ static void YGNodeWithMeasureFuncSetMeasuredDimensions( innerHeight, heightMeasureMode, layoutContext); + layoutMarkerData.measureCallbacks += 1; #ifdef YG_ENABLE_EVENTS Event::publish( @@ -2700,6 +2702,7 @@ static void YGNodelayoutImpl( heightMeasureMode, ownerWidth, ownerHeight, + layoutMarkerData, layoutContext); return; } @@ -4101,13 +4104,13 @@ void YGNodeCalculateLayoutWithContext( #endif } +#ifdef YG_ENABLE_EVENTS + Event::publish(node, {layoutContext, &marker->data}); +#endif + // end marker here marker = nullptr; -#ifdef YG_ENABLE_EVENTS - Event::publish(node, {layoutContext}); -#endif - // We want to get rid off `useLegacyStretchBehaviour` from YGConfig. But we // aren't sure whether client's of yoga have gotten rid off this flag or not. // So logging this in YGLayout would help to find out the call sites depending diff --git a/yoga/event/event.h b/yoga/event/event.h index 5a955ea9..c461de3e 100644 --- a/yoga/event/event.h +++ b/yoga/event/event.h @@ -9,6 +9,7 @@ #include #include #include "../YGEnums.h" +#include "../YGMarker.h" struct YGConfig; struct YGNode; @@ -81,6 +82,7 @@ struct Event::TypedData { template <> struct Event::TypedData { void* layoutContext; + YGMarkerLayoutData* layoutData; }; template <>