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

Unified Diff: ui/gfx/render_text_mac.cc

Issue 968923004: Use GetDisplayText() instead of text() for rendering text. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another fix Created 5 years, 10 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
Index: ui/gfx/render_text_mac.cc
diff --git a/ui/gfx/render_text_mac.cc b/ui/gfx/render_text_mac.cc
index 1c046648dc63220fcca566f1ec8c85a106cd3d5e..27f4d06d76d753f6e976b73f799c25e420465c8e 100644
--- a/ui/gfx/render_text_mac.cc
+++ b/ui/gfx/render_text_mac.cc
@@ -94,7 +94,7 @@ std::vector<Rect> RenderTextMac::GetSubstringBounds(const Range& range) {
size_t RenderTextMac::TextIndexToDisplayIndex(size_t index) {
// TODO(asvitkine): Implement this. http://crbug.com/131618
- return index;
+ return std::min(index, GetDisplayText().size());
}
size_t RenderTextMac::DisplayIndexToTextIndex(size_t index) {
@@ -148,7 +148,7 @@ void RenderTextMac::EnsureLayout() {
&kCFTypeDictionaryValueCallBacks));
base::ScopedCFTypeRef<CFStringRef> cf_text(
- base::SysUTF16ToCFStringRef(text()));
+ base::SysUTF16ToCFStringRef(GetDisplayText()));
base::ScopedCFTypeRef<CFAttributedStringRef> attr_text(
CFAttributedStringCreate(NULL, cf_text, attributes));
base::ScopedCFTypeRef<CFMutableAttributedStringRef> attr_text_mutable(

Powered by Google App Engine
This is Rietveld 408576698