void ScrollingTree::setOrClearLatchedNode(const PlatformWheelEvent& wheelEvent, ScrollingNodeID nodeID) { if (wheelEvent.shouldConsiderLatching()) setLatchedNode(nodeID); else if (wheelEvent.shouldResetLatching()) clearLatchedNode(); }
void ScrollingTree::removeDestroyedNodes(const ScrollingStateTree& stateTree) { for (const auto& removedNodeID : stateTree.removedNodes()) { m_nodeMap.remove(removedNodeID); if (removedNodeID == m_latchedNode) clearLatchedNode(); } }
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); } }