299 Commits

Author SHA1 Message Date
Adlai Holler
1d105c2056
Add an experimental "no-copy" renderer (#741)
* Add "ASGraphicsContext" to skip copying our rendered images

* Zero the buffer before making a context

* Update license header

* Update dangerfile

* Make it a runtime flag

* Restore GState for good measure

* Free buffer if end without image

* Enable the experiment, and cut out the middle-man

* Fix typo
2018-01-13 19:19:08 -08:00
Adlai Holler
5e73396cde
Enable collection node interactive moves (#735)
* Add support for interactive moves

* Enable drag & drop in collection view example

* Update changelog

* Change the gating logic to match UIKit

* Add a warning when we prevent interactive movement due to async layout
2018-01-09 14:34:32 -08:00
appleguy
131619de96
Reimplement ASRectTable using unordered_map to avoid obscure NSMapTable exception. (#719)
* Reimplement ASRectTable using unordered_map to avoid obscure NSMapTable exception.

The new class is called ASRectMap, which patterns alongside ASIntegerMap in both name and implementation.

After some pretty detailed investigation, including study of open-source reimplementations
of Foundation, the best lead I've found on the NSMapTable exception is that
some NSPointerFunction types are not fully supported. Strangely, the ones being used
do seem to work fine almost all of the time.

The main concern is the Struct memory type, which is not officially re-declared in
NSMapTable, and as such the documentation claims that there may exist some
combinations of NSPointerFunction that are not supported.

Because the exception is occurring frequently enough to be a concern (in the hundreds
to low thousands, though only 50 a day) - I decided to replace NSMapTable entirely
in order to ensure full correctness.

"*** -[NSMapTable initWithKeyPointerFunctions:valuePointerFunctions:capacity:] Requested configuration not supported."

* Fix Xcode project
2017-12-21 16:17:25 -08:00
John T McIntosh
fff5aae0a5 Add support for toggling logs off and back on at runtime #trivial (#714) 2017-12-20 12:49:09 +00:00
Ilya
eab7bea48d Add missing flags for ASCollectionDelegate (#718)
* Add missing flags for ASCollectionDelegate

* Update CHANGELOG.md
2017-12-19 17:13:45 +00:00
César Estébanez Tascón
8f19434788 Check for nil elements on ASTableView as well #trivial (#710) 2017-12-19 16:56:35 +00:00
Garrett Moon
46d46fdf12
#trivial Fixes image nodes being stuck not being able to download image (#720)
* #trivial Fixes image nodes being stuck not being able to download image

* Clear out the _cacheUUID too even though this is not strictly necessary.
2017-12-18 15:15:29 -08:00
Huy Nguyen
5a4d569c56
Ensure an ASM enabled node applies its pending layout when enters preload state (#706)
This makes sure subnodes are inserted and start preloading right away, instead of waiting until the next layout pass of the supernode. Fixes #693.
2017-12-08 18:30:26 +00:00
Garrett Moon
008a1ce208
Revert Adds support for specifying a quality indexed array of URLs (#699)
* Revert "Adds support for specifying a quality indexed array of URLs (#557)"

This reverts commit 3c77d4a5da44c46c7b80b2a627c95389b7d6352d.

* Add CHANGELOG entry
2017-12-05 13:55:19 -08:00
Garrett Moon
0b6d41f872
A couple performance tweaks for animated images #trivial (#634)
* A couple performance tweaks for animated images

* @nguyenhuy's comments

* Avoid calling animatedImageData twice. Thanks @maicki.

* Fix call to background deallocation

* Good catch by @Adlai-Holler
2017-12-04 14:56:04 -08:00
Adlai Holler
0dc7002f0b Add unit tests for the layout engine (#424)
* Build testing platform & tests for the layout engine

* Add our license header to debugbreak.

* Remove thing

* Address review comments

* Beef up the logging

* Update -[ASLayout isEqual:]

* testLayoutTransitionWithAsyncMeasurement passes now

* Disable testASetNeedsLayoutInterferingWithTheCurrentTransition

* Fix build errors
2017-12-01 17:05:47 +00:00
Huy Nguyen
bccde6cf0f
[ASScrollNode] Fix small bugs and add unit tests (#637)
* Add unit tests for ASScrollNode

* Make sure ASScrollNode's size is clamped against its size range

* Invalidate ASScrollNode's calculated layout if its scrollable directions changed

* Update comment

* Update CHANGELOG

* Address Adlai's comments
2017-12-01 15:41:06 +00:00
Huy Nguyen
b01fac35b6
[ASDisplayNode+Layout] Ensure a pending layout is applied once (#695)
Before:
  - Even if a pending layout was applied before, it'll be unnecessarily applied again in next layout passes and cause `-calculatedLayoutDidChange` being called multiple times.

After:
  - If a pending layout was applied, the calculated layout will not be ignored but reused, if possible, in next layout passes.

Test plan: testSetNeedsLayoutAndNormalLayoutPass in #424.
2017-12-01 13:11:17 +00:00
Erekle
d8cda8d74a [iOS11] Update project settings and fix errors (#676)
* [iOS11] Update project settings and fix errors

* update changelog

* resolve comments
2017-11-30 12:25:06 +00:00
huang-kun
e4b2c05c21 [ASCornerLayoutSpec] New layout spec class for declarative corner element layout. (#657)
* Add new layout spec class with snapshot testing. Update examples and CHANGELOG.md

* Code review updates.

* Open curly bracket in a new line.
2017-11-24 13:45:59 +00:00
Max Wang
b2539d3531 Bugfix/fix yoga logging aligning api changes (#668)
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix logging message for new api
2017-11-21 13:34:21 +00:00
Adlai Holler
4fc753a458
Make it possible to map between sections even if they're empty (#660)
* Make section mapping work even for empty sections

* Unlock more cases and update changelog

* Fix complexity documentation
2017-11-03 16:24:48 -07:00
Adlai Holler
ff608c92bf
[Minor Breaking API] Make deallocation queues more reliable (#651)
* Make our async deallocation functions take a double pointer, so we can be sure we've released before the queue drains

* Make it a class property

* Fix the return type

* Use a locker

* Improve release notes
2017-11-02 10:45:34 -07:00
Adlai Holler
944cad6ed6
Make the framework backwards compatible with Xcode 8 (#650)
* Make the framework backwards compatible with Xcode < 9

* Update changelog
2017-10-31 16:11:57 -07:00
Garrett Moon
255682da3d Fix a layout deadlock caused by holding the lock and going up the tree. (#638)
* Fix a layout deadlock caused by holding the lock and going up the tree.

* Add CHANGELOG message

* Huy's comments
2017-10-31 15:36:01 +00:00
appleguy
63efdbde8f [ASCollectionView] Call -invalidateFlowLayoutDelegateMetrics when rotating. #trivial (#616)
* [ASCollectionView] Ensure -invalidateFlowLayoutDelegateMetrics is called for UIKit passthrough cells.

This allows rotation to work properly when rotating UIKit passthrough
cells that need to change width.

* [ASCollectionView] No need to verify node is still in model to handle view-only notifications.
2017-10-31 13:20:58 +00:00
Adlai Holler
af99ff5ef2 Have ASNetworkImageNode report whether images were cached or not (#639)
* Have ASNetworkImageNode report whether images were cached or not.

* Update changelog

* Add fileURL case
2017-10-25 15:57:30 -07:00
appleguy
68f3468d91 [ASCollectionView] Improve performance and behavior of rotation / bounds changes. (#431)
* [ASCollectionView] Improve performance and behavior of rotation / bounds changes.

See #430 for details.

* Edit CHANGELOG.md

* [ASDataController] Implement -relayoutAllNodesWithInvalidationBlock:, to flush the ASMainSerialQueue before -invalidateLayout is called.

* Don't set download results if no longer in preload range. (#606)

Good catch by @djblake, if you scroll fast enough, you leave images
set on the image node because didExitPreloadRange (which would have
cleared it) was already called.

* Animated WebP support (#605)

* Updating to support animated WebP

* Fix a deadlock with display link

* Fix playhead issue.

* Fix up timing on iOS 10 and above

* Don't redraw the same frame over and over

* Clear out layer contents if we're an animated GIF on exit range

* Clear out cover image on exit of visible range

* Don't set cover image if we're no longer in display range.

* Don't clear out image if we're not an animated image

* Only set image if we're not already animating

* Get rid of changes to podfile

* Add CHANGELOG entry

* Update license

* Update PINRemoteImage

* Remove commented out lines in example

* [ASDataController] Add nullable specifier to invalidationBlock for relayout of nodes.
2017-10-24 13:12:52 +01:00
Garrett Moon
d31af734df Dispatch batch update to main #trivial (#626)
* Dispatch batch update to main

* TableView too
2017-10-20 15:01:38 -07:00
Garrett Moon
919ec8d32b Check if we need to do a batch update (#624)
* Check if we need to do a batch update

If we've changed our leading screens for batch fetching, we
may need to batch fetch.

* Add CHANGELOG entry
2017-10-20 09:23:07 -07:00
Michael Schneider
526a7cfb53 Fix name clash with YYText (#623) 2017-10-18 15:49:58 -07:00
Huy Nguyen
c12509e67a [ASTextKitComponents] Make sure Main Thread Checker isn't triggered during background calculations #trivial (#612)
* Add unit test

* Make sure TextKit components can calculate size in background without upsetting Main Thread Checker
- Add a new thread-safe text view bounds.
- Temporary components stack doesn't have a text view so it can be safely deallocated off main.

* Add ASTextKitComponentsTextView

* Remove unnecessary change

* Fix minor mistake

* ASTextKitComponentsTextView has only 1 initializer

* Minor change

* Switch to atomic property

* Remove manual synthesization
2017-10-17 14:20:20 +01:00
Mustafa Besnili
1e7d46196f Fix "This block and function declaration is not a prototype" warning. (#619) 2017-10-17 14:18:23 +01:00
Huy Nguyen
929bd4c60e [ASTextKitComponents] Temporary components can be deallocated off main (#610) 2017-10-10 16:03:30 +01:00
Garrett Moon
4dbb6441d7 Animated WebP support (#605)
* Updating to support animated WebP

* Fix a deadlock with display link

* Fix playhead issue.

* Fix up timing on iOS 10 and above

* Don't redraw the same frame over and over

* Clear out layer contents if we're an animated GIF on exit range

* Clear out cover image on exit of visible range

* Don't set cover image if we're no longer in display range.

* Don't clear out image if we're not an animated image

* Only set image if we're not already animating

* Get rid of changes to podfile

* Add CHANGELOG entry

* Update license

* Update PINRemoteImage

* Remove commented out lines in example
2017-10-09 11:48:32 -07:00
Garrett Moon
1705ec0140 Don't set download results if no longer in preload range. (#606)
Good catch by @djblake, if you scroll fast enough, you leave images
set on the image node because didExitPreloadRange (which would have
cleared it) was already called.
2017-10-09 10:13:28 -07:00
appleguy
c6e3dd7a5d [ASCollectionView] Fix index space translation of Flow Layout Delegate methods. (#467)
* [ASCollectionView] Fix index space translation of Flow Layout Delegate methods.

This includes a few other cleanups, including overflow of signed integer indices.

* [ASCollectionView] Improve code sharing of UIKit size method calls; ensure delegate invalidation re-fetches supplementary sizes too.

* [ASCollectionView] Final method ordering and doc-comment for new _sizeForUIKitCellWithKind:atIndexPath: method.
2017-10-09 17:19:46 +01:00
Flo
4a203db9fc [ASVideoNode] Time observer fix (#604)
* [ASVideoNode] Move time observer handling to player observers methods.

* Update CHANGELOG.md.
2017-10-06 15:04:36 +01:00
Michael Schneider
4379b31ac2 Add assertion in dealloc that it is on main in ASTextKitComponents (#603) 2017-10-05 09:06:50 -07:00
Michael Schneider
dd90978fb6 ASTextKitComponents needs to be deallocated on main (#598) 2017-10-04 14:52:49 +01:00
appleguy
7a07d9eb88 [PINCache] Set a default .byteLimit to reduce disk usage & startup time. (#595)
* [PINCache] Set a default .byteLimit to reduce disk usage & startup time.

This default is fairly low - only 20MB - but for most apps with images
in the size range of 10-50KB, this is still 400-1000 images.

Once some optimizations land to PINCache, we'll match the PINCache
default of 50MB to ensure the default better serves users with larger
objects in the cache.

Apps should preferably set their own byteLimit to an optimal value.

@garrettmoon - one interesting question for us is the best place to
set .byteLimit as an app. Digging into the ASPINRemoteImageDownloader
and doing this type cast is a bit complicated, so a passthrough API
to get the PIN* objects directly might be worthwhile.

* [PINCache] Declare necessary APIs to avoid a direct dependency.
2017-10-03 19:32:03 -07:00
Michael Schneider
5c6cd7c8d9 Move clearing out of ASTextKitComponents property delegates into ASTextKitComponents dealloc (#591) 2017-09-30 07:20:14 -07:00
Adlai Holler
5186a4317e Use Nil for class instead of nil (#589) 2017-09-27 20:12:18 -07:00
Michael Schneider
a103bab00a Clear ivar after scheduling for main thread deallocation #trivial (#590)
* Clear ivar after scheduling for main thread deallocation

After scheduling the ivar for main thread deallocation we have clear out the ivar, otherwise we can run into a race condition where the main queue is drained earlier than this node is deallocated and the ivar is still deallocated on a background thread

* First clear and than schedule
2017-09-27 13:42:02 -07:00
Garrett Moon
6c008974d6 Use node lock instead of separate one to avoid deadlocks. (#582)
* Use node lock instead of separate one to avoid deadlocks.

* Add CHANGELOG entry
2017-09-27 11:34:01 +01:00
Huy Nguyen
9e178dc0a6 [_ASPendingState] Make sure accessibility strings are not nil before allocating attributed strings for them #trivial (#581)
* Make sure accessibility strings are not nil before allocating attributed strings for them

- Fix crashes caused by https://github.com/TextureGroup/Texture/pull/554

* Update tests
2017-09-27 11:33:42 +01:00
Garrett Moon
40551c746b Rolling back CI to known version for now (#585)
* Rolling back CI to known version for now

* Fix availability in tests

* Commenting out for now to see if it builds

* Fix up the Swift framework test

* Fix availability
2017-09-27 09:23:30 +01:00
Huy Nguyen
8e0aa1ea73 Fix crashes caused by failing to unlock or destroy a static mutex while the app is being terminated (#577)
* Fix crashes caused by failing to unlock or destroy a static mutex while the app is being terminated

* Allocate static mutexes on the heap memory to avoid destruction at app exit

* ASThread to use ASDisplayNodeCAssert() instead of assert()
2017-09-22 11:53:41 +01:00
Alex Hüllmandel
76eccbf269 Added attributed versions of accessibilityLabel, accessibilityHint, accessibilityValue (#554)
* Added attributed versions of accessibilityLabel, accessibilityHint and accessibilityValue

* Follow conventions for property types

* Use curly braces

* Update changelog

* Follow conventions for property types in UIView+ASConvenience.h

* Add compatibility for Xcode 8

* Use isEqualToString instead of pointer comparison

* Only allocate attributed strings once. Use _setAttributedAccessibilityToViewAndProperty only for attributed properties.
2017-09-18 18:07:01 +01:00
Sev
d4846dc292 [ASElementMap] Fix indexPath's section or item is actually negative #trivial (#457)
* [ASElementMap] Fix indexPath's section or item is actually negative.

* Small code style changes
2017-09-18 16:18:14 +01:00
appleguy
e330e57668 [ASCornerRounding] Introduce .cornerRoundingType: CALayer, Precomposited, or Clip Corners. (#465)
* [ASCornerRounding] Initial (untested) implementation of ASCornerRounding features.

* [ASCornerRounding] Working version of both clip corners and precomposited corners.

* [ASCornerRounding] Improve factoring and documentation of corner rounding features.

* [ASCornerRounding] Some final fixups.

* Add entry to changelog for .cornerRoundingType
2017-09-18 13:02:51 +01:00
appleguy
cfc48679ba [Yoga] Add insertYogaNode:atIndex: method. Improve handling of relayouts. (#469)
* [Yoga] Add insertYogaNode:atIndex: method. Improve handling of relayouts.

* Add new "version" parameter to Yoga initialization of ASDisplayNodeLayout C++ struct.
2017-09-17 22:45:39 -07:00
Samuel Hsiung
008b847a7a Fix -[ASPagerNode view] triggering pendingState + nodeLoaded assert (#564) 2017-09-13 17:12:46 +01:00
Huy Nguyen
9df6909d71 [ASImageNode] Always dealloc images in a background queue (#561)
* ASImageNode to always dealloc its images in a background queue

* Update CHANGELOG
2017-09-11 13:33:30 -07:00
César Estébanez Tascón
002c2d6978 Mark ASRunLoopQueue as drained if it contains only NULLs (#558)
* Mark ASRunLoopQueue as drained if it contains only NULLs

* Update CHANGELOG.md

* Cover ASRunLoopQueue with tests

* Include PR link in CHANGELOG.md

* Replace license header of ASRunLoopQueueTests.m with correct one

* Insert a nil in _internalQueue to ensure compaction, instead of maintaining a state for _isQueueDrained
2017-09-11 13:32:25 -07:00