Changeset 27009 in webkit
- Timestamp:
- Oct 24, 2007 5:58:54 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r27005 r27009 1 2007-10-24 Justin Garcia <justin.garcia@apple.com> 2 3 Reviewed by Darin. 4 5 <rdar://problem/5544856> 6 REGRESSION: After typing 2-byte text, undo only undoes one keystroke at a time 7 8 * platform/mac/editing/input/text-input-controller-expected.txt: The delete 9 we were using previously to remove the old composition makes fewer calls to 10 the editing delegate. 11 1 12 2007-10-24 Alice Liu <alice.liu@apple.com> 2 13 -
trunk/LayoutTests/platform/mac/editing/input/text-input-controller-expected.txt
r26943 r27009 23 23 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 24 24 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification 25 EDITING DELEGATE: shouldInsertText:Success replacingDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document givenAction:WebViewInsertActionTyped 25 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 26 EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE 27 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 28 EDITING DELEGATE: shouldInsertText:Failure replacingDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document givenAction:WebViewInsertActionTyped 26 29 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 27 30 EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 7 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE 28 31 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 29 32 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification 30 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 7 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 7 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE 31 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 32 Success 33 Failure -
trunk/WebCore/ChangeLog
r27008 r27009 1 2007-10-24 Justin Garcia <justin.garcia@apple.com> 2 3 Reviewed by Darin Adler. 4 5 Correcting the fix for: 6 <rdar://problem/5544856> 7 REGRESSION: After typing 2-byte text, undo only undoes one keystroke at a time 8 9 Made removal of the previous composition part of the current Undo step in the 10 case where the new composition is the empty string, too. 11 12 * editing/Editor.cpp: 13 (WebCore::Editor::confirmComposition): Call the new TypingCommand::deleteSelection, 14 which either has the currently open typing command delete the current selection, or 15 opens a new typing command (of type DeleteSelection) if one is not already open. 16 (WebCore::Editor::setComposition): Ditto. 17 * editing/TypingCommand.cpp: 18 (WebCore::TypingCommand::deleteSelection): Added. 19 (WebCore::TypingCommand::doApply): Handle DeleteSelection. 20 (WebCore::TypingCommand::deleteKeyPressed): Clarified which deleteSelection 21 is called. 22 (WebCore::TypingCommand::forwardDeleteKeyPressed): Ditto. 23 (WebCore::TypingCommand::preservesTypingStyle): Handle DeleteSelection. 24 * editing/TypingCommand.h: 25 1 26 2007-10-24 Sam Weinig <sam@webkit.org> 2 27 -
trunk/WebCore/editing/Editor.cpp
r26942 r27009 1706 1706 return; 1707 1707 } 1708 1709 // If there is a composition to replace, remove it with a deletion that will be part of the 1710 // same Undo step as the next and previous insertions. 1711 TypingCommand::deleteSelection(m_frame->document(), false); 1708 1712 1709 1713 m_compositionNode = 0; … … 1728 1732 return; 1729 1733 } 1734 1735 // If there is a composition to replace, remove it with a deletion that will be part of the 1736 // same Undo step as the next and previous insertions. 1737 TypingCommand::deleteSelection(m_frame->document(), false); 1730 1738 1731 1739 m_compositionNode = 0; -
trunk/WebCore/editing/TypingCommand.cpp
r25547 r27009 57 57 } 58 58 59 void TypingCommand::deleteSelection(Document* document, bool smartDelete) 60 { 61 ASSERT(document); 62 63 Frame* frame = document->frame(); 64 ASSERT(frame); 65 66 if (!frame->selectionController()->isRange()) 67 return; 68 69 EditCommand* lastEditCommand = frame->editor()->lastEditCommand(); 70 if (isOpenForMoreTypingCommand(lastEditCommand)) { 71 static_cast<TypingCommand*>(lastEditCommand)->deleteSelection(smartDelete); 72 return; 73 } 74 75 RefPtr<TypingCommand> typingCommand = new TypingCommand(document, DeleteSelection, "", false); 76 typingCommand->setSmartDelete(smartDelete); 77 typingCommand->apply(); 78 } 79 59 80 void TypingCommand::deleteKeyPressed(Document *document, bool smartDelete, TextGranularity granularity) 60 81 { … … 227 248 228 249 switch (m_commandType) { 250 case DeleteSelection: 251 deleteSelection(m_smartDelete); 252 return; 229 253 case DeleteKey: 230 254 deleteKeyPressed(m_granularity); … … 403 427 if (m_openedByBackwardDelete) 404 428 setStartingSelection(selectionAfterUndo); 405 deleteSelection(selectionToDelete, m_smartDelete);429 CompositeEditCommand::deleteSelection(selectionToDelete, m_smartDelete); 406 430 setSmartDelete(false); 407 431 typingAddedToOpenCommand(); … … 473 497 // make undo select what was deleted 474 498 setStartingSelection(selectionAfterUndo); 475 deleteSelection(selectionToDelete, m_smartDelete);499 CompositeEditCommand::deleteSelection(selectionToDelete, m_smartDelete); 476 500 setSmartDelete(false); 477 501 typingAddedToOpenCommand(); … … 479 503 } 480 504 505 void TypingCommand::deleteSelection(bool smartDelete) 506 { 507 CompositeEditCommand::deleteSelection(smartDelete); 508 } 509 481 510 bool TypingCommand::preservesTypingStyle() const 482 511 { 483 512 switch (m_commandType) { 513 case DeleteSelection: 484 514 case DeleteKey: 485 515 case ForwardDeleteKey: -
trunk/WebCore/editing/TypingCommand.h
r25547 r27009 34 34 public: 35 35 enum ETypingCommand { 36 DeleteSelection, 36 37 DeleteKey, 37 38 ForwardDeleteKey, … … 44 45 TypingCommand(Document*, ETypingCommand, const String& text = "", bool selectInsertedText = false, TextGranularity = CharacterGranularity); 45 46 47 static void deleteSelection(Document*, bool smartDelete = false); 46 48 static void deleteKeyPressed(Document*, bool smartDelete = false, TextGranularity = CharacterGranularity); 47 49 static void forwardDeleteKeyPressed(Document*, bool smartDelete = false, TextGranularity = CharacterGranularity); … … 67 69 void deleteKeyPressed(TextGranularity); 68 70 void forwardDeleteKeyPressed(TextGranularity); 71 void deleteSelection(bool); 69 72 70 73 private:
Note: See TracChangeset
for help on using the changeset viewer.