Commit 16426c07 authored by Yi Gu's avatar Yi Gu Committed by Commit Bot

Revert "[omnibox] Vertically center single line entity suggestions"

This reverts commit cfb0eff9.

Reason for revert: failing https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/Mac/43110
 due to adding a static const string16 in the anoymous namespace

Original change's description:
> [omnibox] Vertically center single line entity suggestions
> 
> Omnibox entity suggestions with two lines of text will layout
> as before, but now if the second line description is absent,
> the primary content text line will be vertically centered.
> 
> Bug: 856703
> Change-Id: Ie672ccece28be79d18bf6f7f07f9937af434178d
> Reviewed-on: https://chromium-review.googlesource.com/1115760
> Commit-Queue: Orin Jaworski <orinj@chromium.org>
> Reviewed-by: Justin Donnelly <jdonnelly@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#571174}

TBR=jdonnelly@chromium.org,orinj@chromium.org

Change-Id: I2f7b31736edc2e66240717749961092875002e2a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 856703
Reviewed-on: https://chromium-review.googlesource.com/1118788Reviewed-by: default avatarYi Gu <yigu@chromium.org>
Commit-Queue: Yi Gu <yigu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#571229}
parent 18404028
...@@ -420,19 +420,11 @@ void OmniboxMatchCellView::LayoutNewStyleTwoLineSuggestion() { ...@@ -420,19 +420,11 @@ void OmniboxMatchCellView::LayoutNewStyleTwoLineSuggestion() {
} }
image_view->SetBounds(x, y, kRefreshImageBoxSize, child_area.height()); image_view->SetBounds(x, y, kRefreshImageBoxSize, child_area.height());
const int text_width = child_area.width() - kTextIndent; const int text_width = child_area.width() - kTextIndent;
if (description_view_->text().empty()) { const int text_height = content_view_->GetLineHeight();
// This vertically centers content in the rare case that no description is content_view_->SetBounds(x + kTextIndent, y, text_width, text_height);
// provided. description_view_->SetBounds(
content_view_->SetBounds(x + kTextIndent, y, text_width, x + kTextIndent, y + text_height, text_width,
child_area.height()); description_view_->GetHeightForWidth(text_width));
description_view_->SetSize(gfx::Size());
} else {
const int text_height = content_view_->GetLineHeight();
content_view_->SetBounds(x + kTextIndent, y, text_width, text_height);
description_view_->SetBounds(
x + kTextIndent, y + text_height, text_width,
description_view_->GetHeightForWidth(text_width));
}
} }
void OmniboxMatchCellView::LayoutSplit(int icon_view_width, int text_indent) { void OmniboxMatchCellView::LayoutSplit(int icon_view_width, int text_indent) {
......
...@@ -40,8 +40,6 @@ constexpr int kInherit = INT_MIN; ...@@ -40,8 +40,6 @@ constexpr int kInherit = INT_MIN;
static constexpr int kVerticalPadding = 4; static constexpr int kVerticalPadding = 4;
static constexpr int kRefreshVerticalPadding = 3; static constexpr int kRefreshVerticalPadding = 3;
static const base::string16 kEmptyString;
struct TextStyle { struct TextStyle {
OmniboxPart part; OmniboxPart part;
...@@ -186,12 +184,6 @@ void OmniboxTextView::Dim() { ...@@ -186,12 +184,6 @@ void OmniboxTextView::Dim() {
result_view_->GetColor(OmniboxPart::RESULTS_TEXT_DIMMED)); result_view_->GetColor(OmniboxPart::RESULTS_TEXT_DIMMED));
} }
const base::string16& OmniboxTextView::text() const {
if (!render_text_)
return kEmptyString;
return render_text_->text();
}
void OmniboxTextView::SetText(const base::string16& text) { void OmniboxTextView::SetText(const base::string16& text) {
render_text_.reset(); render_text_.reset();
render_text_ = CreateRenderText(text); render_text_ = CreateRenderText(text);
......
...@@ -40,9 +40,6 @@ class OmniboxTextView : public views::View { ...@@ -40,9 +40,6 @@ class OmniboxTextView : public views::View {
// that the non-dimmed text stands out more). // that the non-dimmed text stands out more).
void Dim(); void Dim();
// Returns the render text, or an empty string if there is none.
const base::string16& text() const;
// Sets the render text with default rendering for the given |text|. The // Sets the render text with default rendering for the given |text|. The
// |classifications| are used to style the text. An ImageLine incorporates // |classifications| are used to style the text. An ImageLine incorporates
// both the text and the styling. // both the text and the styling.
......
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