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

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

Issue 2414263002: Audit the use of updateStyleAndLayoutIgnorePendingStylesheets in toNormalizedEphemeralRange (Closed)
Patch Set: fix nit 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
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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after
966 return false; 966 return false;
967 } 967 }
968 968
969 bool SpellChecker::selectionStartHasSpellingMarkerFor(int from, 969 bool SpellChecker::selectionStartHasSpellingMarkerFor(int from,
970 int length) const { 970 int length) const {
971 return selectionStartHasMarkerFor(DocumentMarker::Spelling, from, length); 971 return selectionStartHasMarkerFor(DocumentMarker::Spelling, from, length);
972 } 972 }
973 973
974 void SpellChecker::removeMarkers(const VisibleSelection& selection, 974 void SpellChecker::removeMarkers(const VisibleSelection& selection,
975 DocumentMarker::MarkerTypes markerTypes) { 975 DocumentMarker::MarkerTypes markerTypes) {
976 const EphemeralRange range = selection.toNormalizedEphemeralRange();
977 if (range.isNull())
978 return;
979
980 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets 976 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
981 // needs to be audited. See http://crbug.com/590369 for more details. 977 // needs to be audited. See http://crbug.com/590369 for more details.
982 frame().document()->updateStyleAndLayoutIgnorePendingStylesheets(); 978 frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
983 979
980 const EphemeralRange& range = selection.toNormalizedEphemeralRange();
981 if (range.isNull())
982 return;
983
984 frame().document()->markers().removeMarkers(range, markerTypes); 984 frame().document()->markers().removeMarkers(range, markerTypes);
985 } 985 }
986 986
987 void SpellChecker::cancelCheck() { 987 void SpellChecker::cancelCheck() {
988 m_spellCheckRequester->cancelCheck(); 988 m_spellCheckRequester->cancelCheck();
989 } 989 }
990 990
991 void SpellChecker::requestTextChecking(const Element& element) { 991 void SpellChecker::requestTextChecking(const Element& element) {
992 if (!element.isSpellCheckingEnabled()) 992 if (!element.isSpellCheckingEnabled())
993 return; 993 return;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 startOfNextParagraph(createVisiblePosition(paragraphEnd)); 1119 startOfNextParagraph(createVisiblePosition(paragraphEnd));
1120 paragraphStart = newParagraphStart.toParentAnchoredPosition(); 1120 paragraphStart = newParagraphStart.toParentAnchoredPosition();
1121 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition(); 1121 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition();
1122 firstIteration = false; 1122 firstIteration = false;
1123 totalLengthProcessed += currentLength; 1123 totalLengthProcessed += currentLength;
1124 } 1124 }
1125 return std::make_pair(firstFoundItem, firstFoundOffset); 1125 return std::make_pair(firstFoundItem, firstFoundOffset);
1126 } 1126 }
1127 1127
1128 } // namespace blink 1128 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698