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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 if (isHTMLInputElement(textControl) && toHTMLInputElement(textControl)->
type() == InputTypeNames::password) | 360 if (isHTMLInputElement(textControl) && toHTMLInputElement(textControl)->
type() == InputTypeNames::password) |
361 return false; | 361 return false; |
362 } | 362 } |
363 if (HTMLElement* element = Traversal<HTMLElement>::firstAncestorOrSelf(*sele
ction.start().anchorNode())) { | 363 if (HTMLElement* element = Traversal<HTMLElement>::firstAncestorOrSelf(*sele
ction.start().anchorNode())) { |
364 if (element->spellcheck()) | 364 if (element->spellcheck()) |
365 return true; | 365 return true; |
366 } | 366 } |
367 return false; | 367 return false; |
368 } | 368 } |
369 | 369 |
370 void SpellChecker::chunkAndMarkAllMisspellingsAndBadGrammar(Node* node, const Ep
hemeralRange& insertedRange) | 370 void SpellChecker::chunkAndMarkAllMisspellingsAndBadGrammar(const EphemeralRange
& insertedRange) |
371 { | 371 { |
372 TRACE_EVENT0("blink", "SpellChecker::chunkAndMarkAllMisspellingsAndBadGramma
r"); | 372 TRACE_EVENT0("blink", "SpellChecker::chunkAndMarkAllMisspellingsAndBadGramma
r"); |
| 373 Node* node = rootEditableElementOf(insertedRange.startPosition()); |
373 if (!node) | 374 if (!node) |
374 return; | 375 return; |
375 EphemeralRange paragraphRange(Position::firstPositionInNode(node), Position:
:lastPositionInNode(node)); | 376 EphemeralRange paragraphRange(Position::firstPositionInNode(node), Position:
:lastPositionInNode(node)); |
376 TextCheckingParagraph textToCheck(insertedRange, paragraphRange); | 377 TextCheckingParagraph textToCheck(insertedRange, paragraphRange); |
377 chunkAndMarkAllMisspellingsAndBadGrammar(textToCheck); | 378 chunkAndMarkAllMisspellingsAndBadGrammar(textToCheck); |
378 } | 379 } |
379 | 380 |
380 void SpellChecker::chunkAndMarkAllMisspellingsAndBadGrammar(const TextCheckingPa
ragraph& fullParagraphToCheck) | 381 void SpellChecker::chunkAndMarkAllMisspellingsAndBadGrammar(const TextCheckingPa
ragraph& fullParagraphToCheck) |
381 { | 382 { |
382 if (fullParagraphToCheck.isEmpty()) | 383 if (fullParagraphToCheck.isEmpty()) |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 VisiblePosition newParagraphStart = startOfNextParagraph(createVisiblePo
sition(paragraphEnd)); | 890 VisiblePosition newParagraphStart = startOfNextParagraph(createVisiblePo
sition(paragraphEnd)); |
890 paragraphStart = newParagraphStart.toParentAnchoredPosition(); | 891 paragraphStart = newParagraphStart.toParentAnchoredPosition(); |
891 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPositio
n(); | 892 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPositio
n(); |
892 firstIteration = false; | 893 firstIteration = false; |
893 totalLengthProcessed += currentLength; | 894 totalLengthProcessed += currentLength; |
894 } | 895 } |
895 return std::make_pair(firstFoundItem, firstFoundOffset); | 896 return std::make_pair(firstFoundItem, firstFoundOffset); |
896 } | 897 } |
897 | 898 |
898 } // namespace blink | 899 } // namespace blink |
OLD | NEW |