diff --git a/tests/InstrumentationTest.cpp b/tests/InstrumentationTest.cpp index 167e782e..be988ec0 100644 --- a/tests/InstrumentationTest.cpp +++ b/tests/InstrumentationTest.cpp @@ -85,6 +85,16 @@ TEST_F(MarkerTest, marker_end_works) { << "pointer returned by `startMarker` was not passed to `endMarker`"; } +TEST_F(MarkerTest, layout_marker) { + auto config = makeConfig(); + auto root = makeNode(config); + + YGNodeCalculateLayout(root.get(), YGUndefined, YGUndefined, YGDirectionLTR); + + ASSERT_EQ(markerCookie.start.marker, YGMarkerLayout); + ASSERT_EQ(markerCookie.start.node, root.get()); +} + void* MarkerTest::startMarker( YGMarker marker, YGNodeRef node, diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index 357e137b..210c6637 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -12,6 +12,7 @@ #include "YGNode.h" #include "YGNodePrint.h" #include "Yoga-internal.h" +#include "instrumentation.h" #ifdef _MSC_VER #include @@ -4004,6 +4005,8 @@ void YGNodeCalculateLayout( const float ownerWidth, const float ownerHeight, const YGDirection ownerDirection) { + marker::MarkerSection marker{node}; + // Increment the generation count. This will force the recursive routine to // visit all dirty nodes at least once. Subsequent visits will be skipped if // the input parameters don't change. @@ -4118,8 +4121,9 @@ void YGNodeCalculateLayout( 0.0f); // Set whether the two layouts are different or not. - node->setLayoutDoesLegacyFlagAffectsLayout( - !originalNode->isLayoutTreeEqualToNode(*node)); + auto neededLegacyStretchBehaviour = + !originalNode->isLayoutTreeEqualToNode(*node); + node->setLayoutDoesLegacyFlagAffectsLayout(neededLegacyStretchBehaviour); if (originalNode->getConfig()->printTree) { YGNodePrint(