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

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

Issue 2705373002: Remove unnecessary layout updates from InsertInto/DeleteFromTextNodeCommand (Closed)
Patch Set: Add layout updates for clients requiring that explicitly Created 3 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 Position endingPosition = Position::firstPositionInNode(textNode); 170 Position endingPosition = Position::firstPositionInNode(textNode);
171 171
172 // Handle whitespace that occurs after the split 172 // Handle whitespace that occurs after the split
173 document().updateStyleAndLayoutIgnorePendingStylesheets(); 173 document().updateStyleAndLayoutIgnorePendingStylesheets();
174 // TODO(yosin) |isRenderedCharacter()| should be removed, and we should 174 // TODO(yosin) |isRenderedCharacter()| should be removed, and we should
175 // use |VisiblePosition::characterAfter()|. 175 // use |VisiblePosition::characterAfter()|.
176 if (!isRenderedCharacter(endingPosition)) { 176 if (!isRenderedCharacter(endingPosition)) {
177 Position positionBeforeTextNode(Position::inParentBeforeNode(*textNode)); 177 Position positionBeforeTextNode(Position::inParentBeforeNode(*textNode));
178 // Clear out all whitespace and insert one non-breaking space 178 // Clear out all whitespace and insert one non-breaking space
179 deleteInsignificantTextDownstream(endingPosition); 179 deleteInsignificantTextDownstream(endingPosition);
180 DCHECK(!textNode->layoutObject() ||
yosin_UTC9 2017/02/22 06:26:08 I really don't like this DCHECK() since it depends
181 textNode->layoutObject()->style()->collapseWhiteSpace());
182 // Deleting insignificant whitespace will remove textNode if it contains 180 // Deleting insignificant whitespace will remove textNode if it contains
183 // nothing but insignificant whitespace. 181 // nothing but insignificant whitespace.
184 if (textNode->isConnected()) { 182 if (textNode->isConnected()) {
185 insertTextIntoNode(textNode, 0, nonBreakingSpaceString()); 183 insertTextIntoNode(textNode, 0, nonBreakingSpaceString());
186 } else { 184 } else {
187 Text* nbspNode = document().createTextNode(nonBreakingSpaceString()); 185 Text* nbspNode = document().createTextNode(nonBreakingSpaceString());
188 insertNodeAt(nbspNode, positionBeforeTextNode, editingState); 186 insertNodeAt(nbspNode, positionBeforeTextNode, editingState);
189 if (editingState->isAborted()) 187 if (editingState->isAborted())
190 return; 188 return;
191 endingPosition = Position::firstPositionInNode(nbspNode); 189 endingPosition = Position::firstPositionInNode(nbspNode);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 // block. 221 // block.
224 setEndingSelection(SelectionInDOMTree::Builder() 222 setEndingSelection(SelectionInDOMTree::Builder()
225 .collapse(endingSelection().end()) 223 .collapse(endingSelection().end())
226 .build()); 224 .build());
227 } 225 }
228 226
229 rebalanceWhitespace(); 227 rebalanceWhitespace();
230 } 228 }
231 229
232 } // namespace blink 230 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698