Commit 1c9849d4 authored by Roberto Moura's avatar Roberto Moura Committed by Commit Bot

Change Tab Grid's bottom inset when Thumb Strip is enabled.

Move kBVCHeightTabGrid (height of the BVC that remains visible when the
tab grid is visible) to the grid constants file.

Correct the Thumb Strip Layout top section inset value that was wrong.
Increase the Grid Layout bottom section inset to account for the BVC on
the bottom of the screen.
Correct the Tab Grid's bottom content inset by increasing it by the same
amount that the top content inset was decreased.

Bug: 1127604
Change-Id: I843d74f7ade7272f032211162a0bca9054602dc4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2479467
Commit-Queue: Gauthier Ambard <gambard@chromium.org>
Auto-Submit: Roberto Moura <mouraroberto@google.com>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#818423}
parent 758e8497
......@@ -24,6 +24,10 @@ extern NSString* const kGridBackgroundColor;
extern NSString* const kPlusSignCellBackgroundColor;
extern NSString* const kPlusSignCellBackgroundDarkColor;
// The height of the BVC that remains visible after transitioning from thumb
// strip to tab grid.
extern const CGFloat kBVCHeightTabGrid;
// GridLayout.
// Extra-small screens require a slightly different layout configuration (e.g.,
// margins) even though they may be categorized into the same size class as
......
......@@ -24,6 +24,10 @@ NSString* const kPlusSignCellBackgroundColor =
NSString* const kPlusSignCellBackgroundDarkColor =
@"plus_sign_grid_cell_background_dark_color";
// The height of the BVC that remains visible after transitioning from thumb
// strip to tab grid.
const CGFloat kBVCHeightTabGrid = 108.0f;
// Definition of limited width for applicable size classes. The first refers to
// the horizontal size class; the second to the vertical.
const CGFloat kGridLayoutCompactCompactLimitedWidth = 666.0f;
......
......@@ -6,6 +6,7 @@
#import "ios/chrome/browser/ui/tab_grid/grid/grid_constants.h"
#import "ios/chrome/browser/ui/tab_grid/grid/reordering_layout_util.h"
#import "ios/chrome/browser/ui/thumb_strip/thumb_strip_feature.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
......@@ -63,6 +64,13 @@
self.sectionInset = kGridLayoutInsetsRegularRegular;
self.minimumLineSpacing = kGridLayoutLineSpacingRegularRegular;
}
if (IsThumbStripEnabled()) {
// When the thumb strip feature is enabled, increase the bottom inset to
// account for the bvc on the bottom of the screen.
UIEdgeInsets sectionInset = self.sectionInset;
sectionInset.bottom += kBVCHeightTabGrid;
self.sectionInset = sectionInset;
}
}
@end
......
......@@ -30,7 +30,7 @@
self.itemSize = kGridCellSizeSmall;
CGFloat height = CGRectGetHeight(self.collectionView.bounds);
CGFloat spacing = kGridLayoutLineSpacingCompactCompactLimitedWidth;
CGFloat topInset = spacing - kGridCellSelectionRingGapWidth -
CGFloat topInset = spacing + kGridCellSelectionRingGapWidth +
kGridCellSelectionRingTintWidth;
self.sectionInset = UIEdgeInsets{
topInset, spacing, height - self.itemSize.height - 2 * topInset, spacing};
......
......@@ -547,6 +547,9 @@ NSUInteger GetPageIndexFromPage(TabGridPage page) {
CGFloat bottomInset = self.configuration == TabGridConfigurationBottomToolbar
? self.bottomToolbar.intrinsicContentSize.height
: 0;
if (IsThumbStripEnabled()) {
bottomInset += self.topToolbar.intrinsicContentSize.height;
}
CGFloat topInset =
IsThumbStripEnabled() ? 0 : self.topToolbar.intrinsicContentSize.height;
UIEdgeInsets inset = UIEdgeInsetsMake(topInset, 0, bottomInset, 0);
......
......@@ -14,6 +14,7 @@ source_set("thumb_strip") {
"//base",
"//ios/chrome/browser/ui/coordinators:chrome_coordinators",
"//ios/chrome/browser/ui/gestures",
"//ios/chrome/browser/ui/tab_grid/grid:grid_ui_constants",
]
configs += [ "//build/config/compiler:enable_arc" ]
}
......
......@@ -5,6 +5,7 @@
#import "ios/chrome/browser/ui/thumb_strip/thumb_strip_coordinator.h"
#import "ios/chrome/browser/ui/gestures/view_revealing_vertical_pan_handler.h"
#import "ios/chrome/browser/ui/tab_grid/grid/grid_constants.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
......@@ -14,11 +15,6 @@ namespace {
// Height of the view that is revealed. The thumb strip has a height equal to a
// small grid cell + edge insets (top and bottm) from thumb strip layout.
const CGFloat kThumbStripHeight = 168.0f + 22.0f + 22.0f;
// The height of the BVC that remains visible after transitioning from thumb
// strip to tab grid.
// TODO(crbug.com/1123048): Change this hardcoded number into a value calculated
// by the runtime toolbar height and any other inputs.
const CGFloat kBVCHeightTabGrid = 108.0f;
} // namespace
@interface ThumbStripCoordinator () <ViewRevealingVerticalPanHandlerDelegate>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment