Layout marker metadata

Summary:
@public

Adds marker meta data to `YGMarkerLayout`: the number of measures, and the numbers of layouts for all nodes in the tree.

Reviewed By: SidharthGuglani

Differential Revision: D13838975

fbshipit-source-id: d575c26a3d5a4f0b66834eb6bedecadc3f3ca265
This commit is contained in:
David Aurelio
2019-01-29 11:41:36 -08:00
committed by Facebook Github Bot
parent fc6a4b6dbb
commit 0dafa0de6b
2 changed files with 13 additions and 1 deletions
+11 -1
View File
@@ -18,7 +18,8 @@ typedef YG_ENUM_BEGIN(YGMarker){
} YG_ENUM_END(YGMarker);
typedef struct {
int unused;
int layouts;
int measures;
} YGMarkerLayoutData;
typedef union {
@@ -54,6 +55,15 @@ struct MarkerData<YGMarkerLayout> {
};
} // namespace detail
template <YGMarker M>
typename detail::MarkerData<M>::type* data(YGMarkerData) = delete;
template <>
inline YGMarkerLayoutData* data<YGMarkerLayout>(YGMarkerData d) {
return d.layout;
}
} // namespace marker
} // namespace yoga
} // namespace facebook
+2
View File
@@ -2685,6 +2685,8 @@ static void YGNodelayoutImpl(
"availableHeight is indefinite so heightMeasureMode must be "
"YGMeasureModeUndefined");
(performLayout ? layoutMarkerData.layouts : layoutMarkerData.measures) += 1;
// Set the resolved resolution in the node's layout.
const YGDirection direction = node->resolveDirection(ownerDirection);
node->setLayoutDirection(direction);