Commit 893f49ab authored by sczs's avatar sczs Committed by Commit Bot

[ios] RecentTabsVC uses heightForHeaderInSection instead of estimatedHeight

This fixes an issue where the section header was being duplicated on collapse/expand.

Whenever we collapse and expand a section on iOS10, a sectionHeaderFooterView is added
on top of the existing one. This causes the sectionHeaderViews to stack on top of each
other leading to bad UI and test failure.

More info on the bug link.

BUG = 850814

Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I743d4dff1c81d389f3313fda4d0c92a202fb4b5e
Reviewed-on: https://chromium-review.googlesource.com/1092233
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#565665}
parent 2b8fd19b
......@@ -90,6 +90,10 @@ const CGFloat kSeparationSpaceBetweenSections = 9;
// The UI displays relative time for up to this number of hours and then
// switches to absolute values.
const int kRelativeTimeMaxHours = 4;
// Height for single line headers.
const CGFloat kSingleLineSectionHeaderHeight = 44;
// Height for double line headers.
const CGFloat kDoubleLineSectionHeaderHeight = 56;
} // namespace
......@@ -164,7 +168,6 @@ const int kRelativeTimeMaxHours = 4;
[self.tableView setDelegate:self];
self.tableView.estimatedRowHeight = kEstimatedRowHeight;
self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedSectionHeaderHeight = kEstimatedRowHeight;
self.tableView.sectionFooterHeight = 0.0;
// Gesture recognizer for long press context menu on Session Headers.
UILongPressGestureRecognizer* longPress =
......@@ -620,6 +623,23 @@ const int kRelativeTimeMaxHours = 4;
}
}
// TODO(crbug.com/850814): Use estimatedSectionHeaderHeight once we stop
// supporting iOS10.
- (CGFloat)tableView:(UITableView*)tableView
heightForHeaderInSection:(NSInteger)section {
DCHECK_EQ(tableView, self.tableView);
NSInteger sectionIdentifier =
[self.tableViewModel sectionIdentifierForSection:section];
switch (sectionIdentifier) {
case SectionIdentifierRecentlyClosedTabs:
case SectionIdentifierOtherDevices:
return kSingleLineSectionHeaderHeight;
default:
// All remote session sections.
return kDoubleLineSectionHeaderHeight;
}
}
- (CGFloat)tableView:(UITableView*)tableView
heightForFooterInSection:(NSInteger)section {
// If section is collapsed there's no need to add a separation space.
......
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