544 Commits

Author SHA1 Message Date
Adlai Holler
6b0d57eda4 Explicitly cast to (void *) -> (const void **) to satisfy strict compilers (#1098) 2018-09-05 22:49:08 -07:00
Max Wang
dbcf8babb8 Fix collection editing (#1081)
* 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

* Rename to reordering.

* Adjust _reordering more acuratedly

* Add change log
2018-09-05 08:08:46 -07:00
Max Wang
eba4e290a5 Allow to add interface state delegate in background. (#1090)
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* remove uncessary assert

* Allow to add interface state delegate in background threads.

* Allow to add interface state delegate in background threads.

* lock around _interfaceStateDelegates

* lock _interfaceStateDelegates to local variable

* Fix comments

* remove extra spaces
2018-08-31 13:16:55 -07:00
Garrett Moon
1fe241df91 #trivial Shouldn't hold the lock while adding subnodes (#1091)
* Shouldn't hold the lock while adding subnodes

* Add comments, good call @nguyenhuy
2018-08-30 22:04:40 -07:00
Garrett Moon
cae37623fd
Add subnode should not be called with the lock held. (#1088) 2018-08-30 09:30:34 -07:00
appleguy
465abb1ded [License] Simplify the Texture license to be pure Apache 2 (removing ASDK-Licenses). (#1077)
* [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.
2018-08-28 07:39:18 -07:00
Jia Wern Lim
1d31fc21d4 Refactored accessibleElements to accessibilityElements (#1069)
* Refactored `accessibleElements` to `accessibilityElements`, and removed the re-definition of the property.

With this refactor, the field can now be used as a single access point into the accessibility elements of a view. Also, removing the re-definition of the property in _ASDisplayViewAccessibility.h enables us to make use of the field and its associated helper methods directly from the `UIAccessibilityContainer` API rather than rolling our own implementation.

* Added tests for the accessors to ASDisplayView.accessibilityElements.

* Commented out tests for older a11y accessors & added relevant warnings.

Also added assertions that the getter and setter for the accessibilityElements
property are used only on the main thread.
2018-08-24 20:41:27 +02:00
Huy Nguyen
31cb65b38a
Fix compiler error in ASLocking #trivial (#1079) 2018-08-22 16:14:03 -07:00
Eric Jensen
5f912d1cd1 Remove double scaling of lineHeightMultiple & paragraphSpacing attributes in ASTextKitFontSizeAdjuster (#1056) 2018-08-15 11:08:32 -07:00
Adlai Holler
03e6ce0916
Reduce copying in ASTextNode2 stack (#1065)
* Remove copying in text stack, make text container have an optional immutable mode

* Changelog

* Comment

* Update CHANGELOG.md

* Use new name

* Import header
2018-08-07 08:32:43 -07:00
Adlai Holler
2bb216b02e Readability improvements in ASDataController #trivial (#1067) 2018-08-05 17:24:13 -07:00
Michael Schneider
847884a7b4
Add NS_DESIGNATED_INITIALIZER to ASViewController initWithNode: (#1054)
* Add NS_DESIGNATED_INITIALIZER to ASViewController initWithNode:

* Add changelog
2018-08-05 08:20:20 -07:00
Adlai Holler
b136e84b4e
Add an experimental framesetter cache in ASTextNode2 (#1063)
* Add an experimental framesetter cache in ASTextNode2, and stop keeping framesetters around

* Update configuration schema

* Fix imports

* Fix import again and remove set statement
2018-08-04 07:33:53 -07:00
Adlai Holler
c5b1d09b49
Remove direct ivar access on non-self object to fix mocking case #trivial (#1066)
* Remove direct ivar access on non-self object to prevent issues when the object is actually a mock

* Comment

* Remove lock to avoid deadlock risk
2018-08-03 16:35:24 -07:00
Adlai Holler
40e3bf8952
Remove objc association & weak proxy from node -> controller pointer (#1061)
* Remove objc association & weak proxy from node -> controller relationship

* Rename ASNodeController+Beta.m to ASNodeControllerx+Beta.mm

Currently we can't import ASDisplayNodeInternal from C

* Update project pointers

* Rename ASNodeControllerx+Beta.mm to ASNodeController+Beta.mm
2018-08-03 10:24:37 -07:00
Adlai Holler
e76b4f02f6
Remove extra string/attributed string creation in accessibility properties (#1062) 2018-08-03 10:23:05 -07:00
Adlai Holler
093ae3fba0
Remove CATransaction signposts because they cause more transactions than needed and are too chatty. (#1060) 2018-08-02 08:39:01 -07:00
Adlai Holler
78be342e77
[ASTextNode2] Simplify allocWithZone: + initialize implementation #trivial (#1059)
* Simplify ASTextNode2 alloc + initialize implementation

* Kick the CI by marking two methods as NO_ESCAPE for Xcode 10
2018-08-02 07:36:26 -07:00
Michael Schneider
9e2947e7fb
Revert "Optimize drawing code + add examples how to round corners (#996)" (#1055)
This reverts commit eb4c21c54540d2c1c0b63a6b0665a77fea810e6c.
2018-07-31 04:40:18 -07:00
Michael Schneider
eb4c21c545 Optimize drawing code + add examples how to round corners (#996)
* Use CoreGraphics for drawing and cropping of node content

* Smaller fixes
2018-07-26 09:44:10 -07:00
Max Wang
905c582497 Background image load api (#1007)
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* remove uncessary assert

* add api to allow delegated calls in background.

* fix typo

* 1. Add class property to decide whether to send delegate callbacks on
main or background.
2. remove non-info api.

* Refactor.

* add ivar for class property.

* Donot use extra api.

* Refactor

* refactor

* revert to use let

* refactor

* make class property atomic.

* kick of new ci test.

* kick off new ci
2018-07-24 15:57:59 -07:00
Huy Nguyen
95de2ab126
Avoid setting frame on the backing store while holding a node's lock (#1048)
Doing so may trigger `-layer:didChangeBoundsWithOldValue:newValue:` on the layer's delegate (i.e `ASCALayerExtendedDelegate`) which then runs other operations that require the lock to be free.
2018-07-24 15:03:47 -07:00
Kevin
b2eb58e9f2 Remove misleading comment and add assertion #trivial (#1027) 2018-07-24 09:15:31 -07:00
Kevin
1beeb9c5e6 Add a comment about tiling mode and issue #1046 (#1047) 2018-07-24 09:13:23 -07:00
Michael Schneider
d9d5b12475
Improve locking situation in ASVideoPlayerNode (#1042)
* Improve locking in ASVideoPlayerNode

* Address comments
2018-07-20 15:27:28 -07:00
Flatout73
4b5b90f7a0 [ASTextNode] One more check variables before calling delegate method #trivial (#922) 2018-07-20 15:15:50 -07:00
Michael Schneider
736e200407 Fix warning for ASLayout method override for the designated initializer of the superclass '-init' not found #trivial (#1036)
* Fix warning for ASLayout method override for the designated initializer of the superclass '-init' not found

* Move unavailable init into header
2018-07-18 02:57:35 -07:00
Michael Schneider
b1f6030e86 Create and set delegate for clip corner layers within ASDisplayNode (#1029)
* Create and use ASDisplayNodeCornerLayerDelegate

* Return kCFNull for actionForLayer:forKey:
2018-07-18 02:56:37 -07:00
Adlai Holler
db0f515812
Revert unreleased layout debug method name change from #1030 #trivial (#1039)
* Revert unreleased layout debugging method name change from #1030 #trivial

* Eh make less changes
2018-07-17 21:08:29 -07:00
Adlai Holler
cf810acaa3
Fix the bug I introduced in #1030 (#1035) 2018-07-16 20:43:58 -07:00
Adlai Holler
6ed5ba29f8
Turn off exceptions to reduce binary size (-600KB for arm64) (#1033)
* Turn off exceptions to reduce binary size

* Changelog
2018-07-16 09:38:12 -07:00
Adlai Holler
f2912ecb48 Update lock-checking flag logic (#1032) 2018-07-15 19:57:12 -07:00
Adlai Holler
0b9f12716e
Remove NSMutableArray for retaining sublayout elements (#1030)
* Remove NSMutableArray for retaining sublayout elements

* Kick the CI

* Kick the CI again

* Smash that CI button

* Murder the CI
2018-07-15 18:41:23 -07:00
Adlai Holler
5cad23b925
Split framework dependencies into separate subspecs to reduce binary size and dynamic linking time when they're not needed (#1028) 2018-07-14 11:10:19 -07:00
Huy Nguyen
0dc97fbb2f
Stricter locking assertions (#1024)
- Rename `ASDisplayNodeAssertLockUnownedByCurrentThread` to `ASAssertUnlocked`, and `ASDisplayNodeAssertLockOwnedByCurrentThread` to `ASAssertLocked` -> shorter and hopefully easier to distinguish between the two.
- Add assertions to `_locked_` and `_u_` (i.e "unlocked") methods.
- Turn `CHECK_LOCKING_SAFETY` flag on by default. After #1022 and #1023, we're in a good shape to actually enforce locked/unlocked requirements of internal methods. Our test suite passed, and we'll test more at Pinterest after the sync this week.
- Fix ASVideoNode to avoid calling `play` while holding the lock. That method inserts a subnode and must be called lock free.
- Simplify `_loaded(node)` to only nil-check `_layer` because regardless of whether the node is view or layer backed, the layer should always be set if loaded. Use it throughout.
- Other minor changes.
2018-07-13 14:58:16 -07:00
Adlai Holler
af7f71f92d
Address warnings in Xcode >= 9.3 about using %zd for NSInteger (#1026) 2018-07-13 11:56:54 -07:00
Kevin
8986838b48 Add move detection and support to ASLayoutTransition (#1006)
* Add move detection and support to ASLayoutTransition

...and NSArray+Diffing.
Add some tests.

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update ASLayout+IGListKit.h

* Update ASLayout+IGListKit.mm

* Use std collections to avoid NSNumber boxing

* Update ASLayoutTransition.mm

* Code review updates.

* Use `unordered_multimap` on stack instead of unordered_map<id,queue> on heap
* Remove notFound BOOL (use NSNotFound sentinel value) and put some vars inside the if (insertions/moves) loop
* Don't copy defaultCompare block (redundant under ARC)
* Whitespace
* Remove unneeded mutableCopy-s in ArrayDiffingTests

* Code review updates.

* Type _subnodeMoves pair.first to ASDisplayNode * instead of id
* C++ enumeration
* unowned refs for adding previousLayout nodes to _subnodeMoves
* Remove unreleated ASDynamicCast that is probably right though

* Add commentary to NSArray+Diffing.h; make multimap elements unowned

* Use std::make_pair, optimize ASLayout+IGListKit

* Oops I thought I had added these headers but nope

* Simplify simplify

* Diff subnodes instead of sublayouts

* Another randomized test with actual ASLayouts
2018-07-13 10:19:03 -07:00
Adlai Holler
7c1aee7315
Fix i386 build by providing fallbacks to thread_local variables (#1025) 2018-07-12 21:09:24 -07:00
Michael Schneider
763332f2a7 Add showsHorizontal(Vertical)ScrollIndicator property applying from pending state (#1016) 2018-07-12 15:39:02 -07:00
Huy Nguyen
814fc382c7
Make sure -_completePendingLayoutTransition is called without the node's instance lock #trivial (#1023)
This is because committing the layout transition (aka `-_completeLayoutTransition:`) results in subnode insertions and removals which must be called lock-free.
2018-07-12 11:26:26 -07:00
Huy Nguyen
5ffcd405c6
Fix misleading/scary stack trace shown when an assertion occurs during node measurement (#1022)
- Currently, there is a pair of mutex unlock and unlock that wraps around `-_u_measureNodeWithBoundsIfNecessary:` in `__layout`. That is because this method must be called without the lock.
- When an assertion occurs within that method, the runtime bails early without reacquire the lock (so the lock is free now). However, the runtime then hits the end of the outmost mutex locker scope and tries to release the lock that it no longer holds, causing another assertion in ASThread to be shown to user (#932). This makes it extremely hard to idenfity the root assertion.
- Fix by replacing the unlock/lock pair with a mutex unlocker.
2018-07-12 11:25:35 -07:00
Sergey Pronin
a08d2210cf [IGListKit] Adds missing UIScrollViewDelegate method to DataSource proxy (#1015)
* Adds missing UIScrollViewDelegate method to IGListKit proxy implementation

* Updates CHANGELOG
2018-07-10 11:16:13 -07:00
Michael Schneider
55abeed743
Introduce let / var macros and some further cleanup (#1012)
* Introduce let / var and some further cleanup

* Address first comments

* Update changelog

* Move the const before auto
2018-07-10 09:37:53 -07:00
Michael Schneider
6c487dd26c
Properly consider node for responder methods (#1008)
* Properly consider node for responder methods

* Add changelog
2018-07-06 08:32:03 -07:00
Michael Schneider
d28b17c87f
Fix warnings and memory issues (#1003) 2018-07-03 08:39:49 -07:00
Adlai Holler
75594affe2
Remove yoga layout spec, which has been superseded (#999)
* Remove yoga layout spec, which has been superseded by tighter yoga-display node integration

* Changelog
2018-06-30 09:42:27 -07:00
Adlai Holler
77e2d28919
Create transfer-array method and use it (#987)
* Create transfer-array method and use it

* License headers

* Update ASArrayByFlatMapping
2018-06-29 18:21:55 -07:00
Garrett Moon
a4f78ad3e0
Adds support for having multiple interface state delegates. (#979)
* 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.
2018-06-27 16:52:40 -07:00
Michael Schneider
b82128ee4e
Add missing instance variables in ASTextNode and warnings cleanup #trivial (#984)
* Add missing instance variables in ASTextNode and warnings cleanup

* Re-add drain
2018-06-24 08:56:10 -07:00
Adlai Holler
0fe991f818
Optimize layout flattening (#982)
* Optimize layout flattening

* Changelog

* Remove whitespace

* Update ASLayout.mm

Add comment
2018-06-22 14:20:33 -07:00