| OLD | NEW |
| 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_WIN_H_ | 5 #ifndef UI_GFX_RENDER_TEXT_WIN_H_ |
| 6 #define UI_GFX_RENDER_TEXT_WIN_H_ | 6 #define UI_GFX_RENDER_TEXT_WIN_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <usp10.h> | 9 #include <usp10.h> |
| 10 | 10 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } // namespace internal | 60 } // namespace internal |
| 61 | 61 |
| 62 // RenderTextWin is the Windows implementation of RenderText using Uniscribe. | 62 // RenderTextWin is the Windows implementation of RenderText using Uniscribe. |
| 63 class RenderTextWin : public RenderText { | 63 class RenderTextWin : public RenderText { |
| 64 public: | 64 public: |
| 65 RenderTextWin(); | 65 RenderTextWin(); |
| 66 virtual ~RenderTextWin(); | 66 virtual ~RenderTextWin(); |
| 67 | 67 |
| 68 // Overridden from RenderText: | 68 // Overridden from RenderText: |
| 69 virtual base::i18n::TextDirection GetTextDirection() OVERRIDE; | 69 virtual base::i18n::TextDirection GetTextDirection() OVERRIDE; |
| 70 virtual int GetStringWidth() OVERRIDE; | 70 virtual Size GetStringSize() OVERRIDE; |
| 71 virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE; | 71 virtual SelectionModel FindCursorPosition(const Point& point) OVERRIDE; |
| 72 virtual Rect GetCursorBounds(const SelectionModel& selection, | |
| 73 bool insert_mode) OVERRIDE; | |
| 74 | 72 |
| 75 protected: | 73 protected: |
| 76 // Overridden from RenderText: | 74 // Overridden from RenderText: |
| 77 virtual SelectionModel AdjacentCharSelectionModel( | 75 virtual SelectionModel AdjacentCharSelectionModel( |
| 78 const SelectionModel& selection, | 76 const SelectionModel& selection, |
| 79 VisualCursorDirection direction) OVERRIDE; | 77 VisualCursorDirection direction) OVERRIDE; |
| 80 virtual SelectionModel AdjacentWordSelectionModel( | 78 virtual SelectionModel AdjacentWordSelectionModel( |
| 81 const SelectionModel& selection, | 79 const SelectionModel& selection, |
| 82 VisualCursorDirection direction) OVERRIDE; | 80 VisualCursorDirection direction) OVERRIDE; |
| 83 virtual SelectionModel EdgeSelectionModel( | 81 virtual void GetGlyphBounds(size_t index, |
| 84 VisualCursorDirection direction) OVERRIDE; | 82 ui::Range* xspan, |
| 85 virtual std::vector<Rect> GetSubstringBounds(size_t from, size_t to) OVERRIDE; | 83 int* height) OVERRIDE; |
| 84 virtual std::vector<Rect> GetSubstringBounds(ui::Range range) OVERRIDE; |
| 86 virtual void SetSelectionModel(const SelectionModel& model) OVERRIDE; | 85 virtual void SetSelectionModel(const SelectionModel& model) OVERRIDE; |
| 87 virtual bool IsCursorablePosition(size_t position) OVERRIDE; | 86 virtual bool IsCursorablePosition(size_t position) OVERRIDE; |
| 88 virtual void UpdateLayout() OVERRIDE; | 87 virtual void UpdateLayout() OVERRIDE; |
| 89 virtual void EnsureLayout() OVERRIDE; | 88 virtual void EnsureLayout() OVERRIDE; |
| 90 virtual void DrawVisualText(Canvas* canvas) OVERRIDE; | 89 virtual void DrawVisualText(Canvas* canvas) OVERRIDE; |
| 91 | 90 |
| 92 private: | 91 private: |
| 93 virtual size_t IndexOfAdjacentGrapheme( | 92 virtual size_t IndexOfAdjacentGrapheme( |
| 94 size_t index, | 93 size_t index, |
| 95 LogicalCursorDirection direction) OVERRIDE; | 94 LogicalCursorDirection direction) OVERRIDE; |
| 96 | 95 |
| 97 void ItemizeLogicalText(); | 96 void ItemizeLogicalText(); |
| 98 void LayoutVisualText(); | 97 void LayoutVisualText(); |
| 99 | 98 |
| 100 // Returns a vector of linked fonts corresponding to |font|. | 99 // Returns a vector of linked fonts corresponding to |font|. |
| 101 const std::vector<Font>* GetLinkedFonts(const Font& font) const; | 100 const std::vector<Font>* GetLinkedFonts(const Font& font) const; |
| 102 | 101 |
| 103 // Return the run index that contains the argument; or the length of the | 102 // Return the run index that contains the argument; or the length of the |
| 104 // |runs_| vector if argument exceeds the text length or width. | 103 // |runs_| vector if argument exceeds the text length or width. |
| 105 size_t GetRunContainingPosition(size_t position) const; | 104 size_t GetRunContainingCaret(const SelectionModel& caret) const; |
| 106 size_t GetRunContainingPoint(const Point& point) const; | 105 size_t GetRunContainingPoint(const Point& point) const; |
| 107 | 106 |
| 108 // Given a |run|, returns the SelectionModel that contains the logical first | 107 // Given a |run|, returns the SelectionModel that contains the logical first |
| 109 // or last caret position inside (not at a boundary of) the run. | 108 // or last caret position inside (not at a boundary of) the run. |
| 110 // The returned value represents a cursor/caret position without a selection. | 109 // The returned value represents a cursor/caret position without a selection. |
| 111 SelectionModel FirstSelectionModelInsideRun(internal::TextRun* run); | 110 SelectionModel FirstSelectionModelInsideRun(internal::TextRun* run); |
| 112 SelectionModel LastSelectionModelInsideRun(internal::TextRun* run); | 111 SelectionModel LastSelectionModelInsideRun(internal::TextRun* run); |
| 113 | 112 |
| 114 // Cached HDC for performing Uniscribe API calls. | 113 // Cached HDC for performing Uniscribe API calls. |
| 115 static HDC cached_hdc_; | 114 static HDC cached_hdc_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 127 scoped_array<int> logical_to_visual_; | 126 scoped_array<int> logical_to_visual_; |
| 128 | 127 |
| 129 bool needs_layout_; | 128 bool needs_layout_; |
| 130 | 129 |
| 131 DISALLOW_COPY_AND_ASSIGN(RenderTextWin); | 130 DISALLOW_COPY_AND_ASSIGN(RenderTextWin); |
| 132 }; | 131 }; |
| 133 | 132 |
| 134 } // namespace gfx | 133 } // namespace gfx |
| 135 | 134 |
| 136 #endif // UI_GFX_RENDER_TEXT_WIN_H_ | 135 #endif // UI_GFX_RENDER_TEXT_WIN_H_ |
| OLD | NEW |