We came across an infinite layout loop in `_u_measureNodeWithBoundsIfNecessary`. After requesting a layout from above, the sizes between pending and caluclated layout still do not match. We continue to prefer to use the pending layout and ask for another layout loop from above. We can’t seem to break out of this loop. The solution (thanks to Huy for the guidance) was to nil out the pending layout we get from requesting the layout from above.
I was only able to reproduce this when working with a node in a `UINavigationBarItem’s` `titleView`. I think that UIKit must be doing something sneaky with setting the frame on the view. While I was not able to create a unit test to catch this issue (I tried for a long time, and can post what I’ve come up with to see if anyone has any suggestions), I was able to create a pretty simple example project that shows the behavior:
https://github.com/rcancro/TextureLayoutLoopExample
* fix SIMULATE_WEB_RESPONSE not imported #449
* Fix to make rangeMode update in right time
* remove uncessary assert
* Fix collection cell editing bug for iOS 9 & 10
* Revert "Fix collection cell editing bug for iOS 9 & 10"
This reverts commit 06e18a1059.
* Fix dealloc long gesture in background
* Getting started on adding threading by example
* writing writing writing
* more info
* More threading
* More more more
* Threading
* self lock
* Some language fixes
* Update docs/_docs/development/threading.md
Co-Authored-By: mikezucc <mikezuccarino@gmail.com>
* fix image references
The changes in #1418 is a bit too aggressive when it comes to nodes that are in display range. It forces those nodes to not preload.
Also update the changes to avoid diluting the experiment data by triggering too broadly (i.e avoid triggering when the old and new implementations yield the same result leading to no behavior change).
* Add layer-action support to nodes, unify hierarchy notifications on it
* Better pending state
* Fix bool
* Skip extra copy
* Never run default actions
* Continue the search
* Remove experimental features
* prevent blocking main thread
* remove small content all together as none is the default
* Update ASExperimentalFeatures.h
~/Texture/Source/Private/ASMutableElementMap.mm:32:24: warning: Conversion from value of type 'NSMutableArray<NSMutableArray *> *' to incompatible type 'ASMutableCollectionElementTwoDimensionalArray *'
_sectionsOfItems = (id)ASTwoDimensionalArrayDeepMutableCopy(items);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
* Rename ASDN C++ namespace to "AS." Referring to the framework as ASDisplayNode is pretty out-dated and verbose. See CoreAnimation which usees CA for their internal namespace.
More using
* More cases
* Adds support for using UIGraphicsImageRenderer in ASTextNode.
In many cases this reduces the backing store of text nodes by 1/2.
* Guard for UIGraphicsRenderer availability.
* Comma
Found by Clang Static Analyzer:
~/Texture/Source/ASTextNode2.mm:663:39: warning: Potential leak of an object stored into 'truncationTokenLine'
CTLineRef truncationTokenLine = CTLineCreateWithAttributedString((CFAttributedStringRef)_truncationAttributedText);
^
~/Texture/Source/ASTextNode2.mm:666:49: warning: Potential leak of an object stored into 'additionalTruncationTokenLine'
CTLineRef additionalTruncationTokenLine = CTLineCreateWithAttributedString((CFAttributedStringRef)_additionalTruncationMessage);
^
2 warnings generated.
Before the change: both - (void)setShouldInvertStrongReference:(BOOL)shouldInvertStrongReference and - (void)setNode:(ASDisplayNode *)node will call through [self setupReferencesWithNode:node]; which call the [node addInterfaceStateDelegate:self];
Luckily it seems this didn't cause huge memory bloat because there's
a check below that keeps the display flag from being set in low memory
conditions when the node is off the screen.
Right now when an image node enters preload state, we kick off an image request with the default priority. Then when it enters display state, we change the priority to "imminent" which is mapped to the default priority as well. This means that requests from preload and display nodes have the same priority and are put to the same pool. The right behavior would be that preload requests should have a lower priority from the beginning.
Another problem is that, due to the execution order of -didEnter(Preload|Display|Visible)State calls, a node may kick off a low priority request when it enters preload state even though it knows that it's also visible. By the time -didEnterVisibleState is called, the low priority request may have already been consumed and the download/data task won't pick up the new higher priority, or some work needs to be done to move it to another queue. A better behavior would be to always use the current interface state to determine the priority. This means that visible nodes will kick off high priority requests as soon as -didEnterPreloadState is called.
The last (and smaller) issue is that a node marks its request as preload/low priority as soon as it exits visible state. I'd argue that this is too agressive. It may be reasonble for nodes in the trailing direction. Even so, we already handle this case by (almost always) have smaller trailing buffers. So this diff makes sure that nodes that exited visible state will have imminent/default priority if they remain in the display range.
All of these new behaviors are wrapped in an experiment and will be tested carefully before being rolled out.
* Add imports
* Fix build failure
* Encapsulate common logics into methods
* Address comments
* Make ASTextNode2 more forgiving when searching for links by searching a 44x44 square around the touch
* Trailing whitespace
* Safely handle end-of-line