Commit Graph

3546 Commits

Author SHA1 Message Date
Scott Goodson
5aa5dc591a [ASDisplayNode] Add -displayWillStartAsynchronously: method to allow skipping synchronous image cache check. 2016-10-04 20:30:25 -07:00
Scott Goodson
07f0b5b02c [ASDisplayNode] Change _pendingDisplayNodes from NSMutableSet to ASWeakSet.
In at least some cases, _pendingDisplayNodes referencing self can cause the
object to live longer than the application needs, while tearing down views.

It also appears there may be a cancellation condition where this state is
not balanced properly, which can cause a reference-cycle leak.  This change
safely fixes this problem when tested against a repro case for it.

I'm filing a followup task to make sure all cancellation edge cases have
proper accounting for this codepath, even though the leak is fixed.
2016-10-04 00:15:49 -07:00
Adlai Holler
f63349a319 Handle nil node blocks gracefully in production (#2338) 2016-10-03 17:51:15 -07:00
Adlai Holler
cb4d354eb5 [ASCollectionView] Allow User to Submit Updates Before Initial Data Load (#2337)
* Add tests for how UICV/ASCV will throw if you update before the initial data load

* Allow user to submit updates before initial data load to workaround UICollectionView bug

* Add some info
2016-10-03 16:14:42 -07:00
Huy Nguyen
b2549196fe Introduce ASSectionContext and ASSection (#2178)
- Objects conform to ASSectionContext protocol can be provided via ASCollectionDataSource and later retrieved from the collection view. They are guaranteed to be in sync with sections of the collection view. They can be used to store additional data associated with each section, to be used in collection view layout and the like.
- ASSection is an internal object that is the foundation for coming debugging tools.
- Unit tests included.
2016-10-03 13:07:05 -07:00
Scott Goodson
ebedda9fec Force xcpretty 0.2.2 instead of new 0.2.3 release that is failing on Travis. 2016-10-03 13:06:45 -07:00
Scott Goodson
d31b278b71 Revert "[ASCellNode] Fix applyLayoutAttributes not called, add readonly layoutAttributes property (#2321)"
This reverts commit f9ee1dd4b6.

This appears to have caused a test failure:
https://travis-ci.org/facebook/AsyncDisplayKit/jobs/164532435
2016-10-03 13:06:34 -07:00
Garrett Moon
79fa476644 [API] Remove old deprecated methods. (#2312)
* Remove old deprecated methods. Will restore ones that were removed recently based on PR.

* Update example to use non-deprecated method.

* Don't remove locking / unlocking, insets or willDisplayNode deprecated methods yet.
2016-10-03 13:06:22 -07:00
Hannah Troisi
97832ce3aa check button state before changing` (#2323) 2016-09-29 21:23:24 -07:00
Adlai Holler
282fa66f2a [ASDataController] Call All Completion Handlers after Nested Batch Updates (#2274)
* Add tests for batch update completion handler calling

* Ensure we call all completion handlers after collection view updates

* Tweak it

* Fix the doc

* Minor improvements

* Document addCompletionHandler better
2016-09-29 16:18:51 -07:00
Adlai Holler
7ee44bd078 Add some nullability specifiers to our public headers (#2291) 2016-09-29 16:18:19 -07:00
Adlai Holler
6a06e1ec27 Simplify/optimize rounded image generation (#2292) 2016-09-29 16:18:04 -07:00
Adlai Holler
0fcd5b7be0 [ASDisplayNode] Failing Test Case: Rasterized Nodes Should Get Interface State Updates (#2242)
* Add new failing test cases for dealloc-while-visible

* Disable the new tests for the time being
2016-09-29 16:17:45 -07:00
Garrett Moon
2691c7494e @return is recognized by the syntax highlighter. (#2313) 2016-09-29 16:16:47 -07:00
Adlai Holler
7a63ea44f1 [ASCellNode] Fix applyLayoutAttributes not called, add readonly layoutAttributes property (#2321) 2016-09-29 16:14:55 -07:00
Michael Schneider
e3489c96f4 Add allowsGroupOpacity property to ASDisplayNode (#2320) 2016-09-29 16:14:14 -07:00
Michael Schneider
2b4d61feb6 Fix ASImageNodeSnapshotTests 2016-09-28 14:02:00 -07:00
Michael Schneider
68442f097a Disable ASTextKitRenderer cache (#2315) 2016-09-28 13:46:44 -07:00
Garrett Moon
4de50ce6ff I don't believe it's safe to return a vector by reference created in a function. (#2286) 2016-09-27 10:17:25 -07:00
Adlai Holler
e1631a5b77 Pass the cell node through in willDisplay: table/collection callbacks (#2282) 2016-09-26 18:13:27 -07:00
Hannah Trosi
c377578a67 Revert "Pass the cell node through in willDisplay: table/collection callbacks (#2282)"
This reverts commit cb836acdab.
2016-09-26 16:15:05 -07:00
Scott Goodson
632c5559b6 Revert "Set alignItems to ASStackLayoutAlignItemsStretch in ASStackLayoutSpec (#2187)"
This reverts commit 37416f1696.

We are reverting this commit only for Pinterest.  The new default of stretch will be maintained on
ASDK master, and when Pinterest syncs to this in 1-2 weeks, we'll communicate to the team about
the new default.

The small number of changes that were made to address code that was relying on Start (previous default)
will continue to work safely, because they'll just be re-setting the value to Start which is now default again.

After the full adoption of ASDK 2.0 APIs, the default will become Stretch again (for alignItems).
2016-09-26 15:56:49 -07:00
Adlai Holler
cb836acdab Pass the cell node through in willDisplay: table/collection callbacks (#2282) 2016-09-24 00:12:42 -07:00
Rocir Santiago
51e5dc0684 Minor tweaks around image alignment in ASButtonNode (#2271) 2016-09-20 22:46:13 -07:00
Rocir Santiago
448753bc57 Add support to image alignment in ASButtonNode (#2266) 2016-09-19 20:25:38 -07:00
appleguy
9c306e9cf2 [ASDisplayNode] Ensure ASHierarchyState propagation does not jump discontinuities in the node hierarchy. (#2263) 2016-09-19 16:23:18 -04:00
Adlai Holler
4c00e1f69b Re-add ASDisplayNode layout generation metric 2016-09-16 12:57:41 -07:00
Adlai Holler
0b7c7be4ba Fix ASViewController accessing traitCollection on iOS 7 (#2259) 2016-09-16 12:28:47 -07:00
Adlai Holler
439c02c417 Remove some thread affinity assertions that we no longer need (#2251) 2016-09-15 12:18:16 -07:00
Adlai Holler
de9d2e19ec [ASDisplayNode] Use kCGBlendModeCopy in a Couple More Places (#2250)
* Use blend mode copy in a couple more places

* Add some tests
2016-09-15 12:18:10 -07:00
Adlai Holler
ad17f61e70 [ASTableView] Add Support for Interactive Reordering (#2221) 2016-09-15 11:05:13 -07:00
Adlai Holler
d9a16f22e6 Remove test for reverted behavior 2016-09-15 10:56:41 -07:00
Adlai Holler
0ad41cfc03 [ASDisplayNode] Use Weak Proxy to Avoid Dangling CALayer.delegate (#2249)
* Add weak proxy between node and layer to avoid dangling layer problem

* Add failing test case for dangling CALayer.delegate pointer issue

* Add docs

* Remove asynctransactioncontainer forwarding preprocessor macro

* Improve comments

* Remove asyncTransactionContainerStateDidChange callback
2016-09-15 10:51:50 -07:00
Adlai Holler
566bd8ef66 Don't beginUpdates/endUpdates on cell relayout if data source is gone (#2248) 2016-09-14 16:21:28 -07:00
Adlai Holler
63a084b627 Fix merge damage when bringing in #2206 2016-09-14 14:41:26 -07:00
Adlai Holler
58b3c75673 Revert "[Layout] Use _addSubnode / _removeFromSupernode methods in _ASDisplayView 2 (#2232)"
This reverts commit 84e633137b.
2016-09-14 11:12:56 -07:00
Adlai Holler
ff8ec4d510 Revert "Initial commit to throw an exception if manually adding / removing subnodes if node has automaticallyManagesSubnodes enabled (#2214)"
This reverts commit 0d8518912e.
2016-09-14 11:10:38 -07:00
Adlai Holler
a4b6942f00 Revert the giant layout diff 2016-09-14 11:08:28 -07:00
gazreese
025af5d594 [ASVideoNode] Maintain playback position between visibility changes (#2120)
* [ASVideoNode] Maintain playback position between visibility changes

* [ASVideoNode] Code style changes and moved the pause to be before caching the current playback time.
2016-09-13 20:44:26 -07:00
Adlai Holler
337e908390 Make Description Functions Dealloc-Safe (#2241)
* Make description functions dealloc-safe

* Make -debugDescription also dealloc-safe
2016-09-13 17:48:31 -07:00
Adlai Holler
84e633137b [Layout] Use _addSubnode / _removeFromSupernode methods in _ASDisplayView 2 (#2232)
* Use `_addSubnode` / `_removeFromSupernode` methods in _ASDisplayView

* Change name
2016-09-12 10:46:43 -07:00
Adlai Holler
8c380d1601 Don't crash in production on invalid subnode insert (#2231) 2016-09-12 10:29:31 -07:00
Harry Shamansky
59fbfb682d Measure performance for ASCellNode layout (#2209)
* Measure performance for ASCellNode layout

* Address Adlai and Levi's feedback:
* Move to ASDisplayNode level
* Lock around setting/getting measurement options and results
* Record all measurement passes and report times as an array
* Only add relevant entries to the performanceMetrics dictionary
* Rebase

* Store sum and count instead of array

* Rename ScopeTimerDataPoint to ScopeTimerSum

* Address Levi's feedback

* Address Adlai's feedback
2016-09-09 10:38:13 -07:00
John Engelhart
8c2f3f666f Fixes unsafe use of asyncdisplaykit_node. (#2207)
The previous code used either a `@property` with `assign, nonatomic` semantics, or a `__unsafe_unretained` (non-atomic) ivar pointer to an instance for `asyncdisplaykit_node`.

This commit changes those access so that they have the equivalent of `weak, atomic` semantics.

- `_ASDisplayView.mm`
  - Removes the `_node` ivar that was qualified with `__unsafe_unretained`.
  - Removes `@synthesize asyncdisplaykit_node = _node;`.
  - All direct uses of `_node` were replaced with:
    - Creates a strong reference via `ASDisplayNode *node = _asyncdisplaykit_node;`.
    - `s/_node/node/`.
    - These changes were made even if there's a single use of `_asyncdisplaykit_node` as a consistency / defensive measure so that anyone editing this code in the future does not accidentally use a `weak` reference twice.

- `ASDisplayNode.mm`
  - Getters and setters for `asyncdisplaykit_node` were changed from `nonatomic, assign` semantics to the equivalent of `atomic, weak` semantics.
  - `weak` semantics were implemented by using a `ASWeakProxy` object.
  - `objc_setAssociatedObject` was changed from `OBJC_ASSOCIATION_ASSIGN` to `OBJC_ASSOCIATION_RETAIN` (the `atomic` version of retain).

- `ASDisplayNode+FrameworkPrivate.h`
  - Changed the `@property` declarations for `asyncdisplaykit_node` from `nonatomic, assign` to `atomic, weak`.
    - The actual getters and setters are implemented in `ASDisplayNode.mm`, which were changed accordingly.
2016-09-08 17:27:49 -07:00
ricky
6bef1e129a [ASViewController] fix layout recursion (#2218)
I don’t think this `setNeedsLayout` is required since we call `measure` now.
2016-09-08 16:01:14 -07:00
Adlai Holler
0d3b31dc2d Fix tests that failed due to merging an old PR (#2217) 2016-09-08 14:37:53 -07:00
Adlai Holler
85fee6b609 Fix the dealloc test (#2216) 2016-09-08 14:25:00 -07:00
Adlai Holler
bc59b96ca9 [ASDisplayNode] Add onDidLoad Method to Perform Work When Loaded (#2128)
* [ASDisplayNode] Add `onDidLoad:` method

* Prevent user from rasterizing wrapper nodes – they can't be reloaded in the future
2016-09-08 14:18:35 -07:00
Hannah Troisi
593f13d800 Improve crash logging [@johnepinterest] (#2210) 2016-09-08 14:06:49 -07:00
Adlai Holler
12ab2e3759 Fix equality in ASTextKitRendererKey (#2215) 2016-09-08 12:59:03 -07:00