| 1094 | } |
| 1095 | |
| 1096 | jlong 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 | |
| 1128 | void ValdiAndroid::NativeBridge::setLayoutSpecs( // NOLINT |
| 1129 | fbjni::alias_ref<fbjni::JClass> /* clazz */, // NOLINT |