{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla/firefox-ios/pulls/comments/34459771","id":34459771,"diff_hunk":"@@ -36,47 +46,101 @@ class ThumbnailCell: UICollectionViewCell {\n         return UILongPressGestureRecognizer(target: self, action: \"SELdidLongPress\")\n     }()\n \n-    let textLabel = UILabel()\n-    let imageView = UIImageViewAligned()\n-    let imageWrapper = UIView()\n-    let removeButton = UIButton()\n+    lazy var textWrapper: UIView = {\n+        let wrapper = UIView()\n+        wrapper.backgroundColor = ThumbnailCellUX.LabelBackgroundColor\n+        return wrapper\n+    }()\n \n-    override init(frame: CGRect) {\n-        imagePadding = CGFloat(0)\n-        super.init(frame: frame)\n+    lazy var textLabel: UILabel = {\n+        let textLabel = UILabel()\n+        textLabel.setContentHuggingPriority(1000, forAxis: UILayoutConstraintAxis.Vertical)\n+        textLabel.font = ThumbnailCellUX.LabelFont\n+        textLabel.textColor = ThumbnailCellUX.LabelColor\n+        textLabel.textAlignment = ThumbnailCellUX.LabelAlignment\n+        return textLabel\n+    }()\n \n-        addGestureRecognizer(longPressGesture)\n+    lazy var imageView: UIImageView = {\n+        let imageView = UIImageView()\n+        imageView.contentMode = UIViewContentMode.ScaleAspectFit\n \n-        contentView.addSubview(textLabel)\n-        contentView.addSubview(imageWrapper)\n-        imageWrapper.addSubview(imageView)\n-        contentView.addSubview(removeButton)\n+        imageView.clipsToBounds = true\n+        imageView.layer.cornerRadius = ThumbnailCellUX.CornerRadius\n+        return imageView\n+    }()\n \n+    lazy var backgroundImage: UIImageView = {\n+        let backgroundImage = UIImageView()\n+        backgroundImage.contentMode = UIViewContentMode.ScaleAspectFill\n+        return backgroundImage\n+    }()\n+\n+    lazy var backgroundEffect: UIVisualEffectView = {\n+        let blur = UIBlurEffect(style: UIBlurEffectStyle.Light)\n+        let vib = UIVibrancyEffect(forBlurEffect: blur)\n+        return UIVisualEffectView(effect: blur)\n+    }()\n+\n+    lazy var imageWrapper: UIView = {\n+        let imageWrapper = UIView()\n         imageWrapper.layer.borderColor = ThumbnailCellUX.BorderColor.CGColor\n-        imageWrapper.layer.borderWidth = 1\n-        imageWrapper.layer.cornerRadius = 3\n+        imageWrapper.layer.borderWidth = ThumbnailCellUX.BorderWidth\n+        imageWrapper.layer.cornerRadius = ThumbnailCellUX.CornerRadius\n         imageWrapper.clipsToBounds = true\n+        return imageWrapper\n+    } ()\n \n+    lazy var removeButton: UIButton = {\n+        let removeButton = UIButton()\n         removeButton.setImage(UIImage(named: \"TileCloseButton\"), forState: UIControlState.Normal)\n         removeButton.addTarget(self, action: \"SELdidRemove\", forControlEvents: UIControlEvents.TouchUpInside)\n         removeButton.hidden = true\n         removeButton.imageEdgeInsets = ThumbnailCellUX.RemoveButtonInsets\n+        return removeButton\n+    } ()\n+\n+    override init(frame: CGRect) {\n+        imagePadding = CGFloat(0)\n+        super.init(frame: frame)\n+\n+        isAccessibilityElement = true\n+        addGestureRecognizer(longPressGesture)\n+\n+        contentView.addSubview(imageWrapper)\n+        imageWrapper.addSubview(backgroundImage)\n+        imageWrapper.addSubview(backgroundEffect)\n+        imageWrapper.addSubview(imageView)\n+        imageWrapper.addSubview(textWrapper)\n+        textWrapper.addSubview(textLabel)\n+        contentView.addSubview(removeButton)\n \n         imageWrapper.snp_remakeConstraints({ make in\n-            make.top.left.right.equalTo(self.contentView).insets(ThumbnailCellUX.Insets)\n-            make.width.equalTo(self.imageWrapper.snp_height).multipliedBy(ThumbnailCellUX.ImageAspectRatio)\n+            make.top.bottom.left.right.equalTo(self.contentView).insets(ThumbnailCellUX.Insets)\n         })\n \n-        imageView.snp_remakeConstraints({ make in\n+        backgroundImage.snp_remakeConstraints({ make in\n             make.top.bottom.left.right.equalTo(self.imageWrapper)\n         })\n \n-        textLabel.setContentHuggingPriority(1000, forAxis: UILayoutConstraintAxis.Vertical)\n-        textLabel.font = ThumbnailCellUX.LabelFont\n-        textLabel.textColor = ThumbnailCellUX.LabelColor\n+        backgroundEffect.snp_remakeConstraints({ make in\n+            make.top.bottom.left.right.equalTo(self.imageWrapper)\n+        })\n+\n+        imageView.snp_remakeConstraints({ make in\n+            let imagePadding: CGFloat = (UIScreen.mainScreen().traitCollection.horizontalSizeClass == .Compact) ? ThumbnailCellUX.ImagePaddingCompact : ThumbnailCellUX.ImagePadding\n+            let insets = UIEdgeInsetsMake(imagePadding, imagePadding, imagePadding, imagePadding)\n+            make.top.left.right.equalTo(self.imageWrapper).insets(insets)\n+            make.bottom.equalTo(textWrapper.snp_top).offset(-imagePadding) // .insets(insets)\n+        })\n+\n+        textWrapper.snp_remakeConstraints({ make in","path":"Client/Frontend/Widgets/ThumbnailCell.swift","position":145,"original_position":145,"commit_id":"82c505a0c68d1cd1852b923fb042a7ef6af051e8","original_commit_id":"82c505a0c68d1cd1852b923fb042a7ef6af051e8","user":{"login":"sleroux","id":434322,"avatar_url":"https://avatars.githubusercontent.com/u/434322?v=3","gravatar_id":"","url":"https://api.github.com/users/sleroux","html_url":"https://github.com/sleroux","followers_url":"https://api.github.com/users/sleroux/followers","following_url":"https://api.github.com/users/sleroux/following{/other_user}","gists_url":"https://api.github.com/users/sleroux/gists{/gist_id}","starred_url":"https://api.github.com/users/sleroux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sleroux/subscriptions","organizations_url":"https://api.github.com/users/sleroux/orgs","repos_url":"https://api.github.com/users/sleroux/repos","events_url":"https://api.github.com/users/sleroux/events{/privacy}","received_events_url":"https://api.github.com/users/sleroux/received_events","type":"User","site_admin":false},"body":"Nit: Instead of using snp_remakeConstraints, you can call snp_makeConstraints since you're not remaking them at this point","created_at":"2015-07-13T12:59:19Z","updated_at":"2015-07-13T12:59:19Z","html_url":"https://github.com/mozilla/firefox-ios/pull/677#discussion_r34459771","pull_request_url":"https://api.github.com/repos/mozilla/firefox-ios/pulls/677","_links":{"self":{"href":"https://api.github.com/repos/mozilla/firefox-ios/pulls/comments/34459771"},"html":{"href":"https://github.com/mozilla/firefox-ios/pull/677#discussion_r34459771"},"pull_request":{"href":"https://api.github.com/repos/mozilla/firefox-ios/pulls/677"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla/firefox-ios/pulls/677","id":39309405,"html_url":"https://github.com/mozilla/firefox-ios/pull/677","diff_url":"https://github.com/mozilla/firefox-ios/pull/677.diff","patch_url":"https://github.com/mozilla/firefox-ios/pull/677.patch","issue_url":"https://api.github.com/repos/mozilla/firefox-ios/issues/677","number":677,"state":"open","locked":false,"title":"Bug 1169379 - Use favicons for top sites tiles","user":{"login":"wesj","id":1117644,"avatar_url":"https://avatars.githubusercontent.com/u/1117644?v=3","gravatar_id":"","url":"https://api.github.com/users/wesj","html_url":"https://github.com/wesj","followers_url":"https://api.github.com/users/wesj/followers","following_url":"https://api.github.com/users/wesj/following{/other_user}","gists_url":"https://api.github.com/users/wesj/gists{/gist_id}","starred_url":"https://api.github.com/users/wesj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wesj/subscriptions","organizations_url":"https://api.github.com/users/wesj/orgs","repos_url":"https://api.github.com/users/wesj/repos","events_url":"https://api.github.com/users/wesj/events{/privacy}","received_events_url":"https://api.github.com/users/wesj/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-06T20:51:35Z","updated_at":"2015-07-13T12:59:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fe8598bfdeef27927e7712ea8b345841fbe6b7d1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mozilla/firefox-ios/pulls/677/commits","review_comments_url":"https://api.github.com/repos/mozilla/firefox-ios/pulls/677/comments","review_comment_url":"https://api.github.com/repos/mozilla/firefox-ios/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla/firefox-ios/issues/677/comments","statuses_url":"https://api.github.com/repos/mozilla/firefox-ios/statuses/82c505a0c68d1cd1852b923fb042a7ef6af051e8","head":{"label":"wesj:paletteTiles","ref":"paletteTiles","sha":"82c505a0c68d1cd1852b923fb042a7ef6af051e8","user":{"login":"wesj","id":1117644,"avatar_url":"https://avatars.githubusercontent.com/u/1117644?v=3","gravatar_id":"","url":"https://api.github.com/users/wesj","html_url":"https://github.com/wesj","followers_url":"https://api.github.com/users/wesj/followers","following_url":"https://api.github.com/users/wesj/following{/other_user}","gists_url":"https://api.github.com/users/wesj/gists{/gist_id}","starred_url":"https://api.github.com/users/wesj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wesj/subscriptions","organizations_url":"https://api.github.com/users/wesj/orgs","repos_url":"https://api.github.com/users/wesj/repos","events_url":"https://api.github.com/users/wesj/events{/privacy}","received_events_url":"https://api.github.com/users/wesj/received_events","type":"User","site_admin":false},"repo":{"id":27951196,"name":"firefox-ios-1","full_name":"wesj/firefox-ios-1","owner":{"login":"wesj","id":1117644,"avatar_url":"https://avatars.githubusercontent.com/u/1117644?v=3","gravatar_id":"","url":"https://api.github.com/users/wesj","html_url":"https://github.com/wesj","followers_url":"https://api.github.com/users/wesj/followers","following_url":"https://api.github.com/users/wesj/following{/other_user}","gists_url":"https://api.github.com/users/wesj/gists{/gist_id}","starred_url":"https://api.github.com/users/wesj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wesj/subscriptions","organizations_url":"https://api.github.com/users/wesj/orgs","repos_url":"https://api.github.com/users/wesj/repos","events_url":"https://api.github.com/users/wesj/events{/privacy}","received_events_url":"https://api.github.com/users/wesj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wesj/firefox-ios-1","description":"Firefox for iOS","fork":true,"url":"https://api.github.com/repos/wesj/firefox-ios-1","forks_url":"https://api.github.com/repos/wesj/firefox-ios-1/forks","keys_url":"https://api.github.com/repos/wesj/firefox-ios-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wesj/firefox-ios-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wesj/firefox-ios-1/teams","hooks_url":"https://api.github.com/repos/wesj/firefox-ios-1/hooks","issue_events_url":"https://api.github.com/repos/wesj/firefox-ios-1/issues/events{/number}","events_url":"https://api.github.com/repos/wesj/firefox-ios-1/events","assignees_url":"https://api.github.com/repos/wesj/firefox-ios-1/assignees{/user}","branches_url":"https://api.github.com/repos/wesj/firefox-ios-1/branches{/branch}","tags_url":"https://api.github.com/repos/wesj/firefox-ios-1/tags","blobs_url":"https://api.github.com/repos/wesj/firefox-ios-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wesj/firefox-ios-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wesj/firefox-ios-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/wesj/firefox-ios-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wesj/firefox-ios-1/statuses/{sha}","languages_url":"https://api.github.com/repos/wesj/firefox-ios-1/languages","stargazers_url":"https://api.github.com/repos/wesj/firefox-ios-1/stargazers","contributors_url":"https://api.github.com/repos/wesj/firefox-ios-1/contributors","subscribers_url":"https://api.github.com/repos/wesj/firefox-ios-1/subscribers","subscription_url":"https://api.github.com/repos/wesj/firefox-ios-1/subscription","commits_url":"https://api.github.com/repos/wesj/firefox-ios-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/wesj/firefox-ios-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/wesj/firefox-ios-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/wesj/firefox-ios-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/wesj/firefox-ios-1/contents/{+path}","compare_url":"https://api.github.com/repos/wesj/firefox-ios-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wesj/firefox-ios-1/merges","archive_url":"https://api.github.com/repos/wesj/firefox-ios-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wesj/firefox-ios-1/downloads","issues_url":"https://api.github.com/repos/wesj/firefox-ios-1/issues{/number}","pulls_url":"https://api.github.com/repos/wesj/firefox-ios-1/pulls{/number}","milestones_url":"https://api.github.com/repos/wesj/firefox-ios-1/milestones{/number}","notifications_url":"https://api.github.com/repos/wesj/firefox-ios-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wesj/firefox-ios-1/labels{/name}","releases_url":"https://api.github.com/repos/wesj/firefox-ios-1/releases{/id}","created_at":"2014-12-13T05:57:28Z","updated_at":"2015-03-26T21:24:58Z","pushed_at":"2015-07-11T06:10:03Z","git_url":"git://github.com/wesj/firefox-ios-1.git","ssh_url":"git@github.com:wesj/firefox-ios-1.git","clone_url":"https://github.com/wesj/firefox-ios-1.git","svn_url":"https://github.com/wesj/firefox-ios-1","homepage":"","size":35529,"stargazers_count":1,"watchers_count":1,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"mozilla:master","ref":"master","sha":"ddea35aeb120e9b3649f92fdeedaf27bba7a3251","user":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"repo":{"id":26133979,"name":"firefox-ios","full_name":"mozilla/firefox-ios","owner":{"login":"mozilla","id":131524,"avatar_url":"https://avatars.githubusercontent.com/u/131524?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla","html_url":"https://github.com/mozilla","followers_url":"https://api.github.com/users/mozilla/followers","following_url":"https://api.github.com/users/mozilla/following{/other_user}","gists_url":"https://api.github.com/users/mozilla/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla/subscriptions","organizations_url":"https://api.github.com/users/mozilla/orgs","repos_url":"https://api.github.com/users/mozilla/repos","events_url":"https://api.github.com/users/mozilla/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla/firefox-ios","description":"Firefox for iOS","fork":false,"url":"https://api.github.com/repos/mozilla/firefox-ios","forks_url":"https://api.github.com/repos/mozilla/firefox-ios/forks","keys_url":"https://api.github.com/repos/mozilla/firefox-ios/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla/firefox-ios/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla/firefox-ios/teams","hooks_url":"https://api.github.com/repos/mozilla/firefox-ios/hooks","issue_events_url":"https://api.github.com/repos/mozilla/firefox-ios/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla/firefox-ios/events","assignees_url":"https://api.github.com/repos/mozilla/firefox-ios/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla/firefox-ios/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla/firefox-ios/tags","blobs_url":"https://api.github.com/repos/mozilla/firefox-ios/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla/firefox-ios/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla/firefox-ios/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla/firefox-ios/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla/firefox-ios/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla/firefox-ios/languages","stargazers_url":"https://api.github.com/repos/mozilla/firefox-ios/stargazers","contributors_url":"https://api.github.com/repos/mozilla/firefox-ios/contributors","subscribers_url":"https://api.github.com/repos/mozilla/firefox-ios/subscribers","subscription_url":"https://api.github.com/repos/mozilla/firefox-ios/subscription","commits_url":"https://api.github.com/repos/mozilla/firefox-ios/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla/firefox-ios/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla/firefox-ios/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla/firefox-ios/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla/firefox-ios/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla/firefox-ios/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla/firefox-ios/merges","archive_url":"https://api.github.com/repos/mozilla/firefox-ios/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla/firefox-ios/downloads","issues_url":"https://api.github.com/repos/mozilla/firefox-ios/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla/firefox-ios/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla/firefox-ios/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla/firefox-ios/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla/firefox-ios/labels{/name}","releases_url":"https://api.github.com/repos/mozilla/firefox-ios/releases{/id}","created_at":"2014-11-03T19:07:02Z","updated_at":"2015-07-13T10:40:24Z","pushed_at":"2015-07-13T12:33:09Z","git_url":"git://github.com/mozilla/firefox-ios.git","ssh_url":"git@github.com:mozilla/firefox-ios.git","clone_url":"https://github.com/mozilla/firefox-ios.git","svn_url":"https://github.com/mozilla/firefox-ios","homepage":"","size":136012,"stargazers_count":3397,"watchers_count":3397,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":570,"mirror_url":null,"open_issues_count":42,"forks":570,"open_issues":42,"watchers":3397,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla/firefox-ios/pulls/677"},"html":{"href":"https://github.com/mozilla/firefox-ios/pull/677"},"issue":{"href":"https://api.github.com/repos/mozilla/firefox-ios/issues/677"},"comments":{"href":"https://api.github.com/repos/mozilla/firefox-ios/issues/677/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla/firefox-ios/pulls/677/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla/firefox-ios/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla/firefox-ios/pulls/677/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla/firefox-ios/statuses/82c505a0c68d1cd1852b923fb042a7ef6af051e8"}}}}