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

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

Issue 867003002: Cache gfx::RenderText instances in views::Label. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_harfbuzz.h" 5 #include "ui/gfx/render_text_harfbuzz.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/i18n/bidi_line_iterator.h" 9 #include "base/i18n/bidi_line_iterator.h"
10 #include "base/i18n/break_iterator.h" 10 #include "base/i18n/break_iterator.h"
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 glyph_width_for_test_(0u) { 627 glyph_width_for_test_(0u) {
628 set_truncate_length(kMaxTextLength); 628 set_truncate_length(kMaxTextLength);
629 } 629 }
630 630
631 RenderTextHarfBuzz::~RenderTextHarfBuzz() {} 631 RenderTextHarfBuzz::~RenderTextHarfBuzz() {}
632 632
633 scoped_ptr<RenderText> RenderTextHarfBuzz::CreateInstanceOfSameType() const { 633 scoped_ptr<RenderText> RenderTextHarfBuzz::CreateInstanceOfSameType() const {
634 return make_scoped_ptr(new RenderTextHarfBuzz); 634 return make_scoped_ptr(new RenderTextHarfBuzz);
635 } 635 }
636 636
637 bool RenderTextHarfBuzz::MultilineSupported() const {
638 return true;
639 }
640
637 const base::string16& RenderTextHarfBuzz::GetDisplayText() { 641 const base::string16& RenderTextHarfBuzz::GetDisplayText() {
638 // TODO(oshima): Consider supporting eliding multi-line text. 642 // TODO(oshima): Consider supporting eliding multi-line text.
639 // This requires max_line support first. 643 // This requires max_line support first.
640 if (multiline() || 644 if (multiline() ||
641 elide_behavior() == NO_ELIDE || 645 elide_behavior() == NO_ELIDE ||
642 elide_behavior() == FADE_TAIL) { 646 elide_behavior() == FADE_TAIL) {
643 // Call UpdateDisplayText to clear |display_text_| and |text_elided_| 647 // Call UpdateDisplayText to clear |display_text_| and |text_elided_|
644 // on the RenderText class. 648 // on the RenderText class.
645 UpdateDisplayText(0); 649 UpdateDisplayText(0);
646 update_display_text_ = false; 650 update_display_text_ = false;
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 DCHECK(!update_layout_run_list_); 1472 DCHECK(!update_layout_run_list_);
1469 DCHECK(!update_display_run_list_); 1473 DCHECK(!update_display_run_list_);
1470 return text_elided() ? display_run_list_.get() : &layout_run_list_; 1474 return text_elided() ? display_run_list_.get() : &layout_run_list_;
1471 } 1475 }
1472 1476
1473 const internal::TextRunList* RenderTextHarfBuzz::GetRunList() const { 1477 const internal::TextRunList* RenderTextHarfBuzz::GetRunList() const {
1474 return const_cast<RenderTextHarfBuzz*>(this)->GetRunList(); 1478 return const_cast<RenderTextHarfBuzz*>(this)->GetRunList();
1475 } 1479 }
1476 1480
1477 } // namespace gfx 1481 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698