| 1711 | Size ViewNode::measureExternal(float width, MeasureMode widthMode, float height, MeasureMode heightMode) { |
| 1712 | std::initializer_list<Value> parameters = {Value(static_cast<double>(width)), |
| 1713 | Value(static_cast<int32_t>(widthMode)), |
| 1714 | Value(static_cast<double>(height)), |
| 1715 | Value(static_cast<int32_t>(heightMode))}; |
| 1716 | |
| 1717 | auto retValue = _lazyLayoutData->onMeasureCallback->call(ValueFunctionFlagsCallSync, parameters); |
| 1718 | if (!retValue) { |
| 1719 | VALDI_ERROR(getLogger(), "onMeasure callback returned an error: {}", retValue.error()); |
| 1720 | return Size(); |
| 1721 | } |
| 1722 | const auto* array = retValue.value().getArray(); |
| 1723 | |
| 1724 | if (array == nullptr || array->size() != 2) { |
| 1725 | VALDI_ERROR(getLogger(), |
| 1726 | "onMeasure callback should return an array with two values, got {}", |
| 1727 | retValue.value().toString()); |
| 1728 | return Size(); |
| 1729 | } |
| 1730 | |
| 1731 | return Size((*array)[0].toFloat(), (*array)[1].toFloat()); |
| 1732 | } |
| 1733 | |
| 1734 | bool ViewNode::isMeasurerPlaceholder() const { |
| 1735 | return _emittingViewNode != nullptr; |
| 1736 | } |
| 1737 | |
| 1738 | ViewNode* ViewNode::getEmittingViewNode() const { |
nothing calls this directly
no test coverage detected