* Prefer `reserve` rather than `fill constructor` in AS::map()
`fill constructor` constructs the vector with n elements and initializes each element with its default constructor. Instead, `reserve` just allocates memory, no element is initialized and put into the vector, so it's more effeicent. For example, after running the `result_type res(iterable.size());` statement, the `res` vector's size is equal to `iterable.size()`, but after running the `res.reserve(iterable.size());` statement, the `res` vector's size is 0.
* Add tests for ASLayoutSpecUtilities
- Address various issues with tint color on text nodes
- Avoid accessing `self.tintColor` off-main since this will trigger an
assertion and might be undefined behavior
- Trigger setNeedsDisplay in cases of hierarchy change and
tintColorDidChange in ASButtonNode, ASTextNode{1,2}
- Fix bug in _ASTableViewCell where we were overwriting the tint color
instead of inheriting the correct value
- Add tests for new logic in changing hierarchy
* Node TintColor Tweaks
- If the tint color changes, be sure to call -setNeedsDisplay on the view.
- Explictly declare tintColor ivar and getter method.
- If the tintColor is the same as the existing one, early-exit.
- Use the ivar and not the property when setting the tintColor, just as is done for background color.
- Add tests (for non iOS13 and iOS13) that the tintColor will call -setNeedsDisplay
- Backfill tests to document/verify the tintColor behavior on a node.
There is a potential dealloc race condition that can occur when attempting to perform work with image asset out of the main thread. Moving that work into the image node draw loop if necessary
To preserve dynamic color capabilities for layer-backed
nodes, we need to track backgroundColor as a UIColor. In layer backed nodes we lose the dynamic color logic since we
extract a CGColor from the UIColor applied to ASDisplayNode. With this
change we can respond to changes in UITraitCollection.userInterfaceStyle
for backgroundColor.
* Add support for tinting layer-backed ASImageNode's
* Move tint color support ASDisplayNode
* Address comments, unlock before calling "tintColorDidChange" on
subclasses
* Address comments
- Add the ability to specify a tintColor for images / buttons that behave similarly to how they would under UIKit.
- Add flag to control if tint color is applied to ASTextNode to match how
UIKit controls if it is .applied to UILabel.
- Update tests for not-tinting automatic render mode for UIImage.
- Add property on ASTextNode2.
- Add tint color support to ASTextNode2.
Given that UIColor is now a dynamic provider we can no longer rely on the fact that there is a 1:1 mapping between UIColor <-> CGColorRef.
I've updated the UIViewBridge and ASPendingState accordingly to use UIColor and translate to CGColorRef only when interacting with layers. This should preserve any dynamic capabilities we might need in the future when trying to re-render layer backed nodes.
* Set background color directly to view or layer depending on if the node
is layerBacked.
Summary:
UIColor can now be a dynamic color provider to support capabilities like Dark Mode in applications. UIKit is able to re-render views when a user enters dark mode but this dynamic capabilities is not handled at the layer level.
Currently this takes the recommendation in facebookarchive/AsyncDisplayKit#1537 (comment) to set background color on the view directly or layer depending on if the node is layer backed. This change allows UIKit to track these colors and update the UI when the UITraitCollection.userInterfaceStyle changes.
* Updates to UIViewBridge to fix tests
* Remove opaque
* Test fixes
* Revert change to test checker method
* Fix strange issue where setting UIView backgroundColor sets the layer to
opaque to false
* Address Huy comments
* Address last comment
* Improve Accessibility Implementation
- Fixes calculations for accessibilityFrame of ASAccessibilityCustomAction and ASAccessibilityElement
- Fix crash for accessibility elements within layer backed nodes
- Fix accessibility action label updating after other actions change the accessibility label of the corresponding node
* Address comments
* Add support for basic ASTextNode2 link highlighting
* Add approach to fix line highlighting
* Enable proper highlighting for first row
* Fix snapshot highlighting test for ASTextNode2
* Update screenshot again
* Address comments
* ASSignpost: Add support for the os_signpost API
- Removes support for colored intervals. These weren't really useful and they aren't part of the signpost api.
- Fixes an issue with range controller interval logging.
- Adds an interval for interface orientation changes.
* Rename
* Support Xcode 9
* Commentary
Revert "Ensure ASControlMode properties lock before accessing their ivars (#1476)"
This reverts commit ce1e1956f4.
Revert "Make sure all ASDisplayNode properties have backing ivars for consistency. (#1475)"
This reverts commit d6061f4390.
- Except the unused property `interfaceStateSuspended` is still removed (this is a memory saver).
* Shrink ASImageNode by .6% and ASNetworkImageNode by 2.2%
ASImageNode goes from 1384 to 1376. ASNetworkImageNode goes from 1496 to 1464.
These objects accumulate in the heap, so reducing their size will allow more to accumulate before memory warnings.
Group the `BOOL`s into a struct. Shrink the various stored `enum`s to fit the size of their contents. Move the ivars around so that the smaller `enum` are near eachother and the bitfield struct.
* add comments as requested in garrett's review.
* access ivar directly since already locked as suggested in review.
* Shrink ASDisplayNode from 1088 to 976 bytes, reduction of 11.48%
These objects accumulate in the heap, so reducing their size will allow more to accumulate before memory warnings.
Group the `BOOL`s into a struct. Shrink the various stored `enum`s to fit the size of their contents. Move the ivars around so that the smaller `enum` are near eachother and the bitfield struct.
* Forgot to bit-field-ify placeholderEnable; new small size is 968, old size is 1072 (measured consistentlyl on iPhoneSE simulator). 10.74% reduction.
* Shrink _ASPendingState from 824 to 808 bytes, reduction of ~2%
These objects accumulate in the heap, so reducing their size will allow more to accumulate before memory warnings.
Shrink ASPendingState BOOLs. Use unsigned int for these bitfields for clarity. Separate from `_flags` as that struct is compared to `0` for testing. The `_boolFlags` struct is just storing other `BOOL`s.
* rename struct fields as suggested in garret's review.
* Make sure all ASDisplayNodes have backing ivars for consistency.
Found this by enabling #pragma clang diagnostic error "-Wobjc-missing-property-synthesis" for ASDisplayNode. One property is unused, saving 8 bytes of heap space per instance on 64-bit builds. Implement setter/getters for these properties, and add appropriate locking. add the warning as error to the build for this file.
* Remove ASEventLog. We'll focus on ASLog for the future, possibly making it triggerable on a per-node basis
* See ya!
* Hello semicolon
* Remove refs to gone tree methods
* Fix
* Remove irrelevant change, kick CI
* Clean up
* 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
~/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