From e2bd70afffea3ebef5fbaff1d3ab85bc4f7a48d5 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Fri, 1 Feb 2019 03:31:12 -0800 Subject: [PATCH] Marker for baseline callbacks Summary: @public Wraps baseline callbacks with a marker. Reviewed By: SidharthGuglani Differential Revision: D13896861 fbshipit-source-id: 848ec697977a0a68b9943f1159f6562d54724f89 --- ReactCommon/yoga/yoga/YGMarker.h | 10 ++++++++-- ReactCommon/yoga/yoga/Yoga.cpp | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ReactCommon/yoga/yoga/YGMarker.h b/ReactCommon/yoga/yoga/YGMarker.h index 385ee9cf5d8..25362ff525b 100644 --- a/ReactCommon/yoga/yoga/YGMarker.h +++ b/ReactCommon/yoga/yoga/YGMarker.h @@ -16,6 +16,7 @@ typedef struct YGConfig* YGConfigRef; typedef YG_ENUM_BEGIN(YGMarker){ YGMarkerLayout, YGMarkerMeasure, + YGMarkerBaselineFn, } YG_ENUM_END(YGMarker); typedef struct { @@ -66,14 +67,19 @@ struct MarkerData { } }; -template <> -struct MarkerData { +struct NoMarkerData { using type = YGMarkerNoData; static type*& get(YGMarkerData& d) { return d.noData; } }; +template <> +struct MarkerData : NoMarkerData {}; + +template <> +struct MarkerData : NoMarkerData {}; + } // namespace detail template diff --git a/ReactCommon/yoga/yoga/Yoga.cpp b/ReactCommon/yoga/yoga/Yoga.cpp index eac63d9cde6..3f65092b69f 100644 --- a/ReactCommon/yoga/yoga/Yoga.cpp +++ b/ReactCommon/yoga/yoga/Yoga.cpp @@ -1074,7 +1074,9 @@ static inline YGAlign YGNodeAlignItem( static float YGBaseline(const YGNodeRef node) { if (node->getBaseline() != nullptr) { - const float baseline = node->getBaseline()( + const float baseline = marker::MarkerSection::wrap( + node, + node->getBaseline(), node, node->getLayout().measuredDimensions[YGDimensionWidth], node->getLayout().measuredDimensions[YGDimensionHeight]);