579 Commits

Author SHA1 Message Date
Max Wang
62b07e100e Match interfacestate update sequence to uikit (#882)
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* Match interface update closer to UIKit.

* allow the correct exiting sequence for thrashing

* refactor
2018-05-25 18:21:50 -07:00
Adlai Holler
cac14e0bce
Standardize Property Declaration Style in Core Classes (#870)
* Audit property attributes for core classes

* Update style guide

* Go crazy

* Update changelog
2018-05-24 14:42:43 -07:00
Adlai Holler
8b890f07be
Create a new dealloc queue that is more efficient (#931)
* Fork dealloc queue in an experiment

* Fix and put back

* Use the right selector

* Go simpler

* Clarify name

* Type inference

* Use CFTypeRefs like a boss

* Improve comments

* License header
2018-05-22 09:06:24 -07:00
appleguy
b2e5f9ec64 [ASTextNode2] Simplify compare-assign check & lock _pointScaleFactors accessor #trivial (#934) 2018-05-22 07:58:33 -07:00
Flo
ede9a7f929 [ASImageNode+AnimatedImage] Fix early return when animatedImage is nil in setAnimatedImage #trivial (#925)
* [ASNetworkImageNodeTests] Add defaultImage test and improve image test. #trivial

* [ASImageNode+AnimatedImage] Fix early return when animatedImage is nil in setAnimatedImage. #trivial
2018-05-21 13:09:01 -07:00
Huy Nguyen
b9ae6c4fa8
[ASDisplayNode] Fix an issue that causes a node to sometimes return an outdated calculated size or size range (#808) 2018-05-21 18:36:19 +01:00
Max Wang
06358d8662 Fix pager node for interface coalescing (#877)
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* Fix pager node for interface coalescing

* Fix typo

* change log
2018-05-19 13:52:30 -07:00
appleguy
6799e26b03 [ASTextNode2] Upgrade lock safety by protecting all ivars (including rarely-changed ones). (#918)
* [ASTextNode2] Upgrade lock safety by protecting all ivars (including rarely-changed ones).

Although I don't know of any specific crashes caused by this, I think we should
lock all properties by default. There are also some indications of premature
optimization in keeping lock scope small, where it is actually important to
have transactional integrity, and also where the ASDisplayNode base class is
otherwise going to repeatedly re-lock the object anyway.

I think this will remain pretty efficient, especially with os_unfair_lock enabled.

* Use compare-assign macros
2018-05-19 12:47:06 -07:00
Max Wang
62dd3ca7ce Remove assert. fix #878 #914 (#924)
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* remove uncessary assert
2018-05-17 15:55:13 -07:00
Adlai Holler
73cdc1b4e4
Call out to delegate for control users in experiments (#923) 2018-05-16 08:33:28 -07:00
Huy Nguyen
0830f6cf23
[ASCollectionNode/ASTableNode] Fix a crash occurs while remeasuring cell nodes (#917) 2018-05-15 20:18:54 +01:00
Huy Nguyen
970ebd987e
Improve thread-safety of ASDisplayNode's didExitHierarchy #trivial (#916)
Since `didExitHierarchy` is called without the node's instance lock being held, the lock must be acquired before accessing `pendingInterfaceState`.
2018-05-11 17:26:00 +01:00
Abdurahim Jauzee
382f624d83 [ASTextNode] Check variables before calling delegate method #trivial (#898) 2018-05-11 17:24:26 +01:00
Michael Schneider
efe924cca7
Prevent UITextView from updating contentOffset while deallocating (#915)
* Prevent UITextView from updating contentOffset while deallocating

* Add comment on the flag point to the issue
2018-05-09 08:30:03 -07:00
Garrett Moon
cb29317300
#trivial Fix the C++ assertion (#911)
* Fix the C++ assertion

* Fix indentation
2018-05-07 15:28:48 -07:00
Adlai Holler
d97065ca39
Update configuration schema (#893) 2018-05-05 09:48:19 -07:00
Garrett Moon
3677e290aa
Issue ASNetworkImageNode callbacks off main thread (#908)
* The main thread is under a bunch of contention on startup, let's avoid using it.

* Update CHANGELOG
2018-05-04 12:21:42 -07:00
appleguy
9de33361dc [ASTextNode] Fix a deadlock that could occur when enabling experimental ASTextNode2 via ASConfiguration (#903)
Because multiple threads can enter this allocWithZone: method around the same time, it is possible for one of them to setSuperclass first, and then the second thread would get stuck in an infinite loop. When climbing the inheritance heirarchy, ASTextNode2 would be encountered by this second thread, and it would continue until reaching c == Nil. Since there was no case to catch this, an infinite loop would result. Then the main thread can be deadlocked if a method like waitUntilAllUpdatesAreProcessed is called on ASCollectionView.
2018-05-03 03:51:59 -07:00
Garrett Moon
e072761aa1 Fixes an issue where playback may not start (#896) 2018-05-02 09:34:53 -07:00
Adlai Holler
f3aaa52700
Request std=c++11 dialect again, and add warning (#900)
* Put back stdc++11 and add compile-time check

* Soften it and update changelog
2018-05-02 09:30:35 -07:00
Alex Hill
f16e05e0b3 [ASDKFastImageNamed] Fixes nullability of UIImage initializers (#897) 2018-04-28 08:19:37 -07:00
Adlai Holler
071bd7379f
Add experiment to skip creating UIViews altogether for constants (#881)
* Add experiment to skip creating UIViews altogether for constants

* Update changelog

* Do it right

* Annotate function

* Skip all the work entirely
2018-04-12 10:14:29 -07:00
Michael Schneider
0aefbb65ba
Fix ASDISPLAYNODE_ASSERTIONS_ENABLED and ASDefaultPlaybackButton warnings #trivial (#880)
* Define ASDISPLAYNODE_ASSERTIONS_ENABLED explicitly

* Add parameter type for drawRect: in ASDefaultPlaybackButton
2018-04-12 10:07:37 -07:00
Andrew Rohn
9d5857664f Fix macro definition for AS_KDEBUG_ENABLE producing warning: “Macro expansion producing ‘defined’ as undefined behavior” in Xcode 9.3 (#879) 2018-04-11 04:51:53 -07:00
Adlai Holler
e90ba47a13
[NoCopyRendering] In non-VM case, use calloc to get a zerod buffer. (#869) 2018-04-04 13:32:23 -07:00
Adlai Holler
e748d053d1
Remove Redundant Atomic Store from Recursive Unfair Lock in Recursive Case #trivial (#867)
* Optimize recursive unfair lock to remove a redundant set

* Simpler
2018-04-04 10:49:05 -07:00
Max Wang
4db9ea37d2 [bugfix] Align timing of interface coalescing and range update. #trivial (#847)
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* This is for cases when CollectionNode is created in cell of another collectionNode, the interfaceState(say didEnterVisible) is not called as expected.

It's because interfaceCoalescing alter the time line and cause RangeController update before actual interface applied.
2018-04-04 08:01:12 -07:00
ricky
1e8c6f0e0f [Issue 838] Update ASCeilPixelValue and ASRoundPixelValue (#864)
* [Issue 838] Update ASCeilPixelValue and ASRoundPixelValue

Layouts can come back for 3x devices as a repeating decimal. Floats/doubles have a hard time representing these values and often the last digit or two will be  garbage. This garbage can result in unexpected values from `ceil` or `round`. I try to fix this by subtracting `FLT_EPSILON` from the value before calling `ceil` or `round`

https://github.com/TextureGroup/Texture/issues/838

* addressed comments on the pr
2018-03-31 10:22:03 -07:00
Max Wang
41473844f4 access view first before checking canBecome/Resign responder in becomeResponder methods (#829)
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* Access view first before check canBecomeFirstResponder.
2018-03-29 10:01:11 -07:00
Max Wang
df7d2a5737 Disable interface coalescing (#862)
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* disable interface coalescing and fix tests

* Revert to before coalescing for ease of reading

* refactor, make min change

* refactor

* add comments

* Add change log
2018-03-28 18:29:05 -07:00
Adlai Holler
4bbbd725de
Introduce ASRecursiveUnfairLock and tests (#858)
* Introduce ASRecursiveUnfairLock and tests

* Document it and put underscores to scare people away

* Increment changelog

* Integrate it with ASDN::Mutex behind experiment

* Rename the experiment

* Love these license headers oh so much

* Move internal header because we have to

* Address Jon's feedback
2018-03-28 11:29:50 -07:00
dmaclach
cf1c3f6d94 Make NSIndexSet+ASHelpers.h reference local #trivial (#857)
* Make NSIndexSet+ASHelpers.h reference local

NSIndexSet+ASHelpers.h should be a user vs a system or framework include.

* Update ASIntegerMap.mm
2018-03-28 08:17:13 +01:00
Yevgen Pogribnyi
7f01b89ddc [ASDisplayNode] Provide safeAreaInsets and layoutMargins bridge (#685)
* [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
2018-03-27 14:29:17 +01:00
Adlai Holler
063194cb1d
Make ASBatchContext lock-free (#854) 2018-03-26 10:46:52 -07:00
Adlai Holler
27fac9f586
Create a centralized configuration API (#747)
* Update the dangerfile

* Make a trivial change to test new dangerfile

* Try out the new value with another trivial change

* Add a configuration API to make a unified place for pulling config from clients safely

* Specify properties for delegate

* Finish removing text experiment global enable

* Generate the config file

* Clean up configuration to fix tests

* Work on making it serializable

* Finish it up

* Fix example code

* Update sample project

* Clean up a few things

* Align with new project order

* Make it faster and update license header

* Add an option to specify your config at compile time

* Update another license header

* Add a version field, and bring interface state coalescing into configuration

* Update CA queue code

* Update CATransactionQueue tests

* Turn transaction queue on by default (for now, see comment)

* Update the tests

* Update the tests AGAIN

* Remove unused ordered set
2018-03-25 12:52:57 -07:00
Max Wang
3d9fe8c3a7 Make cache support animated image (#850)
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* support animated image for cache

* Modify change log
2018-03-25 12:32:00 -07:00
Adlai Holler
bd24015691
[ASNetworkImageNode] Replace NSUUID sentinel with integer #trivial (#852)
* Replace NSUUID sentinel with an integer

* Update ASNetworkImageNode.mm
2018-03-25 12:31:32 -07:00
Adlai Holler
0f9b1e6789
Make objects conform to NSLocking (#851)
* 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
2018-03-25 10:46:04 -07:00
Adlai Holler
2b12654810
Use NS_RETURNS_RETAINED macro to save time (#843)
* Use NS_RETURNS_RETAINED macro to save time

* Update changelog and do the thing with the license headers
2018-03-21 08:13:09 -07:00
Yevgen Pogribnyi
e954b1045a [ASPrimitiveTraitCollection] Always treat preferredContentSize as a potential nil #trivial (#757)
* Fix ASPrimitiveTraitCollection initialization on iOS 9.
Add nil-value checks for preferredContentSizeCategory.

* * Mark -[ASTraitCollection init] as deprecated.
* Mark [ASViewController overrideDisplayTraitsWithWindowSize] as deprecated.

Code review changes:
* Remove unneeded nonnull annotations
* Add null check in ASTraitCollection constructor implementation
* Codestyle
* Add some documentation about ASPrimitiveTraitCollection vs ASTraitCollection usage

* Rename safeContentSizeCategory to AS_safeContentSizeCategory.

Remove safePrimitiveContentSizeCategory in favour of AS_safeContentSizeCategory.
2018-03-21 12:44:30 +00:00
Michael Schneider
0b101135ba Handle nil backgroundColor in ASTextNode2 #trivial (#841)
* Handle nil backgroundColor

* Small improvement
2018-03-16 20:08:19 -07:00
Adlai Holler
15b695c917
Put back a flag that I removed (#839) 2018-03-16 15:21:38 -07:00
Adlai Holler
e6c98d364f
[NoCopyRendering] Use vm instead of malloc (#833)
* [Contexts] Use mmap directly for possible perf gain and to tag the memory as CGImage

* Wrap the mmap in an object

* Go straight to dataprovider

* Tweak it

* Remove wrong comment

* Finish that comment

* Address warnings
2018-03-16 15:13:26 -07:00
appleguy
a41cbb48b3
[ASWrapperCellNode] Introduce a new class allowing more control of UIKit passthrough cells. (#797)
* - [ASWrapperCellNode] Introduce a new class allowing more control of UIKit passthrough cells.

A few minor fixes to Collections behavior as well, including a new isSynchronized
API. The difference from processingUpdates is that after Synchronized, all animations
have also completed (or runloop turn if animations disabled, so .collectionViewLayout
can be relied on being fully in sync).

More upstreaming to come after this can land...

* Fix -[ASDataController clearData] to take no action before initial data loading.

* Empty commit to kick CI

* Spacing change to kick CI (since an empty commit doesn't work...)

* Tweak ASDataController changes to handle an edge case in _editingTransactionQueueCount management.

* Avoid excess cyclic calls to onDidFinishProcessingUpdates: by avoiding ASMainSerialQueue.

* Reverting my initial change as it wasn't the right approach, following the real fix before this.
2018-03-13 01:03:18 -07:00
Adlai Holler
5cafdb9062
[ASTextNode2] Fix background color drawing (#831)
* Fix TextNode2 not respecting background color

* ASTextNode2: Use locks and copies right

* Increment changelog

* Make the Dangerfile accept any license header with Pinterest in it
2018-03-12 13:42:33 -07:00
Adlai Holler
9bffd88134
Fix Text Node Thread Sanitizer Warning (#830)
* Fix thread sanitizer warning in ASTextNodeRendererKey

* Update changelog

* Comment on missing class check
2018-03-12 10:42:24 -07:00
Alex Hill
d9d9a29365 [tvOS] Fixes errors when building against tvOS SDK (#728)
* [tvOS] Fixes errors when building against tvOS SDK

* Update CHANGELOG.md

* [tvOS] Fixes implicit conversion between UIViewAnimationCurve +
UIViewAnimationOptions

* Enable tvOS deployment target in Texture.podspec (for CI)

* [ASMultiplexImageNode] Fixes typo

* [tvOS] Fixes warnings related to @available guards in Xcode 9
[ASMultiplexImageNode] Enables support for Photos framework on tvOS 10+

[ASMultiplexImageNode] Fixes comment depth

[ASAvailability] Adjust logic in AS_AVAILABLE_IOS_TVOS to account for
both versions
Adjusts API_AVAILABLE to minimum deployment target

* [ASAvailability] Update AS_AVAILABLE_XXX fallbacks to function more like
the built-in solution (more accurately target OS by checking target)
Change AS_AVAILABLE_IOS -> AS_AVAILABLE_IOS_TVOS in places that shoud
allow for both

[ASAvailability] Simplify AS_AVAILABLE_IOS_TVOS

* [ASControlNode] Adds missing 'super' call in -[ASControlNode didLoad]
when targeting tvOS

* Fix API_AVAILABLE iOS requirement

* [ASDisplayNode] Fixes last of the linker warnings related to category
overrides. Removes methods already implemented in
ASDisplayNode+UIViewBridge category.
[ASControlNode] Moves tvOS category declaration to ASControlNode header
[ASImageNode] Moves tvOS category declaration to ASImageNode header
[ASControlNode+Private] Adds private category for ASControlNode to
access private selectors

* [NSParagraphStyle+ASText] Fixes typo related to testing

* [ASControlNode] Re-add helpful comment

* [ASTextKitCoreTextAdditions] Adds mappings for kCTParagraphStyleSpecifierMinimumLineSpacing, kCTParagraphStyleSpecifierMaximumLineSpacing, kCTParagraphStyleSpecifierLineSpacingAdjustment when mapping CTParagraphStyle onto NSParagraphStyle
[ASTextNode] Uses CoreText-cleansed attributed string when assigning ascender/descender to avoid crash when a CTParagraphStyle is passed as an attribute

* [AsyncDisplayKit] Update project file to include new/deleted files

* [ASControlNode+tvOS] Add missing Foundation import (whoops!)
[ASImageNode+tvOS] Add missing Foundation import (whoops!)

* Update podspec to only link AssetsLibrary framework on iOS

* [ASTextKitCoreTextAdditions] If kCTParagraphStyleAttributeName key-value
evaluates to an NSParagraphStyle, pass through to cleansed attributes. This
fixes a bug that would occur if a CTParagraphStyle was passed as an
attribute _alone_ (would not be caught by unsupported attributes
check)

* [ASMultiplexImageNode] Bump availability check to support < Xcode 9

* [ASTraitCollection] Fixes typo that was causing build to fail

* Clean up formatting to adhere to character/line limit + braces
2018-03-11 16:37:27 -07:00
Huy Nguyen
e0d07d07ef ASTextNode should avoid acquiring its lock multiple times #trivial (#820)
Since the lock was acquire before we try to access the renderer, we should call `-_locked_renderer` to avoid re-acquiring the same (recursive) lock.
2018-03-09 14:23:41 -08:00
Adlai Holler
6f1d2d1f1d
[ASTextNode] Fix locking, add test for issue #trivial (#825)
* A few small fixes plus a failing test for ASTextNode

* Change the approach

* Update changelog

* Eh screw null_resettable

* No need for changelog now
2018-03-09 14:23:27 -08:00
Garrett Moon
f99dd68a9f
[#trivial] fixes rendered image quality on networked image nodes which have their image directly set. (#826) 2018-03-08 16:21:54 -08:00