OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/renderer/spellchecker/spellcheck_provider.h" | 5 #include "chrome/renderer/spellchecker/spellcheck_provider.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
9 #include "chrome/common/spellcheck_messages.h" | 9 #include "chrome/common/spellcheck_messages.h" |
10 #include "chrome/common/spellcheck_result.h" | 10 #include "chrome/common/spellcheck_result.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 | 327 |
328 bool SpellCheckProvider::HasWordCharacters( | 328 bool SpellCheckProvider::HasWordCharacters( |
329 const WebKit::WebString& text, | 329 const WebKit::WebString& text, |
330 int index) const { | 330 int index) const { |
331 const char16* data = text.data(); | 331 const char16* data = text.data(); |
332 int length = text.length(); | 332 int length = text.length(); |
333 while (index < length) { | 333 while (index < length) { |
334 uint32 code = 0; | 334 uint32 code = 0; |
335 U16_NEXT(data, index, length, code); | 335 U16_NEXT(data, index, length, code); |
336 UErrorCode error = U_ZERO_ERROR; | 336 UErrorCode error = U_ZERO_ERROR; |
337 if (uscript_getScript(code, &error) == USCRIPT_LATIN) | 337 if (uscript_getScript(code, &error) != USCRIPT_COMMON) |
338 return true; | 338 return true; |
339 } | 339 } |
340 return false; | 340 return false; |
341 } | 341 } |
342 #endif | 342 #endif |
343 | 343 |
344 #if defined(OS_MACOSX) | 344 #if defined(OS_MACOSX) |
345 void SpellCheckProvider::OnAdvanceToNextMisspelling() { | 345 void SpellCheckProvider::OnAdvanceToNextMisspelling() { |
346 if (!render_view()->GetWebView()) | 346 if (!render_view()->GetWebView()) |
347 return; | 347 return; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 // TODO(darin): There's actually no reason for this to be here. We should | 387 // TODO(darin): There's actually no reason for this to be here. We should |
388 // have the browser side manage the document tag. | 388 // have the browser side manage the document tag. |
389 #if defined(OS_MACOSX) | 389 #if defined(OS_MACOSX) |
390 if (!has_document_tag_) { | 390 if (!has_document_tag_) { |
391 // Make the call to get the tag. | 391 // Make the call to get the tag. |
392 Send(new SpellCheckHostMsg_GetDocumentTag(routing_id(), &document_tag_)); | 392 Send(new SpellCheckHostMsg_GetDocumentTag(routing_id(), &document_tag_)); |
393 has_document_tag_ = true; | 393 has_document_tag_ = true; |
394 } | 394 } |
395 #endif | 395 #endif |
396 } | 396 } |
OLD | NEW |