27 Commits

Author SHA1 Message Date
Huy Nguyen
a255953d34
Avoid using global Mutex variables (#1252)
After 5c9815f, some Mutexes are used as global C++ variables which are loaded before main(). Since the Mutex constructor checks for unfair lock experiment, it triggers an experiment configuration load, and our app isn't ready to respond that early in the process.
2018-11-26 17:25:38 -08:00
Michael Schneider
f2bc63f05a
Add way to compile out ASTextNode + TextKit dependencies (#1242)
* Add way to compile out ASTextNode + TextKit dependencies

* Compile out ASExperimentalTextNode and fix tests
2018-11-23 09:13:15 -08:00
Adlai Holler
5c9815f46d
ASThread: Remove Locker, Unlocker, and SharedMutex (#1213)
* ASThread: Remove Locker, Unlocker, and SharedMutex

* Remove extra line

* Kick the CI

* Move C++ down

* Fix thing
2018-11-05 13:26:36 -08:00
Adlai Holler
d0ba092a77
Convert the codebase to Objective-C++ (#1206)
* Convert the codebase to Objective-C++ throughout. One language is better than two.

* Put it back

* Fix linker

* Point explicitly to updated Weaver to unblock build

* Revert "Point explicitly to updated Weaver to unblock build"

This reverts commit fdc25296e8794d4e6e56c35f5fe6da2be3f71dbc.

* Revert "Fix linker"

This reverts commit 7be25f91519b8497ef42de79f115bcfbdb965c39.

* Add in the frameworks

* no message

* Address spec lint warnings

* Fix tvos build

* Put that back

* Address Michael's review

* Add comment to kick CI
2018-11-02 12:04:14 -07:00
Adlai Holler
0380b270bb
Address Xcode warnings about unguarded availability and implicit self retains (#1207) 2018-11-01 19:40:16 -07:00
Huy Nguyen
9664364e4b Small fix in ASTextKitRenderer #trivial (#1167) 2018-10-21 11:50:16 -07:00
Eric Jensen
565da7d493 Add missing NS_NOESCAPE in overwritten methods (#1139)
Fixes -Wmissing-noescape warnings
2018-10-04 09:33:08 -07:00
appleguy
465abb1ded [License] Simplify the Texture license to be pure Apache 2 (removing ASDK-Licenses). (#1077)
* [License] Simplify the Texture license to be pure Apache 2 (removing ASDK-Licenses)

With permission of the Facebook Open Source team, we are simplifying the Texture
license so that clients can rely on the Apache 2 terms that most of Texture is
already covered by. This means that code originally forked from AsyncDisplayKit
will be re-licensed from "BSD 3-clause + PATENTS v2" to Apache 2 without a
PATENTS file.

After getting confirmation that the updates to these core files look good, we'll
propagate this new license header to all files (in this same PR) and get sign-off
from all parties before landing.

* [License] Update all Texture source files to be pure Apache 2.

* Changelog entry for Apache 2 license update.

* Revert "[License] Update all Texture source files to be pure Apache 2."

This reverts commit ffa0fbbba9717d871dd16c4b07539f2f8208fc2b.

* [License] Update all Texture source files to be pure Apache 2, maintaining copyrights.

* [License] Update CONTRIBUTING, README, Podspec & Dangerfile.
2018-08-28 07:39:18 -07:00
Eric Jensen
5f912d1cd1 Remove double scaling of lineHeightMultiple & paragraphSpacing attributes in ASTextKitFontSizeAdjuster (#1056) 2018-08-15 11:08:32 -07:00
Adlai Holler
dbe469a94a
Standardize "extern" decls on AS_EXTERN (#972)
* Standardize "extern" decls on AS_EXTERN

* Rebase & remove from implementation files
2018-06-18 15:53:34 -07:00
Adlai Holler
f6c5dc31e2
Generalize the main thread ivar dealloc stuff (#959) 2018-06-07 09:41:58 -07:00
Adlai Holler
cac14e0bce
Standardize Property Declaration Style in Core Classes (#870)
* Audit property attributes for core classes

* Update style guide

* Go crazy

* Update changelog
2018-05-24 14:42:43 -07:00
Michael Schneider
efe924cca7
Prevent UITextView from updating contentOffset while deallocating (#915)
* Prevent UITextView from updating contentOffset while deallocating

* Add comment on the flag point to the issue
2018-05-09 08:30:03 -07:00
Adlai Holler
2b12654810
Use NS_RETURNS_RETAINED macro to save time (#843)
* Use NS_RETURNS_RETAINED macro to save time

* Update changelog and do the thing with the license headers
2018-03-21 08:13:09 -07:00
Alex Hill
d9d9a29365 [tvOS] Fixes errors when building against tvOS SDK (#728)
* [tvOS] Fixes errors when building against tvOS SDK

* Update CHANGELOG.md

* [tvOS] Fixes implicit conversion between UIViewAnimationCurve +
UIViewAnimationOptions

* Enable tvOS deployment target in Texture.podspec (for CI)

* [ASMultiplexImageNode] Fixes typo

* [tvOS] Fixes warnings related to @available guards in Xcode 9
[ASMultiplexImageNode] Enables support for Photos framework on tvOS 10+

[ASMultiplexImageNode] Fixes comment depth

[ASAvailability] Adjust logic in AS_AVAILABLE_IOS_TVOS to account for
both versions
Adjusts API_AVAILABLE to minimum deployment target

* [ASAvailability] Update AS_AVAILABLE_XXX fallbacks to function more like
the built-in solution (more accurately target OS by checking target)
Change AS_AVAILABLE_IOS -> AS_AVAILABLE_IOS_TVOS in places that shoud
allow for both

[ASAvailability] Simplify AS_AVAILABLE_IOS_TVOS

* [ASControlNode] Adds missing 'super' call in -[ASControlNode didLoad]
when targeting tvOS

* Fix API_AVAILABLE iOS requirement

* [ASDisplayNode] Fixes last of the linker warnings related to category
overrides. Removes methods already implemented in
ASDisplayNode+UIViewBridge category.
[ASControlNode] Moves tvOS category declaration to ASControlNode header
[ASImageNode] Moves tvOS category declaration to ASImageNode header
[ASControlNode+Private] Adds private category for ASControlNode to
access private selectors

* [NSParagraphStyle+ASText] Fixes typo related to testing

* [ASControlNode] Re-add helpful comment

* [ASTextKitCoreTextAdditions] Adds mappings for kCTParagraphStyleSpecifierMinimumLineSpacing, kCTParagraphStyleSpecifierMaximumLineSpacing, kCTParagraphStyleSpecifierLineSpacingAdjustment when mapping CTParagraphStyle onto NSParagraphStyle
[ASTextNode] Uses CoreText-cleansed attributed string when assigning ascender/descender to avoid crash when a CTParagraphStyle is passed as an attribute

* [AsyncDisplayKit] Update project file to include new/deleted files

* [ASControlNode+tvOS] Add missing Foundation import (whoops!)
[ASImageNode+tvOS] Add missing Foundation import (whoops!)

* Update podspec to only link AssetsLibrary framework on iOS

* [ASTextKitCoreTextAdditions] If kCTParagraphStyleAttributeName key-value
evaluates to an NSParagraphStyle, pass through to cleansed attributes. This
fixes a bug that would occur if a CTParagraphStyle was passed as an
attribute _alone_ (would not be caught by unsupported attributes
check)

* [ASMultiplexImageNode] Bump availability check to support < Xcode 9

* [ASTraitCollection] Fixes typo that was causing build to fail

* Clean up formatting to adhere to character/line limit + braces
2018-03-11 16:37:27 -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
Huy Nguyen
929bd4c60e [ASTextKitComponents] Temporary components can be deallocated off main (#610) 2017-10-10 16:03:30 +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
5c6cd7c8d9 Move clearing out of ASTextKitComponents property delegates into ASTextKitComponents dealloc (#591) 2017-09-30 07:20:14 -07: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
Adlai Holler
d30c35787c Fix Alignment of Hashed Structs (#287)
* Fix alignment of ASImageNodeContentsKey struct to fix hashing

* Change the change log by logging a change

* Add the world's stupidest explicit cast

* Actually its simpler
2017-05-17 18:08:50 -07:00
ricky
002f470331 [ASTextKitFontSizeAdjuster] Replace use of boundingRectWithSize:options:context: with boundingRectForGlyphRange: inTextContainer: (#251)
* [ASTextKitFontSizeAdjuster] Replace use of boundingRectWithSize:options:context: with boundingRectForGlyphRange: inTextContainer:

`boundingRectWithSize:options:context:`  started returning different values for the same strings between iOS 10.2 and iOS 10.3. Switching to using `NSLayoutManager`’s `boundingRectForGlyphRange: inTextContainer:` fixed this. It also makes sure we are consistent with what `ASTextKitTailTruncater` uses.

* updated changelog
2017-05-10 18:40:22 -07:00
Adlai Holler
456dc8535d Simplify Hashing Code (#86)
* Simplify hashing

* Update chingling

* Update license
2017-04-29 15:23:00 -07:00
Garrett Moon
8013e25524 Update license v2 (#67)
* Fixed license

* Update all licenses

* Update Dangerfile for new license

* Update already updated licenses

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…

* Closer…
2017-04-24 16:59:57 -07:00
Huy Nguyen
5ef1d2b541 Improve hash functions of image and text nodes (#3265)
* Improve hash functions of image and text nodes

* Move ASEqualityHashHelpers to Private/
2017-04-13 16:13:21 -07:00
Huy Nguyen
7d365c7d07 Introduce ASCollectionLayout and friends (#3130)
* Introduce ASCollectionViewLayout
- `ASCollectionViewLayout` is an async `UICollectionViewLayout` that encapsulates its layout calculation logic into a separate thread-safe object which can be used ahead of time and/or on multiple threads.
- `ASDataController` now can prepare for a new layout resulted from a change set before `ASCollectionView` even knows about it. By the time the change set it ready to be consumed by `ASCollectionView`, its new layout is also ready.
- New `ASCollectionViewLayoutCalculating` protocol that is simple and generic enough that many types of calculators can be built on top. `ASCollectionViewLayoutSpecCalculator` conforms to `ASCollectionViewLayoutCalculating` protocol and can be backed by any layout spec (e.g `ASStackLayoutSpec`, `PIMasonryLayoutSpec`, etc). We can even build a `ASCollectionViewLayoutYogaCalculator` that uses Yoga internally.
- A built-in `ASCollectionViewFlowLayoutCalculator` that is a subclass of `ASCollectionViewLayoutSpecCalculator` and uses a multi-threaded multi-line `ASStackLayoutSpec` internally. The result is a performant and thread-safe flow layout calculator.
- Finally, `ASCollectionViewLayout` can be subclassed to handle a specific type of calculator with optimizations implemented based on the knowledge of such calculator. For example, `ASCollectionViewFlowLayout` can have a highly optimized implementation of `-layoutAttributesForElementsInRect:`.

Protocolize layout calculator providing and consuming

Add flex wrap documentation

Add a `multithreaded` flag to ASStackLayoutSpec that forces it to dispatch even if it's off main
- Update ASCollectionViewFlowLayoutSpecCalculator to use that flag.

Minor change in ASCollectionViewLayout

Implement Mosaic layout calculator

Minor change

Fix project file

Rename and fix project file

Skip fetching constrained size only if a layout calculator is available

Update examples/ASCollectionView

Remove unnecessary change in ASTableView

Address comments

Rename collection view calculator protocols

Minor changes after rebasing with master

Add ASLegacyCollectionLayoutCalculator for backward compatibility

Remove ASCollectionLayoutSpecCalculator

Remove ASLegacyCollectionLayoutCalculator

Introduce ASCollectionLayout
- A wrapper object that contains content size and an element to rect table.
- Collection layout calculators to return this new object instead of an ASLayout.

Before adding a content cache

Finishing hooking up ASCollectionLayoutDataSource to ASCollectionNode

Stash

Finish ASCollectionLayout

Rough impl of ASCollectionFlowLayout

Revert changes in CustomCollectionView example

Move ASRectTable back to Private

* Rename ASCollectionContentAttributes to ASCollectionLayoutState

* Address other comments

* Introduce ASCollectionLayoutDelegate and make ASCollectionLayout private

* Address comments

* API tweaks:
- Replace `-layoutContextWithElementMap:` in ASCollectionLayoutDelegate with `-additionalInfoForLayoutWithElements:`. The returned object is then stored in ASCollectionLayoutContext for later lookups.
- ASCollectionLayoutContext has no public initializer.
- ASDataControllerLayoutDelegate no longer requires a context of type ASCollectionLayoutContext but simply an `id`. This helps decouple ASDataController and ASCollectionLayout.
- Rename `elementMap` to `elements`.
- Rename `visibleMap` to `visibleElements`.
- Other minor changes.

* Rename ASCGSizeHash to ASHashFromCGSize

* Make sure to call super in -[ASCollectionLayout prepareLayout]

* Update example/ASCollectionView to use ASCollectionFlowLayoutDelegate

* Remove unnecessary change
2017-04-12 11:13:44 +01:00
Adlai Holler
73ca6ab514 Shuffle & Cleanup Stuff (#3080) 2017-02-26 18:14:13 -08:00