OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |