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

Function ygDirtiedCallback

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

Source from the content-addressed store, hash-verified

3723}
3724
3725void ViewNode::setMaintainScrollAnchor(bool maintain) {
3726 auto& scrollState = getOrCreateScrollState();
3727 scrollState.setMaintainScrollAnchor(maintain);
3728}
3729
3730void ViewNode::setPreserveScrollPosition(bool preserve) {
3731 auto& scrollState = getOrCreateScrollState();
3732 scrollState.setPreserveScrollPosition(preserve);
3733 // Capture the anchor immediately on enable, from the current (still valid, pre-insertion)
3734 // layout. Otherwise the anchor stays empty until the next scroll/layout pass; if that pass is
3735 // a content insertion (live message / forward page), Step 1 in updateScrollState would be
3736 // skipped (no anchor) and the viewport would jump before the anchor is first recorded.
3737 if (preserve && _calculatedFrame.height > 0.0f) {
3738 refreshPreserveAnchor(
3739 this, scrollState, scrollState.getDirectionAgnosticContentOffset().y, _calculatedFrame.height);
3740 }
3741}
3742
3743template<typename F>
3744void ViewNode::updateViewportExtension(F&& handler) {
3745 auto& scrollState = getOrCreateScrollState();

Callers

nothing calls this directly

Calls 8

isLazyLayoutMethod · 0.80
scheduleLazyLayoutMethod · 0.80
getViewNodeTreeMethod · 0.80
scheduleUpdatesMethod · 0.80
resolveRefFunction · 0.50
getContextMethod · 0.45
hasParentMethod · 0.45
onLayoutDirtyMethod · 0.45

Tested by

no test coverage detected