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

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

Issue 1615963004: Fix spellchecker updating of marker ranges spanning multiple elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add reqd rebaseline entries Created 4 years, 11 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
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 return; 703 return;
704 704
705 // Now we remove markers on everything between startOfFirstWord and endOfLas tWord. 705 // Now we remove markers on everything between startOfFirstWord and endOfLas tWord.
706 // However, if an autocorrection change a single word to multiple words, we want to remove correction mark from all the 706 // However, if an autocorrection change a single word to multiple words, we want to remove correction mark from all the
707 // resulted words even we only edit one of them. For example, assuming autoc orrection changes "avantgarde" to "avant 707 // resulted words even we only edit one of them. For example, assuming autoc orrection changes "avantgarde" to "avant
708 // garde", we will have CorrectionIndicator marker on both words and on the whitespace between them. If we then edit garde, 708 // garde", we will have CorrectionIndicator marker on both words and on the whitespace between them. If we then edit garde,
709 // we would like to remove the marker from word "avant" and whitespace as we ll. So we need to get the continous range of 709 // we would like to remove the marker from word "avant" and whitespace as we ll. So we need to get the continous range of
710 // of marker that contains the word in question, and remove marker on that w hole range. 710 // of marker that contains the word in question, and remove marker on that w hole range.
711 Document* document = frame().document(); 711 Document* document = frame().document();
712 ASSERT(document); 712 ASSERT(document);
713 Node* startNode = startOfFirstWord.deepEquivalent().computeContainerNode(); 713 const EphemeralRange wordRange(startOfFirstWord.deepEquivalent(), endOfLastW ord.deepEquivalent());
714 int startOffset = startOfFirstWord.deepEquivalent().computeOffsetInContainer Node(); 714 document->markers().removeMarkers(wordRange, DocumentMarker::MisspellingMark ers(), DocumentMarkerController::RemovePartiallyOverlappingMarker);
715 int endOffset = endOfLastWord.deepEquivalent().computeOffsetInContainerNode( );
716 document->markers().removeMarkers(startNode, startOffset, endOffset - startO ffset, DocumentMarker::MisspellingMarkers(), DocumentMarkerController::RemovePar tiallyOverlappingMarker);
717 } 715 }
718 716
719 void SpellChecker::didEndEditingOnTextField(Element* e) 717 void SpellChecker::didEndEditingOnTextField(Element* e)
720 { 718 {
721 TRACE_EVENT0("blink", "SpellChecker::didEndEditingOnTextField"); 719 TRACE_EVENT0("blink", "SpellChecker::didEndEditingOnTextField");
722 720
723 // Remove markers when deactivating a selection in an <input type="text"/>. 721 // Remove markers when deactivating a selection in an <input type="text"/>.
724 // Prevent new ones from appearing too. 722 // Prevent new ones from appearing too.
725 m_spellCheckRequester->cancelCheck(); 723 m_spellCheckRequester->cancelCheck();
726 HTMLTextFormControlElement* textFormControlElement = toHTMLTextFormControlEl ement(e); 724 HTMLTextFormControlElement* textFormControlElement = toHTMLTextFormControlEl ement(e);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
918 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe ck, rangeToCheck)); 916 m_spellCheckRequester->requestCheckingFor(SpellCheckRequest::create(TextChec kingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToChe ck, rangeToCheck));
919 } 917 }
920 918
921 DEFINE_TRACE(SpellChecker) 919 DEFINE_TRACE(SpellChecker)
922 { 920 {
923 visitor->trace(m_frame); 921 visitor->trace(m_frame);
924 visitor->trace(m_spellCheckRequester); 922 visitor->trace(m_spellCheckRequester);
925 } 923 }
926 924
927 } // namespace blink 925 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698