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

Side by Side Diff: Source/core/editing/TextCheckingHelper.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: Created 7 years, 3 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 | « no previous file | Source/core/editing/VisibleUnits.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) 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 checkLocation += (badGrammarLocation + badGrammarLength); 66 checkLocation += (badGrammarLocation + badGrammarLength);
67 checkLength -= (badGrammarLocation + badGrammarLength); 67 checkLength -= (badGrammarLocation + badGrammarLength);
68 } 68 }
69 } 69 }
70 70
71 static void findMisspellings(TextCheckerClient& client, const UChar* text, int s tart, int length, Vector<TextCheckingResult>& results) 71 static void findMisspellings(TextCheckerClient& client, const UChar* text, int s tart, int length, Vector<TextCheckingResult>& results)
72 { 72 {
73 TextBreakIterator* iterator = wordBreakIterator(text + start, length); 73 TextBreakIterator* iterator = wordBreakIterator(text + start, length);
74 if (!iterator) 74 if (!iterator)
75 return; 75 return;
76 int wordStart = textBreakCurrent(iterator); 76 int wordStart = iterator->current();
77 while (0 <= wordStart) { 77 while (0 <= wordStart) {
78 int wordEnd = textBreakNext(iterator); 78 int wordEnd = iterator->current();
leviw_travelin_and_unemployed 2013/09/17 21:53:39 It seems strange to me that these 2 lines are the
79 if (wordEnd < 0) 79 if (wordEnd < 0)
80 break; 80 break;
81 int wordLength = wordEnd - wordStart; 81 int wordLength = wordEnd - wordStart;
82 int misspellingLocation = -1; 82 int misspellingLocation = -1;
83 int misspellingLength = 0; 83 int misspellingLength = 0;
84 client.checkSpellingOfString(String(text + start + wordStart, wordLength ), &misspellingLocation, &misspellingLength); 84 client.checkSpellingOfString(String(text + start + wordStart, wordLength ), &misspellingLocation, &misspellingLength);
85 if (0 < misspellingLength) { 85 if (0 < misspellingLength) {
86 ASSERT(0 <= misspellingLocation && misspellingLocation <= wordLength ); 86 ASSERT(0 <= misspellingLocation && misspellingLocation <= wordLength );
87 ASSERT(0 < misspellingLength && misspellingLocation + misspellingLen gth <= wordLength); 87 ASSERT(0 < misspellingLength && misspellingLocation + misspellingLen gth <= wordLength);
88 TextCheckingResult misspelling; 88 TextCheckingResult misspelling;
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 return false; 568 return false;
569 569
570 const Settings* settings = frame->settings(); 570 const Settings* settings = frame->settings();
571 if (!settings) 571 if (!settings)
572 return false; 572 return false;
573 573
574 return settings->unifiedTextCheckerEnabled(); 574 return settings->unifiedTextCheckerEnabled();
575 } 575 }
576 576
577 } 577 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698