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

Method removeViewNode

valdi/src/valdi/runtime/Context/ViewNodeTree.cpp:494–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

492// Raw APIs
493
494Ref<ViewNode> ViewNodeTree::removeViewNode(RawViewNodeId id) {
495 const auto& iterator = _rawViewNodes.find(id);
496 if (iterator == _rawViewNodes.end()) {
497 return nullptr;
498 }
499
500 auto viewNode = iterator->second;
501 _rawViewNodes.erase(iterator);
502
503 auto& viewTransactionScope = getCurrentViewTransactionScope();
504
505 while (viewNode->getChildCount() > 0) {
506 auto* child = viewNode->getChildAt(viewNode->getChildCount() - 1);
507 if (removeViewNode(child->getRawId()) == nullptr) {
508 child->removeFromParent(viewTransactionScope);
509 }
510 }
511
512 viewNode->clear(viewTransactionScope);
513
514 if (viewNode == _rootViewNode) {
515 setRootViewNode(nullptr, false);
516 }
517
518 return viewNode;
519}
520
521Ref<ViewNode> ViewNodeTree::getViewNode(RawViewNodeId id) {
522 const auto& iterator = _rawViewNodes.find(id);

Callers 3

destroyTreeMethod · 0.80
destroyViewNodeTreeMethod · 0.80
visitMethod · 0.80

Calls 8

getRawIdMethod · 0.80
endMethod · 0.65
clearMethod · 0.65
findMethod · 0.45
eraseMethod · 0.45
getChildCountMethod · 0.45
getChildAtMethod · 0.45
removeFromParentMethod · 0.45

Tested by 1

destroyTreeMethod · 0.64