Marking nodes as dirty when visiblity changes.

This commit is contained in:
roxlu
2016-12-01 12:11:34 +01:00
parent 2ee412c7dd
commit c113b755ec

View File

@@ -291,10 +291,12 @@ bool CSSNodeIsDirty(const CSSNodeRef node) {
void CSSNodeHide(const CSSNodeRef node) { void CSSNodeHide(const CSSNodeRef node) {
node->isVisible = false; node->isVisible = false;
_CSSNodeMarkDirty(node);
} }
void CSSNodeShow(const CSSNodeRef node) { void CSSNodeShow(const CSSNodeRef node) {
node->isVisible = true; node->isVisible = true;
_CSSNodeMarkDirty(node);
} }
WIN_EXPORT bool CSSNodeIsVisible(const CSSNodeRef node) { WIN_EXPORT bool CSSNodeIsVisible(const CSSNodeRef node) {
@@ -2075,9 +2077,9 @@ static void layoutNodeImpl(const CSSNodeRef node,
} }
uint32_t gDepth = 0; uint32_t gDepth = 0;
bool gPrintTree = false; bool gPrintTree = true;
bool gPrintChanges = false; bool gPrintChanges = true;
bool gPrintSkips = false; bool gPrintSkips = true;
static const char *spacer = " "; static const char *spacer = " ";
@@ -2140,6 +2142,7 @@ bool CSSNodeCanUseCachedMeasurement(const bool isTextNode,
const float lastComputedHeight, const float lastComputedHeight,
const float marginRow, const float marginRow,
const float marginColumn) { const float marginColumn) {
if (lastComputedHeight < 0 || lastComputedWidth < 0) { if (lastComputedHeight < 0 || lastComputedWidth < 0) {
return false; return false;
} }
@@ -2194,11 +2197,15 @@ bool layoutNodeInternal(const CSSNodeRef node,
gDepth++; gDepth++;
#if 0
const bool needToVisitNode = const bool needToVisitNode =
(node->isDirty && layout->generationCount != gCurrentGenerationCount) || (node->isDirty && layout->generationCount != gCurrentGenerationCount) ||
layout->lastParentDirection != parentDirection; layout->lastParentDirection != parentDirection;
#else
const bool needToVisitNode = true;
#endif
if (needToVisitNode) { if (needToVisitNode) {
// Invalidate the cached results. // Invalidate the cached results.
layout->nextCachedMeasurementsIndex = 0; layout->nextCachedMeasurementsIndex = 0;
layout->cachedLayout.widthMeasureMode = (CSSMeasureMode) -1; layout->cachedLayout.widthMeasureMode = (CSSMeasureMode) -1;