[iOS][MF] Move the card icons to the left
Bug: 942001, 942127
Change-Id: I2e8ad9c2765d785bed9e61eb657d3b693483c8c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1530901
Commit-Queue: Javier Ernesto Flores Robles <javierrobles@chromium.org>
Reviewed-by: David Jean <djean@chromium.org>
Cr-Commit-Position: refs/heads/master@{#642456}
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_card_cell.mm b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_card_cell.mm
index 5e2e30c..9f8e003 100644
--- a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_card_cell.mm
+++ b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_card_cell.mm
@@ -37,9 +37,6 @@
@end
@implementation ManualFillCardItem
-@synthesize contentDelegate = _contentDelegate;
-@synthesize navigationDelegate = _navigationDelegate;
-@synthesize card = _card;
- (instancetype)initWithCreditCard:(ManualFillCreditCard*)card
contentDelegate:
@@ -210,11 +207,11 @@
self.cardIcon.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:self.cardIcon];
AppendHorizontalConstraintsForViews(
- staticConstraints, @[ self.cardLabel, self.cardIcon ], self.contentView,
- kButtonHorizontalMargin, AppendConstraintsHorizontalExtraSpaceLeft);
+ staticConstraints, @[ self.cardIcon, self.cardLabel ], self.contentView,
+ kButtonHorizontalMargin);
[NSLayoutConstraint activateConstraints:@[
- [self.cardIcon.bottomAnchor
- constraintEqualToAnchor:self.cardLabel.firstBaselineAnchor]
+ [self.cardIcon.centerYAnchor
+ constraintEqualToAnchor:self.cardLabel.centerYAnchor]
]];
self.cardNumberButton =
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.h b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.h
index f872b74..0900cf45 100644
--- a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.h
+++ b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.h
@@ -27,12 +27,10 @@
// Options for |AppendHorizontalConstraintsForViews|.
typedef NS_OPTIONS(NSUInteger, AppendConstraints) {
AppendConstraintsNone = 0,
- // Add to options to give remaining space in the line to leftmost item.
- AppendConstraintsHorizontalExtraSpaceLeft = 1 << 0,
// Add an equal constraint to the baselines.
- AppendConstraintsHorizontalSyncBaselines = 1 << 1,
+ AppendConstraintsHorizontalSyncBaselines = 1 << 0,
// The views can be constraint smaller than the guide.
- AppendConstraintsHorizontalEqualOrSmallerThanGuide = 1 << 2,
+ AppendConstraintsHorizontalEqualOrSmallerThanGuide = 1 << 1,
};
} // namespace
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.mm b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.mm
index f0fcd64..6f49651 100644
--- a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.mm
+++ b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_cell_utils.mm
@@ -91,14 +91,6 @@
return;
NSLayoutXAxisAnchor* previousAnchor = guide.leadingAnchor;
- UILayoutPriority firstPriority =
- options & AppendConstraintsHorizontalExtraSpaceLeft
- ? UILayoutPriorityDefaultHigh
- : UILayoutPriorityDefaultLow;
- UILayoutPriority lastPriority =
- options & AppendConstraintsHorizontalExtraSpaceLeft
- ? UILayoutPriorityDefaultLow
- : UILayoutPriorityDefaultHigh;
BOOL isFirstView = YES;
for (UIView* view in views) {
@@ -106,10 +98,10 @@
[constraints
addObject:[view.leadingAnchor constraintEqualToAnchor:previousAnchor
constant:constant]];
- [view setContentCompressionResistancePriority:firstPriority
+ [view setContentCompressionResistancePriority:UILayoutPriorityDefaultLow
forAxis:
UILayoutConstraintAxisHorizontal];
- [view setContentHuggingPriority:lastPriority
+ [view setContentHuggingPriority:UILayoutPriorityDefaultHigh
forAxis:UILayoutConstraintAxisHorizontal];
previousAnchor = view.trailingAnchor;
isFirstView = NO;
@@ -127,11 +119,11 @@
constant:-margin]];
// Give all remaining space to the last button, minus margin, as per UX.
[views.lastObject
- setContentCompressionResistancePriority:lastPriority
+ setContentCompressionResistancePriority:UILayoutPriorityDefaultHigh
forAxis:
UILayoutConstraintAxisHorizontal];
[views.lastObject
- setContentHuggingPriority:firstPriority
+ setContentHuggingPriority:UILayoutPriorityDefaultLow
forAxis:UILayoutConstraintAxisHorizontal];
}
if (options & AppendConstraintsHorizontalSyncBaselines) {