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

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

Issue 354963003: Move gfx::ElideText functionality to RenderText. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync and rebase. Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/views/location_bar/origin_chip_view.cc ('k') | ui/gfx/render_text.h » ('j') | 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 11 matching lines...) Expand all
22 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h" 22 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h"
23 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
24 #include "grit/theme_resources.h" 24 #include "grit/theme_resources.h"
25 #include "ui/base/l10n/l10n_util.h" 25 #include "ui/base/l10n/l10n_util.h"
26 #include "ui/base/theme_provider.h" 26 #include "ui/base/theme_provider.h"
27 #include "ui/gfx/canvas.h" 27 #include "ui/gfx/canvas.h"
28 #include "ui/gfx/color_utils.h" 28 #include "ui/gfx/color_utils.h"
29 #include "ui/gfx/image/image.h" 29 #include "ui/gfx/image/image.h"
30 #include "ui/gfx/range/range.h" 30 #include "ui/gfx/range/range.h"
31 #include "ui/gfx/render_text.h" 31 #include "ui/gfx/render_text.h"
32 #include "ui/gfx/text_elider.h"
33 #include "ui/gfx/text_utils.h" 32 #include "ui/gfx/text_utils.h"
34 #include "ui/native_theme/native_theme.h" 33 #include "ui/native_theme/native_theme.h"
35 34
36 using ui::NativeTheme; 35 using ui::NativeTheme;
37 36
38 namespace { 37 namespace {
39 38
40 // The minimum distance between the top and bottom of the {icon|text} and the 39 // The minimum distance between the top and bottom of the {icon|text} and the
41 // top or bottom of the row. 40 // top or bottom of the row.
42 const int kMinimumIconVerticalPadding = 2; 41 const int kMinimumIconVerticalPadding = 2;
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 render_text->SetDisplayRect(gfx::Rect( 330 render_text->SetDisplayRect(gfx::Rect(
332 mirroring_context_->mirrored_left_coord(x, right_x), y, 331 mirroring_context_->mirrored_left_coord(x, right_x), y,
333 right_x - x, height())); 332 right_x - x, height()));
334 render_text->Draw(canvas); 333 render_text->Draw(canvas);
335 return right_x; 334 return right_x;
336 } 335 }
337 336
338 scoped_ptr<gfx::RenderText> OmniboxResultView::CreateRenderText( 337 scoped_ptr<gfx::RenderText> OmniboxResultView::CreateRenderText(
339 const base::string16& text) const { 338 const base::string16& text) const {
340 scoped_ptr<gfx::RenderText> render_text(gfx::RenderText::CreateInstance()); 339 scoped_ptr<gfx::RenderText> render_text(gfx::RenderText::CreateInstance());
340 render_text->SetDisplayRect(gfx::Rect(gfx::Size(INT_MAX, 0)));
341 render_text->SetCursorEnabled(false); 341 render_text->SetCursorEnabled(false);
342 render_text->SetElideBehavior(gfx::ELIDE_TAIL); 342 render_text->SetElideBehavior(gfx::ELIDE_TAIL);
343 render_text->SetFontList(font_list_); 343 render_text->SetFontList(font_list_);
344 render_text->SetText(text); 344 render_text->SetText(text);
345 return render_text.Pass(); 345 return render_text.Pass();
346 } 346 }
347 347
348 scoped_ptr<gfx::RenderText> OmniboxResultView::CreateClassifiedRenderText( 348 scoped_ptr<gfx::RenderText> OmniboxResultView::CreateClassifiedRenderText(
349 const base::string16& text, 349 const base::string16& text,
350 const ACMatchClassifications& classifications, 350 const ACMatchClassifications& classifications,
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 } 555 }
556 PaintMatch(*keyword_match, keyword_contents_rendertext_.get(), 556 PaintMatch(*keyword_match, keyword_contents_rendertext_.get(),
557 keyword_description_rendertext_.get(), canvas, x); 557 keyword_description_rendertext_.get(), canvas, x);
558 } 558 }
559 } 559 }
560 560
561 void OmniboxResultView::AnimationProgressed(const gfx::Animation* animation) { 561 void OmniboxResultView::AnimationProgressed(const gfx::Animation* animation) {
562 Layout(); 562 Layout();
563 SchedulePaint(); 563 SchedulePaint();
564 } 564 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/origin_chip_view.cc ('k') | ui/gfx/render_text.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698