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

Function preserveFindDescendantById

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

Source from the content-addressed store, hash-verified

964 nodeTop = nextTop;
965 }
966 return anchor;
967}
968
969ViewNode* preserveFindDescendantById(ViewNode* node, RawViewNodeId id, int depth) {
970 // id 0 is the unset/default rawId (e.g. synthetic placeholder nodes); never "match" it, or
971 // we would anchor to the first id-less node (content top) and jump the viewport.
972 if (depth <= 0 || id == 0)
973 return nullptr;
974 for (auto* child : *node) {
975 if (child->getRawId() == id)
976 return child;
977 auto* found = preserveFindDescendantById(child, id, depth - 1);
978 if (found)
979 return found;
980 }
981 return nullptr;
982}

Callers 1

updateScrollStateMethod · 0.85

Calls 1

getRawIdMethod · 0.80

Tested by

no test coverage detected