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() { ...@@ -231,10 +231,10 @@ UIColor* BackgroundColorIncognito() {
[detailTextLabel setTextAlignment:_alignment]; [detailTextLabel setTextAlignment:_alignment];
// The width must be positive for CGContextRef to be valid. // The width must be positive for CGContextRef to be valid.
UIEdgeInsets safeAreaInsets = SafeAreaInsetsForView(row); UIEdgeInsets safeAreaInsets = SafeAreaInsetsForView(self.view);
CGFloat labelWidth = MAX( CGRect rowBounds = UIEdgeInsetsInsetRect(self.view.bounds, safeAreaInsets);
40, floorf(UIEdgeInsetsInsetRect(row.bounds, safeAreaInsets).size.width) - CGFloat labelWidth =
kTextCellLeadingPadding); MAX(40, floorf(rowBounds.size.width) - kTextCellLeadingPadding);
CGFloat labelHeight = CGFloat labelHeight =
match.hasAnswer ? kAnswerLabelHeight : kTextDetailLabelHeight; match.hasAnswer ? kAnswerLabelHeight : kTextDetailLabelHeight;
CGFloat answerImagePadding = kAnswerImageWidth + kAnswerImageRightPadding; CGFloat answerImagePadding = kAnswerImageWidth + kAnswerImageRightPadding;
...@@ -243,7 +243,7 @@ UIColor* BackgroundColorIncognito() { ...@@ -243,7 +243,7 @@ UIColor* BackgroundColorIncognito() {
kTextCellLeadingPadding; kTextCellLeadingPadding;
LayoutRect detailTextLabelLayout = LayoutRect detailTextLabelLayout =
LayoutRectMake(leadingPadding, CGRectGetWidth(self.view.bounds), LayoutRectMake(leadingPadding, CGRectGetWidth(rowBounds),
kDetailCellTopPadding, labelWidth, labelHeight); kDetailCellTopPadding, labelWidth, labelHeight);
detailTextLabel.frame = LayoutRectGetRect(detailTextLabelLayout); detailTextLabel.frame = LayoutRectGetRect(detailTextLabelLayout);
...@@ -259,8 +259,8 @@ UIColor* BackgroundColorIncognito() { ...@@ -259,8 +259,8 @@ UIColor* BackgroundColorIncognito() {
OmniboxPopupTruncatingLabel* textLabel = row.textTruncatingLabel; OmniboxPopupTruncatingLabel* textLabel = row.textTruncatingLabel;
[textLabel setTextAlignment:_alignment]; [textLabel setTextAlignment:_alignment];
LayoutRect textLabelLayout = LayoutRect textLabelLayout =
LayoutRectMake(kTextCellLeadingPadding, CGRectGetWidth(self.view.bounds), LayoutRectMake(kTextCellLeadingPadding, CGRectGetWidth(rowBounds), 0,
0, labelWidth, kTextLabelHeight); labelWidth, kTextLabelHeight);
textLabel.frame = LayoutRectGetRect(textLabelLayout); textLabel.frame = LayoutRectGetRect(textLabelLayout);
// Set the text. // 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