271 Commits

Author SHA1 Message Date
Rocir Santiago
1bf8488a0f Safer checks in ASDisplayNode’s setFrame before assigning bounds and position (#2773)
* Safer checks in ASDisplayNode’s setFrame before assigning bounds and position

* Consolidate checks in one place

* Assert with ASDisplayNodeNonFatal

* Allow position to be negative
2017-02-13 13:35:37 -08:00
Michael Schneider
2dca7a0c8d [Debug] Remove not used code around visualizing layout specs (#2991)
* Remove not used code around visualizing layout specs

* This is sad to see but let’s remove the LayoutSpecPlayground for now
2017-02-10 13:09:09 -08:00
Michael Schneider
77f29a8b7b Fix CI that broke due to Yoga merge (#3012)
* Fix CI that broke due to Yoga merge

* Next round

* Add clean before building

* Try something else

* Some more burritos
2017-02-10 11:17:25 -08:00
appleguy
f91265757e [Yoga] Initial commit for supporting Yoga-powered layout calculation. (#2982)
* [Yoga + AsyncDisplayKit] Initial commit for supporting Yoga-powered layout calculation.

Because this results in ASLayout objects, it preserve support for automaticallyManagesSubnodes
as well as the animated transition system. More work remains to vet performance of the new mode,
and it will remain in +Beta for the forseeable future.

I'm not sure that this should ever be used as the primary ASDK layout system, but it should remain an
option for some apps to experiment with if they require an implementation that more strictly mirrors
W3C standard Flexbox.

* [Yoga] Improve usage of ASHierarchyState to ensure simultaneous yoga layouts can't happen.

* [Yoga] Strictly minimize the impact of the Yoga integration on existing code.

Created new file ASDisplayNode+Yoga.mm, reduced size and number of integration points in core code.

* [Yoga] Figured out how to further reduce ASDisplayNode.mm impact by allocating _yogaNode in property accessor, and changing all accesses to use the property.
2017-02-09 16:10:29 -08:00
Adlai Holler
ada553c5a7 Avoid Measuring Cell Nodes with Empty Size Range (#3000)
* Always avoid measuring cell nodes with empty bounds

* Be lenient

* Add required assertion comment

* Avoid importing non-modular header publicly
2017-02-08 13:58:22 -08:00
Michael Schneider
f21254593d [Layout] Add extensibility support to ASLayoutElementStyle (#2975)
* Add extensibility support to ASLayoutElementStyle

* Fix some typo
2017-02-07 10:34:09 -08:00
Michael Schneider
7e4bf953b1 Move debugName into it’s own protocol out of the ASLayoutElement protocol (#2994) 2017-02-06 20:02:21 -08:00
Michael Schneider
aedac5c299 Remove legacy parent pointer of ASLayoutSpec (#2987) 2017-02-06 20:01:37 -08:00
Scott Goodson
9b77f77656 [Build] Fix typo in capitalization of import, which causes build failure on case-sensitive filesystems. 2017-02-05 19:39:44 -08:00
Michael Schneider
12e4e5b048 [Layout] Improve Layout System Abstraction (#2941)
* Improve Layout Abstraction

* Address naming comments

- Rename ASPrimitiveTraitEnvironment to ASTraitEnvironment
- Rename ASPrimitiveTraitCollectionPropagateDown to ASTraitCollectionPropagateDown
- Rename progagateNewPrimitiveTraitCollection: to propagateNewTraitCollection:
2017-02-03 13:04:20 -08:00
Adlai Holler
404795dc02 Remove Support for iOS 7 (#2930)
* Drop support for iOS 7

* Copy reference images

* Update deployment for sample projects

* Update version

* Update "Life Without Cocoapods"
2017-02-01 14:40:37 -08:00
Adlai Holler
295ed22c23 Improve Our Handling of Flow Layout Headers/Footers (#2939)
* Rejigger our flow layout supplementary support to make more sense.

* Support old protocol

* Update

* Update deprecation message

* Undeprecate insetForSection method, because it actually _does_ still work

* Update the tests

* Remove irrelevant junk

* Remove cast, add pragma
2017-01-27 15:58:43 -08:00
Hannah Troisi
7d68ce33bb add the enum direct comments back (#2936) 2017-01-26 16:39:54 -08:00
appleguy
b8872c24db [AsyncDisplayKit] Fix a few comment typos and minor compiler strictness warnings. (#2932) 2017-01-25 12:53:13 -08:00
Michael Schneider
d9be4783e5 [ASLayout] General Layout Cleanup (#2920)
* Remove duplicate import

* Move `ASLayoutController` related code out of CoreGraphics+ASConvenience

* Further cleanup

* Move private layout files to Privat/Layout

* Move ASLayoutElementStylePrivate into Private/Layout

* Further cleanup

* Move tvOS related files to tvOS folder

* Further cleanup
2017-01-24 11:54:05 -08:00
Huy Nguyen
6736367627 [ASStackLayoutSpec] Refactor baseline alignment algorithm (#2892)
* Add tests for baseline alignments

* Merge baseline alignment algorithm to the main stack algorithm
- Baseline alignment is now part of the main stack algorithm.
- ASStackBaselinePositionedLayout is no longer needed and removed.

* All snapshot test cases of ASStackLayoutSpec are passing now

* Remove baselineRelativeArrangement

* Remove TODO

* Minor fixes in cross size determination step
2017-01-18 11:12:10 -08:00
Michael Schneider
89156ebbc7 Add availability check for noescape attribute (#2897) 2017-01-13 11:32:33 -08:00
Michael Schneider
cdf7f70747 [ASDimension] Simplify header file to focus on the most essential types for app developers. (#2794)
* First round of cleanups for ASDimension.mm/h

* Add ASDimensionDeprecated and ASDimensionInternal to Copy Files build phase
2017-01-10 10:05:15 -08:00
David Robles
498e5a9403 Assert when attempting to set a nil background / overlay layout element. (#2796) 2016-12-19 17:41:45 -05:00
Hannah Troisi
a59a0f0a31 don't allow nil background / overlay layout elements (#2795) 2016-12-18 12:25:57 -08:00
appleguy
eeb977e145 [ASDisplayNode] Ensure all subclasses are using base class __instanceLock__ and not re-defining their own. (#2754)
* [ASDisplayNode] Ensure all subclasses are using base class __instanceLock__ and not re-defining their own.

This also moves the @package definition of the instance variable to +FrameworkPrivate instead of Internal.h,
because Internal.h should ideally not be used outside of the ASDisplayNode file setup.  This has greatly reduced
the number of imports of Internal.h.

* [ASDisplayNode] Add ASDisplayNode+FrameworkSubclasses.h to share __instanceLock__ definition.
2016-12-12 19:42:41 -08:00
appleguy
2feabd2832 [ASScrollNode] Support for automaticallyManagesContentSize, adopting the ASLayoutSpec's size as the scrollable contentSize. (#2753)
* [ASScrollNode] Support for automaticallyManagesContentSize, adopting the ASLayoutSpec's size as the scrollable contentSize.

This feature has been desired for a long time, and has turned out to be phenomenally useful and easy to use.

It works well either for a blank ASScrollNode with .layoutSpecBlock set on it, or a subclass of ASScrollNode with a more
traditional layoutSpecThatFits: implementation.  With this approach there is no need to capture the layout size, use
an Absolute layout spec as a wrapper, or set contentSize anywhere in the code and it will update as the layout changes!

There is no automatic management of contentInset, but it would make sense to add this with keyboard listeners in the future.

* [ASScrollNode] Add locking to new properties, adjust how calculateLayout override is done.
2016-12-12 12:03:54 -08:00
Huy Nguyen
016d99f420 Document default values of alignItems and justifyContent (#2733) 2016-12-08 07:53:05 -08:00
Michael Schneider
4355f4d2ee [Layout] Don't crash if layout elements are created in layoutSpecThatFits: (#2694)
* Fix crash if layout elements are created with no owner and referenced in layoutSpecThatFits:

* Add failing test for nodes deallocated while creating in layoutSpecThatFits:

* Some more

* Some cleanup

* Added more complexity to tests

* Only cache sublayouts if the layout get’s flattened

* Address comments

* Address comments
2016-12-07 14:58:34 -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
Garrett Moon
cc00626642 Fix Carthage build (#2567) 2016-11-07 15:54:23 -08:00
Scott Goodson
d7ba0a9c6d [Build] Add imports that are necessary for clang to parse header files after compilation.
This allows the objc-diff tool (which creates API diffs) to run successfully.
2016-11-06 15:04:30 -08:00
Michael Schneider
de36ef29bd Fix height check in ratio layout spec (#2553) 2016-11-05 18:45:42 -07:00
george-gw
ff9e493a59 Fixed asciiArtString. (#2523) 2016-11-01 17:33:27 -07:00
Hannah Troisi
8e6f842b8d [ASLayoutElementStyle] implement -description with sizing info (#2495)
* Layout style object debugging

* Remove cocoapods crap
2016-11-01 07:58:43 -07:00
Garrett Moon
68990cb6cc Deprecations should be re-enabled. If there are specific deprecations… (#2519)
* Deprecations should be re-enabled. If there are specific deprecations we'd like to hold off on, we should address those specifically.

* Fix decleration

* Move select to undeprecated

* Fix deprecations
2016-10-31 17:30:40 -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
Garrett Moon
9aeef7b503 Revert "We need to ensure point dimensions are valid for sizing. (#2503)" (#2512)
This reverts commit 1165628905f92aa00c1605230f32953f5d7f0670.

I wanted to catch dimension issues early, we should move the assert to setting
width and height. The former was correct for here.
2016-10-31 00:02:50 -07:00
Michael Schneider
611894329a [ASStackLayoutSpec] Performance improvements (#2470)
* Initial commit for ASStackLayoutSpec improvements

* Remove the lock in ASStackLayoutSpec and make the ASStackLayoutSpecStyle const

I think we don't need lock here as the style already has a lock while we set the value

* Add ASStackLayoutSpecItem  that replaces layout specific items

* Prevent baseline pass if not needed

* Update comments
2016-10-30 12:07:18 -07:00
Michael Schneider
fb92b448e0 [ASDisplayNode] Proper handling of constrainedSize (#2505)
* Check in ASLayout if size is valid for sizing instead of valid for layout

* Return constrainedSize from calculateSizeThatFits:

Remove invalid constrainedSize check within ASNetworkImageNode. Furthermore as ASDisplayNode does not return CGSizeZero anymore we have to give the display nodes we use in tests and are involving a stack spec an intrinsic content size.

* Remove extra constrainedSize handling in ASNetworkImageNode handling

* Change test to use FLT_MAX
2016-10-28 15:39:03 -07:00
Garrett Moon
1165628905 We need to ensure point dimensions are valid for sizing. (#2503) 2016-10-28 15:18:45 -07:00
Michael Schneider
eb6cf0689d Only throw if ASLayoutElement style width or height are ASDimensionUnitFraction (#2484) 2016-10-26 17:17:09 -07:00
Michael Schneider
d4af95c9f1 Add ASLayoutSizeAuto (#2478) 2016-10-26 11:43:14 -07:00
Michael Schneider
6d5bd6e969 Cleanup calculateLayoutThatFits: (#2480) 2016-10-26 11:26:57 -07:00
Michael Schneider
2a1f7815cc Set sublayout to CGPointZero in ASWrapperLayoutSpec (#2476) 2016-10-24 19:02:03 -07:00
Michael Schneider
4e580b96dc Add support for multiple children to ASWrapperLayoutSpec (#2469) 2016-10-24 09:59:44 -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
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
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
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