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

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

Issue 2370253002: Mark calls of visible{Start,End} with dirty layout deprecated (Closed)
Patch Set: Created 4 years, 2 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/Source/core/editing/commands/TypingCommand.cpp ('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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 } 585 }
586 } 586 }
587 587
588 void SpellChecker::updateMarkersForWordsAffectedByEditing(bool doNotRemoveIfSele ctionAtWordBoundary) 588 void SpellChecker::updateMarkersForWordsAffectedByEditing(bool doNotRemoveIfSele ctionAtWordBoundary)
589 { 589 {
590 DCHECK(frame().selection().isAvailable()); 590 DCHECK(frame().selection().isAvailable());
591 TRACE_EVENT0("blink", "SpellChecker::updateMarkersForWordsAffectedByEditing" ); 591 TRACE_EVENT0("blink", "SpellChecker::updateMarkersForWordsAffectedByEditing" );
592 if (!isSpellCheckingEnabledFor(frame().selection().selection())) 592 if (!isSpellCheckingEnabledFor(frame().selection().selection()))
593 return; 593 return;
594 594
595 Document* document = frame().document();
596 DCHECK(document);
597
598 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
599 // needs to be audited. See http://crbug.com/590369 for more details.
600 document->updateStyleAndLayoutIgnorePendingStylesheets();
601
595 // We want to remove the markers from a word if an editing command will chan ge the word. This can happen in one of 602 // We want to remove the markers from a word if an editing command will chan ge the word. This can happen in one of
596 // several scenarios: 603 // several scenarios:
597 // 1. Insert in the middle of a word. 604 // 1. Insert in the middle of a word.
598 // 2. Appending non whitespace at the beginning of word. 605 // 2. Appending non whitespace at the beginning of word.
599 // 3. Appending non whitespace at the end of word. 606 // 3. Appending non whitespace at the end of word.
600 // Note that, appending only whitespaces at the beginning or end of word won 't change the word, so we don't need to 607 // Note that, appending only whitespaces at the beginning or end of word won 't change the word, so we don't need to
601 // remove the markers on that word. 608 // remove the markers on that word.
602 // Of course, if current selection is a range, we potentially will edit two words that fall on the boundaries of 609 // Of course, if current selection is a range, we potentially will edit two words that fall on the boundaries of
603 // selection, and remove words between the selection boundaries. 610 // selection, and remove words between the selection boundaries.
604 // 611 //
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 // if-statement. 661 // if-statement.
655 return; 662 return;
656 } 663 }
657 664
658 // Now we remove markers on everything between startOfFirstWord and endOfLas tWord. 665 // Now we remove markers on everything between startOfFirstWord and endOfLas tWord.
659 // However, if an autocorrection change a single word to multiple words, we want to remove correction mark from all the 666 // However, if an autocorrection change a single word to multiple words, we want to remove correction mark from all the
660 // resulted words even we only edit one of them. For example, assuming autoc orrection changes "avantgarde" to "avant 667 // resulted words even we only edit one of them. For example, assuming autoc orrection changes "avantgarde" to "avant
661 // garde", we will have CorrectionIndicator marker on both words and on the whitespace between them. If we then edit garde, 668 // garde", we will have CorrectionIndicator marker on both words and on the whitespace between them. If we then edit garde,
662 // we would like to remove the marker from word "avant" and whitespace as we ll. So we need to get the continous range of 669 // we would like to remove the marker from word "avant" and whitespace as we ll. So we need to get the continous range of
663 // of marker that contains the word in question, and remove marker on that w hole range. 670 // of marker that contains the word in question, and remove marker on that w hole range.
664 Document* document = frame().document();
665 DCHECK(document);
666
667 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
668 // needs to be audited. See http://crbug.com/590369 for more details.
669 document->updateStyleAndLayoutIgnorePendingStylesheets();
670
671 const EphemeralRange wordRange(removeMarkerStart, removeMarkerEnd); 671 const EphemeralRange wordRange(removeMarkerStart, removeMarkerEnd);
672 document->markers().removeMarkers(wordRange, DocumentMarker::MisspellingMark ers(), DocumentMarkerController::RemovePartiallyOverlappingMarker); 672 document->markers().removeMarkers(wordRange, DocumentMarker::MisspellingMark ers(), DocumentMarkerController::RemovePartiallyOverlappingMarker);
673 } 673 }
674 674
675 void SpellChecker::didEndEditingOnTextField(Element* e) 675 void SpellChecker::didEndEditingOnTextField(Element* e)
676 { 676 {
677 TRACE_EVENT0("blink", "SpellChecker::didEndEditingOnTextField"); 677 TRACE_EVENT0("blink", "SpellChecker::didEndEditingOnTextField");
678 678
679 // Remove markers when deactivating a selection in an <input type="text"/>. 679 // Remove markers when deactivating a selection in an <input type="text"/>.
680 // Prevent new ones from appearing too. 680 // Prevent new ones from appearing too.
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 VisiblePosition newParagraphStart = startOfNextParagraph(createVisiblePo sition(paragraphEnd)); 1000 VisiblePosition newParagraphStart = startOfNextParagraph(createVisiblePo sition(paragraphEnd));
1001 paragraphStart = newParagraphStart.toParentAnchoredPosition(); 1001 paragraphStart = newParagraphStart.toParentAnchoredPosition();
1002 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPositio n(); 1002 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPositio n();
1003 firstIteration = false; 1003 firstIteration = false;
1004 totalLengthProcessed += currentLength; 1004 totalLengthProcessed += currentLength;
1005 } 1005 }
1006 return std::make_pair(firstFoundItem, firstFoundOffset); 1006 return std::make_pair(firstFoundItem, firstFoundOffset);
1007 } 1007 }
1008 1008
1009 } // namespace blink 1009 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698