154 Commits
Author SHA1 Message Date
Levi McCallum f809d4a1c9 Let ASLayout determine if a node should measure 2016-06-05 09:32:48 -07:00
Levi McCallum a004cc7263 Include header 2016-06-05 09:22:46 -07:00
Levi McCallum c469ad273b [ASLayout] Cache constrained size range 2016-06-05 09:22:46 -07:00
ricky 13a35c5f2f more comments
* allow nil for setChild/children
* moved examples out of examples/
2016-06-03 13:59:59 -07:00
ricky 01dbc86778 First pass of comments
* make variable naming reflect ASEnvironmentTraitCollection vs ASTraitCollection
* move trait propagation to cell allocation instead of via a nested block
* move trait propagation when setting a displaynode's supernode instead of when adding a subnode
* fixed misspelling of "colection"
2016-06-03 09:59:24 -07:00
ricky b66b519bd6 assert that child is not nil
Summary:

Test Plan:

Reviewers:

Subscribers:

JIRA Issue(s):

Service(s):
2016-05-31 10:29:46 -07:00
rcancro cf2d9aef5c fix crash when setting layoutSpec's child to nil 2016-05-26 15:44:21 -07:00
ricky bebc4c604c remove _child from ASLayoutSpec.mm. Store all children in the children array. 2016-05-25 13:30:35 -07:00
ricky c42b0dd33a Remove explicit passing of trait collection to setChild/Children 2016-05-25 10:49:42 -07:00
ricky a33966d4ae Actually propagate the traits down on layout spec 2016-05-24 11:15:41 -07:00
ricky 59a26ee111 [ASTraitCollection] Bug fixing/LayoutSpec propagation
* Fixed bug in `ASEnvironmentMergeObjectAndState`
* New ASLayoutSpec methods for `setChild`/`setChildren`/`setChild:forIdentifier:` have been added to take in a trait collection.
* Added `setChild:`-like methods for ASLayoutSpecs take a traitCollection
* Fixed instances where nodes in a data controller were not getting their trait collections
* propagate traitCollection in ASDisplayNode on insertSubnode or addSubnode
2016-05-23 16:37:40 -07:00
rcancro 8e444092be [ASEnvironment] Remove unneeded locking on environmentState 2016-05-12 13:13:30 -07:00
rcancro 4b54144f55 Levi's comments 2016-05-11 10:21:11 -07:00
rcancro 9d622c7eac changed DisplayTraits to TraitCollection 2016-05-10 14:45:03 -07:00
rcancro f828d079fa added nsobject based ASDisplayTraits class 2016-05-10 14:44:43 -07:00
rcancro b4a6f87ca6 addressed some comments 2016-05-10 14:44:32 -07:00
rcancro 8bb4eba080 Initial attempt at implementing Display Traits
Initial attempt to get display traits working with ASEnvironment.

