Commit Graph
5091 Commits
Author SHA1 Message Date
ricky 453465564d [ASDisplayNode] Stop infinite layout in _u_measureNodeWithBoundsIfNecessary (#1434)
We came across an infinite layout loop in `_u_measureNodeWithBoundsIfNecessary`. After requesting a layout from above, the sizes between pending and caluclated layout still do not match. We continue to prefer to use the pending layout and ask for another layout loop from above. We can’t seem to break out of this loop. The solution (thanks to Huy for the guidance) was to nil out the pending layout we get from requesting the layout from above.

I was only able to reproduce this when working with a node in a `UINavigationBarItem’s` `titleView`. I think that UIKit must be doing something sneaky with setting the frame on the view. While I was not able to create a unit test to catch this issue (I tried for a long time, and can post what I’ve come up with to see if anyone has any suggestions), I was able to create a pretty simple example project that shows the behavior:
https://github.com/rcancro/TextureLayoutLoopExample
2019-04-01 08:53:47 -07:00
dirtmelon c50e509a84 Fix typo in batch-fetching-api.md (#1437) 2019-04-01 08:52:43 -07:00
Adlai Holler 28522ce977 Have image nodes draw into opaque contexts automatically if possible (#1432)
* Have image nodes draw into opaque contexts if the image is opaque and it fills the context

* Call backingSize once
2019-03-29 11:16:35 -07:00
Ballad 8231599d43 [ASImageNode]fix incorrect backing size calculation (#1189)
* fix backing size for image node which content mode is scaleAspectFit

* chore: update comments and naming

* add change log

* Update CHANGELOG.md

* Update CHANGELOG.md

Co-Authored-By: junjielu <348649634@qq.com>

* add unit test for backing size calculation

* correct license
2019-03-29 10:45:55 -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
Max Wang 039b6f03dd Fix dealloc on bg (#1410)
* 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 06e18a1059.

* Fix dealloc long gesture in background
2019-03-28 18:42:16 -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
Greg Bolsinga 5f8161ece7 Fix retain cycle with transaction operations (#1429)
Add unit tests that help find cycles. `-testWeakWithSingleOperation` fails without the code fix applied.
2019-03-28 18:37:06 -07:00
Michael Zuccarino dfd44e8b9e [Experiment] Dont forget about these collection view background deallocs (#1424)
* Dont forget about these collection view background deallocs

* Also Table view for completeness
2019-03-27 11:23:27 -07:00
Michael Zuccarino 27cc0f2717 Experiment with disabling ASViewController background dealloc (#1420) 2019-03-25 14:11:04 -07:00
Dmitry Gridnev 6141198ff9 showcase.md updated (#1421) 2019-03-25 13:59:31 -07:00
Michael Zuccarino ca34768e24 Removed locked jekyll version (#1322) 2019-03-22 15:41:35 -07:00
Michael Zuccarino 98c3791912 Dev docs for threading in Texture (#1319)
* Getting started on adding threading by example

* writing writing writing

* more info

* More threading

* More more more

* Threading

* self lock

* Some language fixes

* Update docs/_docs/development/threading.md

Co-Authored-By: mikezucc <mikezuccarino@gmail.com>

* fix image references
2019-03-22 15:38:41 -07:00
Huy Nguyen dbe1ceb77c Follow up on the ASRangeController fix in #1418 (#1419)
The changes in #1418 is a bit too aggressive when it comes to nodes that are in display range. It forces those nodes to not preload.

Also update the changes to avoid diluting the experiment data by triggering too broadly (i.e avoid triggering when the old and new implementations yield the same result leading to no behavior change).
2019-03-22 12:41:49 -07:00
Tim Norman 5937ac3333 Fix a bug with Yoga nodes whose position change and don't update. (#1408) 2019-03-22 11:30:40 -07:00
Huy Nguyen 09365b90ee Fix bug in ASRangeController that causes some cell nodes of a collection view which is about to becomes invisible to load their backing view/layer and render (#1418) 2019-03-22 06:40:18 -07:00
Michael Schneider 74de765b62 Only set ASLayoutElementStyle delegate if Yoga is enabled (#1417) 2019-03-21 07:41:02 -07:00
Kevin f4d6b95f1c Add support for reverse direction to yoga layouts (#1413)
* Add support for reverse direction to yoga layouts

* #ifdef YOGA yoga-specific additions

* oops
2019-03-20 15:09:21 -07:00
Andrew Yates 59279e7920 Fix GIF Caching (#1405) 2019-03-18 13:32:01 -07:00
Michael Schneider 502256b98b Add clang-format for a common source code format (#1365)
* Add clang-format

* Update format to be as close as our current style
2019-03-16 16:37:46 -07:00
Huy Nguyen e3ae6635c7 Avoid an unnecessary lock & unlock pair in ASMainSerialQueue (#1409) 2019-03-16 09:34:39 -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
Greg Bolsinga 9d77ef944f Suppress documentation warnings when using external libraries (#1401)
Fixes 1400
2019-03-13 10:56:11 -07:00
Garrett Moon 96a7723d3b Context is a pretty general name that will cause conflicts with subclasses (#1399) 2019-03-12 15:32:58 -07:00
Adlai Holler 223d6bdca7 Fix header typo (#1402) 2019-03-12 14:34:58 -07:00
Adlai Holler abe46b08a9 Make shared CA transaction queue variable extern so it's actually shared (#1397) 2019-03-12 08:22:21 -07:00
Adlai Holler 5490d4d1fa Make experiment checks faster (#1393)
* Make experiment checks use dispatch_once when not debugging, clean up singleton

* One more

* Pull out the variable
2019-03-12 07:43:38 -07:00
ernestmama 6f44c3921e Remove experimental features (exp_skip_a11y_wait && exp_new_default_cell_layout_mode) (#1383)
* Remove experimental features

* prevent blocking main thread

* remove small content all together as none is the default

* Update ASExperimentalFeatures.h
2019-03-11 13:34:35 -07:00
Garrett Moon 32a2ebf49b Update for 9.4.1 CI (#1392) 2019-03-11 09:09:28 -07:00
Greg Bolsinga 593b56aaff Clean up a clang analyzer cast error (#1387)
~/Texture/Source/Private/ASMutableElementMap.mm:32:24: warning: Conversion from value of type 'NSMutableArray<NSMutableArray *> *' to incompatible type 'ASMutableCollectionElementTwoDimensionalArray *'
    _sectionsOfItems = (id)ASTwoDimensionalArrayDeepMutableCopy(items);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
2019-03-09 12:15:20 -08: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
Jacob Farkas a38b3f547e Add UIDataSourceModelAssociation to ASTableView and ASCollectionView (#1354)
* Add UIDataSourceModelAssociation protocol conformance to ASTableView and ASCollectionView.

* Implementing review feedback from @Adlai-Holler
2019-03-09 07:56:10 -08:00
Garrett Moon 9b80eabd8f Adds support for using UIGraphicsImageRenderer in ASTextNode. (#1384)
* Adds support for using UIGraphicsImageRenderer in ASTextNode.

In many cases this reduces the backing store of text nodes by 1/2.

* Guard for UIGraphicsRenderer availability.

* Comma
2019-03-09 07:55:46 -08:00
Kevin 872e89b772 Need some more locks for working with calculated yoga layouts (#1388) 2019-03-09 07:55:35 -08:00
Kevin 510000ee85 Correct attributes lookup for supplementary elements. (#1318) sync-base sync-base-03-08-19 2019-03-08 09:41:25 -08:00
Greg Bolsinga dffe22f12d Fix CTLineRef leaks (#1386)
Found by Clang Static Analyzer:

~/Texture/Source/ASTextNode2.mm:663:39: warning: Potential leak of an object stored into 'truncationTokenLine'
      CTLineRef truncationTokenLine = CTLineCreateWithAttributedString((CFAttributedStringRef)_truncationAttributedText);
                                      ^
~/Texture/Source/ASTextNode2.mm:666:49: warning: Potential leak of an object stored into 'additionalTruncationTokenLine'
      CTLineRef additionalTruncationTokenLine = CTLineCreateWithAttributedString((CFAttributedStringRef)_additionalTruncationMessage);
                                                ^
2 warnings generated.
2019-03-08 09:40:51 -08:00
Michael Schneider bb6102aa18 Add Yoga support to ASButtonNode (#1381)
* Add Yoga support to ASButtonNode

* Drop unowned ASLayoutElementStyle parameter

* Fix access of Yoga properties

* Move ASButtonNode Yoga logic to Category

* Update header
2019-03-08 08:32:57 -08:00
Kevin aeb370ff13 Fix an issue where state change notifications can be sent mulitple times. (#1372)
Before the change: both - (void)setShouldInvertStrongReference:(BOOL)shouldInvertStrongReference and - (void)setNode:(ASDisplayNode *)node will call through [self setupReferencesWithNode:node]; which call the [node addInterfaceStateDelegate:self];
2019-03-08 08:27:49 -08:00
Kevin d7eda2ec34 Assert for context creation failure during displayBlock. (#1373)
Nothing good can possibly happen if we continue without one.
2019-03-08 08:26:52 -08:00
Kevin 3089a3e3b0 Expose initial constrained size before layout in case anyone is interested later during the layout on the same thread. (#1377)
Optionally, clients are expected to clean it up after usage to avoid accessing outdated data.
2019-03-08 08:26:35 -08:00
Kevin 993172915a Correct View vs. Layer here (tho it doesn't make any difference) (#1378)
Older FBSnapshot versions, however, don't use VerifyViewOrLayer
2019-03-08 08:24:24 -08:00
Kevin 65061b9d3d Catch invalid sizes during yoga layout (#1376) 2019-03-08 08:24:08 -08:00
Garrett Moon 3547f5add3 Whoops, someone forgot an else! (#1385)
Luckily it seems this didn't cause huge memory bloat because there's
a check below that keeps the display flag from being set in low memory
conditions when the node is off the screen.
2019-03-08 08:18:11 -08:00
Huy Nguyen d102ec81ee Experiment with different strategies for image downloader priority (#1349)
Right now when an image node enters preload state, we kick off an image request with the default priority. Then when it enters display state, we change the priority to "imminent" which is mapped to the default priority as well. This means that requests from preload and display nodes have the same priority and are put to the same pool. The right behavior would be that preload requests should have a lower priority from the beginning.

Another problem is that, due to the execution order of -didEnter(Preload|Display|Visible)State calls, a node may kick off a low priority request when it enters preload state even though it knows that it's also visible. By the time -didEnterVisibleState is called, the low priority request may have already been consumed and the download/data task won't pick up the new higher priority, or some work needs to be done to move it to another queue. A better behavior would be to always use the current interface state to determine the priority. This means that visible nodes will kick off high priority requests as soon as -didEnterPreloadState is called.

The last (and smaller) issue is that a node marks its request as preload/low priority as soon as it exits visible state. I'd argue that this is too agressive. It may be reasonble for nodes in the trailing direction. Even so, we already handle this case by (almost always) have smaller trailing buffers. So this diff makes sure that nodes that exited visible state will have imminent/default priority if they remain in the display range.

All of these new behaviors are wrapped in an experiment and will be tested carefully before being rolled out.

* Add imports

* Fix build failure

* Encapsulate common logics into methods

* Address comments
2019-03-08 08:11:03 -08:00
Adlai Holler 5e8721ebe8 Make ASTextNode2 more forgiving when searching for links (#1374)
* Make ASTextNode2 more forgiving when searching for links by searching a 44x44 square around the touch

* Trailing whitespace

* Safely handle end-of-line
2019-03-07 13:29:13 -08:00
Garrett Moon fce6f23b97 Launches switching ASNetworkImageNode callbacks to global queue. (#1369)
* Launches switching ASNetworkImageNode callbacks to global queue.

* Good catch configuration tests!
2019-03-07 09:47:56 -08:00
Kevin 4c370a899c [Updated Snapshots] Don't add extraneous truncation token during kCTLineTruncationMiddle (#1375)
* Don't add extraneous truncation token during kCTLineTruncationMiddle

* Expand these comments a little.

* Update snapshot tests with beautiful correct behavior
sync-base-03-07-19
2019-03-07 07:20:06 -08:00
Garrett Moon 45146ff1cf Update the FAQ to throw less shade. (#1379)
* Update the FAQ to throw less shade.

Both of these technologies have their place, no point in being assholes.

* Update faq.md
2019-03-06 17:09:49 -08:00
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
Eric Scheers a0012d90c2 Add forwarding of UIAccessibilityAction methods (#1344)
* Add forwarding of UIAccessibilityAction methods

* Use OCMock for testing UIAccessibilityAction method forwarding
2019-03-06 10:02:50 -08:00