MCPcopy Create free account
hub / github.com/Snapchat/Valdi / updateViewTree

Method updateViewTree

valdi/src/valdi/runtime/Context/ViewNode.cpp:584–634  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

582 limitToViewportEnabled,
583 parentViewChanged,
584 viewInflationEnabled,
585 animator,
586 updateResult,
587 currentViewIndex,
588 viewsCount);
589 }
590 } else {
591 for (ViewNode* childViewNode : *this) {
592 childViewNode->doUpdateViewTree(viewTransactionScope,
593 currentParentView,
594 visibleInViewport,
595 limitToViewportEnabled,
596 parentViewChanged,
597 viewInflationEnabled,
598 animator,
599 updateResult,
600 currentViewIndex,
601 viewsCount);
602 }
603 }
604
605 _numberOfViewChildrenInsertedInTree = *currentViewIndex - beforeViewIndex;
606 _numberOfViewChildren = *viewsCount - beforeViewsCount;
607 } else {
608 *currentViewIndex += _numberOfViewChildrenInsertedInTree;
609 *viewsCount += _numberOfViewChildren;
610 }
611 } else {
612 bool viewChanged = false;
613 if (needView) {
614 if (createView(viewTransactionScope, animator)) {
615 viewChanged = true;
616 updateResult.createdViews++;
617 }
618
619 if (parentViewChanged && _flags[kViewIncludedInParentFlag] && currentParentView == nullptr) {
620 // Case where the parent view has changed, we were included in another parent view
621 // and we don't have a parent view anymore. We need to remove ourself from our previous parent.
622 removeViewFromParent(viewTransactionScope);
623 } else if ((parentViewChanged || !_flags[kViewIncludedInParentFlag]) && currentParentView != nullptr &&
624 hasView()) {
625 // Case where the parent view has changed and we are not included in the new parent
626 // We need to insert ourself in the new parent
627 _flags[kViewIncludedInParentFlag] = true;
628
629 viewTransactionScope.transaction().insertChildView(
630 currentParentView, _view, *currentViewIndex, animator);
631
632 updateResult.reinsertedViews++;
633 syncScrollSpecsWithViewIfNeeded(viewTransactionScope);
634 updateViewFrameIfNeeded(viewTransactionScope, animator);
635 }
636
637 if (_flags[kViewIncludedInParentFlag]) {

Callers 3

TESTFunction · 0.80
setRootViewMethod · 0.80

Calls 3

startMethod · 0.65
elapsedMethod · 0.45

Tested by 2

TESTFunction · 0.64