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

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

Issue 2414323002: Move AlreadySpellCheckedFlag from NodeFlags to ElementFlags (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
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 160
161 void SpellChecker::toggleSpellCheckingEnabled() { 161 void SpellChecker::toggleSpellCheckingEnabled() {
162 spellCheckerClient().toggleSpellCheckingEnabled(); 162 spellCheckerClient().toggleSpellCheckingEnabled();
163 if (isSpellCheckingEnabled()) 163 if (isSpellCheckingEnabled())
164 return; 164 return;
165 for (Frame* frame = this->frame().page()->mainFrame(); frame; 165 for (Frame* frame = this->frame().page()->mainFrame(); frame;
166 frame = frame->tree().traverseNext()) { 166 frame = frame->tree().traverseNext()) {
167 if (!frame->isLocalFrame()) 167 if (!frame->isLocalFrame())
168 continue; 168 continue;
169 for (Node& node : 169 for (Node& node :
170 NodeTraversal::startsAt(toLocalFrame(frame)->document()->rootNode())) 170 NodeTraversal::startsAt(toLocalFrame(frame)->document()->rootNode())) {
171 node.setAlreadySpellChecked(false); 171 if (node.isElementNode())
172 toElement(node).setAlreadySpellChecked(false);
tkent 2016/10/14 09:16:47 I realized this adds ElementRareData to every Elem
Xiaocheng 2016/10/14 09:20:12 Setting a false ElementFlag on doesn't create Elem
tkent 2016/10/14 09:26:05 Oh, you're right! So, ElementRareData is added to
173 }
172 } 174 }
173 } 175 }
174 176
175 void SpellChecker::didBeginEditing(Element* element) { 177 void SpellChecker::didBeginEditing(Element* element) {
176 if (!isSpellCheckingEnabled()) 178 if (!isSpellCheckingEnabled())
177 return; 179 return;
178 180
179 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets 181 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
180 // needs to be audited. See http://crbug.com/590369 for more details. 182 // needs to be audited. See http://crbug.com/590369 for more details.
181 // In the long term we should use idle time spell checker to prevent 183 // In the long term we should use idle time spell checker to prevent
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 startOfNextParagraph(createVisiblePosition(paragraphEnd)); 1121 startOfNextParagraph(createVisiblePosition(paragraphEnd));
1120 paragraphStart = newParagraphStart.toParentAnchoredPosition(); 1122 paragraphStart = newParagraphStart.toParentAnchoredPosition();
1121 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition(); 1123 paragraphEnd = endOfParagraph(newParagraphStart).toParentAnchoredPosition();
1122 firstIteration = false; 1124 firstIteration = false;
1123 totalLengthProcessed += currentLength; 1125 totalLengthProcessed += currentLength;
1124 } 1126 }
1125 return std::make_pair(firstFoundItem, firstFoundOffset); 1127 return std::make_pair(firstFoundItem, firstFoundOffset);
1126 } 1128 }
1127 1129
1128 } // namespace blink 1130 } // namespace blink
OLDNEW
« third_party/WebKit/Source/core/dom/Node.h ('K') | « third_party/WebKit/Source/core/dom/Node.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698