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

Side by Side Diff: sky/engine/core/editing/InsertParagraphSeparatorCommand.cpp

Issue 834693007: Remove the remaining parts of ignorePendingStylesheets and placeholder styles. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Remove comment. Created 5 years, 11 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 if (!startBlock->parentNode()) 267 if (!startBlock->parentNode())
268 return; 268 return;
269 269
270 // Put the added block in the tree. 270 // Put the added block in the tree.
271 if (nestNewBlock) { 271 if (nestNewBlock) {
272 appendNode(blockToInsert.get(), startBlock); 272 appendNode(blockToInsert.get(), startBlock);
273 } else { 273 } else {
274 insertNodeAfter(blockToInsert.get(), startBlock); 274 insertNodeAfter(blockToInsert.get(), startBlock);
275 } 275 }
276 276
277 document().updateLayoutIgnorePendingStylesheets(); 277 document().updateLayout();
278 278
279 // Move the start node and the siblings of the start node. 279 // Move the start node and the siblings of the start node.
280 if (VisiblePosition(insertionPosition) != VisiblePosition(positionBeforeNode (blockToInsert.get()))) { 280 if (VisiblePosition(insertionPosition) != VisiblePosition(positionBeforeNode (blockToInsert.get()))) {
281 Node* n; 281 Node* n;
282 if (insertionPosition.containerNode() == startBlock) 282 if (insertionPosition.containerNode() == startBlock)
283 n = insertionPosition.computeNodeAfterPosition(); 283 n = insertionPosition.computeNodeAfterPosition();
284 else { 284 else {
285 Node* splitTo = insertionPosition.containerNode(); 285 Node* splitTo = insertionPosition.containerNode();
286 if (splitTo->isTextNode() && insertionPosition.offsetInContainerNode () >= caretMaxOffset(splitTo)) 286 if (splitTo->isTextNode() && insertionPosition.offsetInContainerNode () >= caretMaxOffset(splitTo))
287 splitTo = NodeTraversal::next(*splitTo, startBlock.get()); 287 splitTo = NodeTraversal::next(*splitTo, startBlock.get());
288 ASSERT(splitTo); 288 ASSERT(splitTo);
289 splitTreeToNode(splitTo, startBlock.get()); 289 splitTreeToNode(splitTo, startBlock.get());
290 290
291 for (n = startBlock->firstChild(); n; n = n->nextSibling()) { 291 for (n = startBlock->firstChild(); n; n = n->nextSibling()) {
292 VisiblePosition beforeNodePosition(positionBeforeNode(n)); 292 VisiblePosition beforeNodePosition(positionBeforeNode(n));
293 if (!beforeNodePosition.isNull() && comparePositions(VisiblePosi tion(insertionPosition), beforeNodePosition) <= 0) 293 if (!beforeNodePosition.isNull() && comparePositions(VisiblePosi tion(insertionPosition), beforeNodePosition) <= 0)
294 break; 294 break;
295 } 295 }
296 } 296 }
297 297
298 moveRemainingSiblingsToNewParent(n, blockToInsert.get(), blockToInsert); 298 moveRemainingSiblingsToNewParent(n, blockToInsert.get(), blockToInsert);
299 } 299 }
300 300
301 // Handle whitespace that occurs after the split 301 // Handle whitespace that occurs after the split
302 if (positionAfterSplit.isNotNull()) { 302 if (positionAfterSplit.isNotNull()) {
303 document().updateLayoutIgnorePendingStylesheets(); 303 document().updateLayout();
304 if (!positionAfterSplit.isRenderedCharacter()) { 304 if (!positionAfterSplit.isRenderedCharacter()) {
305 // Clear out all whitespace and insert one non-breaking space 305 // Clear out all whitespace and insert one non-breaking space
306 ASSERT(!positionAfterSplit.containerNode()->renderer() || positionAf terSplit.containerNode()->renderer()->style()->collapseWhiteSpace()); 306 ASSERT(!positionAfterSplit.containerNode()->renderer() || positionAf terSplit.containerNode()->renderer()->style()->collapseWhiteSpace());
307 deleteInsignificantTextDownstream(positionAfterSplit); 307 deleteInsignificantTextDownstream(positionAfterSplit);
308 if (positionAfterSplit.deprecatedNode()->isTextNode()) 308 if (positionAfterSplit.deprecatedNode()->isTextNode())
309 insertTextIntoNode(toText(positionAfterSplit.containerNode()), 0 , nonBreakingSpaceString()); 309 insertTextIntoNode(toText(positionAfterSplit.containerNode()), 0 , nonBreakingSpaceString());
310 } 310 }
311 } 311 }
312 312
313 setEndingSelection(VisibleSelection(firstPositionInNode(blockToInsert.get()) , DOWNSTREAM, endingSelection().isDirectional())); 313 setEndingSelection(VisibleSelection(firstPositionInNode(blockToInsert.get()) , DOWNSTREAM, endingSelection().isDirectional()));
314 } 314 }
315 315
316 } // namespace blink 316 } // namespace blink
OLDNEW
« no previous file with comments | « sky/engine/core/editing/InsertLineBreakCommand.cpp ('k') | sky/engine/core/editing/ReplaceSelectionCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698