{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/comments/88170640","pull_request_review_id":8751652,"id":88170640,"diff_hunk":"@@ -703,6 +704,89 @@ - (instancetype)styledWithBlock:(void (^)(ASLayoutElementStyle *style))styleBloc\n \n #pragma mark - Layout\n \n+- (void)invalidateSize\n+{\n+  ASDisplayNodeAssertThreadAffinity(self);","path":"AsyncDisplayKit/ASDisplayNode.mm","position":14,"original_position":14,"commit_id":"6d91c0082f5d5336424587727b77d3951838a07f","original_commit_id":"6d91c0082f5d5336424587727b77d3951838a07f","user":{"login":"appleguy","id":565251,"avatar_url":"https://avatars.githubusercontent.com/u/565251?v=3","gravatar_id":"","url":"https://api.github.com/users/appleguy","html_url":"https://github.com/appleguy","followers_url":"https://api.github.com/users/appleguy/followers","following_url":"https://api.github.com/users/appleguy/following{/other_user}","gists_url":"https://api.github.com/users/appleguy/gists{/gist_id}","starred_url":"https://api.github.com/users/appleguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appleguy/subscriptions","organizations_url":"https://api.github.com/users/appleguy/orgs","repos_url":"https://api.github.com/users/appleguy/repos","events_url":"https://api.github.com/users/appleguy/events{/privacy}","received_events_url":"https://api.github.com/users/appleguy/received_events","type":"User","site_admin":false},"body":"It's probably best to keep this thread-affined for now.  However, it's exciting to note that this only reads self.bounds, so we could potentially make it threadsafe in the future (.threadsafeBounds)","created_at":"2016-11-16T05:27:32Z","updated_at":"2016-11-16T05:27:32Z","html_url":"https://github.com/facebook/AsyncDisplayKit/pull/2597#discussion_r88170640","pull_request_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/2597","_links":{"self":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/comments/88170640"},"html":{"href":"https://github.com/facebook/AsyncDisplayKit/pull/2597#discussion_r88170640"},"pull_request":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/2597"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/2597","id":93421888,"html_url":"https://github.com/facebook/AsyncDisplayKit/pull/2597","diff_url":"https://github.com/facebook/AsyncDisplayKit/pull/2597.diff","patch_url":"https://github.com/facebook/AsyncDisplayKit/pull/2597.patch","issue_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/2597","number":2597,"state":"open","locked":false,"title":"[WIP][Layout] Remove overhead of setNeedsLayout","user":{"login":"maicki","id":25288,"avatar_url":"https://avatars.githubusercontent.com/u/25288?v=3","gravatar_id":"","url":"https://api.github.com/users/maicki","html_url":"https://github.com/maicki","followers_url":"https://api.github.com/users/maicki/followers","following_url":"https://api.github.com/users/maicki/following{/other_user}","gists_url":"https://api.github.com/users/maicki/gists{/gist_id}","starred_url":"https://api.github.com/users/maicki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maicki/subscriptions","organizations_url":"https://api.github.com/users/maicki/orgs","repos_url":"https://api.github.com/users/maicki/repos","events_url":"https://api.github.com/users/maicki/events{/privacy}","received_events_url":"https://api.github.com/users/maicki/received_events","type":"User","site_admin":false},"body":"## Current Problems\r\n\r\n1. Currently `-[ASDisplayNode setNeedsLayout]` changes the node's size.  That's very different from the UIKit-equivalent method; UIKit never changes the view's size whose `-[UIView layoutSubviews]` is being invoked (its subviews might change sizes, but never the view itself, unless you do it yourself explicitly in the subclass). \r\n2. The behavior in 1) is troublesome because sometimes the the root-node should not resize itself to the size that's returned by its `-[ASDisplayNode layoutThatFits:]` (or `-[UIView sizeThatFits:]` in UIKit is just that) that just about fits the content - that's the definition by UIKit anyway; it can be different from the size that actually want the node to be. If the root node is a full-screen node with subnodes, it can happen that the fullscreen node's frames changes based on the content, but as the intention for  this node was to be a full-screen node this should never happen. If a node should resize to just fit its content, there should be a method like `[UIView sizeToFit]` ; it's not expected that `-[ASDisplayNode setNeedsLayout]` to be doing this job.\r\n3. Calling `-[ASDisplayNode layoutThatFits:]` explicitly before calling `-[ASDisplayNode setNeedsLayout]`, then `-[ASDisplayNode setNeedsLayout]` just discards the old layout and calls `-[ASDisplayNode layoutThatFits:]` on its own again.\r\n\r\n##  Changes\r\nThe big change is how sizing will work. Currently the root node performs a measure pass and adjust the size of itself based on the new size.\r\n\r\nNow: **The size of the node is expected to be handled / updated by the node's owner (most of the time this is a container component) or the sizing delegate**\r\n\r\nWe will introduce something like a sizing delegate that container components can assign itself to adjust react on hierarchy changes that can have as result a size change. ASDK provides default container components like `ASViewController`, `ASTableView`, `ASCollectionView` etc.\r\n\r\n### TODO\r\n- [x] `sizeThatFits:` returns the fitting size for the node and all subnodes\r\n- [x] `sizeThatFits:` should not create any side effects (creating a `calculatedLayout`)\r\n- [x] `sizeToFit:` Uses the supernode bounds or the max size to adjust the size of the node so that it uses the most appropriate amount of space via calling `sizeThatFits:`\r\n- [x] `setNeedsLayout:` just invalidates the layout. In the next runloop layout will happen with the `bounds` of the node. The node that receives `setNeedsLayout` will not bubble up this layout change anymore. The sizing of the root node needs to managed by a container component or size delegate higher in the hierarchy.\r\n- [x] `layoutSublayers:` just lays out the node with the current bounds if (layout.isDirty || layout.size != bounds)\r\n- [x] `layoutIfNeeded:` walks up the tree and searches the first node that does not need layout and lays out the tree based on the bounds of this node\r\n- [x] `invalidateLayout / invalidateSize / invalidateLayoutSize / setNeedsUpdateSize:` starting from the node that receives the message it walks up the whole hierarchy and tells the display node size delegate that the root size was invalidated and it needs to figure out if it needs to adjust the size. The size is never changed by the root node itself!\r\n- [x] Forward `sizeThatFits:` from `_ASDisplayView` to node\r\n-  [ ] Adjust container components to new sizing model: `ASTableNode`, `ASCollectionNode`, `ASViewController`\r\n- [ ] Adapt new sizing and layout behavior for layout transition\r\n\r\n### Optimizations:\r\n- Manage a _pendingLayout if calling sizeThatFits as it's expected the resulting size is set as size","created_at":"2016-11-12T01:17:03Z","updated_at":"2016-11-16T05:27:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ffe1126e0d3cf8b882ca62e4c90e013bc1253012","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/milestones/8","html_url":"https://github.com/facebook/AsyncDisplayKit/milestones/2.1","labels_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/milestones/8/labels","id":1387070,"number":8,"title":"2.1","description":null,"creator":{"login":"appleguy","id":565251,"avatar_url":"https://avatars.githubusercontent.com/u/565251?v=3","gravatar_id":"","url":"https://api.github.com/users/appleguy","html_url":"https://github.com/appleguy","followers_url":"https://api.github.com/users/appleguy/followers","following_url":"https://api.github.com/users/appleguy/following{/other_user}","gists_url":"https://api.github.com/users/appleguy/gists{/gist_id}","starred_url":"https://api.github.com/users/appleguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/appleguy/subscriptions","organizations_url":"https://api.github.com/users/appleguy/orgs","repos_url":"https://api.github.com/users/appleguy/repos","events_url":"https://api.github.com/users/appleguy/events{/privacy}","received_events_url":"https://api.github.com/users/appleguy/received_events","type":"User","site_admin":false},"open_issues":24,"closed_issues":21,"state":"open","created_at":"2015-11-01T03:37:28Z","updated_at":"2016-11-15T21:42:29Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/2597/commits","review_comments_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/2597/comments","review_comment_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/2597/comments","statuses_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/statuses/6d91c0082f5d5336424587727b77d3951838a07f","head":{"label":"maicki:CoalAnotherApproach","ref":"CoalAnotherApproach","sha":"6d91c0082f5d5336424587727b77d3951838a07f","user":{"login":"maicki","id":25288,"avatar_url":"https://avatars.githubusercontent.com/u/25288?v=3","gravatar_id":"","url":"https://api.github.com/users/maicki","html_url":"https://github.com/maicki","followers_url":"https://api.github.com/users/maicki/followers","following_url":"https://api.github.com/users/maicki/following{/other_user}","gists_url":"https://api.github.com/users/maicki/gists{/gist_id}","starred_url":"https://api.github.com/users/maicki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maicki/subscriptions","organizations_url":"https://api.github.com/users/maicki/orgs","repos_url":"https://api.github.com/users/maicki/repos","events_url":"https://api.github.com/users/maicki/events{/privacy}","received_events_url":"https://api.github.com/users/maicki/received_events","type":"User","site_admin":false},"repo":{"id":50892794,"name":"AsyncDisplayKit","full_name":"maicki/AsyncDisplayKit","owner":{"login":"maicki","id":25288,"avatar_url":"https://avatars.githubusercontent.com/u/25288?v=3","gravatar_id":"","url":"https://api.github.com/users/maicki","html_url":"https://github.com/maicki","followers_url":"https://api.github.com/users/maicki/followers","following_url":"https://api.github.com/users/maicki/following{/other_user}","gists_url":"https://api.github.com/users/maicki/gists{/gist_id}","starred_url":"https://api.github.com/users/maicki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maicki/subscriptions","organizations_url":"https://api.github.com/users/maicki/orgs","repos_url":"https://api.github.com/users/maicki/repos","events_url":"https://api.github.com/users/maicki/events{/privacy}","received_events_url":"https://api.github.com/users/maicki/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/maicki/AsyncDisplayKit","description":"Smooth asynchronous user interfaces for iOS apps.","fork":true,"url":"https://api.github.com/repos/maicki/AsyncDisplayKit","forks_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/forks","keys_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/teams","hooks_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/hooks","issue_events_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/issues/events{/number}","events_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/events","assignees_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/assignees{/user}","branches_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/branches{/branch}","tags_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/tags","blobs_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/git/refs{/sha}","trees_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/statuses/{sha}","languages_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/languages","stargazers_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/stargazers","contributors_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/contributors","subscribers_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/subscribers","subscription_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/subscription","commits_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/commits{/sha}","git_commits_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/git/commits{/sha}","comments_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/comments{/number}","issue_comment_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/issues/comments{/number}","contents_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/contents/{+path}","compare_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/merges","archive_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/downloads","issues_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/issues{/number}","pulls_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/pulls{/number}","milestones_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/milestones{/number}","notifications_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/labels{/name}","releases_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/releases{/id}","deployments_url":"https://api.github.com/repos/maicki/AsyncDisplayKit/deployments","created_at":"2016-02-02T03:59:55Z","updated_at":"2016-11-08T12:24:13Z","pushed_at":"2016-11-16T01:02:46Z","git_url":"git://github.com/maicki/AsyncDisplayKit.git","ssh_url":"git@github.com:maicki/AsyncDisplayKit.git","clone_url":"https://github.com/maicki/AsyncDisplayKit.git","svn_url":"https://github.com/maicki/AsyncDisplayKit","homepage":"http://asyncdisplaykit.org","size":50527,"stargazers_count":1,"watchers_count":1,"language":"Objective-C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"e2e32870ed621b6aa0897efaabeed9f58f400b87","user":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":21265042,"name":"AsyncDisplayKit","full_name":"facebook/AsyncDisplayKit","owner":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/facebook/AsyncDisplayKit","description":"Smooth asynchronous user interfaces for iOS apps.","fork":false,"url":"https://api.github.com/repos/facebook/AsyncDisplayKit","forks_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/forks","keys_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/teams","hooks_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/hooks","issue_events_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/events","assignees_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/tags","blobs_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/languages","stargazers_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/stargazers","contributors_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/contributors","subscribers_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/subscribers","subscription_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/subscription","commits_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/merges","archive_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/downloads","issues_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/labels{/name}","releases_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/releases{/id}","deployments_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/deployments","created_at":"2014-06-27T05:29:02Z","updated_at":"2016-11-16T03:14:00Z","pushed_at":"2016-11-16T03:29:54Z","git_url":"git://github.com/facebook/AsyncDisplayKit.git","ssh_url":"git@github.com:facebook/AsyncDisplayKit.git","clone_url":"https://github.com/facebook/AsyncDisplayKit.git","svn_url":"https://github.com/facebook/AsyncDisplayKit","homepage":"http://asyncdisplaykit.org","size":85514,"stargazers_count":9803,"watchers_count":9803,"language":"Objective-C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1701,"mirror_url":null,"open_issues_count":166,"forks":1701,"open_issues":166,"watchers":9803,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/2597"},"html":{"href":"https://github.com/facebook/AsyncDisplayKit/pull/2597"},"issue":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/2597"},"comments":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/2597/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/2597/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/pulls/2597/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/AsyncDisplayKit/statuses/6d91c0082f5d5336424587727b77d3951838a07f"}}}}
{"actor":{"display_login":"appleguy"}}