diff options
author | xji@google.com <xji@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-21 20:32:29 +0000 |
---|---|---|
committer | xji@google.com <xji@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-21 20:32:29 +0000 |
commit | 53c0b1ba80612d92849dc02e2e7a1aa97df0e6a1 (patch) | |
tree | 28201e71c8163fc73b4b849925bdf87d51bf1636 /ui/gfx/render_text_win.h | |
parent | df09e1b4e119de37af4226a20cd745c209b75f70 (diff) | |
download | chromium_src-53c0b1ba80612d92849dc02e2e7a1aa97df0e6a1.zip chromium_src-53c0b1ba80612d92849dc02e2e7a1aa97df0e6a1.tar.gz chromium_src-53c0b1ba80612d92849dc02e2e7a1aa97df0e6a1.tar.bz2 |
This is a reapply of
http://src.chromium.org/viewvc/chrome?view=rev&revision=102006
fix know issues in RenderText
1. add tests.
2. change SelectWord() to use BreakIterator, so it works for Chinese and Complex script.
3. DELETE/ReplaceChar delete/replace a whole grapheme. ReplaceTextInternal should only replace one grapheme when there is no selection.
4. pointing to position outside of text returns HOME/END position.
5. based on Chrome Linux omnibox and gedit, given
"abc| def", double click should select " " instead of "abc". Change test expectation.
BUG=90426
TEST=compile with touchui=1 test omnibox. run views_unittests.NativeTextfieldViewsTest/TextfieldViewsModelTest
Review URL: http://codereview.chromium.org/7841056
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102160 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/render_text_win.h')
-rw-r--r-- | ui/gfx/render_text_win.h | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/ui/gfx/render_text_win.h b/ui/gfx/render_text_win.h index d812f50..53eea69 100644 --- a/ui/gfx/render_text_win.h +++ b/ui/gfx/render_text_win.h @@ -72,10 +72,12 @@ class RenderTextWin : public RenderText { BreakType break_type) OVERRIDE; virtual SelectionModel LeftEndSelectionModel() OVERRIDE; virtual SelectionModel RightEndSelectionModel() OVERRIDE; - virtual size_t GetIndexOfPreviousGrapheme(size_t position) OVERRIDE; virtual std::vector<Rect> GetSubstringBounds(size_t from, size_t to) OVERRIDE; + virtual bool IsCursorablePosition(size_t position) OVERRIDE; private: + virtual size_t IndexOfAdjacentGrapheme(size_t index, bool next) OVERRIDE; + void ItemizeLogicalText(); void LayoutVisualText(HDC hdc); @@ -84,15 +86,11 @@ class RenderTextWin : public RenderText { size_t GetRunContainingPosition(size_t position) const; size_t GetRunContainingPoint(const Point& point) const; - // Return an index belonging to the |next| or previous logical grapheme. - // The return value is bounded by 0 and the text length, inclusive. - size_t IndexOfAdjacentGrapheme(size_t index, bool next) const; - // Given a |run|, returns the SelectionModel that contains the logical first // or last caret position inside (not at a boundary of) the run. // The returned value represents a cursor/caret position without a selection. - SelectionModel FirstSelectionModelInsideRun(internal::TextRun*) const; - SelectionModel LastSelectionModelInsideRun(internal::TextRun*) const; + SelectionModel FirstSelectionModelInsideRun(internal::TextRun*); + SelectionModel LastSelectionModelInsideRun(internal::TextRun*); // Get the selection model visually left/right of |selection| by one grapheme. // The returned value represents a cursor/caret position without a selection. |