| 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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 | 477 |
| 478 ASSERT(!selectionToDelete.isNone()); | 478 ASSERT(!selectionToDelete.isNone()); |
| 479 if (selectionToDelete.isNone()) | 479 if (selectionToDelete.isNone()) |
| 480 return; | 480 return; |
| 481 | 481 |
| 482 if (selectionToDelete.isCaret()) | 482 if (selectionToDelete.isCaret()) |
| 483 return; | 483 return; |
| 484 | 484 |
| 485 if (killRing) | 485 if (killRing) |
| 486 frame->editor().addToKillRing(selectionToDelete.toNormalizedRange().get(
), false); | 486 frame->editor().addToKillRing(selectionToDelete.toNormalizedRange().get(
), false); |
| 487 // Make undo select everything that has been deleted, unless an undo will un
do more than just this deletion. | 487 // On Mac, make undo select everything that has been deleted, unless an undo
will undo more than just this deletion. |
| 488 // FIXME: This behaves like TextEdit except for the case where you open with
text insertion and then delete | 488 // FIXME: This behaves like TextEdit except for the case where you open with
text insertion and then delete |
| 489 // more text than you insert. In that case all of the text that was around
originally should be selected. | 489 // more text than you insert. In that case all of the text that was around
originally should be selected. |
| 490 if (m_openedByBackwardDelete) | 490 if (frame->editor().behavior().shouldUndoOfWordDeletionSelectWord() && m_ope
nedByBackwardDelete) |
| 491 setStartingSelection(selectionAfterUndo); | 491 setStartingSelection(selectionAfterUndo); |
| 492 CompositeEditCommand::deleteSelection(selectionToDelete, m_smartDelete); | 492 CompositeEditCommand::deleteSelection(selectionToDelete, m_smartDelete); |
| 493 setSmartDelete(false); | 493 setSmartDelete(false); |
| 494 typingAddedToOpenCommand(DeleteKey); | 494 typingAddedToOpenCommand(DeleteKey); |
| 495 } | 495 } |
| 496 | 496 |
| 497 void TypingCommand::forwardDeleteKeyPressed(TextGranularity granularity, bool ki
llRing) | 497 void TypingCommand::forwardDeleteKeyPressed(TextGranularity granularity, bool ki
llRing) |
| 498 { | 498 { |
| 499 Frame* frame = document().frame(); | 499 Frame* frame = document().frame(); |
| 500 if (!frame) | 500 if (!frame) |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 | 570 |
| 571 ASSERT(!selectionToDelete.isNone()); | 571 ASSERT(!selectionToDelete.isNone()); |
| 572 if (selectionToDelete.isNone()) | 572 if (selectionToDelete.isNone()) |
| 573 return; | 573 return; |
| 574 | 574 |
| 575 if (selectionToDelete.isCaret()) | 575 if (selectionToDelete.isCaret()) |
| 576 return; | 576 return; |
| 577 | 577 |
| 578 if (killRing) | 578 if (killRing) |
| 579 frame->editor().addToKillRing(selectionToDelete.toNormalizedRange().get(
), false); | 579 frame->editor().addToKillRing(selectionToDelete.toNormalizedRange().get(
), false); |
| 580 // make undo select what was deleted | 580 // Make undo select what was deleted on Mac alone |
| 581 setStartingSelection(selectionAfterUndo); | 581 if (frame->editor().behavior().shouldUndoOfWordDeletionSelectWord()) |
| 582 setStartingSelection(selectionAfterUndo); |
| 582 CompositeEditCommand::deleteSelection(selectionToDelete, m_smartDelete); | 583 CompositeEditCommand::deleteSelection(selectionToDelete, m_smartDelete); |
| 583 setSmartDelete(false); | 584 setSmartDelete(false); |
| 584 typingAddedToOpenCommand(ForwardDeleteKey); | 585 typingAddedToOpenCommand(ForwardDeleteKey); |
| 585 } | 586 } |
| 586 | 587 |
| 587 void TypingCommand::deleteSelection(bool smartDelete) | 588 void TypingCommand::deleteSelection(bool smartDelete) |
| 588 { | 589 { |
| 589 CompositeEditCommand::deleteSelection(smartDelete); | 590 CompositeEditCommand::deleteSelection(smartDelete); |
| 590 typingAddedToOpenCommand(DeleteSelection); | 591 typingAddedToOpenCommand(DeleteSelection); |
| 591 } | 592 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 608 ASSERT_NOT_REACHED(); | 609 ASSERT_NOT_REACHED(); |
| 609 m_preservesTypingStyle = false; | 610 m_preservesTypingStyle = false; |
| 610 } | 611 } |
| 611 | 612 |
| 612 bool TypingCommand::isTypingCommand() const | 613 bool TypingCommand::isTypingCommand() const |
| 613 { | 614 { |
| 614 return true; | 615 return true; |
| 615 } | 616 } |
| 616 | 617 |
| 617 } // namespace WebCore | 618 } // namespace WebCore |
| OLD | NEW |