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

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

Issue 2692093003: Rewrite DocumentMarkerController to use SynchronousMutationObserver (Closed)
Patch Set: Rebase on separate CL to add SetCharacterDataCommand 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 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2005 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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 // TODO(yosin) |isRenderedCharacter()| should be removed, and we should use 743 // TODO(yosin) |isRenderedCharacter()| should be removed, and we should use
744 // |VisiblePosition::characterAfter()| and 744 // |VisiblePosition::characterAfter()| and
745 // |VisiblePosition::characterBefore()| 745 // |VisiblePosition::characterBefore()|
746 if (m_leadingWhitespace.isNotNull() && 746 if (m_leadingWhitespace.isNotNull() &&
747 !isRenderedCharacter(m_leadingWhitespace) && 747 !isRenderedCharacter(m_leadingWhitespace) &&
748 m_leadingWhitespace.anchorNode()->isTextNode()) { 748 m_leadingWhitespace.anchorNode()->isTextNode()) {
749 Text* textNode = toText(m_leadingWhitespace.anchorNode()); 749 Text* textNode = toText(m_leadingWhitespace.anchorNode());
750 DCHECK(!textNode->layoutObject() || 750 DCHECK(!textNode->layoutObject() ||
751 textNode->layoutObject()->style()->collapseWhiteSpace()) 751 textNode->layoutObject()->style()->collapseWhiteSpace())
752 << textNode; 752 << textNode;
753 replaceTextInNodePreservingMarkers( 753 replaceTextInNode(textNode,
754 textNode, m_leadingWhitespace.computeOffsetInContainerNode(), 1, 754 m_leadingWhitespace.computeOffsetInContainerNode(), 1,
755 nonBreakingSpaceString()); 755 nonBreakingSpaceString());
756 } 756 }
757 if (m_trailingWhitespace.isNotNull() && 757 if (m_trailingWhitespace.isNotNull() &&
758 !isRenderedCharacter(m_trailingWhitespace) && 758 !isRenderedCharacter(m_trailingWhitespace) &&
759 m_trailingWhitespace.anchorNode()->isTextNode()) { 759 m_trailingWhitespace.anchorNode()->isTextNode()) {
760 Text* textNode = toText(m_trailingWhitespace.anchorNode()); 760 Text* textNode = toText(m_trailingWhitespace.anchorNode());
761 DCHECK(!textNode->layoutObject() || 761 DCHECK(!textNode->layoutObject() ||
762 textNode->layoutObject()->style()->collapseWhiteSpace()) 762 textNode->layoutObject()->style()->collapseWhiteSpace())
763 << textNode; 763 << textNode;
764 replaceTextInNodePreservingMarkers( 764 replaceTextInNode(textNode,
765 textNode, m_trailingWhitespace.computeOffsetInContainerNode(), 1, 765 m_trailingWhitespace.computeOffsetInContainerNode(), 1,
766 nonBreakingSpaceString()); 766 nonBreakingSpaceString());
767 } 767 }
768 } 768 }
769 769
770 // If a selection starts in one block and ends in another, we have to merge to 770 // If a selection starts in one block and ends in another, we have to merge to
771 // bring content before the start together with content after the end. 771 // bring content before the start together with content after the end.
772 void DeleteSelectionCommand::mergeParagraphs(EditingState* editingState) { 772 void DeleteSelectionCommand::mergeParagraphs(EditingState* editingState) {
773 if (!m_mergeBlocksAfterDelete) { 773 if (!m_mergeBlocksAfterDelete) {
774 if (m_pruneStartBlockIfNecessary) { 774 if (m_pruneStartBlockIfNecessary) {
775 // We aren't going to merge into the start block, so remove it if it's 775 // We aren't going to merge into the start block, so remove it if it's
776 // empty. 776 // empty.
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 visitor->trace(m_deleteIntoBlockquoteStyle); 1227 visitor->trace(m_deleteIntoBlockquoteStyle);
1228 visitor->trace(m_startRoot); 1228 visitor->trace(m_startRoot);
1229 visitor->trace(m_endRoot); 1229 visitor->trace(m_endRoot);
1230 visitor->trace(m_startTableRow); 1230 visitor->trace(m_startTableRow);
1231 visitor->trace(m_endTableRow); 1231 visitor->trace(m_endTableRow);
1232 visitor->trace(m_temporaryPlaceholder); 1232 visitor->trace(m_temporaryPlaceholder);
1233 CompositeEditCommand::trace(visitor); 1233 CompositeEditCommand::trace(visitor);
1234 } 1234 }
1235 1235
1236 } // namespace blink 1236 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698