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

Side by Side Diff: third_party/WebKit/Source/platform/fonts/shaping/SimpleShaper.cpp

Issue 1394833002: Find In Page doesn't correctly highlight wrapped text. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/shaping/SimpleShaper.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2006, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2003, 2006, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 Holger Hans Peter Freyther 3 * Copyright (C) 2008 Holger Hans Peter Freyther
4 * Copyright (C) 2014 Google Inc. All rights reserved. 4 * Copyright (C) 2014 Google Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 textIterator.advance(); 188 textIterator.advance();
189 m_runWidthSoFar += width; 189 m_runWidthSoFar += width;
190 } 190 }
191 191
192 unsigned consumedCharacters = textIterator.offset() - m_currentCharacter; 192 unsigned consumedCharacters = textIterator.offset() - m_currentCharacter;
193 m_currentCharacter = textIterator.offset(); 193 m_currentCharacter = textIterator.offset();
194 194
195 return consumedCharacters; 195 return consumedCharacters;
196 } 196 }
197 197
198 unsigned SimpleShaper::advance(unsigned offset, GlyphBuffer* glyphBuffer) 198 unsigned SimpleShaper::advance(int offset, GlyphBuffer* glyphBuffer)
199 { 199 {
200 unsigned length = m_textRun.length(); 200 int length = m_textRun.length();
201 201
202 if (offset > length) 202 if (offset > length)
203 offset = length; 203 offset = length;
204 204
205 if (m_currentCharacter >= offset) 205 if (m_currentCharacter >= static_cast<unsigned>(offset))
206 return 0; 206 return 0;
207 207
208 if (m_textRun.is8Bit()) { 208 if (m_textRun.is8Bit()) {
209 Latin1TextIterator textIterator(m_textRun.data8(m_currentCharacter), m_c urrentCharacter, offset); 209 Latin1TextIterator textIterator(m_textRun.data8(m_currentCharacter), m_c urrentCharacter, offset);
210 return advanceInternal(textIterator, glyphBuffer); 210 return advanceInternal(textIterator, glyphBuffer);
211 } 211 }
212 212
213 UTF16TextIterator textIterator(m_textRun.data16(m_currentCharacter), m_curre ntCharacter, offset, length); 213 UTF16TextIterator textIterator(m_textRun.data16(m_currentCharacter), m_curre ntCharacter, offset, length);
214 return advanceInternal(textIterator, glyphBuffer); 214 return advanceInternal(textIterator, glyphBuffer);
215 } 215 }
216 216
217 bool SimpleShaper::advanceOneCharacter(float& width) 217 bool SimpleShaper::advanceOneCharacter(float& width)
218 { 218 {
219 float initialWidth = m_runWidthSoFar; 219 float initialWidth = m_runWidthSoFar;
220 220
221 if (!advance(m_currentCharacter + 1)) 221 if (!advance(m_currentCharacter + 1))
222 return false; 222 return false;
223 223
224 width = m_runWidthSoFar - initialWidth; 224 width = m_runWidthSoFar - initialWidth;
225 return true; 225 return true;
226 } 226 }
227 227
228 } // namespace blink 228 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/shaping/SimpleShaper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698