| 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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 findFirstMisspelling(spellingSearchStart, spellingSearchEnd); | 326 findFirstMisspelling(spellingSearchStart, spellingSearchEnd); |
| 327 } | 327 } |
| 328 | 328 |
| 329 if (!misspelledWord.isEmpty()) { | 329 if (!misspelledWord.isEmpty()) { |
| 330 // We found a misspelling. Select the misspelling, update the spelling | 330 // We found a misspelling. Select the misspelling, update the spelling |
| 331 // panel, and store a marker so we draw the red squiggle later. | 331 // panel, and store a marker so we draw the red squiggle later. |
| 332 | 332 |
| 333 const EphemeralRange misspellingRange = calculateCharacterSubrange( | 333 const EphemeralRange misspellingRange = calculateCharacterSubrange( |
| 334 EphemeralRange(spellingSearchStart, spellingSearchEnd), | 334 EphemeralRange(spellingSearchStart, spellingSearchEnd), |
| 335 misspellingOffset, misspelledWord.length()); | 335 misspellingOffset, misspelledWord.length()); |
| 336 frame().selection().setSelection(createVisibleSelection(misspellingRange)); | 336 frame().selection().setSelection(SelectionInDOMTree::Builder() |
| 337 .setBaseAndExtent(misspellingRange) |
| 338 .build()); |
| 337 frame().selection().revealSelection(); | 339 frame().selection().revealSelection(); |
| 338 spellCheckerClient().updateSpellingUIWithMisspelledWord(misspelledWord); | 340 spellCheckerClient().updateSpellingUIWithMisspelledWord(misspelledWord); |
| 339 frame().document()->markers().addMarker(misspellingRange.startPosition(), | 341 frame().document()->markers().addMarker(misspellingRange.startPosition(), |
| 340 misspellingRange.endPosition(), | 342 misspellingRange.endPosition(), |
| 341 DocumentMarker::Spelling); | 343 DocumentMarker::Spelling); |
| 342 } | 344 } |
| 343 } | 345 } |
| 344 | 346 |
| 345 void SpellChecker::showSpellingGuessPanel() { | 347 void SpellChecker::showSpellingGuessPanel() { |
| 346 if (spellCheckerClient().spellingUIIsShowing()) { | 348 if (spellCheckerClient().spellingUIIsShowing()) { |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 if (markers.size() < 1 || | 797 if (markers.size() < 1 || |
| 796 markers[0]->startOffset() >= markers[0]->endOffset()) | 798 markers[0]->startOffset() >= markers[0]->endOffset()) |
| 797 return; | 799 return; |
| 798 EphemeralRange markerRange = | 800 EphemeralRange markerRange = |
| 799 EphemeralRange(Position(caretRange.startPosition().computeContainerNode(), | 801 EphemeralRange(Position(caretRange.startPosition().computeContainerNode(), |
| 800 markers[0]->startOffset()), | 802 markers[0]->startOffset()), |
| 801 Position(caretRange.endPosition().computeContainerNode(), | 803 Position(caretRange.endPosition().computeContainerNode(), |
| 802 markers[0]->endOffset())); | 804 markers[0]->endOffset())); |
| 803 if (markerRange.isNull()) | 805 if (markerRange.isNull()) |
| 804 return; | 806 return; |
| 805 frame().selection().setSelection(createVisibleSelection(markerRange), | 807 frame().selection().setSelection( |
| 806 CharacterGranularity); | 808 SelectionInDOMTree::Builder().setBaseAndExtent(markerRange).build()); |
| 807 | 809 |
| 808 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets | 810 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
| 809 // needs to be audited. See http://crbug.com/590369 for more details. | 811 // needs to be audited. See http://crbug.com/590369 for more details. |
| 810 frame().document()->updateStyleAndLayoutIgnorePendingStylesheets(); | 812 frame().document()->updateStyleAndLayoutIgnorePendingStylesheets(); |
| 811 | 813 |
| 812 frame().editor().replaceSelectionWithText(text, false, false); | 814 frame().editor().replaceSelectionWithText(text, false, false); |
| 813 } | 815 } |
| 814 | 816 |
| 815 static bool shouldCheckOldSelection(const Position& oldSelectionStart) { | 817 static bool shouldCheckOldSelection(const Position& oldSelectionStart) { |
| 816 if (!oldSelectionStart.isConnected()) | 818 if (!oldSelectionStart.isConnected()) |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 startOfNextParagraph(createVisiblePosition(paragraphEnd)); | 1130 startOfNextParagraph(createVisiblePosition(paragraphEnd)); |
| 1129 paragraphStart = newParagraphStart.toParentAnchoredPosition(); | 1131 paragraphStart = newParagraphStart.toParentAnchoredPosition(); |
| 1130 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition(); | 1132 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition(); |
| 1131 firstIteration = false; | 1133 firstIteration = false; |
| 1132 totalLengthProcessed += currentLength; | 1134 totalLengthProcessed += currentLength; |
| 1133 } | 1135 } |
| 1134 return std::make_pair(firstFoundItem, firstFoundOffset); | 1136 return std::make_pair(firstFoundItem, firstFoundOffset); |
| 1135 } | 1137 } |
| 1136 | 1138 |
| 1137 } // namespace blink | 1139 } // namespace blink |
| OLD | NEW |