* Initial commit to move [ASLayoutSpec children] from std::map to NSMutableArray
* Add NSFastEnumeration to ASLayoutable
* ASNullLayoutSpec is a Singleton now
* Move ASLayoutSpecPrivate in Private folder
* Move to NSArrayPointer and remove ASNullLayoutSpec
* Revert "Move to NSArrayPointer and remove ASNullLayoutSpec"
This reverts commit 9ab9cf7024b1f6e1984d84fe58af2b84e84cdf94.
* Move to childAtIndex: and setChild:atIndex:
* Deprecate preferredFrameSize
- Remove all support for preferredFrameSize in ASDK
- preferredFrameSize setter calls through and sets the width and height of the node
- preferredFrameSize getter tries to return a CGSize based on the width and height properties otherwise if this is not possible it throws
* Address comments
* Return CGSizeZero for preferredFrameSize unless width and height are ASDimensionUnitPoints
* Better comment for preferredFrameSize and remove lock in calculateSizeThatFits:
* Add style property to ASLayoutable
* Add styles property to further layout specs
* Adjust some examples
* Add `loadStyle` to create the style object in a ASLayoutable
* Revert "Add `loadStyle` to create the style object in a ASLayoutable"
This reverts commit 2b7240f2c7dc993e38cadf290cfdf08482dd70c7.
* Revert "Adjust some examples"
This reverts commit 3254ae0a321e75db3ecfa80adee9d96bde93a33d.
* Revert "Add styles property to further layout specs"
This reverts commit c779dcb876ead27122c1af1300146a6ad36912cb.
* Rename ASLayoutableStyleDeclaration to ASLayoutableStyle
* Add styleClass class property for extensibility support of the ASLayoutable style object
* flexShrink should not be YES by default
* Revise performance measurement naming and structure
- Revises naming from LayoutSpecGeneration to LayoutSpecComputation
- Adds a struct instead of an NSDictionary to retrieve performance metrics
- Includes ASEnvironmentStatePropagateDown in LayoutSpecComputation measurements
* Revise SumScopeTimer to include enable flag
* Make struct a typedef
Scenario: An ASCollectionNode is a subnode of an ASCellNode. A layout transition is started, resulting in
the removal of the ASCollectionNode as a subnode. As it is removed, the hierarchy state is cleared - including
the "range managed" bit - on the ASCollectionNode. However, the deep recursion traverses the layer hierarchy
too, and clears this bit on the ASCellNodes inside the ASCollectionNode. A moment later, the collection performs
its final ASRangeController update to mark its cells as invisible and free memory. Then an assertion is triggered
in ASRangeController, because it is operating on nodes that do not have the "range managed" bit set.
It turns out that ASInterfaceState also propogates in this way, but that behavior is efficient and beneficial in
its current configuration (it assists how multi-dimensional preloading works). However, hierarchy state should
never need to jump discontinuities in the node hierarchy. For now, disabling that case and will revisit
other use cases soon.
* Measure performance for ASCellNode layout
* Address Adlai and Levi's feedback:
* Move to ASDisplayNode level
* Lock around setting/getting measurement options and results
* Record all measurement passes and report times as an array
* Only add relevant entries to the performanceMetrics dictionary
* Rebase
* Store sum and count instead of array
* Rename ScopeTimerDataPoint to ScopeTimerSum
* Address Levi's feedback
* Address Adlai's feedback
The previous code used either a `@property` with `assign, nonatomic` semantics, or a `__unsafe_unretained` (non-atomic) ivar pointer to an instance for `asyncdisplaykit_node`.
This commit changes those access so that they have the equivalent of `weak, atomic` semantics.
- `_ASDisplayView.mm`
- Removes the `_node` ivar that was qualified with `__unsafe_unretained`.
- Removes `@synthesize asyncdisplaykit_node = _node;`.
- All direct uses of `_node` were replaced with:
- Creates a strong reference via `ASDisplayNode *node = _asyncdisplaykit_node;`.
- `s/_node/node/`.
- These changes were made even if there's a single use of `_asyncdisplaykit_node` as a consistency / defensive measure so that anyone editing this code in the future does not accidentally use a `weak` reference twice.
- `ASDisplayNode.mm`
- Getters and setters for `asyncdisplaykit_node` were changed from `nonatomic, assign` semantics to the equivalent of `atomic, weak` semantics.
- `weak` semantics were implemented by using a `ASWeakProxy` object.
- `objc_setAssociatedObject` was changed from `OBJC_ASSOCIATION_ASSIGN` to `OBJC_ASSOCIATION_RETAIN` (the `atomic` version of retain).
- `ASDisplayNode+FrameworkPrivate.h`
- Changed the `@property` declarations for `asyncdisplaykit_node` from `nonatomic, assign` to `atomic, weak`.
- The actual getters and setters are implemented in `ASDisplayNode.mm`, which were changed accordingly.
* Initial commit for adding a size constraint to ASLayoutable's
* Some more commits
* Fix sample projects in extra/
* Remove preferredFrameSize test of ASEditableTextNode
* Remove preferredFrameSize from examples_extra
* Add deprecation warning to -[ASDisplayNode preferredFrameSize]
* Add deprecation warning to -[ASDisplayNode measureWithSizeRange:]
* Commit
* Commit
* Remove ASRelativeSizeRange
* Make ASRelativeSize private
* Adjust examples
* Improve setting of -[ASLayoutable size] with points or fractions
* Add ASWrapperLayoutSpec
* Improve creation of ASRelativeDimension
* Add `preferredFrameSize` back and add deprecated logging
* Add `layoutSpecBlock` setter and getter and add locking for it
* Add better documentation and fix macros to create ASRelativeDimension
* Create new ASSizeRangeMake with just a CGSize as parameter
* Update Kitten and Social App Layout example
* Add layoutThatFits: and deprecate measure:
* Rename ASRelativeDimension to ASDimension
* Fix examples for ASDimension renaming
* Remove fancy height and width setter
* Fix ASDimension helper
* Rename -[ASLayout layoutableObject] to -[ASLayout layoutable]
* Update layout related methods and more clearer documentation around how to use it
* Deprecate old ASLayout class constructors
* Don't unnecessary recalculate layout if constrained or parent size did not change
* Use shared pointer for ASDisplayNodeLayout
* Fix rebase conflicts
* Add documentation and move implementation in mm file of ASDisplayNodeLayout
* Fix test errors
* Rename ASSize to ASLayoutableSize
* Address comments
* Rename setSizeFromCGSize to setSizeWithCGSize
* Improve inline functions in ASDimension
* Fix rebase conflicts
* Dealloc _pendingViewState if range managed
_ASPendingState objects can add up very quickly when adding
many nodes. This is especially an issue in large collection views
and table views. This needs to be weighed against the cost of
reallocing a _ASPendingState. So in range managed nodes we
delete the pending state, otherwise we just clear it.
* Adlai's comments
* Automatic measure pass in layout pass if not happened before
If no measure pass happened or the bounds changed between layout passes we manually trigger a measurement pass for the node using a size range equal to whatever bounds were provided to the node
* Add test method that ensures that on a second layout pass with same bounds, layoutSpecThatFits: / layoutSpecBlock is not called
* Attempt to reproduce supplementary crash
* Get closer with supplementary issue testing
* Alright! We have a repro!
* The investigation continues
* Fixed!
* Renamed range update callbacks
We finally settled on
didEnter/ExitDisplayState
didEnter/ExitPreloadState
didEnter/ExitVisibleState
This change is meant to unify the range update methods to relate to each
other and hopefully be a bit more self explanatory.
* Guarantee interface callbacks happen on main.
* move fetchData / clearFetchedData to default implementations
* Move deprecated methods to new deprecated category
* Don't bring in cocoapod change.
* Nits
* Capetalize
* Fixes a deadlock caused by walking up the heirarchy.
* Use scope locker / unlocker and add a comment.
* Add comment about calling __setNeedsLayout without the lock.
* Add default fade in / out layout transition
* Add example for layout transition
* Update for recent layout transition API changes
* To be able to do a layoutTransition the node needs to be loaded
* Rename layoutTransitionDuration to defaultLayoutTransitionDuration
* Expose default layout transition duration delay and options
* Use `UIViewAnimationOptionBeginFromCurrentState` for initial defaultLayoutTransitionOptions
The pending layout transition needs to stay alive at least until applySubnodeInsertions did finish execute as it can happen that with Implicit Hierarchy Management new nodes gonna be added that internally call setNeedsLayout what will invalidate and deallocate the transition in the middle of inserting nodes
* Revert "Revert "[ASLayoutSpec] Use childrenMap directly to prevent creating an NSArray within ASDK (#1937)""
This reverts commit 735b4ebd0872483044d98a5d05b43324e76fc8d4.
* Fix crash and add exception for mutating while using fast enumeration of ASLayoutSpec children
NSFastEnumeration is potentially quite dangerous in the wrong hands. In particular, it does not provide a safe mechanism for you to return temporary objects directly, and it does not provide any guarantee that you will be called when the enumeration has completed; therefore if we generate temporaries and store them in an instance variable, we will not necessarily be able to clean them up! This means fast enumeration methods should never be called within an autorelease pool or the autorelease pool be drained within the fast enumeration loop.
The reason is we store references to objects in the stackBuf struct by casting the child pointer to __autoreleasing id. If we pop the autorelease pool between calls to -countByEnumeratingWithState:objects:count:, it will die in a messy explosion of pointer dereferences and EXC_BAD_ACCESS.
* Add tests for ASDisplayNode and ASLayoutSpec fast enumeration
If a node was added to a supernode, the supernode could be in a layout pending state. All of the hierarchy state properties related to the transition need to be copied over as well as propagated down the subtree. This is especially important as with Implicit Hierarchy Management adding subnodes can happen while a transition is in fly
Something interesting going on here with ARC / Objective-C++ that we are investigating and will re-land.
This reverts commit c90ed08d1073701e2c7f8a2677d460c140f05264.
* [ASDisplayNode] Ensure that nil can never be returned from -measureWithSizeRange:
This can happen in rare cases when multiple relayouts occur while a transition is being measured.
* [ASDisplayNode] Use ternary operator style for nil check.
* Use childrenMap directly to prevent creating an NSArray in ASDK for ASLayoutSpec children
* Add locking for parent property in ASLayoutSpec
* Remove unnecessary import
* Add newline
* Add NSFastEnumeration to ASEnvironment and ASDisplayNode / ASLayoutSpec
* Change NSMutableArray initializer to arrayWithCapacity:
* Move ASLayoutSpec+Private.h into Private folder
Fixes building with Swift
* Remove lock for ASLayoutSpec parent
* Simplify applying layout transition in preparation for bigger layout transition API work
* Change from apply to complete in if layout transitions are involved and _applyLayout: to _setCalculatedLayout: for layout
* Change to applySubnodeInsertions and applySubnodeRemovals
* Change from completeTransition to commitTransition and flip logic around when to trampoline to the main thread for implicit hierarchy management
* More internal API improvements
* Fix merge conflicts
* Rename _layout to _calculatedLayout
* [ASEnvironmentTraitCollection] default user interface idiom to ASEnvironmentTraitCollection
UIUserInterfaceIdiomUnspecified is -1 so we were actually defaulting our trait collection to UIUserInterfaceIdiomPhone (which is 0).
* Fix a few places where we weren’t using the default method to create the base traits
[_ASHierarchyChangeSet] Oopsy daisy
[ASDataController] Tweak our update validation
[ASHierarchyChangeSet] Fix bugs
Finish up some stuff
[ASDataController] Put some stuff back
[ASChangeSetDataController] Always use changeset
[ASDataController] Put other stuff back
[_ASHierarchyChangeSet] Use fast enumeration
[_ASHierarchyChangeSet] Fix assertion format strings, return on fail so we don't crash in production
[ASDataController] Store data source item counts as vector rather than NSArray
[ASDataController] Build some tests for the update validation
[ASDataController] Fix issues with update validation
Get rid of new file
[ASDataController] Suppress changeset validation before initial reload
[ASDataController] Make invalid update log vs. exception publicly toggleable