2103 Commits

Author SHA1 Message Date
Colin McArdell and Robin Chou
9c13018568 Updates exposed method signature and docs for what is now -supplementaryNodeForElementKind:atIndexPath: on ASCollectionView. Assert non-nil for usage of ASCollectionDataControllers -supplementaryNodeOfKind:atIndexPath: within ASCollectionView 2016-06-27 11:05:53 -04:00
Colin McArdell and Robin Chou
1c103333f7 ASCollectionView docs for -supplementaryNodeOfKind:atIndexPath: + nullability. Also, nullability for -nodeForItemAtIndexPath: 2016-06-27 11:05:45 -04:00
Colin McArdell and Robin Chou
488ded2fe8 ASCollectionDataControllers supplementaryNodeOfKind:atIndexPath: now returns nil instead of an assertion if the supplementary node of kind doesn't exist within completedNodesOfKind 2016-06-27 11:05:37 -04:00
Colin McArdell and Robin Chou
d69dd880a5 Exposing supplementaryNodeOfKind:atIndexPath: in the ASCollectionView interface. 2016-06-27 11:05:11 -04:00
Hannah Troisi
db04f4b851 [ASTableView] Add constrainedSizeForRowAtIndexPath: to control row heights from delegate (#1769)
* [ASTableView] constrainedSizeForRowAtIndexPath

* Quick fix to header file

* Switch to Delegate from DataSource.

* Update testing variables to reflect switch to delegate
2016-06-26 23:09:53 -07:00
Hannah Troisi
e4abe898d5 [ASEditableTextNode] Support UITextInputTraits pass-through methods (threadsafe for use before view creation) (#1809)
* [ASEditableTextNode] Support UITextInputTraits

* consistent property attributes

* remove logging, fix tests to account for UIKit weirdness

* address @appleguy's comments
2016-06-24 16:53:10 -07:00
Michael Schneider
3fb0e18504 [ASTextNode] Further locking improvements for ASTextNode (#1813)
* Further locking improvements for ASTextNode

* Remove tighter holding of lock as this operation needs to complete with the lock held
2016-06-24 16:49:05 -07:00
Adlai Holler
77f24231b3 [Documentation] Add a comment why we prefer -indexPathForItem:inSection: 2016-06-24 10:13:51 -07:00
Adlai Holler
457e08005f [ASDataController] Remove asyncDataFetching Option, Cleanup (#1794)
* [ASDataController] Add some assertions to clarify what queues things happen on

* [ASCollectionDataController] Optimize willReloadData

* [ASDataController] Minor optimizations, no functional changes

* [ASDataController] Always reload data on _editingTransactionQueue

* [ASDataController] Remove async data fetching option, deprecate callbacks

* [ASDataController] Not mutable

* [ASMultidimensionalArrayUtils] Use fast enumeration

* Optimize ASMultidimensionalArrayUtils
2016-06-23 21:08:44 -07:00
ricky
997d37dc83 [ASEnvironment] Don't relayout as a result of clearing a traitCollection's context (#1759)
* Don't relayout as a result of clearing a traitCollection's context

I'm not completely sure this change is the best solution. Here is context:

An ASEnvironmentTraitCollection has a pointer to an optional context that an ASVC is the owner of. When the ASVC is dealloc'ed, we go through all subnodes of the VC and clear out the context so that the struct isn't holding on to a garbage pointer.

Setting the traitCollection on ASCollectionNode/ASTableNode causes the cells to relayout if the trait collection changed (this is  a special case for these two nodes since their cells are not actually subnodes). Setting the context to nil registered as a trait collection change and was causing a layout even as we were dealloc'ing the VC.

The logic I'm implementing here is:
If the trait collection changed AND the displayContext did not, then we should relayout.
If the trait collection changed AND the new displayContext is non-nil then we should layout
In the case where the trait collection change was caused soley by the displayContext going from non-nil to nil, then we should NOT layout.

```
// At this point we know that the two traits collections are NOT equal for some reason
BOOL needsLayout = (oldTraits.displayContext == currentTraits.displayContext) || currentTraits.displayContext != nil;
```

Is there a better place/safer way to do this?

* removed extra setNeedsLayout call
2016-06-23 20:07:45 -07:00
Michael Schneider
f0bfa24fa3 Merge pull request #1766 from hannahmbanana/collectionLayout
[ASCollectionView, ASCellNode] Add support applyLayoutAttributes: on ASCellNode
2016-06-23 15:09:10 -07:00
Michael Schneider
2375e31033 Merge pull request #1721 from rcancro/layoutSpec
[ASLayoutSpec] Remove use of dictionary to hold children
2016-06-23 15:07:08 -07:00
Adlai Holler
57310a6fe4 Merge pull request #1802 from facebook/AHThrashTesting
[Unit Tests] Add Table View Data Thrash Testing
2016-06-22 21:35:58 -07:00
Michael Schneider
4f61b6e1cc Merge pull request #1777 from maicki/StructsForDrawingParameter
[ASTextNode / ASImageNode] Use structs for drawing parameter
2016-06-22 20:48:58 -07:00
Michael Schneider
95b03472f2 Merge pull request #1785 from facebook/AHWillDisplayCellDeprecate
[ASCollectionView/ASTableView] Warn Users About Index Paths in willDisplayNode:/didEndDisplayingNode: Methods
2016-06-22 20:47:43 -07:00
Michael Schneider
7175afba59 Merge pull request #1790 from gazreese/ASVideoNode-delegate-superclass
[ASVideoNode] Ensure that both ASVideoNode and ASNetworkImageNode delegate methods are called
2016-06-22 20:43:49 -07:00
John Engelhart
ea64d7d09b Pr/fix unit tests memory leaks (#1795)
* Fix some concurrency problems detected by Xcode 8's new Thread Sanitizer.

Some of these changes are arguably just to silence the warnings from Thread Sanitizer.

* Fix several memory leaks in the unit tests.

A number of the unit test source files are compield with `-fno-objc-arc`.  This was clearly overlooked when writing several of the unit tests.

Fixed by (mostly) switching to use of `-autorelease` for the problem code.

NOTE: This commit doesn't fix all the memory leaks found.  There's still at least one leak in `-[ASDisplayNodeTests testSetNeedsDataFetchImmediateState]`, and several leaks in `ASBasicImageDownloader.mm`.  I wasn't able to find a trivial cause to these, unfortunately.
2016-06-22 16:56:53 -07:00
Nick Velloff
a05d3119ad [WIP] Trigger new batch fetch for collection view after layout transitions (#1697)
[Table / Collection] Trigger new batch fetch after programmatic scrolls, or layout transitions.
2016-06-22 16:21:10 -07:00
Hannah Troisi
d547372a63 [Carthage] define PIN_REMOTE_IMAGE in .pch for non-CocoaPod users (#1797)
* [Carthage] define  PIN_REMOTE_IMAGE in PCH

* fixed ClassString
2016-06-22 15:37:00 -07:00
Adlai Holler
fcf2db79f8 [ASTableViewThrashTests] Initial commit 2016-06-21 18:46:08 -07:00
ricky
af98d23bf0 michael's comments 2016-06-21 14:49:47 -07:00
ricky
eb715e5836 hold children in a map instead of vector 2016-06-21 14:22:49 -07:00
ricky
2675204d50 [ASLayoutSpec.mm] Remove use of dictionary to hold children
Converted the backing store of children to a std::vector. Subclass now have defined indexes instead of string keys to add children.
2016-06-21 14:22:44 -07:00
Michael Schneider
36e48cf340 Remove caching of _drawParameter and use bounds instead of threadSafeBounds 2016-06-21 13:11:38 -07:00
Michael Schneider
74b9b6b49e Use threadSafeBounds instead of bounds to create drawing parameters 2016-06-21 13:11:38 -07:00
Michael Schneider
e7f2edd183 Add updating drawing parameter in ASTextNode
Update drawing on demand if properties change and not on every drawing cycle. This should reduce the overhead to access properties from the view / layer for the drawing parameters.
2016-06-21 13:11:38 -07:00
Michael Schneider
fc7cff333e Prevent subclassing of ASTextNode and ASImageNode 2016-06-21 13:11:38 -07:00
Michael Schneider
3384297c58 Move drawing parameters in ASTextNode and ASImageNode to structs 2016-06-21 13:11:38 -07:00
Michael Schneider
6dac29a16f Merge pull request #1768 from vadims/fix-editable-text-size-calculation
[ASEditableTextNode] should include insets when calculating size
2016-06-21 13:03:01 -07:00
Adlai Holler
fcb6938224 Revert deprecated method warning suppression 2016-06-21 09:20:40 -07:00
Adlai Holler
c14bbf6005 Undeprecate the methods. Just inform users about the index path issue 2016-06-21 09:16:54 -07:00
Gareth Reese
3fee0810d5 [ASVideoNode] Ensure that both ASVideoNode and ASNetworkImageNode delegate methods are called for ASVideoNode observers 2016-06-21 11:36:54 +01:00
Eric Jensen
c32e2f8383 If the animated image is ready, start animating it as soon as it's set (#1724) 2016-06-20 20:18:44 -07:00
Adlai Holler
9873f4bd7d Deprecate willDisplayNode:/didEndDisplayingNode: methods 2016-06-20 16:40:10 -07:00
Michael Schneider
6bde8cdcf3 Adress review comments
- Add locking to _linkAttributeValueAtPoint:attributeName:range:inAdditionalTruncationMessage:forHighlighting: as we access the attributed text in there
- Add locking to touchesBegan:withEvent: as we are accessing the [ASTextKitRenderer firstVisibleRange]
- Add locking for highlightStyle
- Move accessing delegate property access to instance variable access
2016-06-20 13:42:17 -07:00
Michael Schneider
f3a909324d Add lock to _rendererAttributes 2016-06-20 13:42:17 -07:00
Michael Schneider
3d72a6b7e5 Cleanup ASTextNode and add locking
For now we use a big recursive lock. This needs to be revisited as we revisit the whole ASDK locking strategy.
2016-06-20 13:42:17 -07:00
Michael Schneider
22fa715682 Move lock from ASDN::Mutex to std::mutex in ASTextKitContext 2016-06-20 13:42:17 -07:00
Adlai Holler
b4f25f3d63 Merge pull request #1778 from eanagel/asimagenode-animated-scrolling
[ASImageNode] Update default run loop for animated images to CommonModes
2016-06-20 13:40:43 -07:00
Michael Schneider
e230c69055 Improve settings flags 2016-06-20 13:34:14 -07:00
Michael Schneider
eef22074a4 Add caching for checking if ASDisplayNode can clear it contents or setNeedsDisplay: can be called on the layer 2016-06-20 13:04:44 -07:00
Michael Schneider
23736c3cf7 Fix wrapped UIKit components are disappearing
I looked into the internals of UIImageView a bit. I would recommend to not fixing this in a universal way. UIImageView is specifically optimized for performance and does not use the usual way to provide the contents of the CALayer that backs the UIImageView.

Furthermore we cannot trigger a recreation of the contents of the UIImageView layer as if it get’s cleared and we call setNeedsDisplay on it it goes trough the normal flow to assign the contents to a layer via the CALayerDelegate methods. Unfortunately UIImageView does not do it, it actually does not implement some of the methods at all, so nothing will show up. It’s getting better, by calling setNeedsDisplay on an UIImageView layer it actually clears the contents and nothing is visible anymore. So we have to be careful to not calling that too.

Unfortunately I didn’t find a way yet to trigger a recreation of the UIImageView layers content except calling the private _updateState method.

That said it’s different for layers of other UIKit components like UILabel for example. Clearing the contents of a UILabel layer and calling setNeedsDisplay on the layer usually recreates the contents of the it and it will show up again.

This commit prevents to clear the contents of a layer for all wrapped UIKit and instead only NOT clear the content if the node wraps a UIImageView otherwise we should clear the contents of the layer to reclaim memory as usual.
2016-06-20 13:04:44 -07:00
Michael Schneider
2c6e810e26 Fix not handling imageNode:didLoadImage: from ASNetworkImageNodeDelegate as optional 2016-06-20 07:50:40 -07:00
Ethan Nagel
ead9590d36 Default animation run loop -> CommonModes 2016-06-19 18:52:32 -07:00
Hannah Troisi
da27d36b4a Add comments 2016-06-18 12:54:55 -07:00
Adlai Holler
5d434d418f Merge pull request #1765 from facebook/AHLockingPassOne
[ASDisplayNode] Resolve Deadlock Caused By removeFromSupernode
2016-06-17 13:58:10 -07:00
Vadim Spivak
eb057ca380 Editable text node should include insets when calculating size 2016-06-17 13:55:32 -07:00
Adlai Holler
3446f39704 Merge pull request #1746 from maicki/FixFetchDataRangeModeMinimumDefault
Fix default tuning parameter for range mode ASLayoutRangeModeMinimum and range type ASLayoutRangeTypeFetchData
2016-06-17 11:45:43 -07:00
Hannah Troisi
46421f8684 [ASCollectionView] support UICollectionViewLayoutAttributes 2016-06-17 10:17:52 -07:00
Adlai Holler
42aa52b407 [ASDisplayNode] Put the thread affinity assertion back 2016-06-17 09:51:09 -07:00