| 340 | } |
| 341 | |
| 342 | Result<Void> ViewNodeAttribute::update(ViewTransactionScope& viewTransactionScope, |
| 343 | ViewNode* viewNode, |
| 344 | bool hasView, |
| 345 | bool justAddedView, |
| 346 | const Ref<Animator>& animator) { |
| 347 | auto needValue = !empty() && (!_handlerNeedsView || hasView); |
| 348 | |
| 349 | if (needValue) { |
| 350 | if (!_hasAppliedValue || _appliedValueDirty) { |
| 351 | _hasAppliedValue = true; |
| 352 | _appliedValueDirty = false; |
| 353 | |
| 354 | auto pendingAnimatedValue = std::move(_pendingAnimatedValue); |
| 355 | |
| 356 | auto result = getResolvedPreprocessedValue(); |
| 357 | if (!result) { |
| 358 | return result.moveError(); |
| 359 | } |
| 360 | |
| 361 | // The intention here is to only apply the attribute values that are supposed to describe the initial |
| 362 | // pre-animation state of the view, but got captured in the view's "appearing in the viewport" animation |
| 363 | bool shouldForceApplyWithoutAnimation = pendingAnimatedValue == nullptr && justAddedView; |
| 364 | if (shouldForceApplyWithoutAnimation) { |
| 365 | return _handler->applyAttribute(viewTransactionScope, *viewNode, result.value(), nullptr); |
| 366 | } |
| 367 | auto flushResult = |
| 368 | flushPendingAnimatedValue(viewTransactionScope, viewNode, pendingAnimatedValue, animator != nullptr); |
| 369 | |
| 370 | auto applyResult = _handler->applyAttribute(viewTransactionScope, *viewNode, result.value(), animator); |
| 371 | |
| 372 | if (!applyResult) { |
| 373 | return applyResult; |
| 374 | } |
| 375 | |
| 376 | if (!flushResult) { |
| 377 | return flushResult; |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | return Void(); |
| 382 | } else { |
| 383 | if (_hasAppliedValue) { |
| 384 | _hasAppliedValue = false; |
| 385 | _appliedValueDirty = false; |
| 386 | |
| 387 | auto pendingAnimatedValue = std::move(_pendingAnimatedValue); |
| 388 | auto flushResult = |
| 389 | flushPendingAnimatedValue(viewTransactionScope, viewNode, pendingAnimatedValue, animator != nullptr); |
| 390 | |
| 391 | _handler->resetAttribute(viewTransactionScope, *viewNode, animator); |
| 392 | |
| 393 | return flushResult; |
| 394 | } |
| 395 | |
| 396 | return Void(); |
| 397 | } |
| 398 | } |
| 399 |
nothing calls this directly
no test coverage detected