Allow MeasureFunc to be set to NULL no matter how many children a node has.

Reviewed By: emilsjolander

Differential Revision: D4148727

fbshipit-source-id: 79a0f3ef1bf7b1dce9a14de96f870e35c042b78b
This commit is contained in:
Dustin Shahidehpour 2016-11-09 08:42:45 -08:00 коммит произвёл Facebook Github Bot
Родитель ef31c68911
Коммит 39798ae368
1 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -259,8 +259,13 @@ static void _CSSNodeMarkDirty(const CSSNodeRef node) {
}
void CSSNodeSetMeasureFunc(const CSSNodeRef node, CSSMeasureFunc measureFunc) {
CSS_ASSERT(CSSNodeChildCount(node) == 0, "Cannot set measure function: Nodes with measure functions cannot have children.");
node->measure = measureFunc;
// You can always NULLify the measure function of a node.
if (measureFunc == NULL) {
node->measure = NULL;
} else {
CSS_ASSERT(CSSNodeChildCount(node) == 0, "Cannot set measure function: Nodes with measure functions cannot have children.");
node->measure = measureFunc;
}
}
CSSMeasureFunc CSSNodeGetMeasureFunc(const CSSNodeRef node) {