1479 Commits

Author SHA1 Message Date
rcancro
3ebdf5928c Made a few changes to font scale adjustment
1) cache the scale in the font adjuster. The adjuster will be dealloc'ed when the renderer that owns it is dealloc'ed (or invalidated). Until that time we can trust the scale that the adjuster has computed.
2) When measuring line count, make sure that we are not bounding the height of the container's size. This will cause the wrong number of lines to be returned.
3) Instead of setting the ascender/descender on an ASTextNode when an attributed string is added, wait until after the renderer calculates size. This way, if there is any need to scale the font to fit we can apply that scale to the ascender/descender.
2016-03-08 12:05:26 -08:00
Scott Goodson
39f5686982 Revert "[_ASAsyncTransaction] Reduce locking overhead by removing C++ stack-allocated MutexLocker objects."
Locking was not quite right here in a certain case where the transaction leaves after other references
were removed.  Will restore this optimization in the future with more time to analyze.

This reverts commit ee524f497d0692a2c0c6ea39bd3840183a00f3ed.
2016-03-07 14:46:06 -08:00
Scott Goodson
9e72679ffd [ASDataController] Swap order of section / item in optimized indexpath creation from yesterday :). 2016-03-07 12:08:31 -08:00
Rahul Malik
5af8b78d78 Transfer node ownership from renderQueue to displayingNodes queue before removing
the node from the renderQueue.
2016-03-07 11:30:23 -08:00
Rahul Malik
62a39c49ea Break up scheduling of node rendering across various run loops 2016-03-06 12:33:31 -08:00
appleguy
e56c3b03f2 Merge pull request #1332 from facebook/ASDataReload
[ASDataController] If app code issues edit commands before first reload, ignore them, as UIKit will call -reloadData.
2016-03-05 23:00:12 -08:00
Scott Goodson
8cfd951f42 [ASDataController] If app code issues edit commands before first reload, ignore them, as UIKit will call -reloadData. 2016-03-05 21:21:22 -08:00
appleguy
4c834685c8 Merge pull request #1329 from hannahmbanana/debugFeatures
[ASControlNode] A debug feature on ASControlNode to visualize tap-able areas
2016-03-05 20:52:25 -08:00
Scott Goodson
c4f6c9035b [ASDataController] If app code issues edit commands before first reload, ignore them, as UIKit will call -reloadData. 2016-03-05 20:52:00 -08:00
Scott Goodson
6a32e5ccc0 [ASDataController] If app code issues edit commands before first reload, ignore them, as UIKit will call -reloadData. 2016-03-05 20:27:36 -08:00
Scott Goodson
cc7ca4a08f [ASDataController] If app code issues edit commands before first reload, ignore them, as UIKit will call -reloadData. 2016-03-05 20:22:18 -08:00
appleguy
354ccf3e5f Merge pull request #1327 from samhsiung/fix_scrollable_directions
[ASCollectionView] scrollableDirections must account for alwaysBounce(Vertical | Horizontal)
2016-03-05 16:35:48 -08:00
Hannah Troisi
9d5fed280d A debug feature on ASControlNode to visualize tap-able areas (by adding a highlight overlay ASDisplayNode as a subnode) when addTarget:action:ControlEvent: is called. Uses hitTestSlop to get ASControlNode's UIEdgeInset and set the highlight overlay's frame to be the ASControlNode frame + edge insets. Disables clip to bounds on ASControlNode. Enabled by calling +[ASControlNode setEnableHitTestDebug:YES]; 2016-03-05 16:08:55 -08:00
Luke Zhao
03e84e20ac updated with deprecated message 2016-03-05 13:04:20 -08:00
Samuel Hsiung
85394f09b4 Account for alwaysBounce(Vertical|Horizontal) when calculating scrollable directions 2016-03-04 21:33:08 -08:00
Michael Schneider
15a789c719 Fix content inset problems if ASViewControllers root node has usesImplicitHierarchyManagement set to YES
There are content inset problems if a ASViewController is initialized with a root node (e.g a ASCollectionNode subclass) that has usesImplicitHierarchyManagement set to YES. The reason for that is that the subviews (e.g. the UICollectionView) of the ASViewController root node get's added to the view hierarchy in measureWithSizeRange: in ASDisplayNode.  measureWithSizeRange: of the root node is called in -viewWillLayoutSubviews in ASViewController. That is too late, so UIKit does not apply the automatic content inset to the UICollectionView anymore.
2016-03-04 19:22:09 -08:00
appleguy
0a76c7b5d2 Merge pull request #1301 from lkzhao/collectionView-sectionInset-fix
Remove cell constrainedSize adjustment with section insets in constrainedSizeForNode
2016-03-04 14:26:55 -08:00
appleguy
17078bc208 Merge pull request #1316 from levi/patch-7
Add direct implementation of endUpdatesAnimated to ASCollectionNode
2016-03-04 14:26:30 -08:00
Michael Schneider
d19a55f94c Initialize the ASCollectionView with a given frame and not with CGRectZero by default 2016-03-04 14:21:33 -08:00
Luke Zhao
aa180c6f3b completely remove cell constrainedSize adjustment from section inset 2016-03-04 13:14:16 -08:00
Scott Goodson
2a5464356f [ASViewController] Call -[super loadView] in order to harvest frame value and apply it to node's view. 2016-03-03 18:07:47 -08:00
Huy Nguyen
caddd1d287 Fix threadSafeBounds
- Bounds change set directly to _ASDisplayLayer should also be saved to threadSafeBounds
- Remove overkill _usesDisplayView flag
2016-03-03 16:18:07 -08:00
Huy Nguyen
3b0b7fa888 More locks 2016-03-03 15:05:17 -08:00
Levi McCallum
79d593f344 Update header file 2016-03-03 15:00:29 -08:00
Levi McCallum
66133f7e98 Add direct implementation of endUpdatesAnimated to ASCollectionNode 2016-03-03 14:56:36 -08:00
appleguy
0d2fbdf19f Merge pull request #1313 from levi/patch-6
[ASDisplayNode] Transition API - Preserve usesImplicitHierarchyManagement when doing animations
2016-03-03 12:17:14 -08:00
appleguy
00719fbaf8 Merge pull request #1314 from nguyenhuy/async_layout_transition
Finish replacing bounds with threadSafeBounds in ASTextNode
2016-03-03 09:24:43 -08:00
Huy Nguyen
5154573ae7 Finish replacing bounds with threadSafeBounds in ASTextNode 2016-03-03 08:51:44 -08:00
Levi McCallum
4601cd5d1e Preserve usesImplicitHierarchyManagement when doing animations
Currently the flag was being reset to NO in all cases. It should ignore turning off the hierarchy management when the user has already enabled it.
2016-03-03 08:40:08 -08:00
appleguy
f27ea719da Merge pull request #1312 from nguyenhuy/async_layout_transition
Follow-up on 1311
2016-03-03 00:35:47 -08:00
Huy Nguyen
b21974e3f4 Address Scott's comment 2016-03-03 00:33:19 -08:00
Huy Nguyen
f59eb98749 Remove threading assumption in ASDisplayNode measureWithSizeRange:" 2016-03-03 00:31:05 -08:00
appleguy
531052157a Merge pull request #1311 from nguyenhuy/async_layout_transition
[ASDisplayNode] Support measureWithSizeRange: on background, and seamless layout spec animation after complete.
2016-03-02 22:57:49 -08:00
Huy Nguyen
5e49cc4382 Layout transition can measure in background 2016-03-02 22:47:04 -08:00
Huy Nguyen
9162d7b2df Implement thread-safe bounds and use it in ASTextNode 2016-03-02 22:42:53 -08:00
Scott Goodson
cc07d77d68 [ASViewController] Ensure we retain a reference to the UIVC object returned by the initWithViewController: block. 2016-03-02 22:38:56 -08:00
Michael Schneider
f2f1b25ae4 Rename _batchUpdateCounter to _changeSetBatchUpdateCounter in ASChangeSetDataController
Rename variable to prevent confusion between the _batchUpdateCounter variable of ASChangeSetDataController and it's superclass
2016-03-02 19:38:14 -08:00
Michael Schneider
aa2ae87c81 Add -waitUntilAllUpdatesAreCommitted to ASTableView and ASCollectionView
The API allows consumer of ASTableView or ASCollectionCiew to block execution of the main thread until all section and row updates are committed.
2016-03-02 19:38:14 -08:00
appleguy
e82d1408d2 Merge pull request #1292 from nguyenhuy/visibility_improvements
[ASCellNode] Update visibility API to support new event types for initial visibility & invisibility (caused by VC transitions, etc)
2016-03-02 19:30:31 -08:00
appleguy
a06c67f027 Merge pull request #1306 from facebook/TransactionLockingAndAssertion
[_ASAsyncTransaction] Reduce locking overhead by removing C++ stack-allocated MutexLocker objects.
2016-03-02 17:03:57 -08:00
Scott Goodson
ee524f497d [_ASAsyncTransaction] Reduce locking overhead by removing C++ stack-allocated MutexLocker objects.
Support assertion to log specific return value for pthread_mutex_destroy failures.
2016-03-02 14:49:02 -08:00
Michael Schneider
3c32c48be0 Add clear image to ASMultiplexImageNode 2016-03-02 06:14:35 -08:00
appleguy
f4925a107c Merge pull request #1302 from nguyenhuy/fix_collection_data_controller
[ASCollectionDataController] Remove unncessary batch layout calls for supplementary nodes.
2016-03-01 18:16:27 -08:00
appleguy
8f0777e7e5 Merge pull request #1305 from garrettmoon/fixRecursivelyEnsureDisplay
[ASDisplayNode] recursivelyEnsureDisplay should trigger display even if a stale contents exists (re-display)
2016-03-01 17:43:28 -08:00
Garrett Moon
2cee9bfca8 Just because we have contents, doesn't mean we don't want to display 2016-03-01 17:41:29 -08:00
appleguy
47d2981487 Merge pull request #1304 from garrettmoon/betterSkipClearContents
[ASDisplayNode] Coalesce -clearContents onto the next runloop, so it can be skipped if re-added to hierarchy in move operation.
2016-03-01 17:38:36 -08:00
Michael Schneider
6e69c312d6 Dispatch deallocation of UIImage on background thread
Destruction of bigger images in ASNetworkImageNode on the main thread can be expensive and can take some time, so we dispatch onto a background queue to actually dealloc.
2016-03-01 17:04:38 -08:00
Garrett Moon
057c431dfb Thanks @scottg, this is a better more generalized solution. 2016-03-01 16:46:03 -08:00
Garrett Moon
eba6afc36b Revert "Don't clear contents when moving between nodes"
This reverts commit 6d1732fcbdda44603577979afdddb9fc48b6d6e4.
2016-03-01 16:45:36 -08:00
Huy Nguyen
1dffc20e4d Address documentation of ASCellNodeVisibilityEvent 2016-03-01 15:56:08 -08:00