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

Side by Side Diff: ui/gfx/render_text.cc

Issue 965393003: alternative tracing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20150303-RenderText-Goo
Patch Set: Created 5 years, 9 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 | « ui/gfx/render_text.h ('k') | ui/gfx/render_text_mac.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 #include "ui/gfx/render_text.h" 5 #include "ui/gfx/render_text.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <climits> 8 #include <climits>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 } 964 }
965 965
966 void RenderText::UpdateDisplayText(float text_width) { 966 void RenderText::UpdateDisplayText(float text_width) {
967 // TODO(oshima): Consider support eliding for multi-line text. 967 // TODO(oshima): Consider support eliding for multi-line text.
968 // This requires max_line support first. 968 // This requires max_line support first.
969 if (multiline_ || 969 if (multiline_ ||
970 elide_behavior() == NO_ELIDE || 970 elide_behavior() == NO_ELIDE ||
971 elide_behavior() == FADE_TAIL || 971 elide_behavior() == FADE_TAIL ||
972 text_width < display_rect_.width() || 972 text_width < display_rect_.width() ||
973 layout_text_.empty()) { 973 layout_text_.empty()) {
974 DLOG(INFO) << "elided being set FALSE!";
974 text_elided_ = false; 975 text_elided_ = false;
975 display_text_.clear(); 976 display_text_.clear();
976 return; 977 return;
977 } 978 }
978 979
979 // This doesn't trim styles so ellipsis may get rendered as a different 980 // This doesn't trim styles so ellipsis may get rendered as a different
980 // style than the preceding text. See crbug.com/327850. 981 // style than the preceding text. See crbug.com/327850.
981 display_text_.assign(Elide(layout_text_, 982 display_text_.assign(Elide(layout_text_,
982 text_width, 983 text_width,
983 static_cast<float>(display_rect_.width()), 984 static_cast<float>(display_rect_.width()),
984 elide_behavior_)); 985 elide_behavior_));
985 986
987
986 text_elided_ = display_text_ != layout_text_; 988 text_elided_ = display_text_ != layout_text_;
989 DLOG(INFO) << "Elided: " << text_elided_ << " w=" << text_width << ", " << dis play_rect_.width() << " , " << layout_text_ << ", " << display_text_;
987 if (!text_elided_) 990 if (!text_elided_)
988 display_text_.clear(); 991 display_text_.clear();
989 } 992 }
990 993
991 const BreakList<size_t>& RenderText::GetLineBreaks() { 994 const BreakList<size_t>& RenderText::GetLineBreaks() {
992 if (line_breaks_.max() != 0) 995 if (line_breaks_.max() != 0)
993 return line_breaks_; 996 return line_breaks_;
994 997
995 const base::string16& layout_text = GetDisplayText(); 998 const base::string16& layout_text = GetDisplayText();
996 const size_t text_length = layout_text.length(); 999 const size_t text_length = layout_text.length();
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 1467
1465 SetDisplayOffset(display_offset_.x() + delta_x); 1468 SetDisplayOffset(display_offset_.x() + delta_x);
1466 } 1469 }
1467 1470
1468 void RenderText::DrawSelection(Canvas* canvas) { 1471 void RenderText::DrawSelection(Canvas* canvas) {
1469 for (const Rect& s : GetSubstringBounds(selection())) 1472 for (const Rect& s : GetSubstringBounds(selection()))
1470 canvas->FillRect(s, selection_background_focused_color_); 1473 canvas->FillRect(s, selection_background_focused_color_);
1471 } 1474 }
1472 1475
1473 } // namespace gfx 1476 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/render_text.h ('k') | ui/gfx/render_text_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698