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

Side by Side Diff: Source/core/editing/commands/InsertParagraphSeparatorCommand.cpp

Issue 1286993006: Introduce isRenderedCharacter(Position) function (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-19T12:39:43 Created 5 years, 4 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 | « Source/core/editing/commands/InsertLineBreakCommand.cpp ('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, 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 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 break; 410 break;
411 } 411 }
412 } 412 }
413 413
414 moveRemainingSiblingsToNewParent(n, blockToInsert.get(), blockToInsert); 414 moveRemainingSiblingsToNewParent(n, blockToInsert.get(), blockToInsert);
415 } 415 }
416 416
417 // Handle whitespace that occurs after the split 417 // Handle whitespace that occurs after the split
418 if (positionAfterSplit.isNotNull()) { 418 if (positionAfterSplit.isNotNull()) {
419 document().updateLayoutIgnorePendingStylesheets(); 419 document().updateLayoutIgnorePendingStylesheets();
420 if (!positionAfterSplit.isRenderedCharacter()) { 420 // TODO(yosin) |isRenderedCharacter()| should be removed, and we should
421 // use |VisiblePosition::characterAfter()|.
422 if (!isRenderedCharacter(positionAfterSplit)) {
421 // Clear out all whitespace and insert one non-breaking space 423 // Clear out all whitespace and insert one non-breaking space
422 ASSERT(!positionAfterSplit.computeContainerNode()->layoutObject() || positionAfterSplit.computeContainerNode()->layoutObject()->style()->collapseWhi teSpace()); 424 ASSERT(!positionAfterSplit.computeContainerNode()->layoutObject() || positionAfterSplit.computeContainerNode()->layoutObject()->style()->collapseWhi teSpace());
423 deleteInsignificantTextDownstream(positionAfterSplit); 425 deleteInsignificantTextDownstream(positionAfterSplit);
424 if (positionAfterSplit.anchorNode()->isTextNode()) 426 if (positionAfterSplit.anchorNode()->isTextNode())
425 insertTextIntoNode(toText(positionAfterSplit.computeContainerNod e()), 0, nonBreakingSpaceString()); 427 insertTextIntoNode(toText(positionAfterSplit.computeContainerNod e()), 0, nonBreakingSpaceString());
426 } 428 }
427 } 429 }
428 430
429 setEndingSelection(VisibleSelection(firstPositionInNode(blockToInsert.get()) , DOWNSTREAM, endingSelection().isDirectional())); 431 setEndingSelection(VisibleSelection(firstPositionInNode(blockToInsert.get()) , DOWNSTREAM, endingSelection().isDirectional()));
430 applyStyleAfterInsertion(startBlock.get()); 432 applyStyleAfterInsertion(startBlock.get());
431 } 433 }
432 434
433 DEFINE_TRACE(InsertParagraphSeparatorCommand) 435 DEFINE_TRACE(InsertParagraphSeparatorCommand)
434 { 436 {
435 visitor->trace(m_style); 437 visitor->trace(m_style);
436 CompositeEditCommand::trace(visitor); 438 CompositeEditCommand::trace(visitor);
437 } 439 }
438 440
439 441
440 } // namespace blink 442 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/commands/InsertLineBreakCommand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698