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

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

Issue 326123003: RenderTextHarfBuzz: Decide run direction by BiDi embedding level (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gcc pls Created 6 years, 6 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
« no previous file with comments | « no previous file | ui/gfx/render_text_harfbuzz.cc » ('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 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 #ifndef UI_GFX_RENDER_TEXT_HARFBUZZ_H_ 5 #ifndef UI_GFX_RENDER_TEXT_HARFBUZZ_H_
6 #define UI_GFX_RENDER_TEXT_HARFBUZZ_H_ 6 #define UI_GFX_RENDER_TEXT_HARFBUZZ_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "third_party/harfbuzz-ng/src/hb.h" 10 #include "third_party/harfbuzz-ng/src/hb.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 bool strike; 54 bool strike;
55 bool diagonal_strike; 55 bool diagonal_strike;
56 bool underline; 56 bool underline;
57 57
58 private: 58 private:
59 DISALLOW_COPY_AND_ASSIGN(TextRunHarfBuzz); 59 DISALLOW_COPY_AND_ASSIGN(TextRunHarfBuzz);
60 }; 60 };
61 61
62 } // namespace internal 62 } // namespace internal
63 63
64 class RenderTextHarfBuzz : public RenderText { 64 class GFX_EXPORT RenderTextHarfBuzz : public RenderText {
65 public: 65 public:
66 RenderTextHarfBuzz(); 66 RenderTextHarfBuzz();
67 virtual ~RenderTextHarfBuzz(); 67 virtual ~RenderTextHarfBuzz();
68 68
69 // Overridden from RenderText. 69 // Overridden from RenderText.
70 virtual Size GetStringSize() OVERRIDE; 70 virtual Size GetStringSize() OVERRIDE;
71 virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE; 71 virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE;
72 virtual std::vector<FontSpan> GetFontSpansForTesting() OVERRIDE; 72 virtual std::vector<FontSpan> GetFontSpansForTesting() OVERRIDE;
73 73
74 protected: 74 protected:
75 // Overridden from RenderText. 75 // Overridden from RenderText.
76 virtual int GetLayoutTextBaseline() OVERRIDE; 76 virtual int GetLayoutTextBaseline() OVERRIDE;
77 virtual SelectionModel AdjacentCharSelectionModel( 77 virtual SelectionModel AdjacentCharSelectionModel(
78 const SelectionModel& selection, 78 const SelectionModel& selection,
79 VisualCursorDirection direction) OVERRIDE; 79 VisualCursorDirection direction) OVERRIDE;
80 virtual SelectionModel AdjacentWordSelectionModel( 80 virtual SelectionModel AdjacentWordSelectionModel(
81 const SelectionModel& selection, 81 const SelectionModel& selection,
82 VisualCursorDirection direction) OVERRIDE; 82 VisualCursorDirection direction) OVERRIDE;
83 virtual Range GetGlyphBounds(size_t index) OVERRIDE; 83 virtual Range GetGlyphBounds(size_t index) OVERRIDE;
84 virtual std::vector<Rect> GetSubstringBounds(const Range& range) OVERRIDE; 84 virtual std::vector<Rect> GetSubstringBounds(const Range& range) OVERRIDE;
85 virtual size_t TextIndexToLayoutIndex(size_t index) const OVERRIDE; 85 virtual size_t TextIndexToLayoutIndex(size_t index) const OVERRIDE;
86 virtual size_t LayoutIndexToTextIndex(size_t index) const OVERRIDE; 86 virtual size_t LayoutIndexToTextIndex(size_t index) const OVERRIDE;
87 virtual bool IsValidCursorIndex(size_t index) OVERRIDE; 87 virtual bool IsValidCursorIndex(size_t index) OVERRIDE;
88 virtual void ResetLayout() OVERRIDE; 88 virtual void ResetLayout() OVERRIDE;
89 virtual void EnsureLayout() OVERRIDE; 89 virtual void EnsureLayout() OVERRIDE;
90 virtual void DrawVisualText(Canvas* canvas) OVERRIDE; 90 virtual void DrawVisualText(Canvas* canvas) OVERRIDE;
91 91
92 private: 92 private:
93 friend class RenderTextTest;
94 FRIEND_TEST_ALL_PREFIXES(RenderTextTest, HarfBuzz_RunDirection);
95
93 // Return the run index that contains the argument; or the length of the 96 // Return the run index that contains the argument; or the length of the
94 // |runs_| vector if argument exceeds the text length or width. 97 // |runs_| vector if argument exceeds the text length or width.
95 size_t GetRunContainingCaret(const SelectionModel& caret) const; 98 size_t GetRunContainingCaret(const SelectionModel& caret) const;
96 size_t GetRunContainingXCoord(int x, int* offset) const; 99 size_t GetRunContainingXCoord(int x, int* offset) const;
97 100
98 // Given a |run|, returns the SelectionModel that contains the logical first 101 // Given a |run|, returns the SelectionModel that contains the logical first
99 // or last caret position inside (not at a boundary of) the run. 102 // or last caret position inside (not at a boundary of) the run.
100 // The returned value represents a cursor/caret position without a selection. 103 // The returned value represents a cursor/caret position without a selection.
101 SelectionModel FirstSelectionModelInsideRun( 104 SelectionModel FirstSelectionModelInsideRun(
102 const internal::TextRunHarfBuzz* run); 105 const internal::TextRunHarfBuzz* run);
(...skipping 14 matching lines...) Expand all
117 std::vector<int32_t> logical_to_visual_; 120 std::vector<int32_t> logical_to_visual_;
118 121
119 bool needs_layout_; 122 bool needs_layout_;
120 123
121 DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz); 124 DISALLOW_COPY_AND_ASSIGN(RenderTextHarfBuzz);
122 }; 125 };
123 126
124 } // namespace gfx 127 } // namespace gfx
125 128
126 #endif // UI_GFX_RENDER_TEXT_HARFBUZZ_H_ 129 #endif // UI_GFX_RENDER_TEXT_HARFBUZZ_H_
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/render_text_harfbuzz.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698