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

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

Issue 303263006: Make sure end position of selection to delete editable (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
« no previous file with comments | « LayoutTests/editing/deleting/delete-selection-with-non-editable-end-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) 2005 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2005 Apple Computer, 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 VisiblePosition newBase(isBaseFirst ? start : end); 157 VisiblePosition newBase(isBaseFirst ? start : end);
158 VisiblePosition newExtent(isBaseFirst ? end : start); 158 VisiblePosition newExtent(isBaseFirst ? end : start);
159 setStartingSelection(VisibleSelection(newBase, newExtent, startingSelection( ).isDirectional())); 159 setStartingSelection(VisibleSelection(newBase, newExtent, startingSelection( ).isDirectional()));
160 } 160 }
161 161
162 void DeleteSelectionCommand::initializePositionData() 162 void DeleteSelectionCommand::initializePositionData()
163 { 163 {
164 Position start, end; 164 Position start, end;
165 initializeStartEnd(start, end); 165 initializeStartEnd(start, end);
166 166
167 ASSERT(isEditablePosition(start, ContentIsEditable, DoNotUpdateStyle));
168 if (!isEditablePosition(end, ContentIsEditable, DoNotUpdateStyle))
169 end = lastEditablePositionBeforePositionInRoot(end, highestEditableRoot( start)).deepEquivalent();
170
167 m_upstreamStart = start.upstream(); 171 m_upstreamStart = start.upstream();
168 m_downstreamStart = start.downstream(); 172 m_downstreamStart = start.downstream();
169 m_upstreamEnd = end.upstream(); 173 m_upstreamEnd = end.upstream();
170 m_downstreamEnd = end.downstream(); 174 m_downstreamEnd = end.downstream();
171 175
172 m_startRoot = editableRootForPosition(start); 176 m_startRoot = editableRootForPosition(start);
173 m_endRoot = editableRootForPosition(end); 177 m_endRoot = editableRootForPosition(end);
174 178
175 m_startTableRow = enclosingNodeOfType(start, &isHTMLTableRowElement); 179 m_startTableRow = enclosingNodeOfType(start, &isHTMLTableRowElement);
176 m_endTableRow = enclosingNodeOfType(end, &isHTMLTableRowElement); 180 m_endTableRow = enclosingNodeOfType(end, &isHTMLTableRowElement);
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 visitor->trace(m_deleteIntoBlockquoteStyle); 884 visitor->trace(m_deleteIntoBlockquoteStyle);
881 visitor->trace(m_startRoot); 885 visitor->trace(m_startRoot);
882 visitor->trace(m_endRoot); 886 visitor->trace(m_endRoot);
883 visitor->trace(m_startTableRow); 887 visitor->trace(m_startTableRow);
884 visitor->trace(m_endTableRow); 888 visitor->trace(m_endTableRow);
885 visitor->trace(m_temporaryPlaceholder); 889 visitor->trace(m_temporaryPlaceholder);
886 CompositeEditCommand::trace(visitor); 890 CompositeEditCommand::trace(visitor);
887 } 891 }
888 892
889 } // namespace WebCore 893 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/editing/deleting/delete-selection-with-non-editable-end-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698