14 Commits

Author SHA1 Message Date
Huy Nguyen
01715f09d8 [ASDisplayNode] Fix infinite layout loop (#455)
* Fix infinite layout loop

- The problem will occur if a node does either of the followings:
1. Keeps using a stale pending layout over a calculated layout
2. Doesn't update the next layout's version after calling _setNeedsLayoutFromAbove.

* Update CHANGELOG
2017-07-18 19:44:27 +00:00
Adlai Holler
1fa498873e Use a sentinel NSUInteger for node layout data #trivial (#428)
* Use a sentinel NSUInteger for node layout data

* Add a comment

* Address feedback from @appleguy
2017-07-10 12:10:04 +00:00
appleguy
fb6cad941f [ASDisplayNode+Layout] In layoutThatFits:, check and use _pending layout if valid. (#413)
I believe this check is supposed to be here. Unit tests pass with it in place.
Without it, calling layoutThatFits: (as ASDataController does) and then calling
it again later (as ASCollectionNode does when answering the sizeForItem: call)
will recompute the layout, potentially on main.

This seems to have more of an impact / benefit for Yoga layouts, but I don't think
its benefit is exclusive to them.
2017-07-05 10:02:38 +00:00
Adlai Holler
8ec4b312cf Overhaul our logging, add activity tracing support. (#399)
* Improve the os_log and os_activity integration

* Address feedback from Scott and Huy
2017-07-03 19:03:26 -07:00
appleguy
1d1a3787c2 [Yoga] Refine the handling of measurement functions when Yoga is used. (#408)
This ensures that measure funcs are not set for container / empty spacer
nodes, because Yoga has more internal capabilities than layoutThatFits:
knows about.

Avoid need for the main layout pass to directly call setup for measure
funcs, by making it an implicit part of .yogaLayoutInProgress =.

Tear down the measure func after the layout pass to avoid retain cycle.
2017-07-02 13:01:07 -07:00
Huy Nguyen
992df78801 Gate orphaned node detector behind YOGA flag #trivial (#380)
* Gate orphaned node detector behind YOGA flag

* Tiny indentation change
2017-06-22 19:12:41 +01:00
appleguy
486410d7d6 [Yoga] Minimize number of nodes that have MeasureFunc set on them. (#369)
This has one important benefit: fixing the stretching behavior of spacer nodes.

In addition, it should help efficiency of Yoga and certainly minimize calls
to layoutThatFits:.

Next up for Yoga is a mostly-red diff, deleting the non-Contiguous code branches.
2017-06-18 18:18:12 -07:00
appleguy
81def94f6f [ASTraitCollection] Convert ASPrimitiveTraitCollection from lock to atomic. (#355)
* [ASTraitCollection] Convert ASPrimitiveTraitCollection from lock to atomic.

This resolves a deadlock case: https://github.com/TextureGroup/Texture/issues/353

* [ASTraitCollection] Use assignment operator instead of .store() for C++ atomic.
2017-06-14 13:55:52 -07:00
Adlai Holler
c9e4b98a55 Upgrade ASLayoutElementContext to an Object #trivial (#344)
* Upgrade ASLayoutElementContext to an object

* Address feedback from Huy
2017-06-10 00:25:39 -05:00
Huy Nguyen
05e9bdd092 Small changes required by the coming layout debugger (#337)
* Small changes required by the layout debugger
- `ASDisplayNode` can be told to not flatten its layout immediately but later on. The unflattened layout is also stored in a separate property. It's needed for inspecting not only display nodes but also layout specs used to compute a layout tree.
- `ASLayout` can be told to always retain its sublayout elements. This is needed especially for layout specs since they are usually not retained after an ASLayout was computed.

* Update CHANGELOG

* Address comments
2017-06-08 10:47:50 -07:00
appleguy
00013aadab [ASDisplayNode+Layout] Add check for orphaned nodes after layout transition to clean up. (#336)
It is rare that this code has any effect, but I've discovered a case in which it occurs.

This task tracks moving this code to a DEBUG-only assertion: https://github.com/TextureGroup/Texture/issues/335
2017-06-06 12:38:37 -07:00
Huy Nguyen
6aa5ad7703 Only call -layout and -layoutDidFinish if the node is already loaded (#285)
* Only call -layout and -layoutDidFinish if the node is already loaded

* Minor change

* Update CHANGELOG
2017-05-19 15:06:26 +01:00
Adlai Holler
7df1a20c5f Simplify Layout Transition State #trivial (#269)
* Port the changes to the latest master

* Remove extra s
2017-05-15 16:33:44 -07:00
Michael Schneider
b32e69d64b [Layout] Extract layout implementation code into it's own subcategories (#272)
* Extract layout code into ASDisplayNode categories

* Category renaming and documentation

* Changelog

* Change header
2017-05-15 11:10:59 -07:00