Commit fcd25fc0 authored by sczs's avatar sczs Committed by Commit Bot

[ios] Bookmarks TableVC uses dynamic row height.

This CL changes BookmarksTableVC so it uses dynamic row height.

It also updates some EG tests that started to fail once this change
was made. I suspect this has to do with internal TableView management
of cells when using dynamic height.

The BottomCell test cell was moved to the penultimate position since
we now snap at the top of the top cells instead
of using the offset value of the TableView. This meant that the top
cell was completely visible when re-creating the cache and the
"Bottom Cell" was partially hidden.



Bug: 869671
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: I3f02b580332161b3bd30b3df1cb7da0c782edabb
Reviewed-on: https://chromium-review.googlesource.com/1205806Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#589073}
parent 5e9f8064
...@@ -473,6 +473,7 @@ const CGFloat kShadowRadius = 12.0f; ...@@ -473,6 +473,7 @@ const CGFloat kShadowRadius = 12.0f;
// Configure the table view. // Configure the table view.
self.sharedState.tableView.accessibilityIdentifier = @"bookmarksTableView"; self.sharedState.tableView.accessibilityIdentifier = @"bookmarksTableView";
self.sharedState.tableView.estimatedRowHeight = kEstimatedRowHeight; self.sharedState.tableView.estimatedRowHeight = kEstimatedRowHeight;
self.sharedState.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.sectionHeaderHeight = 0; self.tableView.sectionHeaderHeight = 0;
// Setting a sectionFooterHeight of 0 will be the same as not having a // Setting a sectionFooterHeight of 0 will be the same as not having a
// footerView, which shows a cell separator for the last cell. Removing this // footerView, which shows a cell separator for the last cell. Removing this
...@@ -1885,16 +1886,6 @@ const CGFloat kShadowRadius = 12.0f; ...@@ -1885,16 +1886,6 @@ const CGFloat kShadowRadius = 12.0f;
#pragma mark - UITableViewDelegate #pragma mark - UITableViewDelegate
- (CGFloat)tableView:(UITableView*)tableView
heightForRowAtIndexPath:(NSIndexPath*)indexPath {
NSInteger sectionIdentifier = [self.sharedState.tableViewModel
sectionIdentifierForSection:indexPath.section];
if (sectionIdentifier == BookmarkHomeSectionIdentifierBookmarks) {
return kEstimatedRowHeight;
}
return UITableViewAutomaticDimension;
}
- (void)tableView:(UITableView*)tableView - (void)tableView:(UITableView*)tableView
didSelectRowAtIndexPath:(NSIndexPath*)indexPath { didSelectRowAtIndexPath:(NSIndexPath*)indexPath {
NSInteger sectionIdentifier = [self.sharedState.tableViewModel NSInteger sectionIdentifier = [self.sharedState.tableViewModel
......
...@@ -885,7 +885,8 @@ id<GREYMatcher> TappableBookmarkNodeWithLabel(NSString* label) { ...@@ -885,7 +885,8 @@ id<GREYMatcher> TappableBookmarkNodeWithLabel(NSString* label) {
// Ensure the Bottom 1 of Folder 1 is visible. That means both folder and // Ensure the Bottom 1 of Folder 1 is visible. That means both folder and
// scroll position are restored successfully. // scroll position are restored successfully.
[[EarlGrey selectElementWithMatcher:grey_accessibilityID(@"Bottom 1")] [[EarlGrey
selectElementWithMatcher:grey_accessibilityLabel(@"Bottom 1, 127.0.0.1")]
assertWithMatcher:grey_sufficientlyVisible()]; assertWithMatcher:grey_sufficientlyVisible()];
} }
...@@ -1088,6 +1089,8 @@ id<GREYMatcher> TappableBookmarkNodeWithLabel(NSString* label) { ...@@ -1088,6 +1089,8 @@ id<GREYMatcher> TappableBookmarkNodeWithLabel(NSString* label) {
base::SysNSStringToUTF16(@"Top URL"), dummyURL); base::SysNSStringToUTF16(@"Top URL"), dummyURL);
// Add URLs to Folder 1. // Add URLs to Folder 1.
bookmark_model->AddURL(folder1, 0, base::SysNSStringToUTF16(dummyTitle),
dummyURL);
bookmark_model->AddURL(folder1, 0, base::SysNSStringToUTF16(@"Bottom 1"), bookmark_model->AddURL(folder1, 0, base::SysNSStringToUTF16(@"Bottom 1"),
dummyURL); dummyURL);
for (int i = 0; i < 20; i++) { for (int i = 0; i < 20; i++) {
...@@ -1603,7 +1606,7 @@ id<GREYMatcher> TappableBookmarkNodeWithLabel(NSString* label) { ...@@ -1603,7 +1606,7 @@ id<GREYMatcher> TappableBookmarkNodeWithLabel(NSString* label) {
// verify the editable textfield is gone. // verify the editable textfield is gone.
[[EarlGrey [[EarlGrey
selectElementWithMatcher:grey_accessibilityID(@"bookmark_editing_text")] selectElementWithMatcher:grey_accessibilityID(@"bookmark_editing_text")]
assertWithMatcher:grey_nil()]; assertWithMatcher:grey_notVisible()];
} }
+ (void)tapOnContextMenuButton:(int)menuButtonId + (void)tapOnContextMenuButton:(int)menuButtonId
......
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