| 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 // panel, and store a marker so we draw the red squiggle later. | 295 // panel, and store a marker so we draw the red squiggle later. |
| 296 | 296 |
| 297 const EphemeralRange misspellingRange = calculateCharacterSubrange( | 297 const EphemeralRange misspellingRange = calculateCharacterSubrange( |
| 298 EphemeralRange(spellingSearchStart, spellingSearchEnd), | 298 EphemeralRange(spellingSearchStart, spellingSearchEnd), |
| 299 misspellingOffset, misspelledWord.length()); | 299 misspellingOffset, misspelledWord.length()); |
| 300 frame().selection().setSelection(SelectionInDOMTree::Builder() | 300 frame().selection().setSelection(SelectionInDOMTree::Builder() |
| 301 .setBaseAndExtent(misspellingRange) | 301 .setBaseAndExtent(misspellingRange) |
| 302 .build()); | 302 .build()); |
| 303 frame().selection().revealSelection(); | 303 frame().selection().revealSelection(); |
| 304 spellCheckerClient().updateSpellingUIWithMisspelledWord(misspelledWord); | 304 spellCheckerClient().updateSpellingUIWithMisspelledWord(misspelledWord); |
| 305 frame().document()->markers().addSpellingMarker( | 305 frame().document()->markers().addSpellingMarker(misspellingRange); |
| 306 misspellingRange.startPosition(), misspellingRange.endPosition()); | |
| 307 } | 306 } |
| 308 } | 307 } |
| 309 | 308 |
| 310 void SpellChecker::showSpellingGuessPanel() { | 309 void SpellChecker::showSpellingGuessPanel() { |
| 311 if (spellCheckerClient().spellingUIIsShowing()) { | 310 if (spellCheckerClient().spellingUIIsShowing()) { |
| 312 spellCheckerClient().showSpellingUI(false); | 311 spellCheckerClient().showSpellingUI(false); |
| 313 return; | 312 return; |
| 314 } | 313 } |
| 315 | 314 |
| 316 advanceToNextMisspelling(true); | 315 advanceToNextMisspelling(true); |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 DCHECK_GE(location, 0); | 535 DCHECK_GE(location, 0); |
| 537 const EphemeralRange& rangeToMark = | 536 const EphemeralRange& rangeToMark = |
| 538 calculateCharacterSubrange(checkingRange, location, length); | 537 calculateCharacterSubrange(checkingRange, location, length); |
| 539 if (!SpellChecker::isSpellCheckingEnabledAt(rangeToMark.startPosition())) | 538 if (!SpellChecker::isSpellCheckingEnabledAt(rangeToMark.startPosition())) |
| 540 return; | 539 return; |
| 541 if (!SpellChecker::isSpellCheckingEnabledAt(rangeToMark.endPosition())) | 540 if (!SpellChecker::isSpellCheckingEnabledAt(rangeToMark.endPosition())) |
| 542 return; | 541 return; |
| 543 | 542 |
| 544 DCHECK(type == DocumentMarker::Grammar || type == DocumentMarker::Spelling) | 543 DCHECK(type == DocumentMarker::Grammar || type == DocumentMarker::Spelling) |
| 545 << type; | 544 << type; |
| 546 if (type == DocumentMarker::Grammar) { | 545 if (type == DocumentMarker::Grammar) |
| 547 document->markers().addGrammarMarker( | 546 document->markers().addGrammarMarker(rangeToMark, description); |
| 548 rangeToMark.startPosition(), rangeToMark.endPosition(), description); | 547 else |
| 549 } else { | 548 document->markers().addSpellingMarker(rangeToMark, description); |
| 550 document->markers().addSpellingMarker( | |
| 551 rangeToMark.startPosition(), rangeToMark.endPosition(), description); | |
| 552 } | |
| 553 } | 549 } |
| 554 | 550 |
| 555 void SpellChecker::markAndReplaceFor( | 551 void SpellChecker::markAndReplaceFor( |
| 556 SpellCheckRequest* request, | 552 SpellCheckRequest* request, |
| 557 const Vector<TextCheckingResult>& results) { | 553 const Vector<TextCheckingResult>& results) { |
| 558 TRACE_EVENT0("blink", "SpellChecker::markAndReplaceFor"); | 554 TRACE_EVENT0("blink", "SpellChecker::markAndReplaceFor"); |
| 559 DCHECK(request); | 555 DCHECK(request); |
| 560 if (!frame().selection().isAvailable()) { | 556 if (!frame().selection().isAvailable()) { |
| 561 // "editing/spelling/spellcheck-async-remove-frame.html" reaches here. | 557 // "editing/spelling/spellcheck-async-remove-frame.html" reaches here. |
| 562 return; | 558 return; |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1181 if (!input.isFocusedElementInDocument()) | 1177 if (!input.isFocusedElementInDocument()) |
| 1182 return false; | 1178 return false; |
| 1183 } | 1179 } |
| 1184 } | 1180 } |
| 1185 HTMLElement* element = | 1181 HTMLElement* element = |
| 1186 Traversal<HTMLElement>::firstAncestorOrSelf(*position.anchorNode()); | 1182 Traversal<HTMLElement>::firstAncestorOrSelf(*position.anchorNode()); |
| 1187 return element && element->isSpellCheckingEnabled(); | 1183 return element && element->isSpellCheckingEnabled(); |
| 1188 } | 1184 } |
| 1189 | 1185 |
| 1190 } // namespace blink | 1186 } // namespace blink |
| OLD | NEW |