2784 Commits

Author SHA1 Message Date
GitGadd
f52bc786c0 Respect hitTestSlop when determining if a tracked touch is inside for ASControlNode (#2896) 2017-01-13 11:07:50 -08:00
Adlai Holler
30194fe41f Remove duplicate declarations from last PR (#2893) 2017-01-12 14:41:53 -08:00
Leo Tumwattana
4e80acc6e1 [ASEditableTextNode] Maximum number of lines to display (#2777) (#2867)
* WIP

* Calculate TextKit Height based on max lines to display

* Remove TODO

* Calculate height based on lineFragmentRect

* Fixes issue with calculated width

* Resolve TextKit stack threading issues

* Removes blank lines

* Open brace on next line

* setNeedsLayout in case of changes on live node
2017-01-12 13:47:44 -08:00
Garrett Moon
daa12a867e Need an autorelease pool (#2890) 2017-01-11 17:00:27 -08:00
Adlai Holler
7c4ee350b0 Use Native convertRect:, convertPoint: Methods to Handle Nil Cases (#2889)
* When converting rects, points on loaded nodes, call into UIKit/CoreAnimation

* Always use view-ish behavior

* Improve nil window handling, add documentation
2017-01-11 13:44:35 -08:00
Adlai Holler
42f0288fda Account for table view cell separator when reporting height (#2883) 2017-01-11 12:48:16 -08:00
Adlai Holler
98a95a6907 Pin collection cellNode.frame = contentView.bounds (#2884) 2017-01-11 12:47:12 -08:00
Michael Schneider
cdf7f70747 [ASDimension] Simplify header file to focus on the most essential types for app developers. (#2794)
* First round of cleanups for ASDimension.mm/h

* Add ASDimensionDeprecated and ASDimensionInternal to Copy Files build phase
2017-01-10 10:05:15 -08:00
Saif Al-Dilaimi
c85aa11dbb Adding section to passthrough properties (#2847)
* added accessoryType to ASCellNode

* Moved the passthrough properties in an own section in ASEditableTextNode

* added documentation and reverted ASEditableCellNode changes

* fixed code signing

* adding seperatorInset property as a passthrough property

* revert changes to project file

* moved setting properties to setNode:

* moved clipsToBounds to setNode
2017-01-09 18:26:51 -08:00
Huy Nguyen
3761d8b0c3 ASVideoNode should play when its player is ready and if it is expected to play (#2876)
- When a video node is first visible, it's player is called to play if auto play flag is on. However, the player might not be ready by that time, especially when the video is loaded on a slow network. The player just continues loading its asset.
- When the player is ready, we should check if it is expected to be playing and if true, try to play again.
2017-01-09 12:02:00 -08:00
Garrett Moon
202c947be9 [ASNetworkImageNode] Don't lock while calling downloader (#2864)
* Don't lock while calling downloader

Addresses #2785
To avoid performance issues, we should avoid locking the downloader.
To achieve this we need to do some kinda gross things. Essentially
the cost is the code is more complex and potentially far less performant
in edge cases. In testing, edge cases are nearly never hit, but I'm not
sure how good I feel about the cost in code complexity. This exacerbates
the locking issues in ASNetworkImageNode:

1. There is no convention for which methods lock.
2. There's no indication which vars are only set on init and therefore
safe to access except in the class extension definition.

* Shouldn't have checked in product changes.

* Using ivar instead of local var copied within lock.
2017-01-05 15:22:27 -08:00
David Robles
2bc701d23f Copy ASTextNode’s implementation of placeholderImage into ASImageNode in order to fix the usage of placeholderColor. (#2866) 2017-01-05 14:59:11 -08:00
Adlai Holler
513b9f4184 Remove unused and unusable implementations of moveItem: and moveSection: (#2863) 2017-01-04 14:04:56 -08:00
Adlai Holler
d65fe8b5fa Disable UICollectionView prefetching to improve scroll performance (#2861) 2017-01-04 13:30:23 -08:00
Huy Nguyen
89d4193757 Open source pi_imageNamed methods (#2859) 2017-01-04 10:57:23 -08:00
Adlai Holler
4a6ba2761b ASDataController: Correctly Handle Nil IndexPath in nodeForIndexPath: Methods (#2856)
* ASDataController: Correctly handle fetching node at nil index path (return nil).

* Be more aggressive, in order to avoid needlessly waiting for updates to complete
2017-01-03 14:45:16 -08:00
Huy Nguyen
99c5021be7 Remove duplicated _delegate ivar in ASVideoNode (#2844) 2017-01-01 18:42:41 -08:00
Adlai Holler
2f7925544b Add a failing unit test for the automatic subnode management range issue (#2826) 2016-12-28 11:22:43 -06:00
Scott Goodson
e264d94dde [ASScrollNode] Fix a minor error in ASScrollNode sizing. 2016-12-27 13:45:34 -08:00
Hannah Troisi
0a86a6b980 [ASVideoNode] Add missing strong attributes (#2834)
* fix missing strong attribute

* change strong to copy
2016-12-24 23:35:27 -08:00
Adlai Holler
2ea7d4c1c0 By default, capture the current animation enabledness for collection/table updates (#2827) 2016-12-23 09:46:49 -05:00
Huy Nguyen
c1157084ca Clean up ASStackPositionedLayout (#2817)
- Remove lastChildOffset. It's unncessary after #2627.
- Remove the version of `stackedLayout()` that takes 1 less param. Isn't worth the complexity.
2016-12-22 16:02:57 -05:00
Adlai Holler
57913b8578 Range Controller Uses Last Scroll Direction, Defaults to Down/Right (#2808)
* Test that the initial range bounds are what we expect

* Use the user's previous scroll direction in the range controller

* Remove flow layout assertion
2016-12-22 15:48:57 -05:00
appleguy
30924d976f [ASDataController] Ensure ASRangeController has an opportunity to update visible nodes before they're deleted by -reloadData path. (#2815)
This change is specific to the reloadData path, which had the last-known occurrence of "deallocated while marked visible".

https://github.com/facebook/AsyncDisplayKit/issues/2711
2016-12-21 19:23:27 -08:00
Michael Schneider
7872cfb5a4 Reverting back _finishOrCancelTransition that was mistakingly moved in a recent PR (#2820) 2016-12-21 11:24:34 -08:00
Adlai Holler
bdd1077c18 Use NS_ENUM for video enumerated types (#2819) 2016-12-21 13:30:16 -05:00
Chris Danford
ecef8edfdd Add locking around setting weakCacheEntry ivar (#2812) 2016-12-21 13:14:14 -05:00
Marvin Nazari
3506cec1c0 [ASVideoPlayerNode] Added an optional full screen button (#2688)
* full screen button for ASVideoPlayerNode

* fixed a small issue when disabling controlsDisabled is set

* styling fixed

* make videoNode public on ASVidePlayerNode

* [ASVideoPlayerNode] fixed an issue when re-enabling the controls the duration time label didn't updated correctly

* [ASVideoPlayerNode] Check if CMTime is valid before setting the labels
2016-12-21 13:09:57 -05:00
Huy Nguyen
f52275b9ba Annotate the code that records mutex owner and level of ownership in ASThread (#2809)
* Annotate the code that records mutex owner and level of ownership in ASThread

* Fix typo in ASThread
2016-12-21 12:49:55 -05:00
Garrett Moon
4ae2948d53 These messages must be called on main. (#2814) 2016-12-20 14:29:32 -08:00
Huy Nguyen
9357f54344 Support visibility events in ASScrollNode (#2799)
* Support visibility events in ASScrollNode

* Sort imports in ASScrollNode.mm
2016-12-20 10:26:01 -08:00
Adlai Holler
3e53d26686 Ensure that all nodes are deallocated inside the thrash testing method to avoid polluting other tests (#2800) 2016-12-19 18:45:57 -05:00
David Robles
498e5a9403 Assert when attempting to set a nil background / overlay layout element. (#2796) 2016-12-19 17:41:45 -05:00
Adlai Holler
eea5ddac3e Range Controller Explicitly Marks Disappeared Nodes as Invisible (#2805)
* Improve visibility handling for range-managed nodes

* Tweak ASWeakSet & the test

* Put back a few things that are pending a different diff

* Add a test

* Ensure we update visible nodes, even if there are no new ones
2016-12-19 17:38:27 -05:00
haritowa
64ee8dbffb [ASDisplayNode Deallocation] Fix for crash when certain types are used as instance variables. (#2803)
* Fix https://github.com/facebook/AsyncDisplayKit/issues/2802

* Change nil to NULL
2016-12-19 17:06:23 -05:00
Huy Nguyen
f7a0ac9760 [ASThread][ASDisplayNode] Detect and avoid deadlocks caused by upward lock gathering in didEnter/Exit states (#2764)
* Implement mutex ownership and use it to check potential upward lock gathering

* Don't hold instance lock and call willEnterHierarchy/didExitHierarchy of ASDisplayNode
- This can cause deadlocks (e.g #2605) if subsequent methods, that are implemented by developers, walk up the node tree.
- This is a way to keep the optimizations introduced in 9e87813 while making sure the locking situation is a bit safer.

* More lock ownership assertions in ASDisplayNode

* Document main thread contract  of -clearContents

* ASNetworkImageNode shoud not call setNeedsPreload while holding instance lock
- This helps to avoid potentially deadlocks caused if the node (esp in case it's a subclass of ASNetworkImageNode) walks up the tree in didEnterPreloadState, for example to build logging context.

* ASVideoNode should not call setNeedsPreload while holding instance lock
- This helps to avoid potentially deadlocks caused if the node (esp. if it's a subclass of ASVideoNode) walks up the tree in didEnterPreloadState, for example to build logging context.

* Don't hold instance lock for the entire insert subnode operation
- The recursive lock should not be held throughout `_insertSubnode:atSubnodeIndex:sublayerIndex:andRemoveSubnode:`. The method instead should manage the lock itself and acquire it as shortly as possible. The reason is that this method calls many methods outside the scope of `self`. `[subnode __setSupernode:self]` is especially troublesome because it causes the subnode to migrate to new hierarchy and interface states, which triggers `didEnter/Exit(.*)State` methods. These methods are meant to be overriden by subclasses. Thus they might walk up the node tree and potentially cause deadlocks, or they perform expensive tasks and cause the lock to be held for too long.
- Other methods that call this method should release the lock before doing so.

* Lock getter and setter of `synchronous` flag

* Address comment in ASVideoNode

* Add main thread assertions to methods that change asset and assetURL of ASVideoNode

* Explain CHECK_LOCKING_SAFETY flag

* More thread and locking assertions in ASVideNode
- It's not safe to call `-[subnode __setSupernode:self]` while holding instance lock of soon-to-be supernode (e.g `self`).
- It's also not safe to call `[subnode __setSupernode:nil]` while holding the instance lock of the old supernode (e.g `self`).
- did(Enter|Exit)(.*)State methods are always called on main. Add main thread assertions to indicate that.

* Minor change in explanation of CHECK_LOCKING_SAFETY flag
2016-12-19 12:11:26 -08:00
Huy Nguyen
546925b6d6 Lock and unlock __instanceLock__ directly for a Minor perf win in ASImageNode (#2797)
- Suggested by @appleguy in #2778
2016-12-19 12:10:40 -08:00
Huy Nguyen
c0ae709b88 [ASDisplayNode][ASImageNode] Small refactorings (#2778)
* Comment out template code and fix another comment in ASDisplayNode

* Release instance lock a bit sooner and fix indentation in ASImageNode
2016-12-18 20:57:35 -08:00
Hannah Troisi
a59a0f0a31 don't allow nil background / overlay layout elements (#2795) 2016-12-18 12:25:57 -08:00
Garrett Moon
b1094303b5 Need to forward protocol support too. (#2784) 2016-12-18 00:36:05 -08:00
Garrett Moon
6399a44444 Had the conditional in ASNetworkImageNode wrong (#2781) 2016-12-15 12:51:00 -08:00
Garrett Moon
dabb69d461 Don't behave like an image node if URL is set. (#2774)
After much discussion I think this is the correct behavior. It seems
like it's much more likely to be the expected behavior but still enables
you to use the network image node like an regular image node.
2016-12-15 12:01:18 -08:00
Adlai Holler
e9a3d3fd03 Remove a bunch cruft around removed methods (#2765) 2016-12-14 11:02:18 -08:00
Andrey Konstantinov
3cb1112440 [ASDisplayNode] Add nullability declarations in ASDisplayNodeInternal.h (#2721)
* Add nullability declarations in ASDisplayNodeInternal.h

Fixes #2701

* Use NS_ASSUME_NONNULL macros in ASDisplayNodeInternal.h

It reduce visual clutter and keep file in line with most other header
files.
2016-12-14 12:39:34 -05:00
Adlai Holler
f637392a77 [ASTextNode] Ensure that isTruncated computes the correct value when sizing fast-path is used. (#2550) (#2763)
* Fix fast-path isTruncated.

* Clean up formatting; remove extra char.
2016-12-13 14:01:50 -05:00
ricky
8920b60dcd [ASDisplayNode] Remove node from supernode before adding it as a subview (#2746)
* [ASDisplayNode] Remove node from supernode before adding it as a subview

If a node is being added as a subview to a UIVIew, we must make sure to remove it as a subnode of its supernode.

* remove from supernode if adding to a layer.
2016-12-13 09:34:05 -08:00
Scott Goodson
ab5627b9e3 [Build] Fix up ASScrollNode to import the new FrameworkSubclasses.h file. 2016-12-12 19:49:00 -08:00
Michael Schneider
ddc23af8e7 [Layout Transition] Reset the alpha value for inserted and removed subnode to initial value (#2729)
* Reset the alpha value for removed subnodes in layout transition to 1 after removal

* Some improvements

* Restore alpha value of inserted and removed subnodes to original alpha value in animated layout transition
2016-12-12 19:46:01 -08:00
appleguy
eeb977e145 [ASDisplayNode] Ensure all subclasses are using base class __instanceLock__ and not re-defining their own. (#2754)
* [ASDisplayNode] Ensure all subclasses are using base class __instanceLock__ and not re-defining their own.

This also moves the @package definition of the instance variable to +FrameworkPrivate instead of Internal.h,
because Internal.h should ideally not be used outside of the ASDisplayNode file setup.  This has greatly reduced
the number of imports of Internal.h.

* [ASDisplayNode] Add ASDisplayNode+FrameworkSubclasses.h to share __instanceLock__ definition.
2016-12-12 19:42:41 -08:00
Michael Schneider
57cd6a3ba8 [ASPagerNode] Fix content insets are wrong in pager node if root node of ASViewController and transition back (#2736)
* Fix content insets are wrong in pager node if root node of ASViewController and transition back

* Add unit test

* Improve test

* Fix test

* Move tests to ASPagerNodeTests
2016-12-12 16:05:09 -08:00