Added isVisible flag and getter / setter.

This commit is contained in:
roxlu
2016-11-03 20:47:23 +01:00
parent 630ae0972b
commit a048b6e4c7
2 changed files with 14 additions and 0 deletions

View File

@@ -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 "

View File

@@ -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);