Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_result_view.cc

Issue 1262413005: Fix Spacing in OmniboxResultView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <atlbase.h> // NOLINT 8 #include <atlbase.h> // NOLINT
9 #include <atlwin.h> // NOLINT 9 #include <atlwin.h> // NOLINT
10 #endif 10 #endif
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 348
349 if (description_max_width != 0) { 349 if (description_max_width != 0) {
350 if (match.answer) { 350 if (match.answer) {
351 y += GetContentLineHeight(); 351 y += GetContentLineHeight();
352 if (!answer_image_.isNull()) { 352 if (!answer_image_.isNull()) {
353 int answer_icon_size = GetAnswerLineHeight(); 353 int answer_icon_size = GetAnswerLineHeight();
354 canvas->DrawImageInt( 354 canvas->DrawImageInt(
355 answer_image_, 355 answer_image_,
356 0, 0, answer_image_.width(), answer_image_.height(), 356 0, 0, answer_image_.width(), answer_image_.height(),
357 GetMirroredXInView(x), y, answer_icon_size, answer_icon_size, true); 357 GetMirroredXInView(x), y, answer_icon_size, answer_icon_size, true);
358 // See TODO in Layout().
358 x += answer_icon_size + 359 x += answer_icon_size +
359 GetThemeProvider()->GetDisplayProperty( 360 location_bar_view_->GetThemeProvider()->GetDisplayProperty(
360 ThemeProperties::PROPERTY_ICON_LABEL_VIEW_TRAILING_PADDING); 361 ThemeProperties::PROPERTY_ICON_LABEL_VIEW_TRAILING_PADDING);
361 } 362 }
362 } else { 363 } else {
363 x = DrawRenderText(match, separator_rendertext_.get(), false, canvas, 364 x = DrawRenderText(match, separator_rendertext_.get(), false, canvas,
364 after_contents_x, y, separator_width_); 365 after_contents_x, y, separator_width_);
365 } 366 }
366 367
367 DrawRenderText(match, description, false, canvas, x, y, 368 DrawRenderText(match, description, false, canvas, x, y,
368 description_max_width); 369 description_max_width);
369 } 370 }
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 void OmniboxResultView::InitContentsRenderTextIfNecessary() const { 602 void OmniboxResultView::InitContentsRenderTextIfNecessary() const {
602 if (!contents_rendertext_) { 603 if (!contents_rendertext_) {
603 contents_rendertext_.reset( 604 contents_rendertext_.reset(
604 CreateClassifiedRenderText( 605 CreateClassifiedRenderText(
605 match_.contents, match_.contents_class, false).release()); 606 match_.contents, match_.contents_class, false).release());
606 } 607 }
607 } 608 }
608 609
609 void OmniboxResultView::Layout() { 610 void OmniboxResultView::Layout() {
610 const gfx::ImageSkia icon = GetIcon(); 611 const gfx::ImageSkia icon = GetIcon();
611 ui::ThemeProvider* theme_provider = GetThemeProvider(); 612 // TODO(jonross): Currently |location_bar_view_| provides the correct
613 // ThemeProvider, as it is loaded on the BrowserFrame widget. The root widget
614 // for OmniboxResultView is AutocompletePopupWidget, which is not loading the
615 // theme. We should update the omnibox code to also track its own
616 // ThemeProvider in order to reduce dependancy on LocationBarView.
617 ui::ThemeProvider* theme_provider = location_bar_view_->GetThemeProvider();
612 // |theme_provider| can be null when animations are running during shutdown, 618 // |theme_provider| can be null when animations are running during shutdown,
613 // after OmniboxResultView has been removed from the tree of Views. 619 // after OmniboxResultView has been removed from the tree of Views.
614 if (!theme_provider) 620 if (!theme_provider)
615 return; 621 return;
616 const int horizontal_padding = theme_provider->GetDisplayProperty( 622 const int horizontal_padding = theme_provider->GetDisplayProperty(
617 ThemeProperties::PROPERTY_LOCATION_BAR_HORIZONTAL_PADDING); 623 ThemeProperties::PROPERTY_LOCATION_BAR_HORIZONTAL_PADDING);
618 const int trailing_padding = theme_provider->GetDisplayProperty( 624 const int trailing_padding = theme_provider->GetDisplayProperty(
619 ThemeProperties::PROPERTY_ICON_LABEL_VIEW_TRAILING_PADDING); 625 ThemeProperties::PROPERTY_ICON_LABEL_VIEW_TRAILING_PADDING);
620 626
621 icon_bounds_.SetRect( 627 icon_bounds_.SetRect(
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 gfx::Range range(offset, offset + text.length()); 786 gfx::Range range(offset, offset + text.length());
781 destination->AppendText(text); 787 destination->AppendText(text);
782 const TextStyle& text_style = GetTextStyle(text_type); 788 const TextStyle& text_style = GetTextStyle(text_type);
783 // TODO(dschuyler): follow up on the problem of different font sizes within 789 // TODO(dschuyler): follow up on the problem of different font sizes within
784 // one RenderText. Maybe with destination->SetFontList(...). 790 // one RenderText. Maybe with destination->SetFontList(...).
785 destination->ApplyStyle(gfx::BOLD, is_bold, range); 791 destination->ApplyStyle(gfx::BOLD, is_bold, range);
786 destination->ApplyColor( 792 destination->ApplyColor(
787 GetNativeTheme()->GetSystemColor(text_style.colors[GetState()]), range); 793 GetNativeTheme()->GetSystemColor(text_style.colors[GetState()]), range);
788 destination->ApplyBaselineStyle(text_style.baseline, range); 794 destination->ApplyBaselineStyle(text_style.baseline, range);
789 } 795 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698