491 Commits

Author SHA1 Message Date
Michael Schneider
52bb2a3a6e Revert constrainedSize changes that should have never made it in 2016-11-28 17:20:26 -08:00
Michael Schneider
4928af4635 [Layout Transition] Layout Transition Fixes (#2657)
* Don’t call layoutIfNeeded before starting the layout transition

* Further improvements
2016-11-28 12:57:03 -08:00
Scott Goodson
1c70412868 [ASDisplayNode] Create placeholders off main when possible.
This is a fix for https://github.com/facebook/AsyncDisplayKit/issues/2620,
which is a followup to https://github.com/facebook/AsyncDisplayKit/pull/2610

This will ensure thread affinity is respected for .contents but still run
placeholderImage off-main when possible (node isn't loaded).
2016-11-22 22:29:24 -08:00
Adlai Holler
9a762f9832 Make a public function ASPerformMainThreadDeallocation 2016-11-21 11:17:24 +09:00
Adlai Holler
71872a298e Merge pull request #2223 from facebook/AHNaturalDealloc
[ASDisplayNode] Let Nodes Deallocate Naturally, Deallocate UIKit Components in Run Loop
2016-11-21 01:20:47 +09:00
Adlai Holler
e923943e8c Use CACurrentMediaTime instead of CFAbsoluteTime 2016-11-21 00:54:07 +09:00
Adlai Holler
887f48cbda Add support for run loop queues with no handler, optimize 2016-11-21 00:49:54 +09: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
ddd4ef62ae Fix overlapping of nodes in layout transitions 2016-11-19 20:53:32 -08:00
Michael Schneider
9530b609f1 Readd layout transition check for invalid constrained size 2016-11-19 18:31:56 -08:00
Michael Schneider
8d5fc9efe3 We need to invalidate the layout before the transition does start 2016-11-19 06:58:07 -08:00
Michael Schneider
66ad9bd5e3 Apply patch from Scott 2016-11-19 06:46:21 -08:00
Michael Schneider
eef4a61ea0 Add checks to bail out early in layout transition 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
fc747ca58a Small code improvements 2016-11-19 06:43:46 -08:00
Michael Schneider
b762998336 Add detection for a loop if invalidation of a size is happening multiple times 2016-11-19 06:43:46 -08:00
Michael Schneider
5d61b2b4e6 Address further 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
d73712059d Remove unecessary measurement pass in ASCellNode 2016-11-19 06:43:46 -08:00
Michael Schneider
c29b7a184c Introduce ASFloorSizeValues and ASCeilSizeValues 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
3d37e55c7b Some more improvements around constrained size 2016-11-19 06:43:46 -08:00
Michael Schneider
30b7644415 Factor out constrainedSize usage for layout pass 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
c14a86c4d6 More improvements to figure out the constrained size that should be used in the layout pass 2016-11-19 06:43:46 -08:00
Michael Schneider
a71a1d8519 Address comments 2016-11-19 06:43:46 -08:00
Michael Schneider
2744998a10 Further progress 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
b0eb2f81c2 Cleanup 2016-11-19 06:43:46 -08:00
Michael Schneider
0eb882bae5 Some more changes 2016-11-19 06:43:46 -08:00
Michael Schneider
c819d716b4 Implement sizeToFit: 2016-11-19 06:43:46 -08:00
Michael Schneider
0f8eac4757 Some other commit 2016-11-19 06:43:45 -08:00
Michael Schneider
6f40e9a654 Some more stuff in flux 2016-11-19 06:43:45 -08:00
Michael Schneider
c61ba65ba3 Some commit 2016-11-19 06:43:45 -08:00
Michael Schneider
5226879291 Some commit 2016-11-19 06:43:45 -08: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
Garrett Moon
b1f0bbf514 self.contents isn't safe to access on the main thread. 2016-11-14 16:21:14 -08: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
appleguy
55b5dff80c [ASLayoutSpec] Initial commit to support visualizing layout specs (with Playground app). (#2554)
* Initial ASLayoutSpecPlayground commit

* Initial exploratory stab at the main challenge of the app - visualizing ASLayoutSpecs

* Halfway through moving debug features out of ASDK framework files and into debug files. Project builds.

* [ASLayoutSpecPlayground] Created new Inspector node, cleaning up internal implementation to start formalizing support for layout spec visualization.

* Workaround for ensuring creation of visualizerNode for ALL layoutspecs

* continued development

* Layout Inspector Work in Progress

* Resizing the playground works in the shrink direction, not for grow.

* added new ASLayoutableInspectorNode features

* Cleaned up examples code.

* Cleaning up  code.

* more code cleanup

* [ASLayoutableInspector] Transition to an ASTableNode-based architecture to support larger numbers of buttons / customizable types.

* [ASLayoutableInspector] Support different layoutable property types to set up buttons that can edit all of them.

* Huy debugging

* Refactored layout inspector code for extensibility.

* Properly lock layoutableContextMap

* Fix context handling in ASDisplayNode:measureWithSizeRange

* Fix ASLayoutSpecPlayground:ViewController:toggleVisualization

* added slider to InspectorCell

* [ASLayoutSpecPlayground] Improvements to propagation of visualize mode, resize handle, minor cleanup.

* Fix to ASEnvironment

* [ASLayoutSpecPlayground] Fix a few minor issues from the merge with latest master.

* Implement layout spec cache

* add pager ndoe

* add more examples

* add more layout examples

* [ASLayoutPlayground] Fix merge issues

* [ASLayoutPlayground] Fix up the example project from the 2.0 API changes.

* [ASLayoutPlayground] Some fixes (#2411)

* [ASLayoutPlayground]: Some fixes
* Fixed crash when tapping descender.
* Fixed setting the item to inspect.
* Fixed button states in inspector node.
* Added sliders for spacingBefore, spacingAfter, ascender.

* [ASLayoutSpecPlayground] Deselect the buttons when editing is over.

* [ASLayoutSpecPlayground] Changed flexGrow/Shrink's values from YES/NO to 1.0/0.0

* [Project] Create new Debug/ directory for advanced tools dedicated to debugging.

* [LayoutSpecPlayground] Rename project without AS in title, to be consistent with LayoutSpecExamples.

* [Bulid] Fix Xcode project to use new Debug subdirectory / group.

* [Bulid] Fix a small merge error.

* [Build] Fix build issue for Framework target.

* [Bulid] Fix podspec to expose InspectorNode header; Remove old-cocoapods emojis from ASDKgram :)

* Move aside ASLayoutSpecPlayground-Swift to match master

* [LayoutSpecPlayground] Cleanup implementation in several files, xcodeproj, etc.

* [ASControlNode] Add comment for new assertion, to be enabled in a separate diff.
2016-11-08 20:16:16 -08:00
Adlai Holler
a1156e108f Reduce memory consumption caused by event tracing (#2570) 2016-11-08 18:06:31 -08: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
Garrett Moon
17bd3acdee Revert "Need to trampoline to main to make contents check safe if nodes are loaded. (#2545)"
This reverts commit 11e07ff409d64ed7cf48877a325b8b4ad737daef.
2016-11-06 18:09:29 -08:00
Garrett Moon
11e07ff409 Need to trampoline to main to make contents check safe if nodes are loaded. (#2545) 2016-11-04 11:33:17 -07:00
Michael Schneider
dae374d482 Initial commit to cleanup modifying subnode hierarchy (#2535) 2016-11-02 17:12:35 -07:00
Michael Schneider
58e9c807b9 Fix using UIActivityIndicatorView provided in view block (#2522) 2016-11-01 07:58:54 -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
Michael Schneider
7ecce6b677 Remove thread affinity for _displaysAsynchronously (#2518) 2016-10-31 14:12:50 -07:00