diff --git a/CSSLayout/CSSLayout.c b/CSSLayout/CSSLayout.c index dadaab50..668ba35b 100644 --- a/CSSLayout/CSSLayout.c +++ b/CSSLayout/CSSLayout.c @@ -89,6 +89,7 @@ typedef struct CSSNode { CSSNodeRef parent; CSSNodeListRef children; bool isDirty; + bool isVisible; struct CSSNode *nextChild; @@ -198,6 +199,7 @@ void CSSNodeInit(const CSSNodeRef node) { node->children = NULL; node->hasNewLayout = true; node->isDirty = false; + node->isVisible = true; node->style.flex = CSSUndefined; node->style.flexGrow = CSSUndefined; @@ -287,6 +289,14 @@ bool CSSNodeIsDirty(const CSSNodeRef node) { return node->isDirty; } +void CSSNodeHide(const CSSNodeRef node) { + node->isVisible = false; +} + +void CSSNodeShow(const CSSNodeRef node) { + node->isVisible = true;; +} + inline float CSSNodeStyleGetFlexGrow(CSSNodeRef node) { if (!CSSValueIsUndefined(node->style.flexGrow)) { return node->style.flexGrow; @@ -1190,6 +1200,7 @@ static void layoutNodeImpl(const CSSNodeRef node, const CSSMeasureMode widthMeasureMode, const CSSMeasureMode heightMeasureMode, const bool performLayout) { + CSS_ASSERT(CSSValueIsUndefined(availableWidth) ? widthMeasureMode == CSSMeasureModeUndefined : true, "availableWidth is indefinite so widthMeasureMode must be " diff --git a/CSSLayout/CSSLayout.h b/CSSLayout/CSSLayout.h index 881d8f3b..8a08910c 100644 --- a/CSSLayout/CSSLayout.h +++ b/CSSLayout/CSSLayout.h @@ -157,6 +157,9 @@ WIN_EXPORT void CSSNodeCalculateLayout(const CSSNodeRef node, WIN_EXPORT void CSSNodeMarkDirty(const CSSNodeRef node); WIN_EXPORT bool CSSNodeIsDirty(const CSSNodeRef node); +WIN_EXPORT void CSSNodeHide(const CSSNodeRef node); +WIN_EXPORT void CSSNodeShow(const CSSNodeRef node); + WIN_EXPORT void CSSNodePrint(const CSSNodeRef node, const CSSPrintOptions options); WIN_EXPORT bool CSSValueIsUndefined(const float value);