{"action":"created","comment":{"url":"https://api.github.com/repos/facebook/css-layout/pulls/comments/29959673","id":29959673,"diff_hunk":"@@ -654,9 +663,112 @@ var computeLayout = (function() {\n \n       linesCrossDim += crossDim;\n       linesMainDim = fmaxf(linesMainDim, mainDim);\n+      linesCount += 1;\n       startLine = endLine;\n     }\n \n+    // <Loop DD>\n+    //\n+    // PIERRE: More than one line, we need to layout the crossAxis according to\n+    // alignContent.\n+    //\n+    // Note that we could probably remove <Loop D> and handle the one line case\n+    // here too, but for the moment this is safer since it won't interfere with\n+    // previously working code.\n+    //\n+    // See specs:\n+    // http://www.w3.org/TR/2012/CR-css3-flexbox-20120918/#layout-algorithm\n+    // section 9.4\n+    //\n+    if (linesCount > 1 &&\n+        (!isUndefined(node.layout[dim[crossAxis]])))\n+    {\n+      var/*float*/ nodeCrossAxisInnerSize = node.layout[dim[crossAxis]] -\n+          getPaddingAndBorderAxis(node, crossAxis);\n+      var/*float*/ remainingCrossDim = nodeCrossAxisInnerSize - linesCrossDim;\n+\n+      var/*float*/ crossDimAdd = 0;\n+      var/*float*/ currentLead = getPaddingAndBorder(node, leading[crossAxis]);\n+\n+      var/*css_align_t*/ alignContent = getAlignContent(node);\n+      if (alignContent == CSS_ALIGN_FLEX_END) {\n+        currentLead += remainingCrossDim;\n+      }\n+      else if (alignContent == CSS_ALIGN_CENTER) {\n+        currentLead += remainingCrossDim / 2;\n+      }\n+      else if (alignContent == CSS_ALIGN_STRETCH) {\n+        if (nodeCrossAxisInnerSize > linesCrossDim) {\n+          crossDimAdd = (remainingCrossDim / linesCount);\n+        }\n+      }\n+\n+      // find the first node on the first line\n+      for (i = 0; i < node.children.length; ) {\n+        var/*int*/ startIndex = i;\n+        var/*int*/ lineIndex = -1;\n+\n+        // get the first child on the current line\n+        {\n+          child = node.children[i];\n+          if (getPositionType(child) != CSS_POSITION_RELATIVE) {\n+            ++i;\n+            continue;\n+          }\n+          lineIndex = child.lineIndex;\n+        }\n+\n+        // compute the line's height and find the endIndex\n+        var/*float*/ lineHeight = 0;\n+        for (ii = startIndex; ii < node.children.length; ++ii) {\n+          child = node.children[ii];\n+          if (getPositionType(child) != CSS_POSITION_RELATIVE) {\n+            continue;\n+          }\n+          if (child.lineIndex != lineIndex) {\n+            break;\n+          }\n+          if (!isUndefined(child.layout[dim[crossAxis]])) {\n+            lineHeight = fmaxf(lineHeight,child.layout[dim[crossAxis]] +\n+                               getMarginAxis(child,crossAxis));\n+          }\n+        }\n+        var/*int*/ endIndex = ii;\n+        lineHeight += crossDimAdd;\n+\n+        for (ii = startIndex; ii < endIndex; ++ii) {\n+          child = node.children[ii];\n+          if (getPositionType(child) != CSS_POSITION_RELATIVE) {\n+            continue;\n+          }\n+\n+          var/*css_align_t*/ alignItem = getAlignItem(node, child);\n+          var/*float*/ crossPosition = child.layout[pos[crossAxis]]; // preserve current position if someting goes wrong with alignItem?\n+          if (alignItem == CSS_ALIGN_FLEX_START) {\n+            crossPosition = currentLead + getMargin(child,leading[crossAxis]);\n+          }\n+          else if (alignItem == CSS_ALIGN_FLEX_END) {","path":"src/Layout.js","position":127,"original_position":127,"commit_id":"b1a68ef6e04f56231766c7da6cc6c1435303e962","original_commit_id":"b1a68ef6e04f56231766c7da6cc6c1435303e962","user":{"login":"vjeux","id":197597,"avatar_url":"https://avatars.githubusercontent.com/u/197597?v=3","gravatar_id":"","url":"https://api.github.com/users/vjeux","html_url":"https://github.com/vjeux","followers_url":"https://api.github.com/users/vjeux/followers","following_url":"https://api.github.com/users/vjeux/following{/other_user}","gists_url":"https://api.github.com/users/vjeux/gists{/gist_id}","starred_url":"https://api.github.com/users/vjeux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vjeux/subscriptions","organizations_url":"https://api.github.com/users/vjeux/orgs","repos_url":"https://api.github.com/users/vjeux/repos","events_url":"https://api.github.com/users/vjeux/events{/privacy}","received_events_url":"https://api.github.com/users/vjeux/received_events","type":"User","site_admin":false},"body":"===","created_at":"2015-05-08T17:37:41Z","updated_at":"2015-05-08T17:37:41Z","html_url":"https://github.com/facebook/css-layout/pull/79#discussion_r29959673","pull_request_url":"https://api.github.com/repos/facebook/css-layout/pulls/79","_links":{"self":{"href":"https://api.github.com/repos/facebook/css-layout/pulls/comments/29959673"},"html":{"href":"https://github.com/facebook/css-layout/pull/79#discussion_r29959673"},"pull_request":{"href":"https://api.github.com/repos/facebook/css-layout/pulls/79"}}},"pull_request":{"url":"https://api.github.com/repos/facebook/css-layout/pulls/79","id":34793550,"html_url":"https://github.com/facebook/css-layout/pull/79","diff_url":"https://github.com/facebook/css-layout/pull/79.diff","patch_url":"https://github.com/facebook/css-layout/pull/79.patch","issue_url":"https://api.github.com/repos/facebook/css-layout/issues/79","number":79,"state":"open","locked":false,"title":"[Issue facebook/css-layout#78]: Implemented alignContent ;","user":{"login":"prenaux","id":164860,"avatar_url":"https://avatars.githubusercontent.com/u/164860?v=3","gravatar_id":"","url":"https://api.github.com/users/prenaux","html_url":"https://github.com/prenaux","followers_url":"https://api.github.com/users/prenaux/followers","following_url":"https://api.github.com/users/prenaux/following{/other_user}","gists_url":"https://api.github.com/users/prenaux/gists{/gist_id}","starred_url":"https://api.github.com/users/prenaux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prenaux/subscriptions","organizations_url":"https://api.github.com/users/prenaux/orgs","repos_url":"https://api.github.com/users/prenaux/repos","events_url":"https://api.github.com/users/prenaux/events{/privacy}","received_events_url":"https://api.github.com/users/prenaux/received_events","type":"User","site_admin":false},"body":"So this implements align-content. It follows the W3C specs, that's how it works in Chrome as far as I have tested. I tried to make sure that it didn't touch any pre-existing code as much as possible.\r\n\r\nAll the current tests are working (in RunLayoutTests.html and with make - JS, C & Java). RunLayoutRandomTests.html is failing but then it was failing without these changes so I suppose its an issue with the random test suite not being up-to-date.\r\n\r\nI'm going to add some more test cases in Jasmine and add this in react-native. From simple tests it works fine in react-native but I need to add alignContent in there to make sure that the new feature works correctly.\r\n\r\nLet me know if you have any comment about the implementation itself.","created_at":"2015-05-06T07:22:46Z","updated_at":"2015-05-08T17:37:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":"41a629ee817c393496f7ff6c6e64a69918b26ffc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/facebook/css-layout/pulls/79/commits","review_comments_url":"https://api.github.com/repos/facebook/css-layout/pulls/79/comments","review_comment_url":"https://api.github.com/repos/facebook/css-layout/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/css-layout/issues/79/comments","statuses_url":"https://api.github.com/repos/facebook/css-layout/statuses/b1a68ef6e04f56231766c7da6cc6c1435303e962","head":{"label":"prenaux:master","ref":"master","sha":"b1a68ef6e04f56231766c7da6cc6c1435303e962","user":{"login":"prenaux","id":164860,"avatar_url":"https://avatars.githubusercontent.com/u/164860?v=3","gravatar_id":"","url":"https://api.github.com/users/prenaux","html_url":"https://github.com/prenaux","followers_url":"https://api.github.com/users/prenaux/followers","following_url":"https://api.github.com/users/prenaux/following{/other_user}","gists_url":"https://api.github.com/users/prenaux/gists{/gist_id}","starred_url":"https://api.github.com/users/prenaux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prenaux/subscriptions","organizations_url":"https://api.github.com/users/prenaux/orgs","repos_url":"https://api.github.com/users/prenaux/repos","events_url":"https://api.github.com/users/prenaux/events{/privacy}","received_events_url":"https://api.github.com/users/prenaux/received_events","type":"User","site_admin":false},"repo":{"id":35083858,"name":"css-layout","full_name":"prenaux/css-layout","owner":{"login":"prenaux","id":164860,"avatar_url":"https://avatars.githubusercontent.com/u/164860?v=3","gravatar_id":"","url":"https://api.github.com/users/prenaux","html_url":"https://github.com/prenaux","followers_url":"https://api.github.com/users/prenaux/followers","following_url":"https://api.github.com/users/prenaux/following{/other_user}","gists_url":"https://api.github.com/users/prenaux/gists{/gist_id}","starred_url":"https://api.github.com/users/prenaux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prenaux/subscriptions","organizations_url":"https://api.github.com/users/prenaux/orgs","repos_url":"https://api.github.com/users/prenaux/repos","events_url":"https://api.github.com/users/prenaux/events{/privacy}","received_events_url":"https://api.github.com/users/prenaux/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/prenaux/css-layout","description":"Reimplementation of CSS layout using pure JavaScript","fork":true,"url":"https://api.github.com/repos/prenaux/css-layout","forks_url":"https://api.github.com/repos/prenaux/css-layout/forks","keys_url":"https://api.github.com/repos/prenaux/css-layout/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prenaux/css-layout/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prenaux/css-layout/teams","hooks_url":"https://api.github.com/repos/prenaux/css-layout/hooks","issue_events_url":"https://api.github.com/repos/prenaux/css-layout/issues/events{/number}","events_url":"https://api.github.com/repos/prenaux/css-layout/events","assignees_url":"https://api.github.com/repos/prenaux/css-layout/assignees{/user}","branches_url":"https://api.github.com/repos/prenaux/css-layout/branches{/branch}","tags_url":"https://api.github.com/repos/prenaux/css-layout/tags","blobs_url":"https://api.github.com/repos/prenaux/css-layout/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prenaux/css-layout/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prenaux/css-layout/git/refs{/sha}","trees_url":"https://api.github.com/repos/prenaux/css-layout/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prenaux/css-layout/statuses/{sha}","languages_url":"https://api.github.com/repos/prenaux/css-layout/languages","stargazers_url":"https://api.github.com/repos/prenaux/css-layout/stargazers","contributors_url":"https://api.github.com/repos/prenaux/css-layout/contributors","subscribers_url":"https://api.github.com/repos/prenaux/css-layout/subscribers","subscription_url":"https://api.github.com/repos/prenaux/css-layout/subscription","commits_url":"https://api.github.com/repos/prenaux/css-layout/commits{/sha}","git_commits_url":"https://api.github.com/repos/prenaux/css-layout/git/commits{/sha}","comments_url":"https://api.github.com/repos/prenaux/css-layout/comments{/number}","issue_comment_url":"https://api.github.com/repos/prenaux/css-layout/issues/comments{/number}","contents_url":"https://api.github.com/repos/prenaux/css-layout/contents/{+path}","compare_url":"https://api.github.com/repos/prenaux/css-layout/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prenaux/css-layout/merges","archive_url":"https://api.github.com/repos/prenaux/css-layout/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prenaux/css-layout/downloads","issues_url":"https://api.github.com/repos/prenaux/css-layout/issues{/number}","pulls_url":"https://api.github.com/repos/prenaux/css-layout/pulls{/number}","milestones_url":"https://api.github.com/repos/prenaux/css-layout/milestones{/number}","notifications_url":"https://api.github.com/repos/prenaux/css-layout/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prenaux/css-layout/labels{/name}","releases_url":"https://api.github.com/repos/prenaux/css-layout/releases{/id}","created_at":"2015-05-05T07:11:46Z","updated_at":"2015-05-08T07:18:48Z","pushed_at":"2015-05-08T07:18:48Z","git_url":"git://github.com/prenaux/css-layout.git","ssh_url":"git@github.com:prenaux/css-layout.git","clone_url":"https://github.com/prenaux/css-layout.git","svn_url":"https://github.com/prenaux/css-layout","homepage":null,"size":1190,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"3203e86155c71b9897b8534be0b5aa63f7b59d92","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":18503721,"name":"css-layout","full_name":"facebook/css-layout","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/css-layout","description":"Reimplementation of CSS layout using pure JavaScript","fork":false,"url":"https://api.github.com/repos/facebook/css-layout","forks_url":"https://api.github.com/repos/facebook/css-layout/forks","keys_url":"https://api.github.com/repos/facebook/css-layout/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/css-layout/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/css-layout/teams","hooks_url":"https://api.github.com/repos/facebook/css-layout/hooks","issue_events_url":"https://api.github.com/repos/facebook/css-layout/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/css-layout/events","assignees_url":"https://api.github.com/repos/facebook/css-layout/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/css-layout/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/css-layout/tags","blobs_url":"https://api.github.com/repos/facebook/css-layout/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/css-layout/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/css-layout/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/css-layout/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/css-layout/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/css-layout/languages","stargazers_url":"https://api.github.com/repos/facebook/css-layout/stargazers","contributors_url":"https://api.github.com/repos/facebook/css-layout/contributors","subscribers_url":"https://api.github.com/repos/facebook/css-layout/subscribers","subscription_url":"https://api.github.com/repos/facebook/css-layout/subscription","commits_url":"https://api.github.com/repos/facebook/css-layout/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/css-layout/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/css-layout/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/css-layout/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/css-layout/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/css-layout/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/css-layout/merges","archive_url":"https://api.github.com/repos/facebook/css-layout/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/css-layout/downloads","issues_url":"https://api.github.com/repos/facebook/css-layout/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/css-layout/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/css-layout/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/css-layout/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/css-layout/labels{/name}","releases_url":"https://api.github.com/repos/facebook/css-layout/releases{/id}","created_at":"2014-04-07T01:37:37Z","updated_at":"2015-05-08T15:41:28Z","pushed_at":"2015-05-08T09:30:44Z","git_url":"git://github.com/facebook/css-layout.git","ssh_url":"git@github.com:facebook/css-layout.git","clone_url":"https://github.com/facebook/css-layout.git","svn_url":"https://github.com/facebook/css-layout","homepage":null,"size":3102,"stargazers_count":2384,"watchers_count":2384,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":94,"mirror_url":null,"open_issues_count":13,"forks":94,"open_issues":13,"watchers":2384,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/css-layout/pulls/79"},"html":{"href":"https://github.com/facebook/css-layout/pull/79"},"issue":{"href":"https://api.github.com/repos/facebook/css-layout/issues/79"},"comments":{"href":"https://api.github.com/repos/facebook/css-layout/issues/79/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/css-layout/pulls/79/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/css-layout/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/css-layout/pulls/79/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/css-layout/statuses/b1a68ef6e04f56231766c7da6cc6c1435303e962"}}}}