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

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

Issue 2817403002: [Omnibox] Elide omnibox text (Closed)
Patch Set: Reposition elide changing code Created 3 years, 8 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_unittest.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 #include "ui/gfx/render_text.h" 5 #include "ui/gfx/render_text.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <climits> 10 #include <climits>
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 min_line_height_ = line_height; 556 min_line_height_ = line_height;
557 cached_bounds_and_offset_valid_ = false; 557 cached_bounds_and_offset_valid_ = false;
558 lines_.clear(); 558 lines_.clear();
559 OnDisplayTextAttributeChanged(); 559 OnDisplayTextAttributeChanged();
560 } 560 }
561 561
562 void RenderText::SetElideBehavior(ElideBehavior elide_behavior) { 562 void RenderText::SetElideBehavior(ElideBehavior elide_behavior) {
563 // TODO(skanuj) : Add a test for triggering layout change. 563 // TODO(skanuj) : Add a test for triggering layout change.
564 if (elide_behavior_ != elide_behavior) { 564 if (elide_behavior_ != elide_behavior) {
565 elide_behavior_ = elide_behavior; 565 elide_behavior_ = elide_behavior;
566 lines_.clear();
msw 2017/04/17 22:39:10 Hmm, I'm a little surprised this isn't already han
simonhong 2017/04/17 23:21:43 UpdateDisplayText() didn't handled it properly. In
566 OnDisplayTextAttributeChanged(); 567 OnDisplayTextAttributeChanged();
567 } 568 }
568 } 569 }
569 570
570 void RenderText::SetDisplayRect(const Rect& r) { 571 void RenderText::SetDisplayRect(const Rect& r) {
571 if (r != display_rect_) { 572 if (r != display_rect_) {
572 display_rect_ = r; 573 display_rect_ = r;
573 baseline_ = kInvalidBaseline; 574 baseline_ = kInvalidBaseline;
574 cached_bounds_and_offset_valid_ = false; 575 cached_bounds_and_offset_valid_ = false;
575 lines_.clear(); 576 lines_.clear();
(...skipping 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1696 1697
1697 for (; range_max < length; ++range_max) 1698 for (; range_max < length; ++range_max)
1698 if (iter.IsEndOfWord(range_max) || iter.IsStartOfWord(range_max)) 1699 if (iter.IsEndOfWord(range_max) || iter.IsStartOfWord(range_max))
1699 break; 1700 break;
1700 1701
1701 return range.is_reversed() ? Range(range_max, range_min) 1702 return range.is_reversed() ? Range(range_max, range_min)
1702 : Range(range_min, range_max); 1703 : Range(range_min, range_max);
1703 } 1704 }
1704 1705
1705 } // namespace gfx 1706 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/render_text.h ('k') | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698