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

Side by Side Diff: Source/core/platform/graphics/mac/ComplexTextController.cpp

Issue 23618052: TextBreakIterator should use the C++ icu API instead of the C one (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Downcast to icu::RuleBasedBreakIterator Created 7 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 | « Source/core/page/TouchAdjustment.cpp ('k') | Source/core/rendering/RenderText.cpp » ('j') | 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) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 else 199 else
200 hitGlyphEnd = max<CFIndex>(hitGlyphStart, j > 0 ? complexTex tRun.indexAt(j - 1) : static_cast<CFIndex>(complexTextRun.indexEnd())); 200 hitGlyphEnd = max<CFIndex>(hitGlyphStart, j > 0 ? complexTex tRun.indexAt(j - 1) : static_cast<CFIndex>(complexTextRun.indexEnd()));
201 201
202 // FIXME: Instead of dividing the glyph's advance equally betwee n the characters, this 202 // FIXME: Instead of dividing the glyph's advance equally betwee n the characters, this
203 // could use the glyph's "ligature carets". However, there is no Core Text API to get the 203 // could use the glyph's "ligature carets". However, there is no Core Text API to get the
204 // ligature carets. 204 // ligature carets.
205 CFIndex hitIndex = hitGlyphStart + (hitGlyphEnd - hitGlyphStart) * (m_run.ltr() ? x / adjustedAdvance : 1 - x / adjustedAdvance); 205 CFIndex hitIndex = hitGlyphStart + (hitGlyphEnd - hitGlyphStart) * (m_run.ltr() ? x / adjustedAdvance : 1 - x / adjustedAdvance);
206 int stringLength = complexTextRun.stringLength(); 206 int stringLength = complexTextRun.stringLength();
207 TextBreakIterator* cursorPositionIterator = cursorMovementIterat or(complexTextRun.characters(), stringLength); 207 TextBreakIterator* cursorPositionIterator = cursorMovementIterat or(complexTextRun.characters(), stringLength);
208 int clusterStart; 208 int clusterStart;
209 if (isTextBreak(cursorPositionIterator, hitIndex)) 209 if (cursorPositionIterator->isBoundary(hitIndex))
210 clusterStart = hitIndex; 210 clusterStart = hitIndex;
211 else { 211 else {
212 clusterStart = textBreakPreceding(cursorPositionIterator, hi tIndex); 212 clusterStart = cursorPositionIterator->preceding(hitIndex);
213 if (clusterStart == TextBreakDone) 213 if (clusterStart == TextBreakDone)
214 clusterStart = 0; 214 clusterStart = 0;
215 } 215 }
216 216
217 if (!includePartialGlyphs) 217 if (!includePartialGlyphs)
218 return complexTextRun.stringLocation() + clusterStart; 218 return complexTextRun.stringLocation() + clusterStart;
219 219
220 int clusterEnd = textBreakFollowing(cursorPositionIterator, hitI ndex); 220 int clusterEnd = cursorPositionIterator->following(hitIndex);
221 if (clusterEnd == TextBreakDone) 221 if (clusterEnd == TextBreakDone)
222 clusterEnd = stringLength; 222 clusterEnd = stringLength;
223 223
224 CGFloat clusterWidth; 224 CGFloat clusterWidth;
225 // FIXME: The search stops at the boundaries of complexTextRun. In theory, it should go on into neighboring ComplexTextRuns 225 // FIXME: The search stops at the boundaries of complexTextRun. In theory, it should go on into neighboring ComplexTextRuns
226 // derived from the same CTLine. In practice, we do not expect t here to be more than one CTRun in a CTLine, as no 226 // derived from the same CTLine. In practice, we do not expect t here to be more than one CTRun in a CTLine, as no
227 // reordering and no font fallback should occur within a CTLine. 227 // reordering and no font fallback should occur within a CTLine.
228 if (clusterEnd - clusterStart > 1) { 228 if (clusterEnd - clusterStart > 1) {
229 clusterWidth = adjustedAdvance; 229 clusterWidth = adjustedAdvance;
230 int firstGlyphBeforeCluster = j - 1; 230 int firstGlyphBeforeCluster = j - 1;
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 721
722 lastCharacterIndex = characterIndex; 722 lastCharacterIndex = characterIndex;
723 } 723 }
724 if (!isMonotonic) 724 if (!isMonotonic)
725 complexTextRun.setIsNonMonotonic(); 725 complexTextRun.setIsNonMonotonic();
726 } 726 }
727 m_totalWidth += widthSinceLastCommit; 727 m_totalWidth += widthSinceLastCommit;
728 } 728 }
729 729
730 } // namespace WebCore 730 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/TouchAdjustment.cpp ('k') | Source/core/rendering/RenderText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698