Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(575)

Side by Side Diff: Source/core/editing/spellcheck/SpellChecker.cpp

Issue 1299873002: ALL-IN-ONE Introduce enum class TextAffinity (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-19T18:08:52 Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 frame().document()->markers().addMarker(invisibleSpellcheckRange.sta rtPosition(), invisibleSpellcheckRange.endPosition(), DocumentMarker::InvisibleS pellcheck, result->replacement, result->hash); 615 frame().document()->markers().addMarker(invisibleSpellcheckRange.sta rtPosition(), invisibleSpellcheckRange.endPosition(), DocumentMarker::InvisibleS pellcheck, result->replacement, result->hash);
616 } 616 }
617 } 617 }
618 618
619 if (selectionChanged) { 619 if (selectionChanged) {
620 TextCheckingParagraph extendedParagraph(paragraph); 620 TextCheckingParagraph extendedParagraph(paragraph);
621 // Restore the caret position if we have made any replacements 621 // Restore the caret position if we have made any replacements
622 extendedParagraph.expandRangeToNextEnd(); 622 extendedParagraph.expandRangeToNextEnd();
623 if (restoreSelectionAfterChange && selectionOffset >= 0 && selectionOffs et <= extendedParagraph.rangeLength()) { 623 if (restoreSelectionAfterChange && selectionOffset >= 0 && selectionOffs et <= extendedParagraph.rangeLength()) {
624 RefPtrWillBeRawPtr<Range> selectionRange = extendedParagraph.subrang e(0, selectionOffset); 624 RefPtrWillBeRawPtr<Range> selectionRange = extendedParagraph.subrang e(0, selectionOffset);
625 frame().selection().moveTo(selectionRange->endPosition(), DOWNSTREAM ); 625 frame().selection().moveTo(selectionRange->endPosition(), TextAffini ty::Downstream);
626 if (adjustSelectionForParagraphBoundaries) 626 if (adjustSelectionForParagraphBoundaries)
627 frame().selection().modify(FrameSelection::AlterationMove, Direc tionForward, CharacterGranularity); 627 frame().selection().modify(FrameSelection::AlterationMove, Direc tionForward, CharacterGranularity);
628 } else { 628 } else {
629 // If this fails for any reason, the fallback is to go one position beyond the last replacement 629 // If this fails for any reason, the fallback is to go one position beyond the last replacement
630 frame().selection().moveTo(frame().selection().selection().visibleEn d()); 630 frame().selection().moveTo(frame().selection().selection().visibleEn d());
631 frame().selection().modify(FrameSelection::AlterationMove, Direction Forward, CharacterGranularity); 631 frame().selection().modify(FrameSelection::AlterationMove, Direction Forward, CharacterGranularity);
632 } 632 }
633 } 633 }
634 } 634 }
635 635
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe ck, rangeToCheck)); 937 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe ck, rangeToCheck));
938 } 938 }
939 939
940 DEFINE_TRACE(SpellChecker) 940 DEFINE_TRACE(SpellChecker)
941 { 941 {
942 visitor->trace(m_frame); 942 visitor->trace(m_frame);
943 visitor->trace(m_spellCheckRequester); 943 visitor->trace(m_spellCheckRequester);
944 } 944 }
945 945
946 } // namespace blink 946 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/commands/TypingCommand.cpp ('k') | Source/core/html/HTMLTextFormControlElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698