OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2011 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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 return false; | 412 return false; |
413 | 413 |
414 TRACE_EVENT0("blink", "SpellChecker::markMisspellingsOrBadGrammar"); | 414 TRACE_EVENT0("blink", "SpellChecker::markMisspellingsOrBadGrammar"); |
415 | 415 |
416 const EphemeralRange range = selection.toNormalizedEphemeralRange(); | 416 const EphemeralRange range = selection.toNormalizedEphemeralRange(); |
417 if (range.isNull()) | 417 if (range.isNull()) |
418 return false; | 418 return false; |
419 | 419 |
420 // If we're not in an editable node, bail. | 420 // If we're not in an editable node, bail. |
421 Node* editableNode = range.startPosition().computeContainerNode(); | 421 Node* editableNode = range.startPosition().computeContainerNode(); |
422 if (!editableNode || !editableNode->hasEditableStyle()) | 422 if (!editableNode || !hasEditableStyle(*editableNode)) |
423 return false; | 423 return false; |
424 | 424 |
425 if (!isSpellCheckingEnabledFor(editableNode)) | 425 if (!isSpellCheckingEnabledFor(editableNode)) |
426 return false; | 426 return false; |
427 | 427 |
428 TextCheckingHelper checker(spellCheckerClient(), range.startPosition(), rang
e.endPosition()); | 428 TextCheckingHelper checker(spellCheckerClient(), range.startPosition(), rang
e.endPosition()); |
429 if (checkSpelling) | 429 if (checkSpelling) |
430 return checker.markAllMisspellings(); | 430 return checker.markAllMisspellings(); |
431 | 431 |
432 checker.markAllBadGrammar(); | 432 checker.markAllBadGrammar(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 DCHECK(unifiedTextCheckerEnabled()); | 480 DCHECK(unifiedTextCheckerEnabled()); |
481 | 481 |
482 bool shouldMarkGrammar = textCheckingOptions & TextCheckingTypeGrammar; | 482 bool shouldMarkGrammar = textCheckingOptions & TextCheckingTypeGrammar; |
483 | 483 |
484 // This function is called with selections already expanded to word boundari
es. | 484 // This function is called with selections already expanded to word boundari
es. |
485 if (spellingRange.isNull() || (shouldMarkGrammar && grammarRange.isNull())) | 485 if (spellingRange.isNull() || (shouldMarkGrammar && grammarRange.isNull())) |
486 return; | 486 return; |
487 | 487 |
488 // If we're not in an editable node, bail. | 488 // If we're not in an editable node, bail. |
489 Node* editableNode = spellingRange.startPosition().computeContainerNode(); | 489 Node* editableNode = spellingRange.startPosition().computeContainerNode(); |
490 if (!editableNode || !editableNode->hasEditableStyle()) | 490 if (!editableNode || !hasEditableStyle(*editableNode)) |
491 return; | 491 return; |
492 | 492 |
493 if (!isSpellCheckingEnabledFor(editableNode)) | 493 if (!isSpellCheckingEnabledFor(editableNode)) |
494 return; | 494 return; |
495 | 495 |
496 TextCheckingParagraph fullParagraphToCheck(shouldMarkGrammar ? grammarRange
: spellingRange); | 496 TextCheckingParagraph fullParagraphToCheck(shouldMarkGrammar ? grammarRange
: spellingRange); |
497 chunkAndMarkAllMisspellingsAndBadGrammar(textCheckingOptions, fullParagraphT
oCheck); | 497 chunkAndMarkAllMisspellingsAndBadGrammar(textCheckingOptions, fullParagraphT
oCheck); |
498 } | 498 } |
499 | 499 |
500 static EphemeralRange expandEndToSentenceBoundary(const EphemeralRange& range) | 500 static EphemeralRange expandEndToSentenceBoundary(const EphemeralRange& range) |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 visitor->trace(m_frame); | 970 visitor->trace(m_frame); |
971 visitor->trace(m_spellCheckRequester); | 971 visitor->trace(m_spellCheckRequester); |
972 } | 972 } |
973 | 973 |
974 void SpellChecker::prepareForLeakDetection() | 974 void SpellChecker::prepareForLeakDetection() |
975 { | 975 { |
976 m_spellCheckRequester->prepareForLeakDetection(); | 976 m_spellCheckRequester->prepareForLeakDetection(); |
977 } | 977 } |
978 | 978 |
979 } // namespace blink | 979 } // namespace blink |
OLD | NEW |