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

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

Issue 924773002: Fix multiline behaviors for RTL text. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/gfx/render_text_harfbuzz.h » ('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 #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 27 matching lines...) Expand all
38 38
39 namespace gfx { 39 namespace gfx {
40 40
41 class Canvas; 41 class Canvas;
42 class Font; 42 class Font;
43 class RenderTextTest; 43 class RenderTextTest;
44 44
45 namespace internal { 45 namespace internal {
46 46
47 // Internal helper class used by derived classes to draw text through Skia. 47 // Internal helper class used by derived classes to draw text through Skia.
48 class SkiaTextRenderer { 48 class GFX_EXPORT SkiaTextRenderer {
49 public: 49 public:
50 explicit SkiaTextRenderer(Canvas* canvas); 50 explicit SkiaTextRenderer(Canvas* canvas);
51 ~SkiaTextRenderer(); 51 virtual ~SkiaTextRenderer();
52 52
53 void SetDrawLooper(SkDrawLooper* draw_looper); 53 void SetDrawLooper(SkDrawLooper* draw_looper);
54 void SetFontRenderParams(const FontRenderParams& params, 54 void SetFontRenderParams(const FontRenderParams& params,
55 bool background_is_transparent); 55 bool background_is_transparent);
56 void SetTypeface(SkTypeface* typeface); 56 void SetTypeface(SkTypeface* typeface);
57 void SetTextSize(SkScalar size); 57 void SetTextSize(SkScalar size);
58 void SetFontFamilyWithStyle(const std::string& family, int font_style); 58 void SetFontFamilyWithStyle(const std::string& family, int font_style);
59 void SetForegroundColor(SkColor foreground); 59 void SetForegroundColor(SkColor foreground);
60 void SetShader(SkShader* shader); 60 void SetShader(SkShader* shader);
61 // Sets underline metrics to use if the text will be drawn with an underline. 61 // Sets underline metrics to use if the text will be drawn with an underline.
62 // If not set, default values based on the size of the text will be used. The 62 // If not set, default values based on the size of the text will be used. The
63 // two metrics must be set together. 63 // two metrics must be set together.
64 void SetUnderlineMetrics(SkScalar thickness, SkScalar position); 64 void SetUnderlineMetrics(SkScalar thickness, SkScalar position);
65 void DrawSelection(const std::vector<Rect>& selection, SkColor color); 65 void DrawSelection(const std::vector<Rect>& selection, SkColor color);
66 void DrawPosText(const SkPoint* pos, 66 virtual void DrawPosText(const SkPoint* pos,
67 const uint16* glyphs, 67 const uint16* glyphs,
68 size_t glyph_count); 68 size_t glyph_count);
69 // Draw underline and strike-through text decorations. 69 // Draw underline and strike-through text decorations.
70 // Based on |SkCanvas::DrawTextDecorations()| and constants from: 70 // Based on |SkCanvas::DrawTextDecorations()| and constants from:
71 // third_party/skia/src/core/SkTextFormatParams.h 71 // third_party/skia/src/core/SkTextFormatParams.h
72 void DrawDecorations(int x, int y, int width, bool underline, bool strike, 72 virtual void DrawDecorations(int x, int y, int width, bool underline,
73 bool diagonal_strike); 73 bool strike, bool diagonal_strike);
74 // Finishes any ongoing diagonal strike run. 74 // Finishes any ongoing diagonal strike run.
75 void EndDiagonalStrike(); 75 void EndDiagonalStrike();
76 void DrawUnderline(int x, int y, int width); 76 void DrawUnderline(int x, int y, int width);
77 void DrawStrike(int x, int y, int width) const; 77 void DrawStrike(int x, int y, int width) const;
78 78
79 private: 79 private:
80 // Helper class to draw a diagonal line with multiple pieces of different 80 // Helper class to draw a diagonal line with multiple pieces of different
81 // lengths and colors; to support text selection appearances. 81 // lengths and colors; to support text selection appearances.
82 class DiagonalStrike { 82 class DiagonalStrike {
83 public: 83 public:
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 // Lines computed by EnsureLayout. These should be invalidated upon 766 // Lines computed by EnsureLayout. These should be invalidated upon
767 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls. 767 // OnLayoutTextAttributeChanged and OnDisplayTextAttributeChanged calls.
768 std::vector<internal::Line> lines_; 768 std::vector<internal::Line> lines_;
769 769
770 DISALLOW_COPY_AND_ASSIGN(RenderText); 770 DISALLOW_COPY_AND_ASSIGN(RenderText);
771 }; 771 };
772 772
773 } // namespace gfx 773 } // namespace gfx
774 774
775 #endif // UI_GFX_RENDER_TEXT_H_ 775 #endif // UI_GFX_RENDER_TEXT_H_
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/render_text_harfbuzz.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698