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

Method measureLayout

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

Source from the content-addressed store, hash-verified

2302 case SimplifiedScrollDirectionBottomToTop:
2303 directionDependentContentDisplacement.y = -std::min(frame.height, canScrollDistance);
2304 break;
2305 case SimplifiedScrollDirectionLeftToRight:
2306 directionDependentContentDisplacement.x = std::min(frame.width, canScrollDistance);
2307 break;
2308 case SimplifiedScrollDirectionRightToLeft:
2309 directionDependentContentDisplacement.x = -std::min(frame.width, canScrollDistance);
2310 break;
2311 }
2312
2313 auto directionDependentContentOffset = _scrollState->getDirectionDependentContentOffset();
2314 directionDependentContentOffset += directionDependentContentDisplacement;
2315
2316 auto directionAgnosticContentOffset =
2317 _scrollState->resolveDirectionAgnosticContentOffset(directionDependentContentOffset);
2318 setScrollContentOffset(viewTransactionScope, directionAgnosticContentOffset, animated);
2319
2320 if (outScrollPageCurrent != nullptr) {
2321 *outScrollPageCurrent = getPageNumberForContentOffset(directionAgnosticContentOffset);
2322 }
2323 if (outScrollPageMaximum != nullptr) {
2324 auto contentSize = _scrollState->getContentSize();
2325 auto directionAgnosticContentMaximum =
2326 Point(contentSize.width - frame.width, contentSize.height - frame.height);
2327 *outScrollPageMaximum = getPageNumberForContentOffset(directionAgnosticContentMaximum);
2328 }
2329
2330 return true;
2331 }
2332
2333 if (hasParent()) {
2334 return getParent()->scrollByOnePage(

Callers 1

runtimeMeasureContextMethod · 0.45

Calls 2

ygNodeGetFrameFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected