2548 Commits

Author SHA1 Message Date
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
Hannah Troisi
2834ba3490 [ASPagerNode] Fix ASPagerNodeProxy to use collectionNode (#2475)
* Fix ASProxyDelegate to use collectionNode

* fix constrainedSize...issue
2016-10-24 16:10:56 -07:00
Garrett Moon
86a5aece9c Caching scrollable directions is not safe (#2474) 2016-10-24 14:05:03 -07:00
Hannah Troisi
f7b30577b8 Pager Node Should Implement New ASCollectionDataSource/Delegate Methods (#2466) 2016-10-24 10:58:04 -07:00
Michael Schneider
4e580b96dc Add support for multiple children to ASWrapperLayoutSpec (#2469) 2016-10-24 09:59:44 -07:00
Hannah Troisi
97e23776e4 [ASTableNode] expose ASTableView's -visibleNodes (#2449)
* expose ASTableView's -visibleNodes getter at the ASTableNode level

* add safegaurds

* make visibleNodes a read only property for ASTableNode

* make collectionNode .visibleNodes property
2016-10-24 09:42:04 -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
Scott Goodson
30a7edf30f [ASLayout] Remove new ASLayoutPrivate.h file and put contents into ASLayoutSpec+Subclasses.h 2016-10-21 13:23:05 -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
Scott Goodson
3a2ca70676 [ASDisplayNode] Simplify / shorten temporary bridged implementation of preferredFrameSize. 2016-10-21 11:21:21 -07:00
Hannah Troisi
15aa784fe8 [ASCollectionNode] add -indexPathsForVisibleNodes (#2451) 2016-10-21 10:19:27 -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
Adlai Holler
d0421195eb Make flow layout inspector call the new constrainedSize method (#2444) 2016-10-20 14:32:01 -07:00
Adlai Holler
dbe3b1bd71 Remove block copying (#2438) 2016-10-20 12:53:25 -07:00
Hannah Troisi
84d1a637d7 [2.0] add helpful deprecation messages (#2437)
[2.0] add helpful deprecation messages
2016-10-19 14:48:06 -07:00
Michael Schneider
4b914f8e15 Add preferredSize as getter to ASLayoutElementStyle (#2427) 2016-10-19 12:55:19 -07:00
Adlai Holler
67489492ee Fix Uncalled Collection Delegate Methods (#2433)
* Fix batch fetching

* Fix not calling constrainedSizeForItemAtIndexPath:

* Fix constrainedSizeForItemAtIndexPath: not being called
2016-10-19 11:49:49 -07:00
Adlai Holler
d32bf3f297 Conditionally import signpost header to fix Xcode 7 build (#2432) 2016-10-19 10:45:58 -07:00
Michael Schneider
abd80494c7 [ASLayoutElementStyle] ASLayoutElementStyle improvements (#2413)
* Use std::atomic for properties in ASLayoutElementStyle

* Remove setter calls for min / max width and height in ASLayoutElementStyle
2016-10-18 15:55:55 -07:00
Michael Schneider
56d50e6d5e Add ASAbsoluteLayoutSpecSizing (#2394)
Add ability for ASAbsoluteLayoutSpec to grow as far as possible or shrink to fit it's children
2016-10-18 13:55:13 -07:00
Michael Schneider
ba80b83695 [ASRelativeLayoutSpec] Fix ASRelatativeLayoutSpec behavior for ASRelativeLayoutSpecPositionStart (#2393)
* Fix ASRelatativeLayoutSpec behavior for ASRelativeLayoutSpecPositionStart

* Add updated images for snapshot tests
2016-10-18 12:00:01 -07:00
Adlai Holler
5a8d0037ec Add wait method to ASCollectionNode (#2416) 2016-10-18 11:00:09 -07:00
Samuel Hsiung
17dcd5f7ec [ASTableNode] Add missing ASTableNode delegate flag setup (#2415)
* add missing ASTableNode delegate flag setup

* fix typo
2016-10-18 10:54:46 -07:00
Adlai Holler
6e76daf279 [Layout] Check Layout Spec Tree for Duplicated Elements (#2408)
* Check layout spec tree for duplicated elements

* Enable layout spec tree dedupe only in debug
2016-10-18 09:33:37 -07:00
Michael Schneider
9f1643ebfd Final size should always be in constrainedSize in ratio spec (#2403) 2016-10-18 09:18:40 -07:00
appleguy
dec9e4e836 [ASDeallocQueue] Fix teardown of thread (doesn't currently happen due to singleton). (#2410)
Although this didn't occur _currently_, the code was incorrect and needs to be fixed.
2016-10-18 09:07:29 -07:00
Michael Schneider
d407663e3f [ASLayout] Improve ASLayout (#2404)
* Add internal header for ASLayout and change position to readonly publicly

* Don't copy sublayouts during tree filtering

* Revert "Don't copy sublayouts during tree filtering"

This reverts commit 6b0d54d5ffe5bb3941ec13696c9c45b0098b6ba1.
2016-10-18 08:36:38 -07:00
Garrett Moon
093653b507 Upgrades to the latest PINRemoteImage (#2414) 2016-10-18 08:35:25 -07:00
appleguy
0a5c1f43a8 [ASRunLoopQueue - Performance] Add ASDeallocQueue for efficient object teardown. (#2399)
* [ASRunLoopQueue - Performance] Add ASDeallocQueue for efficient object teardown.

This measurably reduces block overhead and context switching.  In the layout benchmark,
it increases ops/s while actually reducing CPU utilization.  This suggests that we are
now at a lock-bounded local maximum, at least for tri-core devices.

* [ASDeallocQueue] Update convenience helper method and adopt in ASImageNode etc.

* [ASDeallocQueue] Reimplement the queue using a timer-based runloop.

* [Debugging] Re-enable ASDisplayNode Event Log.

* [ASDeallocQueue] Final refinements, comments, code minimization.

* [ASDeallocQueue] Fix for lock release needed in early return (refactoring typo from last commit)
2016-10-17 12:24:11 -07:00
appleguy
11293d545a [ASLayout - Performance] Avoid weak ivar access & method call to check layoutElementType. (#2397)
* [ASLayout - Performance] Avoid weak ivar access & method call to check layoutElementType.

This shows up in benchmarking profiles for layout-bound workloads.

* Add comment
2016-10-17 12:23:45 -07:00
Michael Schneider
ae9e128214 Layout inspector instance variable should be weak in ASCollectionView (#2405) 2016-10-17 10:51:54 -07:00
Hannah Troisi
902bb0999d remove miscellaneous true values (#2391)
[Code Cleanup] Replace `true` values with `YES`
2016-10-15 18:28:46 -07:00
Adlai Holler
0ed8ecb677 Test and improve the ASNetworkImageNode progress block handling (#2386) 2016-10-15 17:50:16 -07:00
Hannah Troisi
3c995d8d12 [Examples] Layout 2.0 updates (#2382)
[Examples] Layout 2.0 updates: Switch YES to 1.0 for flexGrow and flexShrink
2016-10-15 17:30:48 -07:00
appleguy
42d1c9a55b [ASCellNode] Add subclass method cache; skip visibility rect calculations in the common case. (#2388)
Profiling showed this area as the most expensive part of ASRangeController propogation of .interfaceState,
when scrolling an ASTableView.  This is very much on the critical path for sustained 60FPS in these views.
2016-10-15 09:58:57 -07:00
Adlai Holler
c2ea7cfeac [Umbrella] ASCollectionView -> ASCollectionNode Migration, Separate Index Spaces (#2372)
* Separate dataSource & UIKit index spaces

Beef up our supplementary node support

Make the API way better

Go nuts

Add a unit test for UICollectionView's handling of reloadData inside batch updates

Wrap indexPathForNode: in a cache

Convert index paths in delegate methods

Go back on table view

Put collection view back

Switch up the API

Move most ASCollectionView API to ASCollectionNode

Move most table logic over to ASTableNode

Do the things

More conversion work

Keep on keepin' on

Get table view delegate API done

More porting

Simplify

Clear the delegate

More cleanup

Move more stuff around

Remove pointless file

Re-add some API

Put back more API

Use the right flag

* Some cleanup

* Remove incorrect comment

* Tweak the API

* Put back a couple methods

* update example projects (note: ASCollectionView deprecation warnings expected)

* change reloadDataWithCompletion:nil --> reloadData

* Clean up rebase

* Make deprecated numberOfItemsInSection methods optional

* Use the right flag

* Address nits

* update ASDKTube, ASDKgram & ASViewController examples
2016-10-14 17:21:16 -07:00
Garrett Moon
1d28639301 [ASCollectionNode] Add scrollableDirections method to ASCollectionViewLayoutInspecting p… (#2381)
* Add scrollableDirections method to ASCollectionViewLayoutInspecting protocol

ASViewController's default method will not always return the correct scrollable
directions in cases where size changes may not have been applied. This allows
us to ignore this issue for a little while longer by allowing the layout
inspector to explicitly vend this.

* Better header, thanks @maicki!
2016-10-14 09:39:28 -07:00
Michael Schneider
3f11c67c82 Return CGSizeZero in case a ASNetworkImageNode is asked for the size and the image did not load yet (#2378) 2016-10-13 14:03:15 -07:00
Adlai Holler
cb838664aa [ASTextNode] Go Back to Having Renderer as Ivar (#2376)
* Revert "Disable ASTextKitRenderer cache (#2315)"

This reverts commit 4aa7c9631d3a03b1542fac168f1a74531755392a.

* Revert "[ASTextNode] Add NSCache based cache for ASTextKitRenderer (#2199)"
2016-10-13 11:37:56 -07:00
Adlai Holler
60b40d8e1c Revert "Scrollable direction is invalid until a relayout. (#2375)" (#2377)
This reverts commit 9abae013a7c2510ead0ea7bf7cffdba54d7f9e08.
2016-10-13 11:24:57 -07:00
Garrett Moon
9abae013a7 Scrollable direction is invalid until a relayout. (#2375) 2016-10-13 10:51:23 -07:00
appleguy
4595ebc06e [ASLog] Add new ASProfilingSignpost defines for System Trace flags. (#2370)
* [Debugging / Profiling] Add kdebug_signpost calls to Range and DataController.

* [ASLog] Add new ASProfilingSignpost defines for System Trace flags.

* [ASLog] Improve kdebug_signpost logging: ASRunloopQueue and AsyncDisplay, and colors.
See https://github.com/facebook/AsyncDisplayKit/pull/2370 for screenshots.
2016-10-13 10:31:22 -07:00
Garrett Moon
8729bc0502 This is super minor, but active processor account takes into processors that may be out of commission due to boot arguments or thermal conditions. (#2373) 2016-10-12 15:54:59 -07:00
Michael Schneider
8491155fb4 Add locking for ASStackLayoutElement and ASAbsoluteLayoutElement (#2371) 2016-10-12 13:40:53 -07:00
Michael Schneider
8f8df537d2 Rename ASRelativeSize to ASLayoutSize (#2369) 2016-10-11 16:36:40 -07:00
Michael Schneider
507bc55504 [Layout] Add ASLayoutElementStylability protocol (#2366)
* Add ASLayoutElementStylability protocol

* Rename to styledWithBlock:, add instancetype and add noescape
2016-10-11 09:16:18 -07:00
Garrett Moon
4f3593b211 Improving documentation based on feedback. Thanks @appleguy! (#2364)
* Improving documentation based on feedback. Thanks @appleguy!

* :palm + forehead:
2016-10-07 16:59:44 -07:00
Adlai Holler
c72b2b212c Tiny change to the doc for ASDimensionMake (#2362) 2016-10-07 10:00:58 -07:00
Hannah Troisi
a79e0be016 quick renaming (#2358) 2016-10-07 09:32:38 -07:00
Michael Schneider
bb7118a26a Fix ASAbsoluteLayoutSpec creation children protocol (#2357) 2016-10-06 20:37:12 -07:00