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

Method setIsLazyLayout

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

Source from the content-addressed store, hash-verified

1711Size 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
1734bool ViewNode::isMeasurerPlaceholder() const {
1735 return _emittingViewNode != nullptr;
1736}
1737
1738ViewNode* ViewNode::getEmittingViewNode() const {

Callers

nothing calls this directly

Calls 4

copyChildrenMethod · 0.95
appendChildFunction · 0.50
destroyNodeMethod · 0.45
removeFromParentMethod · 0.45

Tested by

no test coverage detected