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

Side by Side Diff: Source/core/editing/Editor.h

Issue 21694005: Spell check whole content of an editable element when it gets focused. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: async test added. Sync suffixed with -sync Created 7 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 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 207
208 bool shouldBeginEditing(Range*); 208 bool shouldBeginEditing(Range*);
209 bool shouldEndEditing(Range*); 209 bool shouldEndEditing(Range*);
210 210
211 void clearUndoRedoOperations(); 211 void clearUndoRedoOperations();
212 bool canUndo(); 212 bool canUndo();
213 void undo(); 213 void undo();
214 bool canRedo(); 214 bool canRedo();
215 void redo(); 215 void redo();
216 216
217 void didBeginEditing(); 217 void didBeginEditing(Element*);
218 void didEndEditing(); 218 void didEndEditing(Element*);
tony 2013/08/20 22:10:39 It doesn't look like we use Element in didEndEditi
219 219
220 void setBaseWritingDirection(WritingDirection); 220 void setBaseWritingDirection(WritingDirection);
221 221
222 // smartInsertDeleteEnabled and selectTrailingWhitespaceEnabled are 222 // smartInsertDeleteEnabled and selectTrailingWhitespaceEnabled are
223 // mutually exclusive, meaning that enabling one will disable the other. 223 // mutually exclusive, meaning that enabling one will disable the other.
224 bool smartInsertDeleteEnabled(); 224 bool smartInsertDeleteEnabled();
225 bool isSelectTrailingWhitespaceEnabled(); 225 bool isSelectTrailingWhitespaceEnabled();
226 226
227 bool setSelectionOffsets(int selectionStart, int selectionEnd); 227 bool setSelectionOffsets(int selectionStart, int selectionEnd);
228 228
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 void respondToChangedSelection(const VisibleSelection& oldSelection, FrameSe lection::SetSelectionOptions); 275 void respondToChangedSelection(const VisibleSelection& oldSelection, FrameSe lection::SetSelectionOptions);
276 bool shouldChangeSelection(const VisibleSelection& oldSelection, const Visib leSelection& newSelection, EAffinity, bool stillSelecting) const; 276 bool shouldChangeSelection(const VisibleSelection& oldSelection, const Visib leSelection& newSelection, EAffinity, bool stillSelecting) const;
277 277
278 void spellCheckAfterBlur(); 278 void spellCheckAfterBlur();
279 void spellCheckOldSelection(const VisibleSelection& oldSelection, const Visi bleSelection& newAdjacentWords, const VisibleSelection& newSelectedSentence); 279 void spellCheckOldSelection(const VisibleSelection& oldSelection, const Visi bleSelection& newAdjacentWords, const VisibleSelection& newSelectedSentence);
280 280
281 bool markedTextMatchesAreHighlighted() const; 281 bool markedTextMatchesAreHighlighted() const;
282 void setMarkedTextMatchesAreHighlighted(bool); 282 void setMarkedTextMatchesAreHighlighted(bool);
283 283
284 void textFieldDidBeginEditing(Element*); 284 void textAreaOrTextFieldDidBeginEditing(Element*);
285 void textFieldDidEndEditing(Element*); 285 void textFieldDidEndEditing(Element*);
286 void textDidChangeInTextField(Element*); 286 void textDidChangeInTextField(Element*);
287 bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*); 287 bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*);
288 WritingDirection baseWritingDirectionForSelectionStart() const; 288 WritingDirection baseWritingDirectionForSelectionStart() const;
289 289
290 void replaceSelectionWithFragment(PassRefPtr<DocumentFragment>, bool selectR eplacement, bool smartReplace, bool matchStyle); 290 void replaceSelectionWithFragment(PassRefPtr<DocumentFragment>, bool selectR eplacement, bool smartReplace, bool matchStyle);
291 void replaceSelectionWithText(const String&, bool selectReplacement, bool sm artReplace); 291 void replaceSelectionWithText(const String&, bool selectReplacement, bool sm artReplace);
292 bool selectionStartHasMarkerFor(DocumentMarker::MarkerType, int from, int le ngth) const; 292 bool selectionStartHasMarkerFor(DocumentMarker::MarkerType, int from, int le ngth) const;
293 void updateMarkersForWordsAffectedByEditing(bool onlyHandleWordsContainingSe lection); 293 void updateMarkersForWordsAffectedByEditing(bool onlyHandleWordsContainingSe lection);
294 294
295 void simplifyMarkup(Node* startNode, Node* endNode); 295 void simplifyMarkup(Node* startNode, Node* endNode);
296 296
297 void deviceScaleFactorChanged(); 297 void deviceScaleFactorChanged();
298 298
299 EditorParagraphSeparator defaultParagraphSeparator() const { return m_defaul tParagraphSeparator; } 299 EditorParagraphSeparator defaultParagraphSeparator() const { return m_defaul tParagraphSeparator; }
300 void setDefaultParagraphSeparator(EditorParagraphSeparator separator) { m_de faultParagraphSeparator = separator; } 300 void setDefaultParagraphSeparator(EditorParagraphSeparator separator) { m_de faultParagraphSeparator = separator; }
301 301
302 class RevealSelectionScope { 302 class RevealSelectionScope {
303 WTF_MAKE_NONCOPYABLE(RevealSelectionScope); 303 WTF_MAKE_NONCOPYABLE(RevealSelectionScope);
304 public: 304 public:
305 RevealSelectionScope(Editor*); 305 RevealSelectionScope(Editor*);
306 ~RevealSelectionScope(); 306 ~RevealSelectionScope();
307 private: 307 private:
308 Editor* m_editor; 308 Editor* m_editor;
309 }; 309 };
310 friend class RevealSelectionScope; 310 friend class RevealSelectionScope;
311 311
312 // Spell checks whole contents of a editable element (<input="text"/>, <text area> or contenteditable)
313 // This gets called when any editable element gets focused.
tony 2013/08/20 22:10:39 I would remove this comment. It's a 'what' commen
314 void elementDidBeginEditing(Element*);
315
312 private: 316 private:
313 RefPtr<CompositeEditCommand> m_lastEditCommand; 317 RefPtr<CompositeEditCommand> m_lastEditCommand;
314 RefPtr<Node> m_removedAnchor; 318 RefPtr<Node> m_removedAnchor;
315 int m_preventRevealSelection; 319 int m_preventRevealSelection;
316 bool m_shouldStartNewKillRingSequence; 320 bool m_shouldStartNewKillRingSequence;
317 bool m_shouldStyleWithCSS; 321 bool m_shouldStyleWithCSS;
318 OwnPtr<KillRing> m_killRing; 322 OwnPtr<KillRing> m_killRing;
319 const OwnPtr<SpellCheckRequester> m_spellCheckRequester; 323 const OwnPtr<SpellCheckRequester> m_spellCheckRequester;
320 VisibleSelection m_mark; 324 VisibleSelection m_mark;
321 bool m_areMarkedTextMatchesHighlighted; 325 bool m_areMarkedTextMatchesHighlighted;
322 EditorParagraphSeparator m_defaultParagraphSeparator; 326 EditorParagraphSeparator m_defaultParagraphSeparator;
323 bool m_overwriteModeEnabled; 327 bool m_overwriteModeEnabled;
328 Vector<RefPtr<Node> > m_editablesSpellCheckedOnFocus;
tony 2013/08/20 22:10:39 This should be a HashSet, not a Vector. Also, why
pstanek 2013/08/21 06:05:18 I was thinking the same i.e. it's only a key so No
324 329
325 bool canDeleteRange(Range*) const; 330 bool canDeleteRange(Range*) const;
326 bool canSmartReplaceWithPasteboard(Pasteboard*); 331 bool canSmartReplaceWithPasteboard(Pasteboard*);
327 PassRefPtr<Clipboard> newGeneralClipboard(ClipboardAccessPolicy, Frame*); 332 PassRefPtr<Clipboard> newGeneralClipboard(ClipboardAccessPolicy, Frame*);
328 void pasteAsPlainTextWithPasteboard(Pasteboard*); 333 void pasteAsPlainTextWithPasteboard(Pasteboard*);
329 void pasteWithPasteboard(Pasteboard*, bool allowPlainText); 334 void pasteWithPasteboard(Pasteboard*, bool allowPlainText);
330 335
331 void revealSelectionAfterEditingOperation(const ScrollAlignment& = ScrollAli gnment::alignCenterIfNeeded, RevealExtentOption = DoNotRevealExtent); 336 void revealSelectionAfterEditingOperation(const ScrollAlignment& = ScrollAli gnment::alignCenterIfNeeded, RevealExtentOption = DoNotRevealExtent);
332 void markMisspellingsOrBadGrammar(const VisibleSelection&, bool checkSpellin g, RefPtr<Range>& firstMisspellingRange); 337 void markMisspellingsOrBadGrammar(const VisibleSelection&, bool checkSpellin g, RefPtr<Range>& firstMisspellingRange);
333 TextCheckingTypeMask resolveTextCheckingTypeMask(TextCheckingTypeMask); 338 TextCheckingTypeMask resolveTextCheckingTypeMask(TextCheckingTypeMask);
(...skipping 25 matching lines...) Expand all
359 364
360 inline bool Editor::markedTextMatchesAreHighlighted() const 365 inline bool Editor::markedTextMatchesAreHighlighted() const
361 { 366 {
362 return m_areMarkedTextMatchesHighlighted; 367 return m_areMarkedTextMatchesHighlighted;
363 } 368 }
364 369
365 370
366 } // namespace WebCore 371 } // namespace WebCore
367 372
368 #endif // Editor_h 373 #endif // Editor_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698