| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 | 958 |
| 959 // Command will be equal to last edit command only in the case of typing | 959 // Command will be equal to last edit command only in the case of typing |
| 960 if (last_edit_command_.Get() == cmd) { | 960 if (last_edit_command_.Get() == cmd) { |
| 961 DCHECK(cmd->IsTypingCommand()); | 961 DCHECK(cmd->IsTypingCommand()); |
| 962 } else if (last_edit_command_ && last_edit_command_->IsDragAndDropCommand() && | 962 } else if (last_edit_command_ && last_edit_command_->IsDragAndDropCommand() && |
| 963 (cmd->GetInputType() == InputEvent::InputType::kDeleteByDrag || | 963 (cmd->GetInputType() == InputEvent::InputType::kDeleteByDrag || |
| 964 cmd->GetInputType() == InputEvent::InputType::kInsertFromDrop)) { | 964 cmd->GetInputType() == InputEvent::InputType::kInsertFromDrop)) { |
| 965 // Only register undo entry when combined with other commands. | 965 // Only register undo entry when combined with other commands. |
| 966 if (!last_edit_command_->GetUndoStep()) | 966 if (!last_edit_command_->GetUndoStep()) |
| 967 undo_stack_->RegisterUndoStep(last_edit_command_->EnsureUndoStep()); | 967 undo_stack_->RegisterUndoStep(last_edit_command_->EnsureUndoStep()); |
| 968 last_edit_command_->EnsureUndoStep()->SetEndingSelection( |
| 969 cmd->EnsureUndoStep()->EndingSelection()); |
| 968 last_edit_command_->AppendCommandToUndoStep(cmd); | 970 last_edit_command_->AppendCommandToUndoStep(cmd); |
| 969 } else { | 971 } else { |
| 970 // Only register a new undo command if the command passed in is | 972 // Only register a new undo command if the command passed in is |
| 971 // different from the last command | 973 // different from the last command |
| 972 last_edit_command_ = cmd; | 974 last_edit_command_ = cmd; |
| 973 undo_stack_->RegisterUndoStep(last_edit_command_->EnsureUndoStep()); | 975 undo_stack_->RegisterUndoStep(last_edit_command_->EnsureUndoStep()); |
| 974 } | 976 } |
| 975 | 977 |
| 976 RespondToChangedContents(new_selection.Base()); | 978 RespondToChangedContents(new_selection.Base()); |
| 977 } | 979 } |
| (...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1819 | 1821 |
| 1820 DEFINE_TRACE(Editor) { | 1822 DEFINE_TRACE(Editor) { |
| 1821 visitor->Trace(frame_); | 1823 visitor->Trace(frame_); |
| 1822 visitor->Trace(last_edit_command_); | 1824 visitor->Trace(last_edit_command_); |
| 1823 visitor->Trace(undo_stack_); | 1825 visitor->Trace(undo_stack_); |
| 1824 visitor->Trace(mark_); | 1826 visitor->Trace(mark_); |
| 1825 visitor->Trace(typing_style_); | 1827 visitor->Trace(typing_style_); |
| 1826 } | 1828 } |
| 1827 | 1829 |
| 1828 } // namespace blink | 1830 } // namespace blink |
| OLD | NEW |