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

Method measureLayout

valdi/src/valdi/android/NativeBridge.cpp:1096–1126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1094}
1095
1096jlong ValdiAndroid::NativeBridge::measureLayout( // NOLINT
1097 fbjni::alias_ref<fbjni::JClass> /* clazz */, // NOLINT
1098 jlong runtimeHandle,
1099 jlong contextHandle,
1100 jint maxWidth,
1101 jint widthMode,
1102 jint maxHeight,
1103 jint heightMode,
1104 jboolean isRTL) {
1105 auto viewNodeTree = getViewNodeTree(contextHandle);
1106 auto* runtimeWrapper = getRuntimeWrapper(runtimeHandle);
1107
1108 if (viewNodeTree == nullptr || runtimeWrapper == nullptr) {
1109 return 0;
1110 }
1111
1112 auto pointScale = runtimeWrapper->getPointScale();
1113
1114 auto resolvedWidthMode = static_cast<Valdi::MeasureMode>(widthMode);
1115 auto resolvedHeightMode = static_cast<Valdi::MeasureMode>(heightMode);
1116 auto maxWidthFloat = static_cast<float>(maxWidth) / pointScale;
1117 auto maxHeightFloat = static_cast<float>(maxHeight) / pointScale;
1118
1119 auto layoutDirection = static_cast<bool>(isRTL) ? Valdi::LayoutDirectionRTL : Valdi::LayoutDirectionLTR;
1120
1121 auto lock = viewNodeTree->lock();
1122 auto measuredSize = viewNodeTree->measureLayout(
1123 maxWidthFloat, resolvedWidthMode, maxHeightFloat, resolvedHeightMode, layoutDirection);
1124
1125 return Valdi::pointsToPackedPixels(measuredSize.width, measuredSize.height, pointScale);
1126}
1127
1128void ValdiAndroid::NativeBridge::setLayoutSpecs( // NOLINT
1129 fbjni::alias_ref<fbjni::JClass> /* clazz */, // NOLINT

Callers 3

TESTFunction · 0.45
measureAsyncMethod · 0.45
calculateLayoutMethod · 0.45

Calls 5

getViewNodeTreeFunction · 0.85
getRuntimeWrapperFunction · 0.85
pointsToPackedPixelsFunction · 0.85
getPointScaleMethod · 0.45
lockMethod · 0.45

Tested by 1

TESTFunction · 0.36