Commit Graph

3535 Commits

Author SHA1 Message Date
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
Michael Schneider
0d8518912e Initial commit to throw an exception if manually adding / removing subnodes if node has automaticallyManagesSubnodes enabled (#2214) 2016-09-08 11:59:57 -07:00
Michael Schneider
53a6743908 Don't use automaticallyManageSubnodes in ASTextCellNode (#2212) 2016-09-08 11:17:50 -07:00
Adlai Holler
5593bfa4d1 [ASDisplayNode] Majorly Improve Descriptions (#2208)
* Up our description game big time

* Couple tweaks

* Explain logic

* Fix indentation
2016-09-07 20:11:27 -07:00
Michael Schneider
0aeefaf25f [Layout] Automatic measurement on layout fixes (#2206)
* Don't measure range managed nodes automatically in the layout pass

* Fix auto measure a node mid transition
2016-09-07 12:46:05 -07:00
Michael Schneider
8897614f0e [Layout] Layout API based on content area (#2110)
* Initial commit for adding a size constraint to ASLayoutable's

* Some more commits

* Fix sample projects in extra/

* Remove preferredFrameSize test of ASEditableTextNode

* Remove preferredFrameSize from examples_extra

* Add deprecation warning to -[ASDisplayNode preferredFrameSize]

* Add deprecation warning to -[ASDisplayNode measureWithSizeRange:]

* Commit

* Commit

* Remove ASRelativeSizeRange

* Make ASRelativeSize private

* Adjust examples

* Improve setting of -[ASLayoutable size] with points or fractions

* Add ASWrapperLayoutSpec

* Improve creation of ASRelativeDimension

* Add `preferredFrameSize` back and add deprecated logging

* Add `layoutSpecBlock` setter and getter and add locking for it

* Add better documentation and fix macros to create ASRelativeDimension

* Create new ASSizeRangeMake with just a CGSize as parameter

* Update Kitten and Social App Layout example

* Add layoutThatFits: and deprecate measure:

* Rename ASRelativeDimension to ASDimension

* Fix examples for ASDimension renaming

* Remove fancy height and width setter

* Fix ASDimension helper

* Rename -[ASLayout layoutableObject] to -[ASLayout layoutable]

* Update layout related methods and more clearer documentation around how to use it

* Deprecate old ASLayout class constructors

* Don't unnecessary recalculate layout if constrained or parent size did not change

* Use shared pointer for ASDisplayNodeLayout

* Fix rebase conflicts

* Add documentation and move implementation in mm file of ASDisplayNodeLayout

* Fix test errors

* Rename ASSize to ASLayoutableSize

* Address comments

* Rename setSizeFromCGSize to setSizeWithCGSize

* Improve inline functions in ASDimension

* Fix rebase conflicts
2016-09-07 08:44:48 -07:00
Adlai Holler
2bfeb6de92 Add a failing unit test for automeasuring a node mid-transition (#2204) 2016-09-06 17:58:12 -07:00
ricky
180fcbbc5e [ASViewController] stop propagating traits in the viewWill... methods (#2202)
* [ASTraitCollection] Fix 2 bugs dealing with trait propagation

* Don’t propagate on `viewWillTransitionToTraitCollection`. This is too early
* Pass the size from `viewWillTransitionToSize` as the container size in `traitCollectionDidChange`

* using the old trait collection’s size doesn’t actually make sense.

* Instead of propagating on viewWillTransitionToSize, do it in viewWillLayoutSubviews
2016-09-06 15:23:32 -07:00
Michael Schneider
2388f67474 [ASTextNode] Add NSCache based cache for ASTextKitRenderer (#2199)
* Add cache implementation

* Remove old ASEqualityHashHelpers

* Some more ASEquality and ASEqualityHashHelper cleanup

* Add cache for text renderer in ASTextNode

* Move from C++ LRU renderer cache to NSCache based renderer cache
2016-09-06 15:23:21 -07:00
Huy Nguyen
6124830b23 Fix assertion messages in ASCollectionViewFlowLayoutInspector (#2196) 2016-09-06 11:43:13 -07:00
Hannah Troisi
03c21830a5 improve layoutSpecThatFits: assertion message (#2201) 2016-09-06 11:42:59 -07:00
Adlai Holler
b233122604 Check the image alpha value correctly (#2198) 2016-09-05 21:27:50 -07:00