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

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

Issue 23822003: Have EditCommand classes deal with Document references, not pointers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/editing/TextInsertionBaseCommand.cpp ('k') | Source/core/editing/TypingCommand.cpp » ('j') | 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) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 enum Option { 51 enum Option {
52 SelectInsertedText = 1 << 0, 52 SelectInsertedText = 1 << 0,
53 KillRing = 1 << 1, 53 KillRing = 1 << 1,
54 RetainAutocorrectionIndicator = 1 << 2, 54 RetainAutocorrectionIndicator = 1 << 2,
55 PreventSpellChecking = 1 << 3, 55 PreventSpellChecking = 1 << 3,
56 SmartDelete = 1 << 4 56 SmartDelete = 1 << 4
57 }; 57 };
58 typedef unsigned Options; 58 typedef unsigned Options;
59 59
60 static void deleteSelection(Document*, Options = 0); 60 static void deleteSelection(Document&, Options = 0);
61 static void deleteKeyPressed(Document*, Options = 0, TextGranularity = Chara cterGranularity); 61 static void deleteKeyPressed(Document&, Options = 0, TextGranularity = Chara cterGranularity);
62 static void forwardDeleteKeyPressed(Document*, Options = 0, TextGranularity = CharacterGranularity); 62 static void forwardDeleteKeyPressed(Document&, Options = 0, TextGranularity = CharacterGranularity);
63 static void insertText(Document*, const String&, Options, TextCompositionTyp e = TextCompositionNone); 63 static void insertText(Document&, const String&, Options, TextCompositionTyp e = TextCompositionNone);
64 static void insertText(Document*, const String&, const VisibleSelection&, Op tions, TextCompositionType = TextCompositionNone); 64 static void insertText(Document&, const String&, const VisibleSelection&, Op tions, TextCompositionType = TextCompositionNone);
65 static void insertLineBreak(Document*, Options); 65 static void insertLineBreak(Document&, Options);
66 static void insertParagraphSeparator(Document*, Options); 66 static void insertParagraphSeparator(Document&, Options);
67 static void insertParagraphSeparatorInQuotedContent(Document*); 67 static void insertParagraphSeparatorInQuotedContent(Document&);
68 static void closeTyping(Frame*); 68 static void closeTyping(Frame*);
69 69
70 void insertText(const String &text, bool selectInsertedText); 70 void insertText(const String &text, bool selectInsertedText);
71 void insertTextRunWithoutNewlines(const String &text, bool selectInsertedTex t); 71 void insertTextRunWithoutNewlines(const String &text, bool selectInsertedTex t);
72 void insertLineBreak(); 72 void insertLineBreak();
73 void insertParagraphSeparatorInQuotedContent(); 73 void insertParagraphSeparatorInQuotedContent();
74 void insertParagraphSeparator(); 74 void insertParagraphSeparator();
75 void deleteKeyPressed(TextGranularity, bool killRing); 75 void deleteKeyPressed(TextGranularity, bool killRing);
76 void forwardDeleteKeyPressed(TextGranularity, bool killRing); 76 void forwardDeleteKeyPressed(TextGranularity, bool killRing);
77 void deleteSelection(bool smartDelete); 77 void deleteSelection(bool smartDelete);
78 void setCompositionType(TextCompositionType type) { m_compositionType = type ; } 78 void setCompositionType(TextCompositionType type) { m_compositionType = type ; }
79 79
80 private: 80 private:
81 static PassRefPtr<TypingCommand> create(Document* document, ETypingCommand c ommand, const String& text = "", Options options = 0, TextGranularity granularit y = CharacterGranularity) 81 static PassRefPtr<TypingCommand> create(Document& document, ETypingCommand c ommand, const String& text = "", Options options = 0, TextGranularity granularit y = CharacterGranularity)
82 { 82 {
83 return adoptRef(new TypingCommand(document, command, text, options, gran ularity, TextCompositionNone)); 83 return adoptRef(new TypingCommand(document, command, text, options, gran ularity, TextCompositionNone));
84 } 84 }
85 85
86 static PassRefPtr<TypingCommand> create(Document* document, ETypingCommand c ommand, const String& text, Options options, TextCompositionType compositionType ) 86 static PassRefPtr<TypingCommand> create(Document& document, ETypingCommand c ommand, const String& text, Options options, TextCompositionType compositionType )
87 { 87 {
88 return adoptRef(new TypingCommand(document, command, text, options, Char acterGranularity, compositionType)); 88 return adoptRef(new TypingCommand(document, command, text, options, Char acterGranularity, compositionType));
89 } 89 }
90 90
91 TypingCommand(Document*, ETypingCommand, const String& text, Options, TextGr anularity, TextCompositionType); 91 TypingCommand(Document&, ETypingCommand, const String& text, Options, TextGr anularity, TextCompositionType);
92 92
93 bool smartDelete() const { return m_smartDelete; } 93 bool smartDelete() const { return m_smartDelete; }
94 void setSmartDelete(bool smartDelete) { m_smartDelete = smartDelete; } 94 void setSmartDelete(bool smartDelete) { m_smartDelete = smartDelete; }
95 bool isOpenForMoreTyping() const { return m_openForMoreTyping; } 95 bool isOpenForMoreTyping() const { return m_openForMoreTyping; }
96 void closeTyping() { m_openForMoreTyping = false; } 96 void closeTyping() { m_openForMoreTyping = false; }
97 97
98 static PassRefPtr<TypingCommand> lastTypingCommandIfStillOpenForTyping(Frame *); 98 static PassRefPtr<TypingCommand> lastTypingCommandIfStillOpenForTyping(Frame *);
99 99
100 virtual void doApply(); 100 virtual void doApply();
101 virtual EditAction editingAction() const; 101 virtual EditAction editingAction() const;
(...skipping 30 matching lines...) Expand all
132 // was opened with a backward delete. 132 // was opened with a backward delete.
133 bool m_openedByBackwardDelete; 133 bool m_openedByBackwardDelete;
134 134
135 bool m_shouldRetainAutocorrectionIndicator; 135 bool m_shouldRetainAutocorrectionIndicator;
136 bool m_shouldPreventSpellChecking; 136 bool m_shouldPreventSpellChecking;
137 }; 137 };
138 138
139 } // namespace WebCore 139 } // namespace WebCore
140 140
141 #endif // TypingCommand_h 141 #endif // TypingCommand_h
OLDNEW
« no previous file with comments | « Source/core/editing/TextInsertionBaseCommand.cpp ('k') | Source/core/editing/TypingCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698