200 Commits

Author SHA1 Message Date
Kevin
7bb3079082 Don't add extraneous truncation token during kCTLineTruncationMiddle. (#1297)
* Don't add extraneous truncation token during kCTLineTruncationMiddle

* Expand these comments a little.
2019-03-06 10:05:30 -08:00
Adlai Holler
d14a3b03e9
Optimize ASTwoDimensionalArrayUtils (#1351)
* Optimize ASTwoDimensionalArrayUtils

These methods are called on the main thread during range controller updates (i.e. every frame) and so they should be as fast as possible.

* Rename

* Use vector instead of stack array to handle really big cases (e.g. photos)
2019-03-03 12:49:36 -06:00
Adlai Holler
efeb3d2749 Add an experimental flag to use native dispatch_apply (#1345)
* Add an experimental flag to use native dispatch_apply instead of our core count * 2 approach. This has shown performance wins in some profiling.

* Add in other places
2019-02-21 12:33:39 -08:00
Michael Schneider
8edb5a45d3
Move ASSectionController and ASSupplementaryNodeSource method to be optional (#1302) 2019-02-20 11:21:47 -08:00
Michael Schneider
d4efe95ec5
Improve separation of code for layout method types (#1305)
* Improve separation of code for layout method types

* Address PR comments

- Delegate to layout spec engine if the node is a layout spec node but yoga engine was asked for calculate the layout
- Change ASLayoutType to ASLayoutEngineType
- Improve layout engine fall through code
2019-01-28 07:41:49 -08:00
Adlai Holler
2a4b77b6d5
Remove let and var macros now that we're all-C++ (#1312)
* Remove let and var macros now that we're all-C++

* Another fix

* More!

* And more!
2019-01-17 10:16:53 -08:00
Michael Schneider
7a782f8176 Fix deprecated implementations warning (#1306) 2019-01-16 18:28:37 -08:00
dmaclach
d8cc3c9bdd Reduce startup time. (#1294)
Initializing the LUT arrays at file level scope creates a large chunk of code retaining and releasing all of the NSStrings in the tables. Moving them to function level moves the initialization to being lazy.
2019-01-16 18:25:19 -08:00
dmaclach
4982c84640 Reduce startup time. (#1291)
Get rid of file scope initialization that causes a premain startup hit.
2018-12-20 11:17:00 +01:00
Michael Schneider
82b4d34e5b Introduce ASCellLayoutMode (#1273)
* Introduce ASCellLayoutMode

* Some smaller improvements

* Improve logic around _superPerformBatchUpdates:completion:

* Add comment about default values for ASCellLayoutModeNone

* Always call _superReloadData:completion: within UICollectionView

* Add initial range test for ASCellLayoutModeNone
2018-12-09 23:39:28 -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
Kevin
be021434c8 Newline character support and truncated line sizing improvement. (#1193)
* Newline character support and truncated line sizing improvement.

For purposes of truncating text, respect explicit newlines.
Don't size to smaller than truncated line width unless we have to.

* Update CHANGELOG.md
2018-10-30 13:19:23 -07:00
Max Wang
99fd25c5b8 A11y for scrollnode (#1188)
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* remove uncessary assert

* Fix collection cell editing bug for iOS 9 & 10

* Revert "Fix collection cell editing bug for iOS 9 & 10"

This reverts commit 06e18a10596622ff8a68835c95a23986d7bf61ea.

* Add a11y support for ASSCrollNode.

* Changelog

* Clean up.

* fix braces

* add test

* disable for ci
2018-10-29 16:07:50 -07:00
Kevin
6ea7f06d84 Fix shadowed var warning (and add clarity) #trivial (#1198)
* Fix shadowed var warning (and add clarity)

* Update ASTextLayout.m
2018-10-29 07:55:54 -07:00
Michael Schneider
25a3d331ee
Correct linePositionModifier behavior (#1192) 2018-10-26 07:43:22 -07:00
Michael Schneider
097790317e
Yoga integration improvements (#1187)
* Thread safety for Yoga layout

* Support baseline alignments for ASYogaLayout

* Refactor ASLayoutElementYogaBaselineFunc to not require yogaParent (its parent style is set into a private var on ASLayoutElementStyle before layout instead)

* Only set the accessibility element if the view is loaded

* Add nodeWillCalculateLayout to ASNodeController

* Update Changelog

* Address first comments
2018-10-24 10:27:58 -07:00
Michael Schneider
b11ce52e9c
Add way to suppress invalid CollectionUpdateExceptions (#1173) 2018-10-18 09:35:36 -07:00
Michael Schneider
27d50b03d8
Only initialize framework once, avoid multiple across tests (#1178) 2018-10-18 09:34:29 -07:00
Kevin
bfb22988f7 [ASTextNode2] Add improved support for all line-break modes in experimental text node. (#1150)
* ASTextNode2 rendering corrections.

ASTextNode2 was only setting truncationMode (lineBreakMode) on existing paragraph styles in attributedString (thus having no effect for the two non-truncating modes if there were not any existing paragraph style runs).

ASTextLayout (essentially YYTextLayout) was not rendering the two non-tail truncation lineBreakModes correctly. There's not much history on github but it appears to me that it was set up correctly at one time and then some additional code was added for unclear reasons that assumed any truncation was at the end of the string.

This commit corrects both issues.

* Update CHANGELOG.md
2018-10-17 13:26:45 -07:00
Max Wang
affddb0e96 Set default tuning params (#1158)
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* remove uncessary assert

* Fix collection cell editing bug for iOS 9 & 10

* Revert "Fix collection cell editing bug for iOS 9 & 10"

This reverts commit 06e18a10596622ff8a68835c95a23986d7bf61ea.

* Only test when photo library is enabled.

It will fail to build if photo library is disabled cause the test is
depending on it.

* Add ChangeLog.

* set default tuning parameters for collection/table node

* add change log

* Move to framework private.

* Apply to tableNode

* trigger ci

* fix directory

* fix file link
2018-10-10 10:46:33 -07:00
Michael Schneider
a3763c9c91
Fix crash if setting attributed text on multiple threads (#1141) 2018-10-09 07:39:38 -07:00
Eric Jensen
696f344301 Fix compilation warnings #trivial (#1132)
* Apply recommended warnings

* Squelch designated initializer warning in ASViewController

* Remove unused compiler flag

clang: warning: argument unused during compilation: '-fno-objc-arc-exceptions' [-Wunused-command-line-argument]

* Fix warning about overriding an instance variable within a category

Instance method 'methodOverrides' in category from _ASDisplayView.o overrides method from class in ASDisplayNode.o
2018-09-20 07:54:10 -07:00
Adlai Holler
ceed2d2008 Remove reliance on shared_ptr for ASDisplayNodeLayouts (#1131)
* Remove reliance on shared_ptr for ASDisplayNodeLayouts

* Fix up

* Fix in yoga

* Back to let

* Returns inner pointer

* Trivial change to kick the CI
2018-09-19 11:23:19 -07:00
Adlai Holler
69ed9562df
Remove ASRectMap, which is not worth its own weight (#1127) 2018-09-18 11:58:24 -07:00
Adlai Holler
9bcafefa33
Remove use of NSHashTable for interface state delegates #trivial (#1122)
* Remove use of NSHashTable for interface state delegates #trivial

* Stray line

* One more case

* Add code to let people have more delegates

* Do it more
2018-09-17 14:29:22 -07:00
Huy Nguyen
f161665f5f
Fix typos and minor code cleanups #trivial (#1120)
- Fix typos in ASEditableTextNode.h and ASDisplayNode+FrameworkPrivate.h.
- Remove unnecessary declaration for ASPINRemoteImageDownloader's sharedDownloader class property.
- Remove unnecessary empty lines in ASPINRemoteImageDownloader.m and ASEditableTextNode.h.
2018-09-17 13:35:00 -07:00
Max Wang
bf8d268573 Interface state not update correctly during layer thrash. (#1111)
* fix SIMULATE_WEB_RESPONSE not imported #449

* Fix to make rangeMode update in right time

* remove uncessary assert

* Fix collection cell editing bug for iOS 9 & 10

* Revert "Fix collection cell editing bug for iOS 9 & 10"

This reverts commit 06e18a10596622ff8a68835c95a23986d7bf61ea.

* Fix interface state not update correctly during layer thrash

* add change log
2018-09-17 10:11:04 -07:00
Adlai Holler
56c94a8941
Add a -textureDidInitialize delegate callback (#1100) 2018-09-06 11:08:45 -07:00
Adlai Holler
395fbd1302 Reuse interface state delegates when calling out #trivial (#1099)
* Reuse interface state delegates when calling out instead of always copying
2018-09-05 22:52:41 -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
Adlai Holler
03e6ce0916
Reduce copying in ASTextNode2 stack (#1065)
* Remove copying in text stack, make text container have an optional immutable mode

* Changelog

* Comment

* Update CHANGELOG.md

* Use new name

* Import header
2018-08-07 08:32:43 -07:00
Adlai Holler
b136e84b4e
Add an experimental framesetter cache in ASTextNode2 (#1063)
* Add an experimental framesetter cache in ASTextNode2, and stop keeping framesetters around

* Update configuration schema

* Fix imports

* Fix import again and remove set statement
2018-08-04 07:33:53 -07:00
Adlai Holler
c5b1d09b49
Remove direct ivar access on non-self object to fix mocking case #trivial (#1066)
* Remove direct ivar access on non-self object to prevent issues when the object is actually a mock

* Comment

* Remove lock to avoid deadlock risk
2018-08-03 16:35:24 -07:00
Adlai Holler
40e3bf8952
Remove objc association & weak proxy from node -> controller pointer (#1061)
* Remove objc association & weak proxy from node -> controller relationship

* Rename ASNodeController+Beta.m to ASNodeControllerx+Beta.mm

Currently we can't import ASDisplayNodeInternal from C

* Update project pointers

* Rename ASNodeControllerx+Beta.mm to ASNodeController+Beta.mm
2018-08-03 10:24:37 -07:00
Adlai Holler
e76b4f02f6
Remove extra string/attributed string creation in accessibility properties (#1062) 2018-08-03 10:23:05 -07:00
Michael Schneider
9e2947e7fb
Revert "Optimize drawing code + add examples how to round corners (#996)" (#1055)
This reverts commit eb4c21c54540d2c1c0b63a6b0665a77fea810e6c.
2018-07-31 04:40:18 -07:00
Michael Schneider
eb4c21c545 Optimize drawing code + add examples how to round corners (#996)
* Use CoreGraphics for drawing and cropping of node content

* Smaller fixes
2018-07-26 09:44:10 -07:00
Huy Nguyen
95de2ab126
Avoid setting frame on the backing store while holding a node's lock (#1048)
Doing so may trigger `-layer:didChangeBoundsWithOldValue:newValue:` on the layer's delegate (i.e `ASCALayerExtendedDelegate`) which then runs other operations that require the lock to be free.
2018-07-24 15:03:47 -07:00
Kevin
b2eb58e9f2 Remove misleading comment and add assertion #trivial (#1027) 2018-07-24 09:15:31 -07:00
Kevin
1beeb9c5e6 Add a comment about tiling mode and issue #1046 (#1047) 2018-07-24 09:13:23 -07:00
Michael Schneider
736e200407 Fix warning for ASLayout method override for the designated initializer of the superclass '-init' not found #trivial (#1036)
* Fix warning for ASLayout method override for the designated initializer of the superclass '-init' not found

* Move unavailable init into header
2018-07-18 02:57:35 -07:00
Michael Schneider
b1f6030e86 Create and set delegate for clip corner layers within ASDisplayNode (#1029)
* Create and use ASDisplayNodeCornerLayerDelegate

* Return kCFNull for actionForLayer:forKey:
2018-07-18 02:56:37 -07:00
Huy Nguyen
0dc97fbb2f
Stricter locking assertions (#1024)
- Rename `ASDisplayNodeAssertLockUnownedByCurrentThread` to `ASAssertUnlocked`, and `ASDisplayNodeAssertLockOwnedByCurrentThread` to `ASAssertLocked` -> shorter and hopefully easier to distinguish between the two.
- Add assertions to `_locked_` and `_u_` (i.e "unlocked") methods.
- Turn `CHECK_LOCKING_SAFETY` flag on by default. After #1022 and #1023, we're in a good shape to actually enforce locked/unlocked requirements of internal methods. Our test suite passed, and we'll test more at Pinterest after the sync this week.
- Fix ASVideoNode to avoid calling `play` while holding the lock. That method inserts a subnode and must be called lock free.
- Simplify `_loaded(node)` to only nil-check `_layer` because regardless of whether the node is view or layer backed, the layer should always be set if loaded. Use it throughout.
- Other minor changes.
2018-07-13 14:58:16 -07:00
Adlai Holler
af7f71f92d
Address warnings in Xcode >= 9.3 about using %zd for NSInteger (#1026) 2018-07-13 11:56:54 -07:00
Kevin
8986838b48 Add move detection and support to ASLayoutTransition (#1006)
* Add move detection and support to ASLayoutTransition

...and NSArray+Diffing.
Add some tests.

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update ASLayout+IGListKit.h

* Update ASLayout+IGListKit.mm

* Use std collections to avoid NSNumber boxing

* Update ASLayoutTransition.mm

* Code review updates.

* Use `unordered_multimap` on stack instead of unordered_map<id,queue> on heap
* Remove notFound BOOL (use NSNotFound sentinel value) and put some vars inside the if (insertions/moves) loop
* Don't copy defaultCompare block (redundant under ARC)
* Whitespace
* Remove unneeded mutableCopy-s in ArrayDiffingTests

* Code review updates.

* Type _subnodeMoves pair.first to ASDisplayNode * instead of id
* C++ enumeration
* unowned refs for adding previousLayout nodes to _subnodeMoves
* Remove unreleated ASDynamicCast that is probably right though

* Add commentary to NSArray+Diffing.h; make multimap elements unowned

* Use std::make_pair, optimize ASLayout+IGListKit

* Oops I thought I had added these headers but nope

* Simplify simplify

* Diff subnodes instead of sublayouts

* Another randomized test with actual ASLayouts
2018-07-13 10:19:03 -07:00
Sergey Pronin
a08d2210cf [IGListKit] Adds missing UIScrollViewDelegate method to DataSource proxy (#1015)
* Adds missing UIScrollViewDelegate method to IGListKit proxy implementation

* Updates CHANGELOG
2018-07-10 11:16:13 -07:00
Michael Schneider
55abeed743
Introduce let / var macros and some further cleanup (#1012)
* Introduce let / var and some further cleanup

* Address first comments

* Update changelog

* Move the const before auto
2018-07-10 09:37:53 -07:00
Michael Schneider
6c487dd26c
Properly consider node for responder methods (#1008)
* Properly consider node for responder methods

* Add changelog
2018-07-06 08:32:03 -07:00