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

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp

Issue 1702233002: Editing: Make the |EditingState*| argument of CompositeEditCommand::insertNodeAt mandatory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2005, 2006 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 if (!isRenderedCharacter(endingPosition)) { 145 if (!isRenderedCharacter(endingPosition)) {
146 Position positionBeforeTextNode(positionInParentBeforeNode(*textNode )); 146 Position positionBeforeTextNode(positionInParentBeforeNode(*textNode ));
147 // Clear out all whitespace and insert one non-breaking space 147 // Clear out all whitespace and insert one non-breaking space
148 deleteInsignificantTextDownstream(endingPosition); 148 deleteInsignificantTextDownstream(endingPosition);
149 ASSERT(!textNode->layoutObject() || textNode->layoutObject()->style( )->collapseWhiteSpace()); 149 ASSERT(!textNode->layoutObject() || textNode->layoutObject()->style( )->collapseWhiteSpace());
150 // Deleting insignificant whitespace will remove textNode if it cont ains nothing but insignificant whitespace. 150 // Deleting insignificant whitespace will remove textNode if it cont ains nothing but insignificant whitespace.
151 if (textNode->inDocument()) { 151 if (textNode->inDocument()) {
152 insertTextIntoNode(textNode, 0, nonBreakingSpaceString()); 152 insertTextIntoNode(textNode, 0, nonBreakingSpaceString());
153 } else { 153 } else {
154 RefPtrWillBeRawPtr<Text> nbspNode = document().createTextNode(no nBreakingSpaceString()); 154 RefPtrWillBeRawPtr<Text> nbspNode = document().createTextNode(no nBreakingSpaceString());
155 insertNodeAt(nbspNode.get(), positionBeforeTextNode); 155 insertNodeAt(nbspNode.get(), positionBeforeTextNode, editingStat e);
156 if (editingState->isAborted())
157 return;
156 endingPosition = firstPositionInNode(nbspNode.get()); 158 endingPosition = firstPositionInNode(nbspNode.get());
157 } 159 }
158 } 160 }
159 161
160 setEndingSelection(VisibleSelection(endingPosition, TextAffinity::Downst ream, endingSelection().isDirectional())); 162 setEndingSelection(VisibleSelection(endingPosition, TextAffinity::Downst ream, endingSelection().isDirectional()));
161 } 163 }
162 164
163 // Handle the case where there is a typing style. 165 // Handle the case where there is a typing style.
164 166
165 RefPtrWillBeRawPtr<EditingStyle> typingStyle = document().frame()->selection ().typingStyle(); 167 RefPtrWillBeRawPtr<EditingStyle> typingStyle = document().frame()->selection ().typingStyle();
(...skipping 12 matching lines...) Expand all
178 // before the line break (if the line break is at the end of a block it isn't selectable). 180 // before the line break (if the line break is at the end of a block it isn't selectable).
179 // So, this next call sets the endingSelection() to a caret just after t he line break 181 // So, this next call sets the endingSelection() to a caret just after t he line break
180 // that we inserted, or just before it if it's at the end of a block. 182 // that we inserted, or just before it if it's at the end of a block.
181 setEndingSelection(endingSelection().visibleEnd()); 183 setEndingSelection(endingSelection().visibleEnd());
182 } 184 }
183 185
184 rebalanceWhitespace(); 186 rebalanceWhitespace();
185 } 187 }
186 188
187 } // namespace blink 189 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698