OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // For WinDDK ATL compatibility, these ATL headers must come first. | 5 // For WinDDK ATL compatibility, these ATL headers must come first. |
6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
7 | 7 |
8 #if defined(OS_WIN) | 8 #if defined(OS_WIN) |
9 #include <atlbase.h> // NOLINT | 9 #include <atlbase.h> // NOLINT |
10 #include <atlwin.h> // NOLINT | 10 #include <atlwin.h> // NOLINT |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 // updating the text in the omnibox but this alert and GetAccessibleState | 283 // updating the text in the omnibox but this alert and GetAccessibleState |
284 // below make the answer contents accessible. | 284 // below make the answer contents accessible. |
285 if (match_.answer) | 285 if (match_.answer) |
286 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); | 286 NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true); |
287 } | 287 } |
288 | 288 |
289 gfx::Size OmniboxResultView::GetPreferredSize() const { | 289 gfx::Size OmniboxResultView::GetPreferredSize() const { |
290 if (!match_.answer) | 290 if (!match_.answer) |
291 return gfx::Size(0, GetContentLineHeight()); | 291 return gfx::Size(0, GetContentLineHeight()); |
292 // An answer implies a match and a description in a large font. | 292 // An answer implies a match and a description in a large font. |
293 const auto& text_fields = match_.answer->second_line().text_fields(); | 293 if (match_.answer->second_line().num_text_lines() == 1) |
294 if (text_fields.empty() || !text_fields.front().has_num_lines()) | |
295 return gfx::Size(0, GetContentLineHeight() + GetAnswerLineHeight()); | 294 return gfx::Size(0, GetContentLineHeight() + GetAnswerLineHeight()); |
296 if (!description_rendertext_) { | 295 if (!description_rendertext_) { |
297 description_rendertext_ = | 296 description_rendertext_ = |
298 CreateAnswerLine(match_.answer->second_line(), font_list_); | 297 CreateAnswerLine(match_.answer->second_line(), font_list_); |
299 } | 298 } |
300 description_rendertext_->SetDisplayRect( | 299 description_rendertext_->SetDisplayRect( |
301 gfx::Rect(text_bounds_.width(), 0)); | 300 gfx::Rect(text_bounds_.width(), 0)); |
302 description_rendertext_->GetStringSize(); | 301 description_rendertext_->GetStringSize(); |
303 return gfx::Size( | 302 return gfx::Size( |
304 0, GetContentLineHeight() + | 303 0, GetContentLineHeight() + |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 destination->AppendText(text); | 838 destination->AppendText(text); |
840 const TextStyle& text_style = GetTextStyle(text_type); | 839 const TextStyle& text_style = GetTextStyle(text_type); |
841 // TODO(dschuyler): follow up on the problem of different font sizes within | 840 // TODO(dschuyler): follow up on the problem of different font sizes within |
842 // one RenderText. Maybe with destination->SetFontList(...). | 841 // one RenderText. Maybe with destination->SetFontList(...). |
843 destination->ApplyWeight( | 842 destination->ApplyWeight( |
844 is_bold ? gfx::Font::Weight::BOLD : gfx::Font::Weight::NORMAL, range); | 843 is_bold ? gfx::Font::Weight::BOLD : gfx::Font::Weight::NORMAL, range); |
845 destination->ApplyColor( | 844 destination->ApplyColor( |
846 GetNativeTheme()->GetSystemColor(text_style.colors[GetState()]), range); | 845 GetNativeTheme()->GetSystemColor(text_style.colors[GetState()]), range); |
847 destination->ApplyBaselineStyle(text_style.baseline, range); | 846 destination->ApplyBaselineStyle(text_style.baseline, range); |
848 } | 847 } |
OLD | NEW |