Commit 795f1320 authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

Better fix to apply safe area to omnibox popup width.

Although the omnibox popup itself honors safe are in the table view, the width
of the omnibox pop text can be too wide.

This is a second attempt after crrev/d4774195 only accounted for RTL keyboards,
not a full RTL layout.

Bug: 787164
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: Icd668c45ae32b8ff5520d1e54c85292d66c4c7ee
Reviewed-on: https://chromium-review.googlesource.com/817383
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Reviewed-by: default avatarStepan Khapugin <stkhapugin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523083}
parent ed3da78b
......@@ -231,10 +231,10 @@ UIColor* BackgroundColorIncognito() {
[detailTextLabel setTextAlignment:_alignment];
// The width must be positive for CGContextRef to be valid.
UIEdgeInsets safeAreaInsets = SafeAreaInsetsForView(row);
CGFloat labelWidth = MAX(
40, floorf(UIEdgeInsetsInsetRect(row.bounds, safeAreaInsets).size.width) -
kTextCellLeadingPadding);
UIEdgeInsets safeAreaInsets = SafeAreaInsetsForView(self.view);
CGRect rowBounds = UIEdgeInsetsInsetRect(self.view.bounds, safeAreaInsets);
CGFloat labelWidth =
MAX(40, floorf(rowBounds.size.width) - kTextCellLeadingPadding);
CGFloat labelHeight =
match.hasAnswer ? kAnswerLabelHeight : kTextDetailLabelHeight;
CGFloat answerImagePadding = kAnswerImageWidth + kAnswerImageRightPadding;
......@@ -243,7 +243,7 @@ UIColor* BackgroundColorIncognito() {
kTextCellLeadingPadding;
LayoutRect detailTextLabelLayout =
LayoutRectMake(leadingPadding, CGRectGetWidth(self.view.bounds),
LayoutRectMake(leadingPadding, CGRectGetWidth(rowBounds),
kDetailCellTopPadding, labelWidth, labelHeight);
detailTextLabel.frame = LayoutRectGetRect(detailTextLabelLayout);
......@@ -259,8 +259,8 @@ UIColor* BackgroundColorIncognito() {
OmniboxPopupTruncatingLabel* textLabel = row.textTruncatingLabel;
[textLabel setTextAlignment:_alignment];
LayoutRect textLabelLayout =
LayoutRectMake(kTextCellLeadingPadding, CGRectGetWidth(self.view.bounds),
0, labelWidth, kTextLabelHeight);
LayoutRectMake(kTextCellLeadingPadding, CGRectGetWidth(rowBounds), 0,
labelWidth, kTextLabelHeight);
textLabel.frame = LayoutRectGetRect(textLabelLayout);
// Set the text.
......
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