void ScrollingTree::removeDestroyedNodes(ScrollingStateTree* stateTree) { const Vector<ScrollingNodeID>& removedNodes = stateTree->removedNodes(); size_t size = removedNodes.size(); for (size_t i = 0; i < size; ++i) { ScrollingTreeNode* node = m_nodeMap.take(removedNodes[i]); // Never destroy the root node. There will be a new root node in the state tree, and we will // associate it with our existing root node in updateTreeFromStateNode(). if (node && node->parent()) m_rootNode->removeChild(node); } }
void ScrollingTree::removeDestroyedNodes(const ScrollingStateTree& stateTree) { for (const auto& removedNode : stateTree.removedNodes()) { ScrollingTreeNode* node = m_nodeMap.take(removedNode); if (!node) continue; if (node->scrollingNodeID() == m_latchedNode) clearLatchedNode(); // Never destroy the root node. There will be a new root node in the state tree, and we will // associate it with our existing root node in updateTreeFromStateNode(). if (node->parent()) m_rootNode->removeChild(node); } }