Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface state not update correctly during layer thrash. #1111

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
929d118
fix SIMULATE_WEB_RESPONSE not imported #449
wsdwsd0829 Jul 16, 2017
dd24d8f
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Sep 6, 2017
b8eaffa
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Oct 4, 2017
2918ea0
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Oct 11, 2017
9c42266
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Oct 12, 2017
329f35f
Fix to make rangeMode update in right time
wsdwsd0829 Feb 5, 2018
5f8b7ec
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Feb 7, 2018
d87bb11
merge master from upstream
wsdwsd0829 Feb 15, 2018
269c2ab
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Mar 10, 2018
24c1ce8
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Mar 12, 2018
233169e
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Mar 26, 2018
b19f90d
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Mar 28, 2018
b50cec4
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Apr 5, 2018
b75a5f3
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 May 3, 2018
64b46e0
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 May 16, 2018
5fabc1e
remove uncessary assert
wsdwsd0829 May 17, 2018
3d5b84b
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 May 21, 2018
098b978
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Jun 8, 2018
77eefd6
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Jun 13, 2018
0310ed7
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Jul 3, 2018
0b886de
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Jul 25, 2018
a63d438
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Aug 21, 2018
06e18a1
Fix collection cell editing bug for iOS 9 & 10
wsdwsd0829 Aug 22, 2018
918434d
Merge branch 'master' of github.com:TextureGroup/Texture
wsdwsd0829 Aug 31, 2018
41d3680
Revert "Fix collection cell editing bug for iOS 9 & 10"
wsdwsd0829 Sep 10, 2018
f769b3b
Fix interface state not update correctly during layer thrash
wsdwsd0829 Sep 10, 2018
02a6e6c
add change log
wsdwsd0829 Sep 12, 2018
40007ef
Merge branch 'master' into interface-state-not-update-correctly-durin…
Adlai-Holler Sep 14, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
- Improve TextNode2 by skipping an unneeded copy during measurement. [Adlai Holler](https://github.com/Adlai-Holler)
- Improve locking around clearContents [Michael Schneider](https://github.com/maicki)
- Unlock before cleanup and calling out to subclass hooks for animated images. [Michael Schneider](https://github.com/maicki) [#1087](https://github.com/TextureGroup/Texture/pull/1087)
- [ASDisplayNode] Fix interface state update for layer backed nodes when layer thrashes (interface coaleascing case).[Max Wang](https://github.com/wsdwsd0829). [#1111](https://github.com/TextureGroup/Texture/pull/1111)

## 2.7
- Fix pager node for interface coalescing. [Max Wang](https://github.com/wsdwsd0829) [#877](https://github.com/TextureGroup/Texture/pull/877)
Expand Down
12 changes: 12 additions & 0 deletions Source/ASDisplayNode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2947,6 +2947,15 @@ - (void)willEnterHierarchy

if (![self supportsRangeManagedInterfaceState]) {
self.interfaceState = ASInterfaceStateInHierarchy;
} else if (ASCATransactionQueue.sharedQueue.isEnabled) {
__instanceLock__.lock();
ASInterfaceState state = _preExitingInterfaceState;
_preExitingInterfaceState = ASInterfaceStateNone;
__instanceLock__.unlock();
// Layer thrash happened, revert to before exiting.
if (state != ASInterfaceStateNone) {
self.interfaceState = state;
}
}
}

Expand Down Expand Up @@ -2985,6 +2994,8 @@ - (void)didExitHierarchy
unsigned isStillInHierarchy = _flags.isInHierarchy;
BOOL isVisible = ASInterfaceStateIncludesVisible(_pendingInterfaceState);
ASInterfaceState newState = (_pendingInterfaceState & ~ASInterfaceStateVisible);
// layer may be thrashed, we need to remember the state so we can reset if it enters in same runloop later.
_preExitingInterfaceState = _pendingInterfaceState;
__instanceLock__.unlock();
if (!isStillInHierarchy && isVisible) {
#if ENABLE_NEW_EXIT_HIERARCHY_BEHAVIOR
Expand Down Expand Up @@ -3102,6 +3113,7 @@ - (void)applyPendingInterfaceState:(ASInterfaceState)newPendingState
return;
}
_interfaceState = newState;
_preExitingInterfaceState = ASInterfaceStateNone;
}

// It should never be possible for a node to be visible but not be allowed / expected to display.
Expand Down
2 changes: 2 additions & 0 deletions Source/Private/ASDisplayNodeInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ AS_EXTERN NSString * const ASRenderingEngineDidDisplayNodesScheduledBeforeTimest

_ASPendingState *_pendingViewState;
ASInterfaceState _pendingInterfaceState;
ASInterfaceState _preExitingInterfaceState;

UIView *_view;
CALayer *_layer;

Expand Down