Commit 1a1ba1bf authored by Mohamad Ahmadi's avatar Mohamad Ahmadi Committed by Commit Bot

[Autofill] Fixes a bug where all autofill suggestions have generic-cc icon

Bug:763499

after: https://drive.google.com/file/d/0B-GXJsF3pXyjRm4zbHVsaTFfSGs/view?usp=sharing
before: https://drive.google.com/file/d/0B-GXJsF3pXyjWUx5MG81QWFKNnM/view?usp=sharing

Change-Id: Iba3625cf83a626b38c4cf338650d0c98f06f674d
Reviewed-on: https://chromium-review.googlesource.com/664217Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Moe Ahmadi <mahmadi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501623}
parent 4a6f65da
...@@ -92,17 +92,19 @@ UILabel* TextLabel(NSString* text, CGFloat alpha, BOOL bold) { ...@@ -92,17 +92,19 @@ UILabel* TextLabel(NSString* text, CGFloat alpha, BOOL bold) {
const CGFloat frameHeight = CGRectGetHeight(proposedFrame); const CGFloat frameHeight = CGRectGetHeight(proposedFrame);
CGFloat currentX = kBorderWidth; CGFloat currentX = kBorderWidth;
const int iconImageID = autofill::data_util::GetPaymentRequestData( if (suggestion.icon.length > 0) {
base::SysNSStringToUTF8(suggestion.icon)) const int iconImageID = autofill::data_util::GetPaymentRequestData(
.icon_resource_id; base::SysNSStringToUTF8(suggestion.icon))
UIImage* iconImage = NativeImage(iconImageID); .icon_resource_id;
UIImageView* iconView = [[UIImageView alloc] initWithImage:iconImage]; UIImage* iconImage = NativeImage(iconImageID);
const CGFloat iconY = UIImageView* iconView = [[UIImageView alloc] initWithImage:iconImage];
std::floor((frameHeight - iconImage.size.height) / 2.0f); const CGFloat iconY =
iconView.frame = CGRectMake(currentX, iconY, iconImage.size.width, std::floor((frameHeight - iconImage.size.height) / 2.0f);
iconImage.size.height); iconView.frame = CGRectMake(currentX, iconY, iconImage.size.width,
[self addSubview:iconView]; iconImage.size.height);
currentX += CGRectGetWidth(iconView.frame) + kSpacing; [self addSubview:iconView];
currentX += CGRectGetWidth(iconView.frame) + kSpacing;
}
UILabel* label = TextLabel(suggestion.value, kMainLabelAlpha, YES); UILabel* label = TextLabel(suggestion.value, kMainLabelAlpha, YES);
const CGFloat labelY = const CGFloat labelY =
......
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