Commit 12234dec authored by David Jean's avatar David Jean Committed by Commit Bot

[ios] Fixed history/bookmarks scrim issues

- Resize on rotation.
- Disable scrolling of table when active.

Bug: 889012,889506, 889461
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: I54d4f41d31a0fb3ec7e248a3cb25bb985e58cf72
Reviewed-on: https://chromium-review.googlesource.com/1249483
Commit-Queue: David Jean <djean@chromium.org>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595750}
parent 7e6c79b3
......@@ -382,13 +382,11 @@ std::vector<GURL> GetUrlsToOpen(const std::vector<const BookmarkNode*>& nodes) {
// SearchController is active will fail.
self.definesPresentationContext = YES;
self.scrimView = [[UIControl alloc] initWithFrame:self.tableView.bounds];
self.scrimView = [[UIControl alloc] init];
self.scrimView.backgroundColor =
[UIColor colorWithWhite:0
alpha:kTableViewNavigationWhiteAlphaForSearchScrim];
self.scrimView.translatesAutoresizingMaskIntoConstraints = NO;
self.scrimView.autoresizingMask =
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.scrimView.accessibilityIdentifier = kBookmarkHomeSearchScrimIdentifier;
[self.scrimView addTarget:self
action:@selector(dismissSearchController:)
......@@ -946,7 +944,7 @@ std::vector<GURL> GetUrlsToOpen(const std::vector<const BookmarkNode*>& nodes) {
// Early return if the controller has been deallocated.
if (!strongSelf)
return;
[UIView animateWithDuration:kTableViewNavigationScrimFadeDuration
[UIView animateWithDuration:0.2f
animations:^{
strongSelf.spinnerView.alpha = 0.0;
}
......@@ -1291,14 +1289,15 @@ std::vector<GURL> GetUrlsToOpen(const std::vector<const BookmarkNode*>& nodes) {
- (void)showScrim {
self.navigationController.toolbarHidden = YES;
self.scrimView.alpha = 0.0f;
CGSize contentSize = self.tableView.contentSize;
self.scrimView.frame =
CGRectMake(0.0f, 0.0f, contentSize.width,
std::max(contentSize.height, self.view.bounds.size.height));
[self.tableView addSubview:self.scrimView];
// We attach our constraints to the superview because the tableView is
// a scrollView and it seems that we get an empty frame when attaching to it.
AddSameConstraints(self.scrimView, self.view.superview);
self.tableView.scrollEnabled = NO;
[UIView animateWithDuration:kTableViewNavigationScrimFadeDuration
animations:^{
self.scrimView.alpha = 1.0f;
[self.view layoutIfNeeded];
}];
}
......@@ -1310,6 +1309,7 @@ std::vector<GURL> GetUrlsToOpen(const std::vector<const BookmarkNode*>& nodes) {
}
completion:^(BOOL finished) {
[self.scrimView removeFromSuperview];
self.tableView.scrollEnabled = YES;
}];
[self setupContextBar];
}
......
......@@ -37,6 +37,7 @@
#import "ios/chrome/browser/ui/util/pasteboard_util.h"
#import "ios/chrome/browser/ui/util/top_view_controller.h"
#import "ios/chrome/common/favicon/favicon_view.h"
#import "ios/chrome/common/ui_util/constraints_ui_util.h"
#include "ios/chrome/grit/ios_strings.h"
#import "ios/web/public/navigation_manager.h"
#import "ios/web/public/referrer.h"
......@@ -231,14 +232,12 @@ const CGFloat kButtonHorizontalPadding = 30.0;
// SearchController is active will fail.
self.definesPresentationContext = YES;
self.scrimView = [[UIControl alloc] initWithFrame:self.tableView.bounds];
self.scrimView = [[UIControl alloc] init];
self.scrimView.alpha = 0.0f;
self.scrimView.backgroundColor =
[UIColor colorWithWhite:0
alpha:kTableViewNavigationWhiteAlphaForSearchScrim];
self.scrimView.translatesAutoresizingMaskIntoConstraints = NO;
self.scrimView.autoresizingMask =
UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.scrimView.accessibilityIdentifier = kHistorySearchScrimIdentifier;
[self.scrimView addTarget:self
action:@selector(dismissSearchController:)
......@@ -918,14 +917,16 @@ const CGFloat kButtonHorizontalPadding = 30.0;
if (self.scrimView.alpha < 1.0f) {
self.navigationController.toolbarHidden = YES;
self.scrimView.alpha = 0.0f;
CGSize contentSize = self.tableView.contentSize;
self.scrimView.frame =
CGRectMake(0.0f, 0.0f, contentSize.width,
std::max(contentSize.height, self.view.bounds.size.height));
[self.tableView addSubview:self.scrimView];
// We attach our constraints to the superview because the tableView is
// a scrollView and it seems that we get an empty frame when attaching to
// it.
AddSameConstraints(self.scrimView, self.view.superview);
self.tableView.scrollEnabled = NO;
[UIView animateWithDuration:kTableViewNavigationScrimFadeDuration
animations:^{
self.scrimView.alpha = 1.0f;
[self.view layoutIfNeeded];
}];
}
}
......@@ -940,6 +941,7 @@ const CGFloat kButtonHorizontalPadding = 30.0;
}
completion:^(BOOL finished) {
[self.scrimView removeFromSuperview];
self.tableView.scrollEnabled = YES;
}];
}
}
......
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