315 Commits
Author SHA1 Message Date
Michael Schneider d5cbe33686 Revert "[ASLayoutSpec] Use childrenMap directly to prevent creating an NSArray within ASDK Part 2 (#2021)"
This reverts commit d5a7c19522.
2016-08-02 10:10:36 -07:00
Michael Schneider d5a7c19522 [ASLayoutSpec] Use childrenMap directly to prevent creating an NSArray within ASDK Part 2 (#2021)
* Revert "Revert "[ASLayoutSpec] Use childrenMap directly to prevent creating an NSArray within ASDK (#1937)""

This reverts commit 735b4ebd08.

* Fix crash and add exception for mutating while using fast enumeration of ASLayoutSpec children

NSFastEnumeration is potentially quite dangerous in the wrong hands. In particular, it does not provide a safe mechanism for you to return temporary objects directly, and it does not provide any guarantee that you will be called when the enumeration has completed; therefore if we generate temporaries and store them in an instance variable, we will not necessarily be able to clean them up! This means fast enumeration methods should never be called within an autorelease pool or the autorelease pool be drained within the fast enumeration loop.

The reason is we store references to objects in the stackBuf struct by casting the child pointer to __autoreleasing id. If we pop the autorelease pool between calls to -countByEnumeratingWithState:objects:count:, it will die in a messy explosion of pointer dereferences and EXC_BAD_ACCESS.

* Add tests for ASDisplayNode and ASLayoutSpec fast enumeration
2016-08-01 18:08:48 -07:00
Yue-Wang-Google b0aeb2997d Fixed recursively setting displaysAsynchronously in ASDK snapshot tests to recurse through all descendant nodes instead of just the root node's subnodes (#1995)
Patch from Google Inc.
2016-07-28 14:57:23 -07:00
Adlai Holler 7b2e14c128 Disable thrash tests to avoid deallocated-while-visible exception that's popped up 2016-07-25 10:26:51 -07:00
Adlai Holler f434192339 [Tests] Two Minor Cleanups (#1977)
* [Tests] Use XCTestExpectation instead of rolling our own in ASMultiplexImageNode

* [Tests] Remove do-nothing ASCollectionView test method
2016-07-24 15:32:27 -07:00
Michael Schneider bbe2fe5f4c Add and fix tests for adding a nil subnode 2016-07-21 14:54:39 -07:00
Adlai Holler 8cde594de3 [ASDataController] Add validation logic to the change set to throw exceptions on invalid updates (#1894)
[_ASHierarchyChangeSet] Oopsy daisy

[ASDataController] Tweak our update validation

[ASHierarchyChangeSet] Fix bugs

Finish up some stuff

[ASDataController] Put some stuff back

[ASChangeSetDataController] Always use changeset

[ASDataController] Put other stuff back

[_ASHierarchyChangeSet] Use fast enumeration

[_ASHierarchyChangeSet] Fix assertion format strings, return on fail so we don't crash in production

[ASDataController] Store data source item counts as vector rather than NSArray

[ASDataController] Build some tests for the update validation

[ASDataController] Fix issues with update validation

Get rid of new file

[ASDataController] Suppress changeset validation before initial reload

[ASDataController] Make invalid update log vs. exception publicly toggleable
2016-07-21 14:37:51 -07:00
Hannah Troisi abf8d5b9aa [Infer] change atomic properties to nonatomic (#1932) 2016-07-16 10:46:55 -07:00
Adlai Holler cc8e0049c5 Merge pull request #1921 from facebook/AHRangeModeUpdatingIssues
[ASRangeController] Fix Major Range Mode Updating Issues
2016-07-15 10:22:36 -07:00
Michael Schneider 705cc763fd Fix failing ASTextNode tests 2016-07-14 19:30:44 -07:00
Adlai Holler 65e194c7c6 [Tests] Add failing tests for weird conformance issue 2016-07-14 11:06:22 -07:00
Michael Schneider 8b3ec83bfd Small name changes 2016-07-13 16:36:48 -07:00
Michael Schneider 30bb2ee93d Address comments from @levi 2016-07-13 16:36:48 -07:00
Michael Schneider 9fb3129a0e Add default ASCollectionViewLayoutInspecting for custom ASCollectionViewLayout 2016-07-13 16:36:48 -07:00
Michael Schneider 35c860c183 Refactor usage of ASCollectionViewLayoutInspecting
- Fix not using itemSize of UICollectionViewFlowLayout
- Move automatic constrained size calculation to the ASCollectionViewFlowLayoutInspector
- Provide a null layout inspector for throwing exceptions if a custom
  UICollectionView is given but no ASCollectionViewLayoutInspecting
- Fix not checking for optional layout inspecting data source methods
  are implemented or not
- Improving tests around ASCollectionViewLayoutInspecting
2016-07-13 16:36:48 -07:00
Scott Goodson bf9c142765 Revert "[ASTextNode] Fix text node truncation (#1863)"
This reverts commit 6238e5edbd.

We will re-apply this change, but there are some early signs of performance impacts that need to be investigated.
2016-07-09 23:54:43 -07:00
Scott Goodson f0ff9c108d Merge branch 'master' of git://github.com/kielgillard/AsyncDisplayKit into kielgillard-master 2016-07-09 15:44:31 -07:00
Michael Schneider 6238e5edbd [ASTextNode] Fix text node truncation (#1863)
* Before truncate a text storage in ASTextKitContext reset the text storage to original value

* Fix ASTextNode tests

We should pass in the constrained size in both cases and the sizes should be the same. We adjust the calculated size in ASTextNode to be a bit narrower in the second case if we truncate again with the calculated size as constrained size it will truncate more and the resulting size will shrink.
2016-07-09 15:40:31 -07:00
Adlai Holler 38fab7cd94 Merge pull request #1816 from hannahmbanana/selectionBug
[ASCellNode] Fix selection / highlight implementation
2016-07-08 15:48:22 -07:00
Adlai Holler a2d4dc5888 Merge pull request #1839 from maicki/MSAsyncMeasure
[ASDisplayNode] Allow measure always be off the main thread
2016-07-08 15:41:05 -07:00
Michael Schneider f25e0f0d01 Fix Xcode 8 errors 2016-07-08 10:51:07 -07:00
Kiel Gillard 6a15ab6130 * Tidy the header imports, forward declaring classes and protocols where appropriate to avoid import cycles and using the framework/system header notation for imports occuring in .h files.
* Perhaps controversially, decomposing ASRangeControllerUpdateRangeProtocol+Beta.h such that the categories on various classes are defined in the classes themselves since that's where the implementation of those categories is provided.
* Updating unit tests and import other headers the tests took for granted. The tests could probably import the umbrella header and not have to worry about this.
* Updating the "Life without Cocoapods" sample to build and run dependent on ASDK as a static library.
* Added a "Life With Frameworks" sample app to build and run dependent on ASDK as a framework, proving the framework targets work.
2016-07-07 15:12:19 +10:00
Hannah Trosi 3994f2089c [ASCellNode] Final revisions to behavior of setSelected: & setHighlighted: 2016-07-05 17:47:00 -07:00
Hannah Trosi 61d7c093a1 Merge branch 'master' into selectionBug 2016-07-02 11:50:19 -07:00
Hannah Trosi 3080ee33cf Revert "update from master/"
This reverts commit d7fde61e16.
2016-07-02 11:45:40 -07:00
Adlai Holler 5d7f3b4293 Merge pull request #1819 from kielgillard/master
[ASDisplayNodeExtras] Collect subnodes passing the test
2016-07-02 08:55:51 -07:00
Michael Schneider 01fed69b26 Adds trampoline for inserting and deletion of nodes
Currently measurement always needs to happen on the main thread if implicit hierarchy management is enabled as adding and removing from nodes needs to happen on the main thread. We now will trampoline to the main thread to do the insertion and deletion of nodes.

This also resolves the issue that can occur if a node is already loaded deep in the layout hierarchy in the layout that the node is transforming to. Before insertion or deletion is happening we need to crawl the layout hierarchy to check that though.
2016-07-01 16:33:37 -07:00
Hannah Trosi d7fde61e16 update from master/ 2016-07-01 16:25:48 -07:00
Adlai Holler a77a6eaaf5 Merge pull request #1820 from gazreese/ASCollectionView-tuning-parameters
[ASCollectionView] Tuning parameters not set
2016-07-01 15:09:01 -07:00
Adlai Holler d82e1ce95b Merge pull request #1812 from facebook/AHUpdateIntegrity
[ASDataController] Improve Update Handling, Esp. Reloading Sections
2016-06-27 18:11:11 -07:00
Gareth Reese d55621c285 [ASCollectionView] Tuning parameters not set 2016-06-27 14:07:00 +01: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
Kiel Gillard cc74fb0cdc Prove the change gets the correct nodes with a pair of tests. 2016-06-27 12:53:33 +10:00
Hannah Trosi 2e4b1ea053 [ASCellNode] Fix selection / highlight implementation 2016-06-25 00:22:28 -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
Adlai Holler 5d72f2f2cc Enable the thrash testing 2016-06-24 11:12:37 -07:00
Adlai Holler 681876bd59 Fix more issues with data integrity 2016-06-24 11:12:37 -07:00
Adlai Holler 35056f708b [ASDataController] Improve update handling 2016-06-24 11:12:37 -07:00
Adlai Holler 71d9f64535 Carry over first-pass change set improvements 2016-06-24 11:12:37 -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
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 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
Adlai Holler 12336de325 [ASThrashTesting] Array is immutable 2016-06-22 17:25:09 -07:00
Adlai Holler 9fc3ec9096 [ASThrashTesting] Numbers so magic 2016-06-22 17:19:36 -07:00
Adlai Holler bd7f90f7ee [ASThrashTesting] Remove unneeded clang diagnostics 2016-06-22 17:14:01 -07:00
Adlai Holler 3ca95778df [ASThrashTesting] Some cleanup 2016-06-22 17:11:21 -07:00
Adlai Holler 383667f2c3 [ASThrashTesting] Rocking and rolling! 2016-06-22 17:02:46 -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
Adlai Holler 4184c21c0c [ASThrashTesting] Continue setting up replay feature 2016-06-22 15:46:47 -07:00
Adlai Holler 15e03d85cf [ASThrashTesting] Move update into an archivable object so we can replay tests 2016-06-22 14:19:59 -07:00