From c113b755ec4fa12a3125e87dbd73d8e60899f563 Mon Sep 17 00:00:00 2001 From: roxlu Date: Thu, 1 Dec 2016 12:11:34 +0100 Subject: [PATCH] Marking nodes as dirty when visiblity changes. --- CSSLayout/CSSLayout.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/CSSLayout/CSSLayout.c b/CSSLayout/CSSLayout.c index 6cacefdd..26141fb1 100644 --- a/CSSLayout/CSSLayout.c +++ b/CSSLayout/CSSLayout.c @@ -291,10 +291,12 @@ bool CSSNodeIsDirty(const CSSNodeRef node) { void CSSNodeHide(const CSSNodeRef node) { node->isVisible = false; + _CSSNodeMarkDirty(node); } void CSSNodeShow(const CSSNodeRef node) { node->isVisible = true; + _CSSNodeMarkDirty(node); } WIN_EXPORT bool CSSNodeIsVisible(const CSSNodeRef node) { @@ -2075,9 +2077,9 @@ static void layoutNodeImpl(const CSSNodeRef node, } uint32_t gDepth = 0; -bool gPrintTree = false; -bool gPrintChanges = false; -bool gPrintSkips = false; +bool gPrintTree = true; +bool gPrintChanges = true; +bool gPrintSkips = true; static const char *spacer = " "; @@ -2140,6 +2142,7 @@ bool CSSNodeCanUseCachedMeasurement(const bool isTextNode, const float lastComputedHeight, const float marginRow, const float marginColumn) { + if (lastComputedHeight < 0 || lastComputedWidth < 0) { return false; } @@ -2194,11 +2197,15 @@ bool layoutNodeInternal(const CSSNodeRef node, gDepth++; +#if 0 const bool needToVisitNode = (node->isDirty && layout->generationCount != gCurrentGenerationCount) || layout->lastParentDirection != parentDirection; - +#else + const bool needToVisitNode = true; +#endif if (needToVisitNode) { + // Invalidate the cached results. layout->nextCachedMeasurementsIndex = 0; layout->cachedLayout.widthMeasureMode = (CSSMeasureMode) -1;