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

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

Issue 112063003: Implement eliding/truncating at end in RenderText (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Synced Created 7 years 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 | « base/i18n/rtl_unittest.cc ('k') | chrome/browser/ui/views/omnibox/omnibox_result_view.cc » ('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 #ifndef CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "chrome/browser/autocomplete/autocomplete_match.h" 10 #include "chrome/browser/autocomplete/autocomplete_match.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 static void CommonInitColors(const ui::NativeTheme* theme, 104 static void CommonInitColors(const ui::NativeTheme* theme,
105 SkColor colors[][NUM_KINDS]); 105 SkColor colors[][NUM_KINDS]);
106 106
107 // Predicate functions for use when sorting the runs. 107 // Predicate functions for use when sorting the runs.
108 static bool SortRunsLogically(const RunData& lhs, const RunData& rhs); 108 static bool SortRunsLogically(const RunData& lhs, const RunData& rhs);
109 static bool SortRunsVisually(const RunData& lhs, const RunData& rhs); 109 static bool SortRunsVisually(const RunData& lhs, const RunData& rhs);
110 110
111 gfx::ImageSkia GetIcon() const; 111 gfx::ImageSkia GetIcon() const;
112 const gfx::ImageSkia* GetKeywordIcon() const; 112 const gfx::ImageSkia* GetKeywordIcon() const;
113 113
114 // Elides |runs| to fit in |remaining_width|. The runs in |runs| should be in
115 // logical order.
116 //
117 // When we need to elide a run, the ellipsis will be placed at the end of that
118 // run. This means that if we elide a run whose visual direction is opposite
119 // that of the drawing context, the ellipsis will not be at the "end" of the
120 // drawn string. For example, if in an LTR context we have the LTR run
121 // "LTR_STRING" and the RTL run "RTL_STRING", the unelided text would be drawn
122 // like:
123 // LTR_STRING GNIRTS_LTR
124 // If we need to elide the RTL run, then it will be drawn like:
125 // LTR_STRING ...RTS_LTR
126 // Instead of:
127 // LTR_STRING RTS_LTR...
128 void Elide(Runs* runs, int remaining_width) const;
129
130 // views::View: 114 // views::View:
131 virtual void Layout() OVERRIDE; 115 virtual void Layout() OVERRIDE;
132 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; 116 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE;
133 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 117 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
134 118
135 // gfx::AnimationDelegate: 119 // gfx::AnimationDelegate:
136 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; 120 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
137 121
138 static int default_icon_size_; 122 static int default_icon_size_;
139 123
(...skipping 25 matching lines...) Expand all
165 149
166 gfx::Rect keyword_text_bounds_; 150 gfx::Rect keyword_text_bounds_;
167 scoped_ptr<views::ImageView> keyword_icon_; 151 scoped_ptr<views::ImageView> keyword_icon_;
168 152
169 scoped_ptr<gfx::SlideAnimation> animation_; 153 scoped_ptr<gfx::SlideAnimation> animation_;
170 154
171 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView); 155 DISALLOW_COPY_AND_ASSIGN(OmniboxResultView);
172 }; 156 };
173 157
174 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_ 158 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_RESULT_VIEW_H_
OLDNEW
« no previous file with comments | « base/i18n/rtl_unittest.cc ('k') | chrome/browser/ui/views/omnibox/omnibox_result_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698