Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: Source/core/editing/Editor.cpp

Issue 326323003: Fix a crash caused by invalid selection set by Undo command. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix minor issues in test. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/editing/undo/undo-set-selection-crash-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 712
713 void Editor::unappliedEditing(PassRefPtrWillBeRawPtr<EditCommandComposition> cmd ) 713 void Editor::unappliedEditing(PassRefPtrWillBeRawPtr<EditCommandComposition> cmd )
714 { 714 {
715 EventQueueScope scope; 715 EventQueueScope scope;
716 m_frame.document()->updateLayout(); 716 m_frame.document()->updateLayout();
717 717
718 dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), cmd ->endingRootEditableElement()); 718 dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), cmd ->endingRootEditableElement());
719 719
720 VisibleSelection newSelection(cmd->startingSelection()); 720 VisibleSelection newSelection(cmd->startingSelection());
721 newSelection.validatePositionsIfNeeded(); 721 newSelection.validatePositionsIfNeeded();
722 changeSelectionAfterCommand(newSelection, FrameSelection::CloseTyping | Fram eSelection::ClearTypingStyle); 722 if (newSelection.start().document() == m_frame.document() && newSelection.en d().document() == m_frame.document())
723 changeSelectionAfterCommand(newSelection, FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle);
723 724
724 m_lastEditCommand = nullptr; 725 m_lastEditCommand = nullptr;
725 if (UndoStack* undoStack = this->undoStack()) 726 if (UndoStack* undoStack = this->undoStack())
726 undoStack->registerRedoStep(cmd); 727 undoStack->registerRedoStep(cmd);
727 respondToChangedContents(newSelection); 728 respondToChangedContents(newSelection);
728 } 729 }
729 730
730 void Editor::reappliedEditing(PassRefPtrWillBeRawPtr<EditCommandComposition> cmd ) 731 void Editor::reappliedEditing(PassRefPtrWillBeRawPtr<EditCommandComposition> cmd )
731 { 732 {
732 EventQueueScope scope; 733 EventQueueScope scope;
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 frame().selection().setShouldShowBlockCursor(m_overwriteModeEnabled); 1237 frame().selection().setShouldShowBlockCursor(m_overwriteModeEnabled);
1237 } 1238 }
1238 1239
1239 void Editor::trace(Visitor* visitor) 1240 void Editor::trace(Visitor* visitor)
1240 { 1241 {
1241 visitor->trace(m_lastEditCommand); 1242 visitor->trace(m_lastEditCommand);
1242 visitor->trace(m_mark); 1243 visitor->trace(m_mark);
1243 } 1244 }
1244 1245
1245 } // namespace WebCore 1246 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/editing/undo/undo-set-selection-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698