diff options
author | ckocagil@chromium.org <ckocagil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-29 01:19:19 +0000 |
---|---|---|
committer | ckocagil@chromium.org <ckocagil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-29 01:19:19 +0000 |
commit | 1b8f8cd4545168b1b36b5ae066acc06e17963650 (patch) | |
tree | 8146072c3dca7ff21953cf1d8b81d92d6200ff91 /ui/gfx/break_list.h | |
parent | edc9183c42f56dbdedafb6455bb6ac71c97d7faf (diff) | |
download | chromium_src-1b8f8cd4545168b1b36b5ae066acc06e17963650.zip chromium_src-1b8f8cd4545168b1b36b5ae066acc06e17963650.tar.gz chromium_src-1b8f8cd4545168b1b36b5ae066acc06e17963650.tar.bz2 |
Re-land: Colors shouldn't break runs and should be handled while drawing the text
Previous CL: https://codereview.chromium.org/19672006/ http://crrev.com/212778
BUG=262119, 256908
TEST=In a views textfield, selecting half of a ligature shouldn't break the ligature. See http://www.catch22.net/tuts/uniscribe-mysteries in Firefox for an example of how it used to look versus how it is supposed to look.
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/20241002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@214150 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/break_list.h')
-rw-r--r-- | ui/gfx/break_list.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ui/gfx/break_list.h b/ui/gfx/break_list.h index c380222..770386e 100644 --- a/ui/gfx/break_list.h +++ b/ui/gfx/break_list.h @@ -47,6 +47,7 @@ class BreakList { // Get the break applicable to |position| (at or preceeding |position|). typename std::vector<Break>::iterator GetBreak(size_t position); + typename std::vector<Break>::const_iterator GetBreak(size_t position) const; // Get the range of the supplied break; returns the break's start position and // the next break's start position (or |max_| for the terminal break). @@ -126,6 +127,14 @@ typename std::vector<std::pair<size_t, T> >::iterator BreakList<T>::GetBreak( } template<class T> +typename std::vector<std::pair<size_t, T> >::const_iterator + BreakList<T>::GetBreak(size_t position) const { + typename std::vector<Break>::const_iterator i = breaks_.end() - 1; + for (; i != breaks_.begin() && i->first > position; --i); + return i; +} + +template<class T> ui::Range BreakList<T>::GetRange( const typename BreakList<T>::const_iterator& i) const { const typename BreakList<T>::const_iterator next = i + 1; |