     }()
 
     private lazy var cancelComparisonButton = UIBarButtonItem(title: CommonStrings.cancelActionTitle, style: .done, target: self, action: #selector(cancelComparison(_:)))
+
+    private var comparisonSelectionViewHeightConstraint: NSLayoutConstraint?
+    private var comparisonSelectionViewVisibleConstraint: NSLayoutConstraint?
+    private var comparisonSelectionViewHiddenConstraint: NSLayoutConstraint?
+
+    private func setupComparisonSelectionViewController() {
+        addChild(comparisonSelectionViewController)
+        comparisonSelectionViewController.view.translatesAutoresizingMaskIntoConstraints = false
+        view.addSubview(comparisonSelectionViewController.view)
+        comparisonSelectionViewController.didMove(toParent: self)
+        comparisonSelectionViewVisibleConstraint = view.bottomAnchor.constraint(equalTo: comparisonSelectionViewController.view.bottomAnchor)
+        comparisonSelectionViewHiddenConstraint = view.bottomAnchor.constraint(equalTo: comparisonSelectionViewController.view.topAnchor)
+
+        let leadingConstraint = view.leadingAnchor.constraint(equalTo: comparisonSelectionViewController.view.leadingAnchor)
+        let trailingConstraint = view.trailingAnchor.constraint(equalTo: comparisonSelectionViewController.view.trailingAnchor)
+
+        NSLayoutConstraint.activate([comparisonSelectionViewHiddenConstraint!, leadingConstraint, trailingConstraint])
+    }
+
+    private func setComparisonSelectionViewHidden(_ hidden: Bool, animated: Bool) {
+        let changes = {
+            if hidden {
+                self.comparisonSelectionViewVisibleConstraint?.isActive = false
+                self.comparisonSelectionViewHiddenConstraint?.isActive = true
+            } else {
+                self.comparisonSelectionViewHiddenConstraint?.isActive = false
+                self.comparisonSelectionViewVisibleConstraint?.isActive = true
+            }
+            self.view.layoutIfNeeded()
+        }
+        if animated {
+            UIView.animate(withDuration: 0.3, animations: changes)
+        } else {
+            changes()
+        }
+    }
 
     override func viewDidLoad() {
         super.viewDidLoad()

    }
    private var indexPathsSelectedForComparison = Set<IndexPath>()

    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        
        if state == .editing {
            selectedCellsCount += 1

            defer {
                compareToolbarButton.isEnabled = maxNumberOfRevisionsSelected
            }

            guard let cell = collectionView.cellForItem(at: indexPath) as? PageHistoryCollectionViewCell else {
                return
            }

            let button: UIButton?
            let themeModel: SelectionThemeModel?
            if maxNumberOfRevisionsSelected {
                assert(indexPathsSelectedForComparisonGroupedByButtonTags.count == 1)
                if let previouslySelectedIndexPath = indexPathsSelectedForComparisonGroupedByButtonTags.first?.value, let previouslySelectedCell = collectionView.cellForItem(at: previouslySelectedIndexPath) as?  PageHistoryCollectionViewCell {
                    if previouslySelectedIndexPath > indexPath, previouslySelectedCell.selectionIndex == 0 {
                        updateComparisonButton(secondComparisonSelectionButton, with: secondSelectionThemeModel, cell: previouslySelectedCell)
                        indexPathsSelectedForComparisonGroupedByButtonTags[secondComparisonSelectionButton.tag] = previouslySelectedIndexPath
                        updateSelectionIndex(openSelectionIndex, for: previouslySelectedCell, at: previouslySelectedIndexPath)
                        updateSelectionThemeModel(secondSelectionThemeModel, for: previouslySelectedCell, at: previouslySelectedIndexPath)
                        openSelectionIndex = 0
                    } else if previouslySelectedIndexPath < indexPath, previouslySelectedCell.selectionIndex == 1 {
                        updateComparisonButton(firstComparisonSelectionButton, with: firstSelectionThemeModel, cell: previouslySelectedCell)
                        indexPathsSelectedForComparisonGroupedByButtonTags[firstComparisonSelectionButton.tag] = previouslySelectedIndexPath
                        updateSelectionIndex(openSelectionIndex, for: previouslySelectedCell, at: previouslySelectedIndexPath)
                        updateSelectionThemeModel(firstSelectionThemeModel, for: previouslySelectedCell, at: previouslySelectedIndexPath)
                        openSelectionIndex = 1

        }
    }

    private var comparisonSelectionButtonWidthConstraints = [NSLayoutConstraint]()

    @objc private func compare(_ sender: UIBarButtonItem) {
        state = .editing
