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

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

Issue 779793006: MacViews: Use RenderTextHarfBuzz only for Textfields (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 #include <map> 8 #include <map>
9 9
10 #include "base/i18n/bidi_line_iterator.h" 10 #include "base/i18n/bidi_line_iterator.h"
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 } // namespace internal 581 } // namespace internal
582 582
583 RenderTextHarfBuzz::RenderTextHarfBuzz() 583 RenderTextHarfBuzz::RenderTextHarfBuzz()
584 : RenderText(), 584 : RenderText(),
585 needs_layout_(false) { 585 needs_layout_(false) {
586 set_truncate_length(kMaxTextLength); 586 set_truncate_length(kMaxTextLength);
587 } 587 }
588 588
589 RenderTextHarfBuzz::~RenderTextHarfBuzz() {} 589 RenderTextHarfBuzz::~RenderTextHarfBuzz() {}
590 590
591 scoped_ptr<RenderText> RenderTextHarfBuzz::NewInstance() const {
592 return scoped_ptr<RenderTextHarfBuzz>(new RenderTextHarfBuzz);
593 }
594
591 Size RenderTextHarfBuzz::GetStringSize() { 595 Size RenderTextHarfBuzz::GetStringSize() {
592 const SizeF size_f = GetStringSizeF(); 596 const SizeF size_f = GetStringSizeF();
593 return Size(std::ceil(size_f.width()), size_f.height()); 597 return Size(std::ceil(size_f.width()), size_f.height());
594 } 598 }
595 599
596 SizeF RenderTextHarfBuzz::GetStringSizeF() { 600 SizeF RenderTextHarfBuzz::GetStringSizeF() {
597 EnsureLayout(); 601 EnsureLayout();
598 return lines()[0].size; 602 return lines()[0].size;
599 } 603 }
600 604
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 if (!run->render_params.subpixel_positioning) 1238 if (!run->render_params.subpixel_positioning)
1235 run->width = std::floor(run->width + 0.5f); 1239 run->width = std::floor(run->width + 0.5f);
1236 } 1240 }
1237 1241
1238 hb_buffer_destroy(buffer); 1242 hb_buffer_destroy(buffer);
1239 hb_font_destroy(harfbuzz_font); 1243 hb_font_destroy(harfbuzz_font);
1240 return true; 1244 return true;
1241 } 1245 }
1242 1246
1243 } // namespace gfx 1247 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698