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

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

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

Powered by Google App Engine
This is Rietveld 408576698