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

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

Issue 351963002: RenderTextHarfBuzz: Allow mid-glyph cursors in multi-grapheme clusters (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments addressed Created 6 years, 4 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 | Annotate | Revision Log
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 #ifndef UI_GFX_RENDER_TEXT_H_ 5 #ifndef UI_GFX_RENDER_TEXT_H_
6 #define UI_GFX_RENDER_TEXT_H_ 6 #define UI_GFX_RENDER_TEXT_H_
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <cstring> 9 #include <cstring>
10 #include <string> 10 #include <string>
(...skipping 19 matching lines...) Expand all
30 #include "ui/gfx/size_f.h" 30 #include "ui/gfx/size_f.h"
31 #include "ui/gfx/text_constants.h" 31 #include "ui/gfx/text_constants.h"
32 #include "ui/gfx/vector2d.h" 32 #include "ui/gfx/vector2d.h"
33 33
34 class SkCanvas; 34 class SkCanvas;
35 class SkDrawLooper; 35 class SkDrawLooper;
36 struct SkPoint; 36 struct SkPoint;
37 class SkShader; 37 class SkShader;
38 class SkTypeface; 38 class SkTypeface;
39 39
40 namespace base {
41 namespace i18n {
42 class BreakIterator;
43 }
44 }
45
40 namespace gfx { 46 namespace gfx {
41 47
42 class Canvas; 48 class Canvas;
43 class Font; 49 class Font;
44 class RenderTextTest; 50 class RenderTextTest;
45 51
46 namespace internal { 52 namespace internal {
47 53
48 // Internal helper class used by derived classes to draw text through Skia. 54 // Internal helper class used by derived classes to draw text through Skia.
49 class SkiaTextRenderer { 55 class SkiaTextRenderer {
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 431
426 protected: 432 protected:
427 RenderText(); 433 RenderText();
428 434
429 const BreakList<SkColor>& colors() const { return colors_; } 435 const BreakList<SkColor>& colors() const { return colors_; }
430 const std::vector<BreakList<bool> >& styles() const { return styles_; } 436 const std::vector<BreakList<bool> >& styles() const { return styles_; }
431 437
432 const std::vector<internal::Line>& lines() const { return lines_; } 438 const std::vector<internal::Line>& lines() const { return lines_; }
433 void set_lines(std::vector<internal::Line>* lines) { lines_.swap(*lines); } 439 void set_lines(std::vector<internal::Line>* lines) { lines_.swap(*lines); }
434 440
441 base::i18n::BreakIterator* grapheme_iterator() {
442 return grapheme_iterator_.get();
msw 2014/07/25 00:37:00 nit: fix indent
ckocagil 2014/07/29 23:13:41 Done.
443 }
444
435 // Returns the baseline of the current text. The return value depends on 445 // Returns the baseline of the current text. The return value depends on
436 // the text and its layout while the return value of GetBaseline() doesn't. 446 // the text and its layout while the return value of GetBaseline() doesn't.
437 // GetAlignmentOffset() takes into account the difference between them. 447 // GetAlignmentOffset() takes into account the difference between them.
438 // 448 //
439 // We'd like a RenderText to show the text always on the same baseline 449 // We'd like a RenderText to show the text always on the same baseline
440 // regardless of the text, so the text does not jump up or down depending 450 // regardless of the text, so the text does not jump up or down depending
441 // on the text. However, underlying layout engines return different baselines 451 // on the text. However, underlying layout engines return different baselines
442 // depending on the text. In general, layout engines determine the minimum 452 // depending on the text. In general, layout engines determine the minimum
443 // bounding box for the text and return the baseline from the top of the 453 // bounding box for the text and return the baseline from the top of the
444 // bounding box. So the baseline changes depending on font metrics used to 454 // bounding box. So the baseline changes depending on font metrics used to
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 // Text shadows to be drawn. 708 // Text shadows to be drawn.
699 ShadowValues shadows_; 709 ShadowValues shadows_;
700 710
701 // A list of valid layout text line break positions. 711 // A list of valid layout text line break positions.
702 BreakList<size_t> line_breaks_; 712 BreakList<size_t> line_breaks_;
703 713
704 // Lines computed by EnsureLayout. These should be invalidated with 714 // Lines computed by EnsureLayout. These should be invalidated with
705 // ResetLayout and on |display_rect_| changes. 715 // ResetLayout and on |display_rect_| changes.
706 std::vector<internal::Line> lines_; 716 std::vector<internal::Line> lines_;
707 717
718 // ICU grapheme iterator for the layout text. Can be NULL in case of an error.
719 scoped_ptr<base::i18n::BreakIterator> grapheme_iterator_;
msw 2014/07/25 00:37:00 Move this to RenderTextHarfBuzz if it's only used
ckocagil 2014/07/29 23:13:41 Done.
720
708 DISALLOW_COPY_AND_ASSIGN(RenderText); 721 DISALLOW_COPY_AND_ASSIGN(RenderText);
709 }; 722 };
710 723
711 } // namespace gfx 724 } // namespace gfx
712 725
713 #endif // UI_GFX_RENDER_TEXT_H_ 726 #endif // UI_GFX_RENDER_TEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698