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

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

Issue 2149893003: Rename Node::inShadowIncludingDocument() to Node::isConnected() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Created 4 years, 5 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // Handle whitespace that occurs after the split 153 // Handle whitespace that occurs after the split
154 document().updateStyleAndLayoutIgnorePendingStylesheets(); 154 document().updateStyleAndLayoutIgnorePendingStylesheets();
155 // TODO(yosin) |isRenderedCharacter()| should be removed, and we should 155 // TODO(yosin) |isRenderedCharacter()| should be removed, and we should
156 // use |VisiblePosition::characterAfter()|. 156 // use |VisiblePosition::characterAfter()|.
157 if (!isRenderedCharacter(endingPosition)) { 157 if (!isRenderedCharacter(endingPosition)) {
158 Position positionBeforeTextNode(Position::inParentBeforeNode(*textNo de)); 158 Position positionBeforeTextNode(Position::inParentBeforeNode(*textNo de));
159 // Clear out all whitespace and insert one non-breaking space 159 // Clear out all whitespace and insert one non-breaking space
160 deleteInsignificantTextDownstream(endingPosition); 160 deleteInsignificantTextDownstream(endingPosition);
161 DCHECK(!textNode->layoutObject() || textNode->layoutObject()->style( )->collapseWhiteSpace()); 161 DCHECK(!textNode->layoutObject() || textNode->layoutObject()->style( )->collapseWhiteSpace());
162 // Deleting insignificant whitespace will remove textNode if it cont ains nothing but insignificant whitespace. 162 // Deleting insignificant whitespace will remove textNode if it cont ains nothing but insignificant whitespace.
163 if (textNode->inShadowIncludingDocument()) { 163 if (textNode->isConnected()) {
164 insertTextIntoNode(textNode, 0, nonBreakingSpaceString()); 164 insertTextIntoNode(textNode, 0, nonBreakingSpaceString());
165 } else { 165 } else {
166 Text* nbspNode = document().createTextNode(nonBreakingSpaceStrin g()); 166 Text* nbspNode = document().createTextNode(nonBreakingSpaceStrin g());
167 insertNodeAt(nbspNode, positionBeforeTextNode, editingState); 167 insertNodeAt(nbspNode, positionBeforeTextNode, editingState);
168 if (editingState->isAborted()) 168 if (editingState->isAborted())
169 return; 169 return;
170 endingPosition = Position::firstPositionInNode(nbspNode); 170 endingPosition = Position::firstPositionInNode(nbspNode);
171 } 171 }
172 } 172 }
173 173
(...skipping 18 matching lines...) Expand all
192 // before the line break (if the line break is at the end of a block it isn't selectable). 192 // before the line break (if the line break is at the end of a block it isn't selectable).
193 // So, this next call sets the endingSelection() to a caret just after t he line break 193 // So, this next call sets the endingSelection() to a caret just after t he line break
194 // that we inserted, or just before it if it's at the end of a block. 194 // that we inserted, or just before it if it's at the end of a block.
195 setEndingSelection(endingSelection().visibleEnd()); 195 setEndingSelection(endingSelection().visibleEnd());
196 } 196 }
197 197
198 rebalanceWhitespace(); 198 rebalanceWhitespace();
199 } 199 }
200 200
201 } // namespace blink 201 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698