To get proper ASDisplayTraits support, you must use an ASViewController. The ASViewController implements UITraitCollection-related methods (`traitCollectionDidChange:`, `willTransitionToTraitCollection:withTransitionCoordinator:`, viewWillTransitionToSize:withTransitionCoordinator`) to update the internal ASDisplayTraits and propagate them to subnodes.

ASTableNode and ASCollectionNode don't actually have their cells as subnodes, so a little bit of trickery is involved (on `setEnvironment:` the table/collection node gets its data controllers completedNodes and propagates the new traits. see `ASDisplayTraitsCollectionTableSetEnvironmentState`). The data controller also passes the current display traits when creating new cells.

ASViewController also supports the ability to return a custom set of display traits. So if you have a modal dialog that should always be told it is in a compact size class, you can set the override block before displaying the VC.

A new example, called Display Traits, has been added. It shows how display traits can be used in a ASViewController with a normal ASDisplayNode as its root, as well as in ASViewControllers hosting table nodes and collection nodes. There is also an example of overriding the default display traits of a VC.

Please provide feedback!
2016-05-10 14:44:22 -07:00
Michael Schneider bcd91f18ce Remove ASLayoutOptions locking 2016-04-22 19:54:40 -07:00
Michael Schneider 9fdce828c1 Small improvements for ASLayoutSpec
- Add nullable for returning children
- Store default child and children as properties
- Use vector for creating final children
2016-04-15 07:11:24 -07:00
Scott Goodson 8ccef1e99f [ASEnvironment] Fix incomplete gating of upward propagation of layout properties (disabled for now). 2016-04-11 20:34:24 -07:00
Michael Schneider 45d50624d1 Fix disabled state propagation for final layoutable 2016-04-11 17:41:48 -07:00
Scott Goodson 678c201dbc [ASLayout] Add additional validation step to intercept incorrect values in production and safely zero them out.
These conditions already had assertions, but at runtime, an insufficiently tested and incorrect ASLayoutSpec could
generate values that cause UIKit to enter an infinite loop (e.g. inside of UICollectionView layout validation).
2016-04-10 16:42:22 -07:00
Levi McCallum 25096117e7 Prevent ASInsetLayoutSpec from creating a computed layout when child is nil
Reviewers: scottg, schneider, ricky, garrett

Reviewed By: garrett

Subscribers: garrett, jenkins

Differential Revision: https://phabricator.pinadmin.com/D83683

JIRA Issue(s): BRIO-4729
2016-04-06 17:05:49 -07:00
Michael Schneider 5ba756eac7 Fix comments about maximum number of extended values in ASLayoutableExtensibility 2016-04-05 07:44:28 -07:00
Hannah Troisi dbad1c38e5 [ASEnvironment - Layout] Fixes to upward propagation of ASLayoutable properties. 2016-04-02 15:03:43 -07:00
Michael Schneider 20ee9bca8d Rename ASEnvironmentStateCreate to ASEnvironmentStateMakeDefault 2016-03-31 20:43:20 -07:00
Michael Schneider 5baab95506 Add up propagation of ASEnvironmentLayoutOptionsState in ASLayoutSpec while setting a child 2016-03-31 20:43:20 -07:00
Michael Schneider f46f5640ff Add improvements
- Remove defaults for ASEnvironmentLayoutOptionsState and ASEnvironmentHierarchyState
- Add locking for ASEnvironmentLayoutExtensibilityForwarding
- Other smaller improvements
2016-03-31 20:43:20 -07:00
Michael Schneider 4e757f0969 General improvements
- Refactor naming of ASEnvironmentCollection to ASEnvironmentState
- Remove struct pointers
- Move ASEnvironmentStatePropagation to a enum class
- Move merge functions to pure functions
- Move ASLayoutOptionsForwarding and ASLayoutableExtensibility into ASLayoutSpec and ASDisplayNode
- Remove ASLayoutableSetValuesForLayoutable and move into explicit classes (ASDisplayNode, ASTextNode)
2016-03-31 20:43:20 -07:00
Michael Schneider 65b4961802 Add extensibility support for ASEnvironmentLayoutOptionsState 2016-03-31 20:43:20 -07:00
Michael Schneider 96df35e41a Initial commit for ASEnvironment 2016-03-31 20:43:20 -07:00
Huy Nguyen 387f3bf634 Properly lock layoutableContextMap
Signed-off-by: Huy Nguyen <huy@pinterest.com>
2016-03-29 13:40:57 -07:00
Huy Nguyen 7bb3015950 Rename ASLayoutableContext methods 2016-03-27 17:38:41 -07:00
Huy Nguyen 81d26994c5 Introduce ASLayoutableContext
- The struct is mapped to ID of the current thread and used by subnodes to decide whether they should proceed measurement.
2016-03-27 17:09:59 -07:00
Scott Goodson eed812dcdf [ASRangeController] Slight tweaks to the default Full ranges, for memory savings in multi-tabbed apps with still-excellent preloading consistency. 2016-03-23 23:36:59 -07:00
Eric Jensen 12da9ac6a9 Improve Swift compatibility of ASHorizontalAlignment & ASVerticalAlignment by using consistent naming 2016-03-21 11:16:28 -07:00
Sam Stow 086bd8a52b [ASRelativeLayoutSpec] New core layout spec type: Relative Position, now powers Center as well.
This spec allows positioning a child at any 9-part box position (corners, edges, or center).
2016-03-19 22:37:02 -07:00
Eric Jensen 17aebcbaba Add a space between the ? and : in ternarys 2016-03-17 10:38:51 -07:00
appleguy d9ef0922d8 Merge pull request #1354 from ejensen/cleanup
[Refactoring] Objective-C 2.0 / Modern syntax for arrays, dictionaries, numbers; logic simplification
2016-03-17 01:06:33 -07:00
Eric Jensen 33fda7ab49 - Use modern Objective-C syntax.
-  Simplify comparisons.
-  Remove dead stores.
2016-03-15 22:34:29 -07:00
Eric Jensen ddd5ff1f75 Correct spelling errors 2016-03-15 21:56:51 -07:00
appleguy a4e3ba49b4 Merge pull request #1349 from levi/patch-8
[ASDimension / ASSizeRange] Add ASSizeRangeMakeExactSize method
2016-03-11 21:21:09 -08:00
Huy Nguyen fa8f2f4429 Implement async transition 2016-03-11 18:56:58 -08:00
Levi McCallum 52391dcc27 Change method name in implementation 2016-03-09 10:42:56 -08:00
Levi McCallum a07f7b73f0 Change method name in header 2016-03-09 10:42:35 -08:00
Levi McCallum d4a0c34d86 Add ASSizeRangeMakeWithExactCGSize method 2016-03-09 10:39:46 -08:00
Levi McCallum 167b7d404e Add header for extern ASSizeRangeMakeWithExactCGSize 2016-03-09 10:38:25 -08:00
Garrett Moon 6d9720bd18 Wrong name in header 2016-02-20 17:33:29 -08:00
Levi McCallum 5cf5cb8452 Delegate layout frame calculation to sublayout method 2016-02-10 11:44:12 -08:00
Levi McCallum 8cdea808ec Expose calculated frame on layout 2016-02-10 11:44:11 -08:00