* Improve separation of code for layout method types
* Address PR comments
- Delegate to layout spec engine if the node is a layout spec node but yoga engine was asked for calculate the layout
- Change ASLayoutType to ASLayoutEngineType
- Improve layout engine fall through code
* Remove use of NSHashTable for interface state delegates #trivial
* Stray line
* One more case
* Add code to let people have more delegates
* Do it more
* [License] Simplify the Texture license to be pure Apache 2 (removing ASDK-Licenses)
With permission of the Facebook Open Source team, we are simplifying the Texture
license so that clients can rely on the Apache 2 terms that most of Texture is
already covered by. This means that code originally forked from AsyncDisplayKit
will be re-licensed from "BSD 3-clause + PATENTS v2" to Apache 2 without a
PATENTS file.
After getting confirmation that the updates to these core files look good, we'll
propagate this new license header to all files (in this same PR) and get sign-off
from all parties before landing.
* [License] Update all Texture source files to be pure Apache 2.
* Changelog entry for Apache 2 license update.
* Revert "[License] Update all Texture source files to be pure Apache 2."
This reverts commit ffa0fbbba9717d871dd16c4b07539f2f8208fc2b.
* [License] Update all Texture source files to be pure Apache 2, maintaining copyrights.
* [License] Update CONTRIBUTING, README, Podspec & Dangerfile.
* Adds support for having multiple interface state delegates.
Hopefully in a performant way.
* Switch to respondsToSelector for int del instead of separate object
* Add CHANGELOG
* Make ASDisplayNode+InterfaceState.h public
* Huy's comments
* Don't even bother removing since it's a weak hash table.
* [ASDisplayNode] Add safeAreaInsets, layoutMargins and related properties to ASDisplayNode
* Add layoutMargins bridged to the underlying view
* Add safeAreaInsets bridged to the underlying view
* Add fallback calculation of safeAreaInsets for old iOS versions
* Add automaticallyRelayoutOnSafeAreaChanges and automaticallyRelayoutOnLayoutMarginsChanges properties
* Add additionalSafeAreaInsets property to ASViewController for compatibility with old iOS versions
* Provide safeAreaInsets for layer-backed nodes.
This also fixes tests.
* Fix crash when insetsLayoutMarginsFromSafeArea is set from a background thread
* Changes requested at code review:
* Update documentation for layoutMargins and safeAreaInsets properties. Suggest that users set the automaticallyRelayout* flags to ensure that their layout is synchronized to the margin's values.
* Fix accessing ASDisplayNode internal structures without a lock.
* Add shortcut in -[ASDisplayNode _fallbackUpdateSafeAreaOnChildren] to skip a child when possible.
* Add shortcut in ASViewController to avoid fallback safe area insets recalculation in iOS 11. Fix fallback safe area insets recalculation when the additionalSafeAreaInsets are set.
* Add debug check that a view controller's node is never reused without its view controller, so the viewControllerRoot flag value is always consistent.
* Use getters instead of reading ivars directly in -layoutMarginsDidChange and -safeAreaInsetsDidChange.
* Minor change in CHANGELOG
* Minor change in ASDisplayNodeTests.mm
* Make display node, layout spec, and style conform to NSLocking so that users/subclasses can access their locks
* Update the changelog
* Align slashes
* Put it back, when we're in ASDisplayNode
* Go a little further
* Put back the changes I didn't mean to commit
* Kick the CI
* Fix yoga build
* Put back non-locking change
* Address comments from Scott
- Failing to do so will introduce race conditions in which the property was updated on a background thread but main thread has not executed the block that updates the property of the node's layer. During that window, the layer's property is out-of-date and can't be used.
- After this change, ASDisplayNode's cornerRadius is the only source of truth and users must always use it instead of CALayer's.
* Added attributed versions of accessibilityLabel, accessibilityHint and accessibilityValue
* Follow conventions for property types
* Use curly braces
* Update changelog
* Follow conventions for property types in UIView+ASConvenience.h
* Add compatibility for Xcode 8
* Use isEqualToString instead of pointer comparison
* Only allocate attributed strings once. Use _setAttributedAccessibilityToViewAndProperty only for attributed properties.
* [ASCornerRounding] Initial (untested) implementation of ASCornerRounding features.
* [ASCornerRounding] Working version of both clip corners and precomposited corners.
* [ASCornerRounding] Improve factoring and documentation of corner rounding features.
* [ASCornerRounding] Some final fixups.
* Add entry to changelog for .cornerRoundingType
* Be more aggressive at invalidating layouts during transitions, add a debug method, fix some build errors when verbose logging
* Add a changelog entry
This makes it much easier to use the ASCoreAnimationExtras method which offers by
far the most efficient way to display a stretchable image.
In the future, we should move that function to UIImage+ASConvenience or another
header where it can be more easily found and enjoyed!
* Small changes required by the layout debugger
- `ASDisplayNode` can be told to not flatten its layout immediately but later on. The unflattened layout is also stored in a separate property. It's needed for inspecting not only display nodes but also layout specs used to compute a layout tree.
- `ASLayout` can be told to always retain its sublayout elements. This is needed especially for layout specs since they are usually not retained after an ASLayout was computed.
* Update CHANGELOG
* Address comments
* [ASDisplayNode] Convert isSynchronous to an Objective-C atomic BOOL.
This reduces lock contention, and should also fix a very rarely seen deadlock.
* [ASDisplayNode] Implement a std::atomic-based flag system for superb performance
Although Objective-C atomics are equally fast, or better that std::atomic when
access through method calls, for the most intense use cases it is best to avoid
method calls entirely.
In ASDisplayNode, we could benefit significantly from avoiding both method calls
(already true today) but also avoid locking the mutex, for both CPU and contention
gains.
There will still be many methods that need locking for transactional
consistency - however, there are currently dozens of accessor methods that could
avoid frequent lock / unlock cycles with use of atomics, and other usages of the
ivars directly where locking could be delayed until after early-return conditions
are checked and passed.
Although apps could handle this before by setting the view's property in didLoad, it's
useful to bridge this property for setting during off-main initialization.
This change also makes RTL fully functional / automatic for Yoga layout users.
* Add a thread-safe layoutIfNeeded implementation to ASDisplayNode
* Trigger a layout pass when a display node enters preload state
- This ensures that all the subnodes have the correct size to preload their content.
* ASCollectionNode to trigger its initial data load when it enters preload state
* Minor change in _ASCollectionViewCell
* Layout sublayouts before dispatch to main for subclass hooks
* Update comments
* Don't wait until updates are committed when the collection node enters display state
* Same deal for table node
* Explain the layout trigger in ASDisplayNode