diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-20 21:21:14 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-20 21:21:14 +0000 |
commit | aa351ca8d4ec607d94b1559bb78b46d8301daf1b (patch) | |
tree | fad1e2da20e07f483ff3a45ddc4c79a9fc8cccdb /ui/gfx/render_text_win.h | |
parent | 9edeb71c75df9eed63d4e27e90c2ddfc287049b8 (diff) | |
download | chromium_src-aa351ca8d4ec607d94b1559bb78b46d8301daf1b.zip chromium_src-aa351ca8d4ec607d94b1559bb78b46d8301daf1b.tar.gz chromium_src-aa351ca8d4ec607d94b1559bb78b46d8301daf1b.tar.bz2 |
Revert 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
TBR=xji@google.com
Review URL: http://codereview.chromium.org/7982013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102020 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, 7 insertions, 5 deletions
diff --git a/ui/gfx/render_text_win.h b/ui/gfx/render_text_win.h index 53eea69..d812f50 100644 --- a/ui/gfx/render_text_win.h +++ b/ui/gfx/render_text_win.h @@ -72,12 +72,10 @@ 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); @@ -86,11 +84,15 @@ 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*); - SelectionModel LastSelectionModelInsideRun(internal::TextRun*); + SelectionModel FirstSelectionModelInsideRun(internal::TextRun*) const; + SelectionModel LastSelectionModelInsideRun(internal::TextRun*) const; // Get the selection model visually left/right of |selection| by one grapheme. // The returned value represents a cursor/caret position without a selection. |