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

Method onScrollEnd

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

Source from the content-addressed store, hash-verified

1057 break;
1058 // Track the deepest node that has a trackable (non-zero) rawId. If the deepest node is
1059 // id-less we fall back to this ancestor rather than returning an unanchorable node, which
1060 // would clear the anchor and let the next reflow jump.
1061 if (next->getRawId() != 0) {
1062 anchor = next;
1063 }
1064 node = next;
1065 nodeTop = nextTop;
1066 }
1067 return anchor;
1068}
1069
1070ViewNode* preserveFindDescendantById(ViewNode* node, RawViewNodeId id, int depth) {
1071 // id 0 is the unset/default rawId (e.g. synthetic placeholder nodes); never "match" it, or
1072 // we would anchor to the first id-less node (content top) and jump the viewport.
1073 if (depth <= 0 || id == 0)
1074 return nullptr;
1075 for (auto* child : *node) {
1076 if (child->getRawId() == id)
1077 return child;
1078 auto* found = preserveFindDescendantById(child, id, depth - 1);
1079 if (found)
1080 return found;
1081 }

Callers 1

notifyScrollMethod · 0.45

Tested by

no test coverage detected