[iOS][MF] Fixes the size of the popover for passwords
Reduces the estimated size of the row to the minimum, so it is correctly
calculated on |contentSize|.
Starts the view controller with a more appropiate size for the popover.
Bug: 912515
Change-Id: If7c2dc4a0ab2a6df445fdac2c5fc21453927a71c
Reviewed-on: https://chromium-review.googlesource.com/c/1371873
Commit-Queue: Javier Ernesto Flores Robles <javierrobles@chromium.org>
Reviewed-by: Olivier Robin <olivierrobin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615855}
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/fallback_coordinator.mm b/ios/chrome/browser/ui/autofill/manual_fill/fallback_coordinator.mm
index 1e9230e..00101a58 100644
--- a/ios/chrome/browser/ui/autofill/manual_fill/fallback_coordinator.mm
+++ b/ios/chrome/browser/ui/autofill/manual_fill/fallback_coordinator.mm
@@ -68,7 +68,7 @@
popoverPresentationController.sourceView = button;
popoverPresentationController.sourceRect = button.bounds;
popoverPresentationController.permittedArrowDirections =
- UIPopoverArrowDirectionUp | UIMenuControllerArrowDown;
+ UIPopoverArrowDirectionUp | UIPopoverArrowDirectionDown;
popoverPresentationController.delegate = self;
popoverPresentationController.backgroundColor = UIColor.whiteColor;
}
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/fallback_view_controller.mm b/ios/chrome/browser/ui/autofill/manual_fill/fallback_view_controller.mm
index 16a6184b..da1f1615 100644
--- a/ios/chrome/browser/ui/autofill/manual_fill/fallback_view_controller.mm
+++ b/ios/chrome/browser/ui/autofill/manual_fill/fallback_view_controller.mm
@@ -24,10 +24,14 @@
namespace {
// This is the width used for |self.preferredContentSize|.
-constexpr float PopoverPreferredWidth = 320;
+constexpr CGFloat PopoverPreferredWidth = 320;
// This is the maximum height used for |self.preferredContentSize|.
-constexpr float PopoverMaxHeight = 360;
+constexpr CGFloat PopoverMaxHeight = 360;
+
+// This is the height used for |self.preferredContentSize| when showing the
+// loading indicator on iPad.
+constexpr CGFloat PopoverLoadingHeight = 185.5;
} // namespace
@@ -61,11 +65,15 @@
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.sectionHeaderHeight = 0;
self.tableView.sectionFooterHeight = 20.0;
- self.tableView.estimatedRowHeight = 200;
+ self.tableView.estimatedRowHeight = 1;
self.tableView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0);
self.tableView.allowsSelection = NO;
self.definesPresentationContext = YES;
if (!self.tableViewModel) {
+ if (IsIPadIdiom()) {
+ self.preferredContentSize = CGSizeMake(
+ PopoverPreferredWidth, AlignValueToPixel(PopoverLoadingHeight));
+ }
[self startLoadingIndicatorWithLoadingMessage:@""];
}
}