455 Commits

Author SHA1 Message Date
Adlai Holler
b075aa2851 Merge pull request #2682 from facebook/AHFixMoreDeallocVisibleCases
Fix Edge Cases of Table Cell Nodes Deallocated While Visible
2016-11-30 09:01:01 -08:00
Adlai Holler
81a04bc93b Remove magic number 2016-11-30 09:00:48 -08:00
Adlai Holler
3fe87ffb64 Add a test replicating Issue 2252 2016-11-29 16:19:48 -08:00
Adlai Holler
df497b82c2 Improve Batch Fetching Call Pattern to Reduce Fetch Calls (#2675)
* Test & tweak batch fetching implementation

* Tighten the test

* Stop batch fetching at the end of range controller pass

* Clean up the test

* Still check for batch fetching after each frame when scrolling

* Ensure batch fetching happens for empty collection/table
2016-11-29 13:40:03 -08:00
Adlai Holler
14765a55d2 Revert "Merge pull request #2649 from facebook/AHCollectionNodeInitializer"
This reverts commit 0f620f458d815b6f7a6b5d954ac29a6d056caf58, reversing
changes made to 0c65d21f8de3023c6d3a25572da18e3b82a35040.
2016-11-23 15:56:24 -08:00
Adlai Holler
94a0ba8635 Make the tests pass 2016-11-22 16:52:48 -08:00
Adlai Holler
04b93182cd Rejigger ASCollectionNode initializers 2016-11-22 16:49:52 -08:00
Adlai Holler
6d01bbeb19 Let nodes deallocate naturally, manually trampoline UIKit ivars
Be more aggressive with main thread punting

Trampoline setting the dataSource/delegate onto the main thread

Short-circuit the supplementary nodes method if no data source

Don't rely on assertions

Mark variable unused to fix release builds

Handle ASCollectionNode/ASTableNode deallocation better

Add some comments about new macro
2016-11-21 00:46:57 +09:00
Michael Schneider
1b0b9e4830 Fix layout transition measurement completion on main test (#2639) 2016-11-20 07:05:54 -08:00
Michael Schneider
acc080ab9c Revert setting isMutable to true in ASLayoutSpecSnapshotTestHelper 2016-11-19 06:43:46 -08:00
Michael Schneider
f9c70470d8 Address another round of comments 2016-11-19 06:43:46 -08:00
Michael Schneider
2cd49642b9 Address comments from @appleguy 2016-11-19 06:43:46 -08:00
Michael Schneider
cc297a2dae Fix some tests and add a workaround to ceil the values from self.bounds.size before checking for equality 2016-11-19 06:43:46 -08:00
Michael Schneider
257d4c3a1f Further improvements and fixing tests 2016-11-19 06:43:46 -08:00
Michael Schneider
a71a1d8519 Address comments 2016-11-19 06:43:46 -08:00
Michael Schneider
c7765f6183 Add pending layout to ASDisplayNode 2016-11-19 06:43:46 -08:00
Michael Schneider
d21a512907 Some commit 2016-11-19 06:43:46 -08:00
Michael Schneider
8f079bd1ca Fix some tests 2016-11-19 06:43:46 -08:00
Michael Schneider
5226879291 Some commit 2016-11-19 06:43:45 -08:00
Michael Schneider
bc0443db02 Don’t floor space between items for ASStackLayoutJustifyContentSpaceBetween and ASStackLayoutJustifyContentSpaceAround 2016-11-17 18:05:22 -08:00
Adlai Holler
da465bf812 Merge pull request #2624 from facebook/HTDeprecateTableViewDelegates
[ASCollectionNode, ASTableNode] Deprecate asyncDelegate & asyncDataSource Properties
2016-11-17 18:41:41 +09:00
Hannah Trosi
6565b8348d collectionView 2016-11-17 16:46:07 +09:00
Adlai Holler
00f448d534 Merge pull request #2623 from facebook/AssertLog
[ASDisplayNode] Convert assertion to log so developer can see layout issues onscreen.
2016-11-17 14:55:44 +09:00
Scott Goodson
8c01fccfca [ASDisplayNode] Convert assertion to log so developer can see layout issues onscreen.
In this case, the user hasn't specified enough about the layout of a node.  We default to
0, 0 - but ideally the case should not occur at all.  So it's important to help developers
detect these cases and fix them quickly.

An assertion causes developers several problems:
- They can't see important information unless an exception breakpoint is manually added.
- They can't see their layout onscreen and so visually understanding the problem is impossible.
- They can't proceed with testing to trigger other faults in the layout and are blocked fixing one at a time.

A log fixes every one of those problems:
- They can set a breakpoint on the log line very easily if desired.
- They can see their layout display and recognize the 0,0 node even more quickly than the log text information.
- They can see if multiple logs print out, or if the log only occurs for one item in a feed, or certain types --
    This helps them debug faster by knowing if the layout is always broken or certain conditions break it.

Since developing with ASLayoutSpecs is an iterative process, it's crucial that we let developers have the
freedom to experiment and test without hitting too many assertions.  Fortunately it will be impossible to ignore
these huge logs (full recursive description) and their nodes will be 0, 0 size, so they will get fixed.
2016-11-16 21:14:15 -08:00
Adlai Holler
4a48ba8be2 Improve our event logging greatly 2016-11-17 12:04:30 +09:00
Adlai Holler
e2e32870ed Reduce Flashing & Optimize ASTableNode/ASCollectionNode Data Loading (#2541)
* Optimize data controller loading by combining section updates with first set of item updates

* Update call pattern test

* Add some explanation about the approach
2016-11-14 14:30:41 +09:00
Michael Schneider
44aa582ceb Fix crash if batch update blocks are nil although method declaration allows nullable (#2599) 2016-11-14 10:15:11 +09:00
Adlai Holler
171cc2f527 Improve Automatic Subnode Management Node Ordering (#2589)
* Add failing tests for subnode ordering

* Ensure that subnode ordering matches layout spec tree ordering
2016-11-10 09:22:53 +09:00
Adlai Holler
88fecbe3eb Fix Issue in ASPagerNode Flags Handling, Restore Disabled Test (#2582)
* Fix ASPagerNode flags handling, restore affected test

* Rejigger ASPagerNode's flag handling to ensure it handles edge case in production
2016-11-09 14:20:07 +09:00
Adlai Holler
5c15869087 Disable Text Node Fast Path (#2581)
* Disable text node fast path

* Actually commit the test change
2016-11-09 10:25:02 +09:00
Huy Nguyen
fb6d1830a0 Beter table/collection update history (#2562)
- Introduce thread-safe ASEventLog
- ASCollectionNode and ASTableNode share their event log with their ASDataController. The controller uses it to log change set submitting and finishing events.
- ASCollectionNode and ASTableNode print their data source and delegate in their debug description.
2016-11-08 16:44:49 -08:00
Scott Goodson
d3e942acf7 [Build] Disable failing test in ASViewController until it can be investigated. 2016-11-08 15:25:05 -08:00
Luke Parham
2754af3858 added index of page with node method to ASPagerNode along with some tests (#2561) 2016-11-07 16:07:54 -08:00
Garrett Moon
68990cb6cc Deprecations should be re-enabled. If there are specific deprecations… (#2519)
* Deprecations should be re-enabled. If there are specific deprecations we'd like to hold off on, we should address those specifically.

* Fix decleration

* Move select to undeprecated

* Fix deprecations
2016-10-31 17:30:40 -07:00
Michael Schneider
4464b7de60 Improve deprecation situation for 2.0 (#2514)
* Improve deprecations for 2.0

- Add deprecations for node / layoutSpec style properties
- Implement missing methods on ASDisplay from deprecation header
- Cleanup all of the deprecation categories

* Remove DeprecatedProtocolMethods

* Fix "Life without Cocoapods"

* Update comments
2016-10-31 16:46:21 -07:00
Adlai Holler
3eb7a307fa Share a singleton shadower for all cases when shadow isn't drawn, fix issues (#2511) 2016-10-30 15:34:29 -07:00
Tamás Kárai
ca203158da [ASControlNode] Invoke target actions in the same order as they were added (#2456)
* added control node test

* fix tests

* target action pair

* go back to class

* move ASControlTargetAction to Private

* added ASControlTarget to cimpole sources

* add ASControlTargetAction to framework target as well

* init local variables with nil

* removed comment with private Apple class name

* isEqual implementation for ASControlTargetAction

* eliminate retain cycle

* use ASControlTargetAction isEqual

* change to NSMutableOrderedSet

* Use OrderedSet and isEqual

* Use that NSMutableOrderedSet stored the same object only once

* Moving back to NSMutableArray

* minor improvements
2016-10-30 11:44:50 -07:00
Adlai Holler
f066efd49e Improve Table Performance, Especially When Using Section Index Bar (#2506)
* Only trigger table view height requery if row-node height changed

* Make ASTableView handle the section index bar better

* Remove outdated comment

* Add a main thread assertion
2016-10-30 09:18:13 -07:00
Michael Schneider
c4451edab1 Add assertion for invalid constrainedSize in calculateSizeThatFits: (#2507) 2016-10-28 16:45:22 -07:00
Michael Schneider
fb92b448e0 [ASDisplayNode] Proper handling of constrainedSize (#2505)
* Check in ASLayout if size is valid for sizing instead of valid for layout

* Return constrainedSize from calculateSizeThatFits:

Remove invalid constrainedSize check within ASNetworkImageNode. Furthermore as ASDisplayNode does not return CGSizeZero anymore we have to give the display nodes we use in tests and are involving a stack spec an intrinsic content size.

* Remove extra constrainedSize handling in ASNetworkImageNode handling

* Change test to use FLT_MAX
2016-10-28 15:39:03 -07:00
Adlai Holler
8add4619cf Reduce Traffic to Table/Collection View When Updating (#2496)
* Improve the call pattern when loading table/collection data

* When deleting sections, no need to delete rows first

* Clean up a couple things
2016-10-28 09:42:45 -07:00
george-gw
54cda5fdbb [ASCellNode] Added indexPath property. (#2468)
* [ASCellNode] Added indexPath property.

* [ASCellNode] Cached the type of scrollView we're using in the node, and placed that logic in setScrollView.

* [ASCellNode] Removed table and collection view from indexPath, since they return the index paths from the view-space.

* Changed the logic for getting indexPath so that it works even when the cell is not displayed.

* [VerticalWithinHorizontalScrolling] Explicitally synthesized indexPath property.
2016-10-27 16:56:00 -07:00
Michael Schneider
021f5ebdbb Add initial snapshot tests for ASWrapperSpec (#2482) 2016-10-27 16:27:09 -07:00
Michael Schneider
eb6cf0689d Only throw if ASLayoutElement style width or height are ASDimensionUnitFraction (#2484) 2016-10-26 17:17:09 -07:00
george-gw
ea9d785180 Call reloadData if necessary when accessing specific methods. (#2479)
Added test case.
2016-10-26 11:38:21 -07:00
Adlai Holler
0d439a43b6 [ASTextNode] Add Fast-Paths For Text Measurement and Drawing (#2392)
* Add test case for TextKit truncation style

* Add fast path for text node measurement with default truncation

* Use fast path more often

* Reverse options order

* Simplify implementation – no functional change

* Share "isScaled" variable

* Intersect with constrained rect

* Add a failing test case for fast-path truncation

* Add some more truncation tests, using slow path as reference image

* Update the tests

* In ASTextKitRenderer, intersect bounds with constrained rect

* Add test case for TextKit truncation style

* Add fast path for text node measurement with default truncation

* Use fast path more often

* Reverse options order

* Simplify implementation – no functional change

* Share "isScaled" variable

* Intersect with constrained rect

* Add a failing test case for fast-path truncation

* Add some more truncation tests, using slow path as reference image

* Update the tests

* In ASTextKitRenderer, intersect bounds with constrained rect

* Use maximumNumberOfLines property in text kit fast path

Add reference images

Disable fast-path for max-one-line case

* Remove unneeded snapshot files
2016-10-24 17:05:59 -07:00
george-gw
3638feffd4 Added selection API to ASTableNode and ASCollectionNode (#2453)
* Added selection API to ASTableNode and ASCollectionNode (#2450)

* Updated test case to use collectionNode instead of collectionView for the selection tests.

* Fixed typos.
Added asserts for main thread.
Updated ASCollectionViewTests for multiple selections for nodes.

* Added assigns to the different properties.
2016-10-24 09:30:09 -07:00
appleguy
2c6f8b0506 [AsyncDisplayKit 2] Final changes to ease migration of clients to 2.0 APIs. (#2460) 2016-10-21 13:12:13 -07:00
Hannah Troisi
e87ac54138 disable flaky table thrash test (#2458) 2016-10-21 12:43:51 -07:00
Hannah Troisi
9719357901 [ASLayoutElement] Move ASDisplayNode's .name property to ASLayoutElement (renamed to .debugName) (#2395)
* Move ASDisplay .name property to ASLayoutElement

* keep ASDisplayNode.name deprecated

* address @appleguy's comments
2016-10-20 17:27:31 -07:00