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

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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 x += answer_icon_size + 358 x += answer_icon_size +
359 GetThemeProvider()->GetDisplayProperty( 359 location_bar_view_->GetThemeProvider()->GetDisplayProperty(
Peter Kasting 2015/07/31 20:37:59 Might want some sort of a "See TODO in Layout()" c
jonross 2015/08/04 21:58:10 Done.
360 ThemeProperties::PROPERTY_ICON_LABEL_VIEW_TRAILING_PADDING); 360 ThemeProperties::PROPERTY_ICON_LABEL_VIEW_TRAILING_PADDING);
361 } 361 }
362 } else { 362 } else {
363 x = DrawRenderText(match, separator_rendertext_.get(), false, canvas, 363 x = DrawRenderText(match, separator_rendertext_.get(), false, canvas,
364 after_contents_x, y, separator_width_); 364 after_contents_x, y, separator_width_);
365 } 365 }
366 366
367 DrawRenderText(match, description, false, canvas, x, y, 367 DrawRenderText(match, description, false, canvas, x, y,
368 description_max_width); 368 description_max_width);
369 } 369 }
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 void OmniboxResultView::InitContentsRenderTextIfNecessary() const { 601 void OmniboxResultView::InitContentsRenderTextIfNecessary() const {
602 if (!contents_rendertext_) { 602 if (!contents_rendertext_) {
603 contents_rendertext_.reset( 603 contents_rendertext_.reset(
604 CreateClassifiedRenderText( 604 CreateClassifiedRenderText(
605 match_.contents, match_.contents_class, false).release()); 605 match_.contents, match_.contents_class, false).release());
606 } 606 }
607 } 607 }
608 608
609 void OmniboxResultView::Layout() { 609 void OmniboxResultView::Layout() {
610 const gfx::ImageSkia icon = GetIcon(); 610 const gfx::ImageSkia icon = GetIcon();
611 ui::ThemeProvider* theme_provider = GetThemeProvider(); 611 // TODO(jonross): Currently |location_bar_view_| provides the correct
612 // ThemeProvider, as it is loaded on the BrowserFrame widget. The root widget
613 // for OmniboxResultView is AutocompletePopupWidget, which is not loading the
614 // theme. We should update the omnibox code to also track its own
615 // ThemeProvider in order to reduce dependancy on LocationBarView.
616 ui::ThemeProvider* theme_provider = location_bar_view_->GetThemeProvider();
612 // |theme_provider| can be null when animations are running during shutdown, 617 // |theme_provider| can be null when animations are running during shutdown,
613 // after OmniboxResultView has been removed from the tree of Views. 618 // after OmniboxResultView has been removed from the tree of Views.
614 if (!theme_provider) 619 if (!theme_provider)
615 return; 620 return;
616 const int horizontal_padding = theme_provider->GetDisplayProperty( 621 const int horizontal_padding = theme_provider->GetDisplayProperty(
617 ThemeProperties::PROPERTY_LOCATION_BAR_HORIZONTAL_PADDING); 622 ThemeProperties::PROPERTY_LOCATION_BAR_HORIZONTAL_PADDING);
618 const int trailing_padding = theme_provider->GetDisplayProperty( 623 const int trailing_padding = theme_provider->GetDisplayProperty(
619 ThemeProperties::PROPERTY_ICON_LABEL_VIEW_TRAILING_PADDING); 624 ThemeProperties::PROPERTY_ICON_LABEL_VIEW_TRAILING_PADDING);
620 625
621 icon_bounds_.SetRect( 626 icon_bounds_.SetRect(
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 gfx::Range range(offset, offset + text.length()); 785 gfx::Range range(offset, offset + text.length());
781 destination->AppendText(text); 786 destination->AppendText(text);
782 const TextStyle& text_style = GetTextStyle(text_type); 787 const TextStyle& text_style = GetTextStyle(text_type);
783 // TODO(dschuyler): follow up on the problem of different font sizes within 788 // TODO(dschuyler): follow up on the problem of different font sizes within
784 // one RenderText. Maybe with destination->SetFontList(...). 789 // one RenderText. Maybe with destination->SetFontList(...).
785 destination->ApplyStyle(gfx::BOLD, is_bold, range); 790 destination->ApplyStyle(gfx::BOLD, is_bold, range);
786 destination->ApplyColor( 791 destination->ApplyColor(
787 GetNativeTheme()->GetSystemColor(text_style.colors[GetState()]), range); 792 GetNativeTheme()->GetSystemColor(text_style.colors[GetState()]), range);
788 destination->ApplyBaselineStyle(text_style.baseline, range); 793 destination->ApplyBaselineStyle(text_style.baseline, range);
789 } 794 }
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