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

Method setLayoutSpecs

valdi/src/valdi/android/NativeBridge.cpp:1128–1147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1126 auto pointScale = runtimeWrapper->getPointScale();
1127
1128 auto resolvedWidthMode = static_cast<Valdi::MeasureMode>(widthMode);
1129 auto resolvedHeightMode = static_cast<Valdi::MeasureMode>(heightMode);
1130 auto maxWidthFloat = static_cast<float>(maxWidth) / pointScale;
1131 auto maxHeightFloat = static_cast<float>(maxHeight) / pointScale;
1132
1133 auto layoutDirection = static_cast<bool>(isRTL) ? Valdi::LayoutDirectionRTL : Valdi::LayoutDirectionLTR;
1134
1135 auto lock = viewNodeTree->lock();
1136 auto measuredSize = viewNodeTree->measureLayout(
1137 maxWidthFloat, resolvedWidthMode, maxHeightFloat, resolvedHeightMode, layoutDirection);
1138
1139 return Valdi::pointsToPackedPixels(measuredSize.width, measuredSize.height, pointScale);
1140}
1141
1142void ValdiAndroid::NativeBridge::setLayoutSpecs( // NOLINT
1143 fbjni::alias_ref<fbjni::JClass> /* clazz */, // NOLINT
1144 jlong runtimeHandle,
1145 jlong contextHandle,
1146 jint width,
1147 jint height,
1148 jboolean isRTL) {
1149 auto viewNodeTree = getViewNodeTree(contextHandle);
1150 auto* runtimeWrapper = getRuntimeWrapper(runtimeHandle);

Callers

nothing calls this directly

Calls 5

getViewNodeTreeFunction · 0.85
getRuntimeWrapperFunction · 0.85
setLayoutSpecsMethod · 0.65
SizeClass · 0.50
getPointScaleMethod · 0.45

Tested by

no test coverage detected