2349 Commits

Author SHA1 Message Date
Michael Schneider
11215bf97f [Automatic Hierarchy Management] Rename IHM to automatic hierarchy management and move out of beta header (#2066)
* Rename automaticHierarchy to automaticallyManagesSubnodes

* Comment adjustments
2016-08-15 12:06:06 -07:00
David Rodrigues
f05ccea860 Fix wrong annotation which is causing a warning at compile time (#2072) 2016-08-15 11:26:10 -07:00
Michael Schneider
adcc9afb5a [Layout Transition] Add default fade in / out layout transition (#2052)
* Add default fade in / out layout transition

* Add example for layout transition

* Update for recent layout transition API changes

* To be able to do a layoutTransition the node needs to be loaded

* Rename layoutTransitionDuration to defaultLayoutTransitionDuration

* Expose default layout transition duration delay and options

* Use `UIViewAnimationOptionBeginFromCurrentState` for initial defaultLayoutTransitionOptions
2016-08-13 17:35:20 -07:00
Maximilian Szengel
43370fe6ff Expose AVPlayerLayer on ASVideoNode (#2028)
The playerLayer is needed for picture in picture support on the iPad (AVPictureInPictureController).
2016-08-13 17:28:19 -07:00
Michael Schneider
93be894e0c [ASCollectionView / ASPagerNode] Move constrainedSizeForNodeAtIndexPath from the DataSource to the Delegate (#2065)
* Move constrainedSizeForNodeAtIndexPath from the DataSource to the Delegate in ASCollectionView and ASPagerNode

* Fix ASPagerNode declaration of dataSource and delegate

As ASPagerDataSource does not inherit from ASCollectionDataSource it's not possible to declare it as property.

* Update comment
2016-08-12 15:37:23 -07:00
Garrett Moon
2c9e51e8f7 Add support for textContainerInset to ASTextNode (ala UITextView) (#2062)
* Add support for textContainerInset to ASTextNode (ala UITextView)

* Better comment, parens to increase readability. Thanks @schneider!

* Add textContainerInset snapshot test.
2016-08-12 12:07:00 -07:00
Flo
39cb188b9e [ASVideoNode] Improve playerStatus behaviour and image generation (#2024)
* [ASVideoNode] Use the videoComposition when generating images.

* [ASVideoNode] Improve playerState behaviour.

* [ASVideoNode] Use KVO on _player.rate to determine the playerState.
2016-08-12 12:06:02 -07:00
Hannah Troisi
3c0fea80ef Merge pull request #2023 from maicki/MSLayoutTransitionAPINaming
[Layout Transition API] Move Transition Layout API out of beta header and remove shouldMeasureAsync from API
2016-08-11 21:17:54 -07:00
Hannah Troisi
2040674aed Merge pull request #1767 from facebook/AHPercentToFraction
[ASRelativeDimensionType] Replace "percent" with "fraction" Where Appropriate
2016-08-11 20:33:34 -07:00
Adlai Holler
aedb83cfe3 [ASDataController] Remove Unused Batch Update Processing Code (#2054)
* [ASDataController] Remove dead batch updating code

* Address PR comments
2016-08-11 11:48:17 -07:00
Hannah Troisi
2afd063b10 [ASRangeController] Debug overlay to show the size and direction of display + fetchData ranges during scrolling. (#2008)
* Rebase ASRangeController diff with master.

* fix Table / CollectionNode debug label names
- now returns class names rather than generic ASTableNode, ASPagerNode
- ASPagerNode will be labeled as ASPagerNodeProxy (not sure how to get around this)

* refactor layout code: use ASDk's own resizeableRoundedCorner... methods

* Fixes and cleanup for manual layout version of range controller debug overlay.

I am working on a layout spec-based version, but it has some issues, so landing this to get the near-term value is probably the best next step.

* Remove .orig and .rej files.

* One last .orig file to remove.

* Final project file cleanup and tweaks to implementation for ASTableNode.

* fix build issues

* fix arrow directions
2016-08-11 11:23:07 -07:00
Hannah Troisi
7494b114aa Merge pull request #2041 from maicki/MSLayoutSpecChildChildrenProperty
[ASLayoutSpec] Make child and children a property
2016-08-11 10:56:31 -07:00
Adlai Holler
3f77a3d46c More Percent -> Fraction 2016-08-11 10:37:48 -07:00
Adlai Holler
e80a82f832 [ASDataController] Bail on waitUntilUpdatesAreCommitted if batch updating (#2053) 2016-08-10 14:51:10 -07:00
Michael Schneider
b84be07776 Make child and children on ASLayoutSpec a property 2016-08-10 10:33:13 -07:00
Michael Schneider
32058815f2 Move Transition Layout API out of beta header and remove shouldMeasureAsync from API
shouldMeasureAsync is enabled by default now.
2016-08-10 10:30:25 -07:00
Adlai Holler
eb9f86cfdb Replace "percent" with "fraction" where appropriate 2016-08-10 10:26:21 -07:00
Adlai Holler
49b65fd783 Revert "Fix if pending layout will be deallocated (#2038)" (#2051)
This reverts commit 2804d50220dabebc62b088b17d5ffe2347da1e36.
2016-08-09 16:10:21 -07:00
Hannah Troisi
893e601e81 Convert to type-generic math (#2050)
* [Optimization] Convert to type-generic math

* add std:: prefix in obj-c++ files

* more cleanup

* revert test changes

* convert min and max back to fmin/fmax
2016-08-09 15:31:37 -07:00
Michael Schneider
aba05a747c [ASThread] Add SharedLocker and SharedUnlocker that uses a shared pointer for the mutex (#2047)
* Add SharedLocker and SharedUnlocker that uses a shared pointer for the mutex

* Move ASTextKitContext to use Shared Locker
2016-08-09 15:20:31 -07:00
Michael Schneider
d9db780b0b [ASTextNode] Fix ASTextNode shadow is not rendering (#2042)
* Passing through shadow in renderer attribute

* Fix memory leak setting shadow color
2016-08-09 14:56:59 -07:00
Hannah Troisi
03c74452b2 [ASImageNode] fix scaling math (#2045)
* fix ASImageNode scaling

* convert to type-generic math
2016-08-09 13:45:19 -07:00
Michael Schneider
024b8afef5 Move NS_ASSUME_NONNULL_END to the end of the ASDisplayNode header (#2046) 2016-08-09 13:06:01 -07:00
Adlai Holler
1fbf8ad073 [ASDataController] Cancel if we lose our data source, fix bugs (#1987)
[ASRangeController] We're already on main thread, remove blocks

Make data source read-only, clarify what's asynchronous

[ASDataController] Clean up some interfaces

[ASDataController] A little more cleanup

[ASDataController] Cleanup

[ASDataController] Restore some changes, exit more often

[ASDataController] Use item counts that we already have rather than requerying them

[ASDataController] Revert weakifications

[ASDataController] Add a mechanism to measure how much work we avoided
2016-08-05 15:39:33 -07:00
ricky
39da5d2cb0 [ASTraitCollection] propagate window container size via ASTraitCollection in iOS7 (#2019) 2016-08-05 10:34:13 -07:00
Michael Schneider
2804d50220 Fix if pending layout will be deallocated (#2038)
The pending layout transition needs to stay alive at least until applySubnodeInsertions did finish execute as it can happen that with Implicit Hierarchy Management new nodes gonna be added that internally call setNeedsLayout what will invalidate and deallocate the transition in the middle of inserting nodes
2016-08-05 10:25:50 -07:00
David Rodrigues
70574243f7 Prevent API misuse at compile time (#2035)
Using Objective-C attributes, in this case `unavailable`, we can hide
unsupported APIs at compile time instead of detecting and warn about it
at runtime with a set of asserts.
2016-08-04 19:00:46 -07:00
Adlai Holler
01c8dc3dc2 [ASDisplayNode] Assert that user doesn't reuse layout specs (#2036) 2016-08-04 16:54:48 -07:00
Adlai Holler
4725035f21 [ASTableView/ASCollectionView] Flush pending updates before selecting/scrolling to item (#2034) 2016-08-04 13:19:14 -07:00
Chris Danford
c09db1cb17 ASImageNode backing store sharing for memory and CPU reduction (#1974) 2016-08-03 13:10:50 -07:00
Michael Schneider
d5cbe33686 Revert "[ASLayoutSpec] Use childrenMap directly to prevent creating an NSArray within ASDK Part 2 (#2021)"
This reverts commit d5a7c195226925e483c74fb210120d15ff423378.
2016-08-02 10:10:36 -07:00
Michael Schneider
d5a7c19522 [ASLayoutSpec] Use childrenMap directly to prevent creating an NSArray within ASDK Part 2 (#2021)
* Revert "Revert "[ASLayoutSpec] Use childrenMap directly to prevent creating an NSArray within ASDK (#1937)""

This reverts commit 735b4ebd0872483044d98a5d05b43324e76fc8d4.

* Fix crash and add exception for mutating while using fast enumeration of ASLayoutSpec children

NSFastEnumeration is potentially quite dangerous in the wrong hands. In particular, it does not provide a safe mechanism for you to return temporary objects directly, and it does not provide any guarantee that you will be called when the enumeration has completed; therefore if we generate temporaries and store them in an instance variable, we will not necessarily be able to clean them up! This means fast enumeration methods should never be called within an autorelease pool or the autorelease pool be drained within the fast enumeration loop.

The reason is we store references to objects in the stackBuf struct by casting the child pointer to __autoreleasing id. If we pop the autorelease pool between calls to -countByEnumeratingWithState:objects:count:, it will die in a messy explosion of pointer dereferences and EXC_BAD_ACCESS.

* Add tests for ASDisplayNode and ASLayoutSpec fast enumeration
2016-08-01 18:08:48 -07:00
Michael Schneider
3a1a987dbe Fix not propagating updating and propagating down the layout transition id if a subnode is added (#2018)
If a node was added to a supernode, the supernode could be in a layout pending state. All of the hierarchy state properties related to the transition need to be copied over as well as propagated down the subtree. This is especially important as with Implicit Hierarchy Management adding subnodes can happen while a transition is in fly
2016-08-01 09:44:02 -07:00
Scott Goodson
735b4ebd08 Revert "[ASLayoutSpec] Use childrenMap directly to prevent creating an NSArray within ASDK (#1937)"
Something interesting going on here with ARC / Objective-C++ that we are investigating and will re-land.

This reverts commit c90ed08d1073701e2c7f8a2677d460c140f05264.
2016-07-31 18:43:20 -07:00
Michael Schneider
c797fdf23a Use children directly instead of fast enumeration of ASEnvironment object (#2015) 2016-07-31 18:29:38 -07:00
Scott Goodson
589efefcf2 [ASDimension] Disable assertions for Percent values being between 0.0 and 1.0.
This triggers on existing code that needs to be updated, but also there is some investigation
needed as to whether it is a valid use case to have a >1.0 value in order to position greater-than-bounds elements.
2016-07-30 23:44:46 -07:00
appleguy
965fe05c11 [ASDisplayNode] Ensure that nil can never be returned from -measureWithSizeRange: (#2014)
* [ASDisplayNode] Ensure that nil can never be returned from -measureWithSizeRange:

This can happen in rare cases when multiple relayouts occur while a transition is being measured.

* [ASDisplayNode] Use ternary operator style for nil check.
2016-07-30 18:04:08 -07:00
gazreese
e0ada479a0 [ASVideoPlayerNode] Expose the UIActivityIndicatorViewStyle to clients (#1911) 2016-07-29 11:09:38 -07:00
Michael Schneider
c90ed08d10 [ASLayoutSpec] Use childrenMap directly to prevent creating an NSArray within ASDK (#1937)
* Use childrenMap directly to prevent creating an NSArray in ASDK for ASLayoutSpec children

* Add locking for parent property in ASLayoutSpec

* Remove unnecessary import

* Add newline

* Add NSFastEnumeration to ASEnvironment and ASDisplayNode / ASLayoutSpec

* Change NSMutableArray initializer to arrayWithCapacity:

* Move ASLayoutSpec+Private.h into Private folder

Fixes building with Swift

* Remove lock for ASLayoutSpec parent
2016-07-29 10:53:31 -07:00
Michael Schneider
678df37017 [Layout Transition API] Simplify applying layout transition (#1886)
* Simplify applying layout transition in preparation for bigger layout transition API work

* Change from apply to complete in if layout transitions are involved and _applyLayout: to _setCalculatedLayout: for layout

* Change to applySubnodeInsertions and applySubnodeRemovals

* Change from completeTransition to commitTransition and flip logic around when to trampoline to the main thread for implicit hierarchy management

* More internal API improvements

* Fix merge conflicts

* Rename _layout to _calculatedLayout
2016-07-29 10:52:55 -07:00
Hannah Troisi
ff2c47c415 add assertion for ASRelativeDimensionTypePercent value to be between 0-1 (#2009) 2016-07-29 10:38:20 -07:00
Adlai Holler
6a21daa80f [ASInternalHelpers] Use type-generic math (#2006) 2016-07-28 20:44:14 -07:00
Adlai Holler
5ff5a27717 [ASTextKitComponents] Remove unused, somewhat dangerous functions (#2007)
[ASTextKitComponents] Remove Unused Scale Conversion Functions
2016-07-28 20:43:27 -07:00
Yue-Wang-Google
7426c1dd66 Fixed implicit cast for 64-bit devices in ASTextKitComponents.h (#1994) 2016-07-28 17:03:02 -07:00
Hannah Troisi
79e44207e8 Merge pull request #1993 from Yue-Wang-Google/patch-2
[ASRangeController] Fix import misspelling
2016-07-28 15:15:54 -07:00
Yue-Wang-Google
d481ce5423 [ASTextNode] Fix ascender to include line height specified in attributed string paragraph style (#1997)
* Fix ASTextNode's ascender to also include the line height specified by paragraph style in the attributed string.

* Merge conflict (original patch is for an old version)
2016-07-28 10:53:48 -07:00
Yue-Wang-Google
93a5c36a39 Fixed typo in ASCollectionViewFlowLayoutInspector.m pertaining to supplementary node layout. (#1996)
Patch from iOS teams at Google Inc.
2016-07-28 10:13:49 -07:00
ricky
f0b1f12160 [ASEnvironmentTraitCollection] default user interface idiom to UIUserInterfaceIdiomUnspecified (#1998)
* [ASEnvironmentTraitCollection] default user interface idiom to ASEnvironmentTraitCollection

UIUserInterfaceIdiomUnspecified is -1 so we were actually defaulting our trait collection to UIUserInterfaceIdiomPhone (which is 0).

* Fix a few places where we weren’t using the default method to create the base traits
2016-07-28 10:03:32 -07:00
Yue-Wang-Google
b59e368b71 [PATCH] Fix capitalizations in imports. 2016-07-27 14:17:56 -07:00
Yue-Wang-Google
95bf8bbe1f Fix ASTextNode truncation string (#1992)
Initial PR to open source our internal ASDK patch list from Google Inc. :)
2016-07-27 13:18:21 -07:00