mirror of
https://github.com/status-im/react-native.git
synced 2025-02-22 06:08:24 +00:00
Marker for baseline callbacks
Summary: @public Wraps baseline callbacks with a marker. Reviewed By: SidharthGuglani Differential Revision: D13896861 fbshipit-source-id: 848ec697977a0a68b9943f1159f6562d54724f89
This commit is contained in:
parent
d2b2316722
commit
e2bd70afff
@ -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<YGMarkerLayout> {
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct MarkerData<YGMarkerMeasure> {
|
||||
struct NoMarkerData {
|
||||
using type = YGMarkerNoData;
|
||||
static type*& get(YGMarkerData& d) {
|
||||
return d.noData;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct MarkerData<YGMarkerMeasure> : NoMarkerData {};
|
||||
|
||||
template <>
|
||||
struct MarkerData<YGMarkerBaselineFn> : NoMarkerData {};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <YGMarker M>
|
||||
|
@ -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<YGMarkerBaselineFn>::wrap(
|
||||
node,
|
||||
node->getBaseline(),
|
||||
node,
|
||||
node->getLayout().measuredDimensions[YGDimensionWidth],
|
||||
node->getLayout().measuredDimensions[YGDimensionHeight]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user