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

Unified Diff: ui/base/text/text_elider.cc

Issue 23731010: Move text_elider to gfx. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update3 Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/cocoa/menu_controller.mm ('k') | ui/base/text/text_elider_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/text/text_elider.cc
diff --git a/ui/base/text/text_elider.cc b/ui/base/text/text_elider.cc
index 76dbb719946a0e4dec9cf6736fdc78a03cd284ce..ed7b4d30cf7b0bf9452e8089e28d89e3d24e84c8 100644
--- a/ui/base/text/text_elider.cc
+++ b/ui/base/text/text_elider.cc
@@ -7,7 +7,7 @@
// Note that several of the functions declared in text_elider.h are implemented
// in this file using helper classes in an unnamed namespace.
-#include "ui/base/text/text_elider.h"
+#include "ui/gfx/text_elider.h"
#include <string>
#include <vector>
@@ -814,7 +814,7 @@ class RectangleText {
RectangleText(const gfx::FontList& font_list,
int available_pixel_width,
int available_pixel_height,
- ui::WordWrapBehavior wrap_behavior,
+ gfx::WordWrapBehavior wrap_behavior,
std::vector<string16>* lines)
: font_list_(font_list),
line_height_(font_list.GetHeight()),
@@ -882,7 +882,7 @@ class RectangleText {
const int available_pixel_height_;
// The wrap behavior for words that are too long to fit on a single line.
- const ui::WordWrapBehavior wrap_behavior_;
+ const gfx::WordWrapBehavior wrap_behavior_;
// The current running width.
int current_width_;
@@ -938,8 +938,8 @@ int RectangleText::Finalize() {
}
if (last_line_ended_in_lf_)
lines_->push_back(string16());
- return (insufficient_width_ ? ui::INSUFFICIENT_SPACE_HORIZONTAL : 0) |
- (insufficient_height_ ? ui::INSUFFICIENT_SPACE_VERTICAL : 0);
+ return (insufficient_width_ ? gfx::INSUFFICIENT_SPACE_HORIZONTAL : 0) |
+ (insufficient_height_ ? gfx::INSUFFICIENT_SPACE_VERTICAL : 0);
}
void RectangleText::AddLine(const string16& line) {
@@ -984,8 +984,8 @@ int RectangleText::WrapWord(const string16& word) {
bool first_fragment = true;
while (!insufficient_height_ && !text.empty()) {
string16 fragment =
- ui::ElideText(text, font_list_, available_pixel_width_,
- ui::TRUNCATE_AT_END);
+ gfx::ElideText(text, font_list_, available_pixel_width_,
+ gfx::TRUNCATE_AT_END);
// At least one character has to be added at every line, even if the
// available space is too small.
if(fragment.empty())
@@ -1009,17 +1009,17 @@ int RectangleText::AddWordOverflow(const string16& word) {
lines_added++;
}
- if (wrap_behavior_ == ui::IGNORE_LONG_WORDS) {
+ if (wrap_behavior_ == gfx::IGNORE_LONG_WORDS) {
current_line_ = word;
current_width_ = available_pixel_width_;
- } else if (wrap_behavior_ == ui::WRAP_LONG_WORDS) {
+ } else if (wrap_behavior_ == gfx::WRAP_LONG_WORDS) {
lines_added += WrapWord(word);
} else {
- const ui::ElideBehavior elide_behavior =
- (wrap_behavior_ == ui::ELIDE_LONG_WORDS ? ui::ELIDE_AT_END :
- ui::TRUNCATE_AT_END);
+ const gfx::ElideBehavior elide_behavior =
+ (wrap_behavior_ == gfx::ELIDE_LONG_WORDS ? gfx::ELIDE_AT_END :
+ gfx::TRUNCATE_AT_END);
const string16 elided_word =
- ui::ElideText(word, font_list_, available_pixel_width_, elide_behavior);
+ gfx::ElideText(word, font_list_, available_pixel_width_, elide_behavior);
AddToCurrentLine(elided_word);
insufficient_width_ = true;
}
@@ -1039,7 +1039,7 @@ int RectangleText::AddWord(const string16& word) {
// Append the non-trimmed word, in case more words are added after.
AddToCurrentLine(word);
} else {
- lines_added = AddWordOverflow(wrap_behavior_ == ui::IGNORE_LONG_WORDS ?
+ lines_added = AddWordOverflow(wrap_behavior_ == gfx::IGNORE_LONG_WORDS ?
trimmed : word);
}
return lines_added;
« no previous file with comments | « ui/base/cocoa/menu_controller.mm ('k') | ui/base/text/text_elider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698