Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure an ASM enabled node applies its pending layout when enters preload state #706

Merged
merged 5 commits into from
Dec 8, 2017

Conversation

nguyenhuy
Copy link
Member

This makes sure subnodes are inserted and start preloading right away, instead of waiting until the next layout pass of the supernode. Fixes #693.

…load state

This makes sure subnodes are inserted and start preloading right away, instead of waiting until the next layout pass of the supernode. Fixes TextureGroup#693.
@@ -2,8 +2,6 @@
// ASDisplayNodeImplicitHierarchyTests.m
// Texture
//
// Created by Levi McCallum on 2/1/16.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry Levi, Danger forces me to do this :)

// (see __layout and _u_measureNodeWithBoundsIfNecessary:).
// This scenario should be uncommon, and running a measurement pass here is a fine trade-off because preloading
// any time after this point would be late.
[self layoutIfNeeded];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work in the case of a node that doesn't have self.isNodeLoaded yet?

Ideally, we would be able to flush the layout / ASM process without relying on a CoreAnimation call at all. For example, a codepath that could call __layout without relying on -layoutSubviews.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. That's why I'm calling the bridged layoutIfNeeded implementation of ASDisplayNode which is thread-safe and doesn't allocate the backing store if the node is not yet loaded (code here). I also have an assertion in the test specifically for this behavior.

@nguyenhuy nguyenhuy merged commit 5a4d569 into TextureGroup:master Dec 8, 2017
@nguyenhuy nguyenhuy deleted the HNASMAndInterfaceState branch December 8, 2017 18:30
nguyenhuy added a commit that referenced this pull request Jan 17, 2018
…rs preload state (#751)

- After #706, a layout pass is forced on an ASM-enabled node that enters preload state to make sure that its subnodes can start preloading as well. However, when the node is visible, a (coalesced, thus more efficient) layout pass will be triggered by CA soon anyways, so rely on it instead.
bernieperez pushed a commit to AtomTickets/Texture that referenced this pull request Apr 25, 2018
…load state (TextureGroup#706)

This makes sure subnodes are inserted and start preloading right away, instead of waiting until the next layout pass of the supernode. Fixes TextureGroup#693.
bernieperez pushed a commit to AtomTickets/Texture that referenced this pull request Apr 25, 2018
…rs preload state (TextureGroup#751)

- After TextureGroup#706, a layout pass is forced on an ASM-enabled node that enters preload state to make sure that its subnodes can start preloading as well. However, when the node is visible, a (coalesced, thus more efficient) layout pass will be triggered by CA soon anyways, so rely on it instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants