164 Commits
Author SHA1 Message Date
Garrett Moon c5f69f0b01 Renames AS_EXTERN and ASViewController (#1876)
* Renames AS_EXTERN and ASViewController

To ASDK_EXTERN and ASDKViewController.
This is to avoid conflicting with AuthenticationServices in
Xcode 12

* Fix up examples and docs

* Add bit about updating ASViewController rename
2020-06-29 12:49:59 -07:00
Garrett Moon dbb06bf58f Fix all the warnings and re-enable on CI (#1872) 2020-06-25 11:54:00 -07:00
Greg Bolsinga bbb03b1e56 Ship ASExperimentalTraitCollectionDidChangeWithPreviousCollection (#1842)
- PINS shipped this experiment in 08/2019
2020-05-27 08:01:06 -07:00
Greg Bolsinga 44c68a3fef Update Texture Xcode project to 11.4 and fix resulting warnings - 4 (#1838)
* Update Texture Xcode project to 11.4 and fix resulting warnings - 4

* Some tests require testing deprecated functionality
2020-05-26 13:55:16 -07:00
vovasty 74fd8f3d33 deprecate ASGraphicsCreateImageWithTraitCollectionAndOptions (#1836) 2020-05-22 20:15:09 -07:00
vovasty 70f61e9d01 [ASDisplayNode] Resolve background color using system trait collection (#1777) 2020-02-20 16:04:39 -08:00
vovasty 3674402859 Fix calling CALayer out of the main thread (#1762) 2020-02-10 16:13:37 -08:00
vovasty 18fa714c3f deprecate ASGraphicsCreateImageWithOptions (#1704) 2019-10-16 13:20:39 -07:00
vovasty 6baf29a8a0 fix a node background color in non layer baked mode. (#1693) 2019-10-08 15:50:58 -07:00
Rahul Malik ee18b9cd6c Use backgroundColor ivar instead of property access in traitCollectionDidChange (#1678)
traitCollectionDidChange isn't necessarily called on Main, but our self.backgroundColor property access must be done on main once the view is loaded.

I originally opted to use self.backgroundColor rather than _backgroundColor in #1674, but I think we should use the ivar here. This could get out-of-sync if someone modified the UIView's background color instead of updating the node, but I think that's unlikely, so we should be safe to use the ivar here.
2019-09-18 09:15:32 -07:00
Harry Shamansky 0b02e8bdf8 #1673 - Re-render Clipping Corners when User Interface Style Changes (#1674)
* This PR addresses an issue I raised with #1673 where the clipping corner layer doesn't get re-rendered when going from a dark to light user interface style. The fix is to add code in the `-asyncTraitCollectionDidChangeWithPreviousTraitCollection:` method that calls through to `-_updateClipCornerLayerContentsWithRadius:backgroundColor:` if the user interface style changes.

I've also added snapshot tests to verify that using clipping corners with a dynamic background color updates when the user interface style changes.
2019-09-16 14:14:10 -07:00
Rahul Malik bda0a5b22b Track backgroundColor in ASDisplayNode (#1640)
To preserve dynamic color capabilities for layer-backed
nodes, we need to track backgroundColor as a UIColor. In layer backed nodes we lose the dynamic color logic since we
extract a CGColor from the UIColor applied to ASDisplayNode. With this
change we can respond to changes in UITraitCollection.userInterfaceStyle
for backgroundColor.
2019-08-26 17:58:53 -07:00
Rahul Malik e0d5cedd23 Dark Mode dynamic rendering preparation, adding experiment to propagate older trait collections (#1637)
- Adding experiment to propagate older trait collections when trait
collections change
- Re-render nodes when user interface style changes (dark mode)
- Snapshot testing examples for dark mode
- Fixes for applying trait collection overrides in XCTest
- Create new define for gating Xcode 11 / iOS 13 features until CI is running it
2019-08-22 15:53:17 -07:00
Huy Nguyen b721a911c8 Remove _ASDisplayLayer's delegateDidChangeBounds flag (#1618)
We rely on the delegate setter to be called to set the flag. However, recent change on iOS 13 causes the setter to not be called at all and thus we had to put up a workaround (https://github.com/TextureGroup/Texture/pull/1609). While the workaround works, the perf benefit of that the flag provides doesn't warranty the extra complexity IMO. So I think we should just remove everything.
2019-08-15 10:01:36 -07:00
Rahul Malik ae00a9053d Force -[_ASDisplayLayer setDelegate:] to evaluate delegateFlags in iOS13. (#1609)
It appears that UIKit might be setting the delegate ivar directly which bypasses establishing the `_delegateFlags` ivar on `ASDisplayLayer`. This is critical for things like ASPagerNode, ASCollectionNode that depend on layer delegateFlags to forward bounds changes.
Radar filed: FB6956185
2019-08-08 10:15:22 -07:00
Greg Bolsinga 7da85c5008 Run Import Optimizer on Texture (#1580)
* Run Import Optimizer on Texture
2019-07-11 19:19:13 -07:00
LiuJian 59ab0e8773 Fix placeholder (#1555)
* Fix placeholder

* [Unit Tests] Add Placeholder Test (#1555)
2019-06-28 10:40:45 -07:00
Huy Nguyen ba1e0acb1e Restore call pattern where UIView methods drive __enterHierarchy and __exitHierarchy for view-backed nodes (#1561)
After #1396, some view-backed nodes in our app stop responding to tap events. I tracked it down to [this change](https://github.com/TextureGroup/Texture/pull/1396/files#diff-7fbc7d84a259cbfbee7546a5310dddcfR162) which suggests that the order of execution matters.

This diff attempts to fix the issue by restoring the previous call order where `__enterHierarchy` and `__exitHierarchy` are driven by `_ASDisplayView`'s `-willMoveToWindow:` and `-didMoveToWindow` if the node is view-backed. Layer-backed nodes will still call `__enterHierarchy`/`__exitHierarchy` when they get `kCAOnOrderIn`/`kCAOnOrderOut`.

This maintains the layer-action support introduced in #1396.
2019-06-25 10:58:13 -07:00
Michael Schneider 62e5a8e86c Use flag for responder chain methods between view and node dispatching (#1522)
* Use flag for responder chain methods between view and node dispatching

* Use bitfields
2019-05-30 07:18:07 -07:00
Adlai Holler 0a3a37e8ca Reclaim pending display nodes memory once the subtree is finished drawing (#1509) 2019-05-10 16:31:54 -07:00
Adlai Holler 4cd8e82996 ASSignpost: Add support for the os_signpost API, fixes (#1501)
* ASSignpost: Add support for the os_signpost API

- Removes support for colored intervals. These weren't really useful and they aren't part of the signpost api.
- Fixes an issue with range controller interval logging.
- Adds an interval for interface orientation changes.

* Rename

* Support Xcode 9

* Commentary
2019-05-08 19:59:13 -07:00
Greg Bolsinga 87335d8dc5 Keep the atomics - does not affect memory work (#1498)
Revert "Ensure ASControlMode properties lock before accessing their ivars (#1476)"
This reverts commit ce1e1956f4.

Revert "Make sure all ASDisplayNode properties have backing ivars for consistency. (#1475)"
This reverts commit d6061f4390.
- Except the unused property `interfaceStateSuspended` is still removed (this is a memory saver).
2019-05-07 20:14:19 -07:00
Greg Bolsinga c571c8d1c4 Shrink ASDisplayNode from 1072 to 968 bytes, reduction of 10.74% (#1484)
* Shrink ASDisplayNode from 1088 to 976 bytes, reduction of 11.48%

These objects accumulate in the heap, so reducing their size will allow more to accumulate before memory warnings.

Group the `BOOL`s into a struct. Shrink the various stored `enum`s to fit the size of their contents. Move the ivars around so that the smaller `enum` are near eachother and the bitfield struct.

* Forgot to bit-field-ify placeholderEnable; new small size is 968, old size is 1072 (measured consistentlyl on iPhoneSE simulator). 10.74% reduction.
2019-05-07 09:56:33 -07:00
Adlai Holler 64c43c0ded Add a new "global drawing" experiment to use UIGraphicsRenderer (#1469)
* Add a new "global drawing" experiment to use UIGraphicsRenderer everywhere, when available

* Fix logic

* Use preferredFormat
2019-05-02 20:42:23 -07:00
Greg Bolsinga d6061f4390 Make sure all ASDisplayNode properties have backing ivars for consistency. (#1475)
* Make sure all ASDisplayNodes have backing ivars for consistency.

Found this by enabling #pragma clang diagnostic error "-Wobjc-missing-property-synthesis" for ASDisplayNode. One property is unused, saving 8 bytes of heap space per instance on 64-bit builds. Implement setter/getters for these properties, and add appropriate locking. add the warning as error to the build for this file.
2019-04-30 15:56:03 -07:00
Adlai Holler 4d524495b3 Remove ASEventLog (#1460)
* Remove ASEventLog. We'll focus on ASLog for the future, possibly making it triggerable on a per-node basis

* See ya!

* Hello semicolon

* Remove refs to gone tree methods

* Fix

* Remove irrelevant change, kick CI

* Clean up
2019-04-23 10:33:44 -07:00
Adlai Holler f653128d03 Remove iOS 8 support from logging code. (#1462) 2019-04-23 08:01:28 -07:00
Huy Nguyen 3120c4e4ee Disable ASAssertLocked and ASAssertUnlocked (#1412) 2019-04-19 23:22:53 -07:00
Wu Zhong 5c185baae9 Remove lock of ASTextNodeRendererKey (#1454)
* Remove lock of ASTextNodeRendererKey

* Remove class check for isEqual

* Add const specifier to function parameter

* Fixes typo

* Fixes typo
2019-04-19 14:07:18 -07:00
Adlai Holler 38a67dd328 Shut down graphics contexts experiment (#1458)
* Shut down graphics contexts experiment

* Remove dead import

* Remove gone class
2019-04-18 18:36:39 -07:00
Tim Norman 981482c564 Add didEnterHierarchy/didExitHierarchy to ASNodeController. (#1444) 2019-04-12 12:13:43 -07:00
Adlai Holler bf466e83f2 Fix the stub for layerActionForKey: to let CA continue the search (#1441)
* Fix the stub for layerActionForKey: to let CA continue the search

* Kick CI
2019-04-03 17:46:26 -07:00
Adlai Holler 19e1a34a70 Add a verbose log for locking operations. Has no effect in production (#1436)
* Add a verbose log for locking operations. Has no effect in production

* Need check
2019-04-01 11:20:38 -07:00
Adlai Holler fe1cb1c79d Add support for clipping only specific corners, add unit tests (#1415)
* Add support for clipping only specific corners, add unit tests

* Remove some cleanup to make the diff smaller

* Fix
2019-03-28 18:42:33 -07:00
Jacob Farkas 69f42dbb1d Replace +load initializers with __attribute__((constructor)) functions (#1425)
* Replace +load initializers with __attribute__((constructor)) functions

* Updating the documentation for textureDidInitialize, per @nguyenhuy
2019-03-28 18:41:42 -07:00
Adlai Holler 34f16217a6 Add layer-action support to nodes (#1396)
* Add layer-action support to nodes, unify hierarchy notifications on it

* Better pending state

* Fix bool

* Skip extra copy

* Never run default actions

* Continue the search
2019-03-13 11:58:08 -07:00
Adlai Holler 9cd0d58373 Rename ASDN C++ namespace to AS (#1366)
* Rename ASDN C++ namespace to "AS." Referring to the framework as ASDisplayNode is pretty out-dated and verbose. See CoreAnimation which usees CA for their internal namespace.

More using

* More cases
2019-03-09 12:14:58 -08:00
Adlai Holler dd4359db7b Optimize ASCATransactionQueue (#1350)
* Optimize ASCATransactionQueue. This queue is very busy, and it runs on the main thread so it's important for it to be fast.

Avoid waking up the run loop for every single node.
Avoid a ton of NSPointerArray overhead that we don't need.
Avoid retain/release traffic on the singleton by using an inline function. I confirmed that in release mode, the static __strong is correctly inlined and no ARC traffic is incurred.

* Comment

* Unlock right

* Remove magic number
2019-03-05 18:20:17 -08:00
Kevin 1410b29b63 Lock up to yogaRoot during layout to avoid deadlocks. (#1356)
* Lock up to yogaRoot during layout to avoid dead lock.

1) lock to root for tree
2) lock self to change parent (& consequently root)
3) Implement ASLocking (tryLock) on ASNodeController
4) add lockPair to try-lock node & controller together
5) lock controllers if they exist in lockToRoot...

Disable some asserts due to lock to root. :(

LL# No commands remaining.

* Add macro so non-Yoga still builds :)

* wut
2019-03-03 08:05:01 -08:00
Adlai Holler 6e7cdea797 Add extension points for global node behaviors, potentially replacing interface state delegates (#1229)
* Add extension points for global node behaviors via categories and a public ivar

* Update documentation on context ivar
2019-02-14 14:17:03 -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 e59eff8aa0 Reduce startup time. (#1292)
Move file scope constant that is initialized at startup to function scope to avoid startup hit.
2019-01-15 08:56:43 -08:00
ricky 9cf54e8e8b [ASDisplayNode] Propagate traits before loading a subnode (#1234)
https://github.com/TextureGroup/Texture/pull/886 enforces that some nodes are loaded before they are sent a visiblity event, but it was not propagating the trait collection before forcing the load.

We are propagating traits in `_setSupernode:` (which was happening after the forced load). I moved the possible forced load to `_setSupernode:`, after propagating traits but before any visibility states are changed.
2018-11-19 17:53:00 -08:00
Michael Schneider 53368a5cb6 Remove CHECK_LOCKING_SAFETY check (#1225)
Locking assertions are always active now
2018-11-09 07:31: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
Michael Schneider a34f45355e Revert #1023 (#1204)
We will revert #1023. The current solution introduces problems if we are unlocking before calling _completePendingLayoutTransition. _completePendingLayoutTransition needs to be happening in one transaction if called from _u_measureNodeWithBoundsIfNecessary.
2018-11-03 12:32:15 -07:00
Michael Schneider ecfc7835da Add experiment flag to skip layoutIfNeeded in enterPreloadState for ASM nodes (#1201) 2018-11-03 09:44:42 -07:00
Michael Schneider 8822bae0d5 Follow up cleanup #trivial (#1203)
* Remove whitespace at the end of the line

* Fix indentation

* Wrap if check for assertion in ASDISPLAYNODE_ASSERTIONS_ENABLED

* Add testTextNodeSwitchWorksInMultiThreadEnvironment tests
2018-11-02 07:54:15 -07:00