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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 162 |
163 if (!text.isEmpty()) | 163 if (!text.isEmpty()) |
164 document.frame()->spellChecker().updateMarkersForWordsAffectedByEditing(
isSpaceOrNewline(text[0])); | 164 document.frame()->spellChecker().updateMarkersForWordsAffectedByEditing(
isSpaceOrNewline(text[0])); |
165 | 165 |
166 insertText(document, text, frame->selection().selection(), options, composit
ion); | 166 insertText(document, text, frame->selection().selection(), options, composit
ion); |
167 } | 167 } |
168 | 168 |
169 // FIXME: We shouldn't need to take selectionForInsertion. It should be identica
l to FrameSelection's current selection. | 169 // FIXME: We shouldn't need to take selectionForInsertion. It should be identica
l to FrameSelection's current selection. |
170 void TypingCommand::insertText(Document& document, const String& text, const Vis
ibleSelection& selectionForInsertion, Options options, TextCompositionType compo
sitionType) | 170 void TypingCommand::insertText(Document& document, const String& text, const Vis
ibleSelection& selectionForInsertion, Options options, TextCompositionType compo
sitionType) |
171 { | 171 { |
172 RefPtr<LocalFrame> frame = document.frame(); | 172 RefPtrWillBeRawPtr<LocalFrame> frame = document.frame(); |
173 ASSERT(frame); | 173 ASSERT(frame); |
174 | 174 |
175 VisibleSelection currentSelection = frame->selection().selection(); | 175 VisibleSelection currentSelection = frame->selection().selection(); |
176 | 176 |
177 String newText = dispatchBeforeTextInsertedEvent(text, selectionForInsertion
, compositionType == TextCompositionUpdate); | 177 String newText = dispatchBeforeTextInsertedEvent(text, selectionForInsertion
, compositionType == TextCompositionUpdate); |
178 | 178 |
179 // Set the starting and ending selection appropriately if we are using a sel
ection | 179 // Set the starting and ending selection appropriately if we are using a sel
ection |
180 // that is different from the current selection. In the future, we should c
hange EditCommand | 180 // that is different from the current selection. In the future, we should c
hange EditCommand |
181 // to deal with custom selections in a general way that can be used by all o
f the commands. | 181 // to deal with custom selections in a general way that can be used by all o
f the commands. |
182 if (RefPtrWillBeRawPtr<TypingCommand> lastTypingCommand = lastTypingCommandI
fStillOpenForTyping(frame.get())) { | 182 if (RefPtrWillBeRawPtr<TypingCommand> lastTypingCommand = lastTypingCommandI
fStillOpenForTyping(frame.get())) { |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 ASSERT_NOT_REACHED(); | 624 ASSERT_NOT_REACHED(); |
625 m_preservesTypingStyle = false; | 625 m_preservesTypingStyle = false; |
626 } | 626 } |
627 | 627 |
628 bool TypingCommand::isTypingCommand() const | 628 bool TypingCommand::isTypingCommand() const |
629 { | 629 { |
630 return true; | 630 return true; |
631 } | 631 } |
632 | 632 |
633 } // namespace blink | 633 } // namespace blink |
OLD | NEW |