Allow MeasureFunc to be set to NULL no matter how many children a node has.
Summary: Within `UIView+CSSLayout`, we often nil out the measure function of a node because view hierarchy can often change. Unfortunately, this causes us to hit an assert which crashes the app. Instead, lets the measure func to be set to NULL, regardless of how many children a node might have. Reviewed By: emilsjolander Differential Revision: D4148727 fbshipit-source-id: 79a0f3ef1bf7b1dce9a14de96f870e35c042b78b
This commit is contained in:
committed by
Facebook Github Bot
parent
502f3c7010
commit
e54af5e854
@@ -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) {
|
||||
|
Reference in New Issue
Block a user