From 0f250490d48b2af459729bb37caf593352979fd2 Mon Sep 17 00:00:00 2001 From: Sidharth Guglani Date: Wed, 10 Jul 2019 08:43:41 -0700 Subject: [PATCH] add baseline start and baseline end events Summary: Adds Baseline start and end events to be handled later for instrumentation Reviewed By: davidaurelio Differential Revision: D16048790 fbshipit-source-id: 8409dbb633168753a7bf8fab20bc6551d113ddd6 --- tests/EventsTest.cpp | 3 +++ yoga/Yoga.cpp | 6 ++++++ yoga/event/event.h | 2 ++ 3 files changed, 11 insertions(+) diff --git a/tests/EventsTest.cpp b/tests/EventsTest.cpp index e10efa07..fd8acf86 100644 --- a/tests/EventsTest.cpp +++ b/tests/EventsTest.cpp @@ -300,6 +300,9 @@ void EventTest::listen(const YGNode& node, Event::Type type, Event::Data data) { case Event::MeasureCallbackStart: case Event::MeasureCallbackEnd: break; + case Event::NodeBaselineStart: + case Event::NodeBaselineEnd: + break; } } diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index e35c8db9..d8175295 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -997,12 +997,18 @@ static inline YGAlign YGNodeAlignItem(const YGNode* node, const YGNode* child) { static float YGBaseline(const YGNodeRef node, void* layoutContext) { if (node->hasBaselineFunc()) { + + Event::publish(node); + const float baseline = marker::MarkerSection::wrap( node, &YGNode::baseline, node->getLayout().measuredDimensions[YGDimensionWidth], node->getLayout().measuredDimensions[YGDimensionHeight], layoutContext); + + Event::publish(node); + YGAssertWithNode( node, !YGFloatIsUndefined(baseline), diff --git a/yoga/event/event.h b/yoga/event/event.h index 1f2cf90f..2043cc8c 100644 --- a/yoga/event/event.h +++ b/yoga/event/event.h @@ -33,6 +33,8 @@ struct Event { LayoutPassEnd, MeasureCallbackStart, MeasureCallbackEnd, + NodeBaselineStart, + NodeBaselineEnd, }; class Data; using Subscriber = void(const YGNode&, Type, Data);