2388 Commits

Author SHA1 Message Date
Garrett Moon
645aa6f24b [ASDisplayNode] Renamed range update callbacks (#2130)
* Renamed range update callbacks

We finally settled on

didEnter/ExitDisplayState
didEnter/ExitPreloadState
didEnter/ExitVisibleState

This change is meant to unify the range update methods to relate to each
other and hopefully be a bit more self explanatory.

* Guarantee interface callbacks happen on main.

* move fetchData / clearFetchedData to default implementations

* Move deprecated methods to new deprecated category

* Don't bring in cocoapod change.

* Nits

* Capetalize
2016-08-26 20:18:38 -07:00
Adlai Holler
f542e8d458 [ASDisplayNode] If We Skipped Rendering Due to Zero-Area, Re-Render When We Get a Real Area (#2149)
* Add failing test case

* [_ASDisplayLayer] If we skipped render due to being zero-size, enqueue a render when we get a real size

* Remove pointless import
2016-08-26 15:51:49 -07:00
Garrett Moon
8032758176 Fixes a deadlock caused by walking up the heirarchy. (#2147)
* Fixes a deadlock caused by walking up the heirarchy.

* Use scope locker / unlocker and add a comment.

* Add comment about calling __setNeedsLayout without the lock.
2016-08-26 14:09:38 -07:00
Garrett Moon
e6e5c346de I wrote a bunch of code with the Mutex::Unlocker and didn't understand it. (#2150) 2016-08-26 14:07:18 -07:00
Michael Schneider
905508e9be Factor in constrained size for final size calculation of ASTextNode (#2146) 2016-08-26 11:55:13 -07:00
Adlai Holler
9c3b688a87 Remove textStorageCreationBlock API (#2142)
* Remove textStorageCreationBlock API

* Remove layoutManagerCreationBlock also
2016-08-26 11:42:20 -07:00
Adlai Holler
6a482dc153 [ASDataController] Use 2 Threads Per CPU When Measuring Nodes (#2145)
* [ASDataController] Use custom apply function to control thread count

* Relax the test for stupid Travis CI

* Remove unneeded import
2016-08-26 10:54:55 -07:00
Adlai Holler
480ba8c3fa [ASViewController] Remeasure node with new constrained size when propagating trait collection (#2143) 2016-08-25 21:21:44 -07:00
Garrett Moon
e3091737ca Enable ASRangeControllerUpdateRangeProtocol by default if view controller or node support it. (#2133) 2016-08-25 21:18:04 -07:00
Adlai Holler
04ecd4180e [ASTextKitRenderer] Shift TextKit Teardown onto the Deallocation Queue (#2136)
* [ASTextKitRenderer] Shift TextKit teardown onto the deallocation queue

* Import it!
2016-08-25 17:29:31 -07:00
ricky
b5b9eefe44 [ASViewController] Layout root node AFTER propagating all the traits (#2137)
Wait until all subnodes have the new trait collection before laying out the root node. The way I’m using `asyncTraitCollectionDidChange`, I sometimes call methods that call `setNeedsLayout` which causes a new layout pass to begin before the new trait collection has been propagated to all nodes. This leads to weird behavoir, like nodes being laid out twice in the same call stack!

This change won’t stop possibly unnecessary layout passes because of `asyncTraitCollectionDidChange`, but it will at least do a complete layout pass once we have propagated all traits.

Ultimately the solution to this problem (as Adlai pointed out) is to wait until the CA transaction commit to perform the actual layout.
2016-08-25 11:52:43 -07:00
Adlai Holler
a193a4bca4 [ASStackLayoutSpec] Create children NSArray less often (#2139) 2016-08-25 10:03:07 -07:00
Michael Schneider
370d0597df Fix compiler warning in Xcode 8 2016-08-24 15:56:21 -07:00
Garrett Moon
dfe4585cec Add ability to force the size which an image node is rendered. (#2107)
* Add ability to force the size which an image node is rendered.

* Add unit tests for forced scaling.

* Whoops, need results!

* Round forced scaling.

* Check size of contents too.

* Remove unnecessary container node.
2016-08-23 16:01:43 -07:00
Adlai Holler
b21742c3c9 [ASCollectionView] Relayout Nodes as Soon as Bounds Changes (#2121)
* Add failing test case for ASCollectionView rotation

* [ASCollectionView] Relayout nodes immediately on bounds change
2016-08-23 14:33:45 -07:00
Adlai Holler
8edc9fe08f Ensure supplementary section count tracks item section count (#2118) 2016-08-22 20:50:09 -07:00
Michal Ziman
873bae2eed [ASMapNode] Add custom pin annotation for static maps (#1890)
* Adds possibility to have custom annotation pins on static map. This resolves #1889.

* Removes wrong example for map annotations and adds some annotations to correct map example. #1889

* Static map node now uses specific property block to get annotation views.

* Changes self to strongSelf inside of the snapshotters completion block.

* MapNode: Adds statement in documentation.

* MapNode: Block for annotation view/image now returns UIImage and center offset is returned in inout param.

* MapNode and map example: Fixes from review.

* MapNode example: Gets image directly from custom annotation, without creating annotation view.
2016-08-22 10:44:29 -07:00
ricky
c0be871812 [ASViewController] Propagate the traits on willTransitionToTraitCollection (#2115)
Previously we were only propagating the trait collection on `viewWillTransitionToSize` since it is called shortly after `willTransitionToTraitCollection`. However, some important things can happen in that time “shortly after” (like collection view layout). As long as nothing changes from `willTransitionToTraitCollection` to `viewWillTransitionToSize` (which it shouldn’t) the traits will not be re-propagated anyhow.

Also make sure to use the `ASEnvironmentTraitCollectionMakeDefault` method when creating new envTraitCollection so the struct isn’t filled with junk.
2016-08-22 10:06:53 -07:00
Yue-Wang-Google
a38f3db6b0 set the right attributes for block properties. (#2113)
* set the right attributes for block properties.

* oops. should remove strong.

* Update ASImageNode.mm

* revert to use copy for blocks. See apple documentation below

https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/WorkingwithBlocks/WorkingwithBlocks.html#//apple_ref/doc/uid/TP40011210-CH8-SW12

* make the block properties nonatomic.
2016-08-21 13:06:21 -07:00
Yue-Wang-Google
1951954ba5 remove non unicode char (#2109)
see https://github.com/facebook/AsyncDisplayKit/issues/2108
2016-08-19 17:51:41 -07:00
Adlai Holler
69e73065e5 Avoid accessing itemCountsFromDataSource off-main (#2106) 2016-08-19 12:10:19 -07:00
Adlai Holler
fa3a988b54 [ASPagerNode] Rename constrainedSizeForNodeAtIndexPath: to constrainedSizeForNodeAtIndex: for consistency (#2097) 2016-08-19 11:47:56 -07:00
Adlai Holler
0bd664f9ed Remove numberOfSectionsForSupplementaryNodeOfKind: Method (#2102)
* Add unit test to confirm that supplementary items must be contained within actual sections

* [ASLayoutInspecting] Deprecate collectionView:numberOfSectionsForSupplementaryNodeOfKind:

* Add another test to dig deeper into UICollectionView
2016-08-19 11:18:31 -07:00
Hannah Trosi
971d43ad4d [Build settings] add missing newlines at end of file 2016-08-18 15:01:41 -07:00
Michael Schneider
c409e79714 Fix accessibleElements warning in _ASDisplayView (#2100) 2016-08-18 13:12:19 -07:00
Adlai Holler
f61b7d5d5d [ASDisplayView] Remove some gunk (#2095) 2016-08-18 10:16:09 -07:00
Adlai Holler
00af76226d [ASDisplayNode] Clarify logic around calling setNeedsDisplay (#2094) 2016-08-18 09:45:43 -07:00
Adlai Holler
4baffea8f6 [ASTableView] Ignore table view cell layouts when there's no node assigned (#2091) 2016-08-17 19:58:40 -07:00
Garrett Moon
86d2ab617e I didn't really understand NSProxy (#2089)
* I didn't really understand NSProxy

But I think I do now :)

Previously I inherited from NSObject because I didn't think I needed
anything fancy, but it turns out NSProxy is *less* fancy than NSObject
and allows for overriding more methods. This change is probably purely
academic in that we don't use this class to forward NSObject specific
messages, but I believe this is the 'right thing'.

* Update comment, thanks @maicki!
2016-08-17 17:59:28 -07:00
Adlai Holler
99574a728c Make our snapshot testing possible without framework-private access, simplify (#2083) 2016-08-17 17:42:37 -07:00
Garrett Moon
7d21ccc184 [_ASDisplayViewAccessiblity] Fix accessibility in scroll views (#2079)
* Fixes issues with accessibility elements in scroll views

There are two changes here:

1. Because we can't reliably update the screen positions of accessibility elements
contained within a scroll view, we need to calculate them on demand, so we override
the accessibilityFrame method to do that.

2. Throwing away our calculated accessibility elements on frame change seemed to
cause the accessibility system to be confused.

Combining these two fixes together results in success, yay!

* Don't set the accessibilityFrame, getter is overridden.
2016-08-16 17:01:06 -07:00
Adlai Holler
05dba2263c Make ASWeakSet and NSArray+Diffing public, add support for large arrays (#2078) 2016-08-16 16:47:26 -07:00
Garrett Moon
eb497b7db1 ASCellNode was overriding old deprecated methods
It needs to override the new signatures as well.
2016-08-16 15:40:55 -07:00
Michael Schneider
c65b2efed7 [_ASDisplayViewAccessiblity] Improve accessibility support (#2060)
* First approach to improve accessiblity

* Clear accessibleElements in addSubview: and willRemoveSubview:

* Adjust comments and rename viewNode to node

* Create new accessible elements if screen coordinates of view changes

* Remove legacy clearing of accessibleElements

* Performance improvements

* Use bounds for screenFrame calculation and indexOfObjectIdentical: in indexOfAccessiblityElement:

* Add ASDK_ACCESSIBILITY_DISABLE compiler flag to disable custom accessibility code in ASDK

* No need to set a frame if a subnode view is an accessibility element and not layer backed
2016-08-16 10:27:14 -07:00
Hannah Troisi
14ccb0b886 [ASTextNode] placeholder image shouldn't draw for zero area strings (#2069)
* placeholder should not draw if area is zero

* styling fix

* super precision
2016-08-16 10:20:59 -07:00
Nikita Lutsenko
2091df9607 [ASTextNode] Fix highlighting when textContainerInsets are set. (#2073)
* [ASTextNode] Fix highlighting when textContainerInsets are set.

* Add ASTextNodeSnapshotTests to xcodeproj.

* Add snapshot test for container inset and highlighting.
2016-08-16 10:18:51 -07:00
Michael Schneider
365f739ce7 Fix ASPagerNode delegate and data source warning (#2076) 2016-08-15 20:58:50 -07:00
Michael Schneider
067e4998e2 Fix methods from ASCollectionDelegate are not passed through to pager delegate (#2074) 2016-08-15 17:23:39 -07:00
Michael Schneider
ee87695fc8 Don't use the default layout transition animation of no animation is wanted (#2075) 2016-08-15 17:23:02 -07:00
Michael Schneider
11215bf97f [Automatic Hierarchy Management] Rename IHM to automatic hierarchy management and move out of beta header (#2066)
* Rename automaticHierarchy to automaticallyManagesSubnodes

* Comment adjustments
2016-08-15 12:06:06 -07:00
David Rodrigues
f05ccea860 Fix wrong annotation which is causing a warning at compile time (#2072) 2016-08-15 11:26:10 -07:00
Michael Schneider
adcc9afb5a [Layout Transition] Add default fade in / out layout transition (#2052)
* Add default fade in / out layout transition

* Add example for layout transition

* Update for recent layout transition API changes

* To be able to do a layoutTransition the node needs to be loaded

* Rename layoutTransitionDuration to defaultLayoutTransitionDuration

* Expose default layout transition duration delay and options

* Use `UIViewAnimationOptionBeginFromCurrentState` for initial defaultLayoutTransitionOptions
2016-08-13 17:35:20 -07:00
Maximilian Szengel
43370fe6ff Expose AVPlayerLayer on ASVideoNode (#2028)
The playerLayer is needed for picture in picture support on the iPad (AVPictureInPictureController).
2016-08-13 17:28:19 -07:00
Michael Schneider
93be894e0c [ASCollectionView / ASPagerNode] Move constrainedSizeForNodeAtIndexPath from the DataSource to the Delegate (#2065)
* Move constrainedSizeForNodeAtIndexPath from the DataSource to the Delegate in ASCollectionView and ASPagerNode

* Fix ASPagerNode declaration of dataSource and delegate

As ASPagerDataSource does not inherit from ASCollectionDataSource it's not possible to declare it as property.

* Update comment
2016-08-12 15:37:23 -07:00
Garrett Moon
2c9e51e8f7 Add support for textContainerInset to ASTextNode (ala UITextView) (#2062)
* Add support for textContainerInset to ASTextNode (ala UITextView)

* Better comment, parens to increase readability. Thanks @schneider!

* Add textContainerInset snapshot test.
2016-08-12 12:07:00 -07:00
Flo
39cb188b9e [ASVideoNode] Improve playerStatus behaviour and image generation (#2024)
* [ASVideoNode] Use the videoComposition when generating images.

* [ASVideoNode] Improve playerState behaviour.

* [ASVideoNode] Use KVO on _player.rate to determine the playerState.
2016-08-12 12:06:02 -07:00
Hannah Troisi
3c0fea80ef Merge pull request #2023 from maicki/MSLayoutTransitionAPINaming
[Layout Transition API] Move Transition Layout API out of beta header and remove shouldMeasureAsync from API
2016-08-11 21:17:54 -07:00
Hannah Troisi
2040674aed Merge pull request #1767 from facebook/AHPercentToFraction
[ASRelativeDimensionType] Replace "percent" with "fraction" Where Appropriate
2016-08-11 20:33:34 -07:00
Adlai Holler
aedb83cfe3 [ASDataController] Remove Unused Batch Update Processing Code (#2054)
* [ASDataController] Remove dead batch updating code

* Address PR comments
2016-08-11 11:48:17 -07:00
Hannah Troisi
2afd063b10 [ASRangeController] Debug overlay to show the size and direction of display + fetchData ranges during scrolling. (#2008)
* Rebase ASRangeController diff with master.

* fix Table / CollectionNode debug label names
- now returns class names rather than generic ASTableNode, ASPagerNode
- ASPagerNode will be labeled as ASPagerNodeProxy (not sure how to get around this)

* refactor layout code: use ASDk's own resizeableRoundedCorner... methods

* Fixes and cleanup for manual layout version of range controller debug overlay.

I am working on a layout spec-based version, but it has some issues, so landing this to get the near-term value is probably the best next step.

* Remove .orig and .rej files.

* One last .orig file to remove.

* Final project file cleanup and tweaks to implementation for ASTableNode.

* fix build issues

* fix arrow directions
2016-08-11 11:23:07 -07:00