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 21 matching lines...) Expand all Loading... |
32 | 32 |
33 class TypingCommand : public TextInsertionBaseCommand { | 33 class TypingCommand : public TextInsertionBaseCommand { |
34 public: | 34 public: |
35 enum ETypingCommand { | 35 enum ETypingCommand { |
36 DeleteSelection, | 36 DeleteSelection, |
37 DeleteKey, | 37 DeleteKey, |
38 ForwardDeleteKey, | 38 ForwardDeleteKey, |
39 InsertText, | 39 InsertText, |
40 InsertLineBreak, | 40 InsertLineBreak, |
41 InsertParagraphSeparator, | 41 InsertParagraphSeparator, |
42 InsertParagraphSeparatorInQuotedContent | |
43 }; | 42 }; |
44 | 43 |
45 enum TextCompositionType { | 44 enum TextCompositionType { |
46 TextCompositionNone, | 45 TextCompositionNone, |
47 TextCompositionUpdate, | 46 TextCompositionUpdate, |
48 TextCompositionConfirm | 47 TextCompositionConfirm |
49 }; | 48 }; |
50 | 49 |
51 enum Option { | 50 enum Option { |
52 SelectInsertedText = 1 << 0, | 51 SelectInsertedText = 1 << 0, |
53 KillRing = 1 << 1, | 52 KillRing = 1 << 1, |
54 RetainAutocorrectionIndicator = 1 << 2, | 53 RetainAutocorrectionIndicator = 1 << 2, |
55 PreventSpellChecking = 1 << 3, | 54 PreventSpellChecking = 1 << 3, |
56 SmartDelete = 1 << 4 | 55 SmartDelete = 1 << 4 |
57 }; | 56 }; |
58 typedef unsigned Options; | 57 typedef unsigned Options; |
59 | 58 |
60 static void deleteSelection(Document*, Options = 0); | 59 static void deleteSelection(Document*, Options = 0); |
61 static void deleteKeyPressed(Document*, Options = 0, TextGranularity = Chara
cterGranularity); | 60 static void deleteKeyPressed(Document*, Options = 0, TextGranularity = Chara
cterGranularity); |
62 static void forwardDeleteKeyPressed(Document*, Options = 0, TextGranularity
= CharacterGranularity); | 61 static void forwardDeleteKeyPressed(Document*, Options = 0, TextGranularity
= CharacterGranularity); |
63 static void insertText(Document*, const String&, Options, TextCompositionTyp
e = TextCompositionNone); | 62 static void insertText(Document*, const String&, Options, TextCompositionTyp
e = TextCompositionNone); |
64 static void insertText(Document*, const String&, const VisibleSelection&, Op
tions, TextCompositionType = TextCompositionNone); | 63 static void insertText(Document*, const String&, const VisibleSelection&, Op
tions, TextCompositionType = TextCompositionNone); |
65 static void insertLineBreak(Document*, Options); | 64 static void insertLineBreak(Document*, Options); |
66 static void insertParagraphSeparator(Document*, Options); | 65 static void insertParagraphSeparator(Document*, Options); |
67 static void insertParagraphSeparatorInQuotedContent(Document*); | |
68 static void closeTyping(Frame*); | 66 static void closeTyping(Frame*); |
69 | 67 |
70 void insertText(const String &text, bool selectInsertedText); | 68 void insertText(const String &text, bool selectInsertedText); |
71 void insertTextRunWithoutNewlines(const String &text, bool selectInsertedTex
t); | 69 void insertTextRunWithoutNewlines(const String &text, bool selectInsertedTex
t); |
72 void insertLineBreak(); | 70 void insertLineBreak(); |
73 void insertParagraphSeparatorInQuotedContent(); | |
74 void insertParagraphSeparator(); | 71 void insertParagraphSeparator(); |
75 void deleteKeyPressed(TextGranularity, bool killRing); | 72 void deleteKeyPressed(TextGranularity, bool killRing); |
76 void forwardDeleteKeyPressed(TextGranularity, bool killRing); | 73 void forwardDeleteKeyPressed(TextGranularity, bool killRing); |
77 void deleteSelection(bool smartDelete); | 74 void deleteSelection(bool smartDelete); |
78 void setCompositionType(TextCompositionType type) { m_compositionType = type
; } | 75 void setCompositionType(TextCompositionType type) { m_compositionType = type
; } |
79 | 76 |
80 private: | 77 private: |
81 static PassRefPtr<TypingCommand> create(Document* document, ETypingCommand c
ommand, const String& text = "", Options options = 0, TextGranularity granularit
y = CharacterGranularity) | 78 static PassRefPtr<TypingCommand> create(Document* document, ETypingCommand c
ommand, const String& text = "", Options options = 0, TextGranularity granularit
y = CharacterGranularity) |
82 { | 79 { |
83 return adoptRef(new TypingCommand(document, command, text, options, gran
ularity, TextCompositionNone)); | 80 return adoptRef(new TypingCommand(document, command, text, options, gran
ularity, TextCompositionNone)); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 // was opened with a backward delete. | 129 // was opened with a backward delete. |
133 bool m_openedByBackwardDelete; | 130 bool m_openedByBackwardDelete; |
134 | 131 |
135 bool m_shouldRetainAutocorrectionIndicator; | 132 bool m_shouldRetainAutocorrectionIndicator; |
136 bool m_shouldPreventSpellChecking; | 133 bool m_shouldPreventSpellChecking; |
137 }; | 134 }; |
138 | 135 |
139 } // namespace WebCore | 136 } // namespace WebCore |
140 | 137 |
141 #endif // TypingCommand_h | 138 #endif // TypingCommand_h |
OLD | NEW |