Move event NodeLayout to end of NodeLayout step

Summary:
Added event NodeLayoutEnd and this is being used now instead of NodeLayout
It will be used later to add more information about caches

Reviewed By: davidaurelio

Differential Revision: D15920935

fbshipit-source-id: c9f5e193bc8cc70d26ff5d84882d483c9b09f67d
This commit is contained in:
Sidharth Guglani
2019-06-24 08:29:59 -07:00
committed by Facebook Github Bot
parent d667ebd66e
commit 2dc5a16d1f
2 changed files with 12 additions and 4 deletions

View File

@@ -96,12 +96,18 @@ TEST_F(EventTest, layout_events) {
YGNodeCalculateLayout(root, 123, 456, YGDirectionLTR);
ASSERT_EQ(events[2].node, root);
ASSERT_EQ(events[2].node, child);
ASSERT_EQ(events[2].type, Event::NodeLayout);
ASSERT_EQ(events[3].node, child);
ASSERT_EQ(events[3].type, Event::NodeLayout);
ASSERT_EQ(events[4].node, child);
ASSERT_EQ(events[4].type, Event::NodeLayout);
ASSERT_EQ(events[5].node, root);
ASSERT_EQ(events[5].type, Event::NodeLayout);
YGNodeFreeRecursive(root);
}

View File

@@ -3693,9 +3693,6 @@ bool YGLayoutNodeInternal(
const YGConfigRef config,
YGMarkerLayoutData& layoutMarkerData,
void* const layoutContext) {
#ifdef YG_ENABLE_EVENTS
Event::publish<Event::NodeLayout>(node, {performLayout, layoutContext});
#endif
YGLayout* layout = &node->getLayout();
gDepth++;
@@ -3929,6 +3926,11 @@ bool YGLayoutNodeInternal(
gDepth--;
layout->generationCount = gCurrentGenerationCount;
#ifdef YG_ENABLE_EVENTS
Event::publish<Event::NodeLayout>(node, {performLayout, layoutContext});
#endif
return (needToVisitNode || cachedResults == nullptr);
}