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

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

Issue 2755013004: Improve how DocumentMarkerController updates markers in response to text edits (Closed)
Patch Set: Rebase Created 3 years, 8 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 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 // TODO(yosin) |isRenderedCharacter()| should be removed, and we should use 753 // TODO(yosin) |isRenderedCharacter()| should be removed, and we should use
754 // |VisiblePosition::characterAfter()| and 754 // |VisiblePosition::characterAfter()| and
755 // |VisiblePosition::characterBefore()| 755 // |VisiblePosition::characterBefore()|
756 if (leading_whitespace_.IsNotNull() && 756 if (leading_whitespace_.IsNotNull() &&
757 !IsRenderedCharacter(leading_whitespace_) && 757 !IsRenderedCharacter(leading_whitespace_) &&
758 leading_whitespace_.AnchorNode()->IsTextNode()) { 758 leading_whitespace_.AnchorNode()->IsTextNode()) {
759 Text* text_node = ToText(leading_whitespace_.AnchorNode()); 759 Text* text_node = ToText(leading_whitespace_.AnchorNode());
760 DCHECK(!text_node->GetLayoutObject() || 760 DCHECK(!text_node->GetLayoutObject() ||
761 text_node->GetLayoutObject()->Style()->CollapseWhiteSpace()) 761 text_node->GetLayoutObject()->Style()->CollapseWhiteSpace())
762 << text_node; 762 << text_node;
763 ReplaceTextInNodePreservingMarkers( 763 ReplaceTextInNode(text_node,
764 text_node, leading_whitespace_.ComputeOffsetInContainerNode(), 1, 764 leading_whitespace_.ComputeOffsetInContainerNode(), 1,
765 NonBreakingSpaceString()); 765 NonBreakingSpaceString());
766 } 766 }
767 if (trailing_whitespace_.IsNotNull() && 767 if (trailing_whitespace_.IsNotNull() &&
768 !IsRenderedCharacter(trailing_whitespace_) && 768 !IsRenderedCharacter(trailing_whitespace_) &&
769 trailing_whitespace_.AnchorNode()->IsTextNode()) { 769 trailing_whitespace_.AnchorNode()->IsTextNode()) {
770 Text* text_node = ToText(trailing_whitespace_.AnchorNode()); 770 Text* text_node = ToText(trailing_whitespace_.AnchorNode());
771 DCHECK(!text_node->GetLayoutObject() || 771 DCHECK(!text_node->GetLayoutObject() ||
772 text_node->GetLayoutObject()->Style()->CollapseWhiteSpace()) 772 text_node->GetLayoutObject()->Style()->CollapseWhiteSpace())
773 << text_node; 773 << text_node;
774 ReplaceTextInNodePreservingMarkers( 774 ReplaceTextInNode(text_node,
775 text_node, trailing_whitespace_.ComputeOffsetInContainerNode(), 1, 775 trailing_whitespace_.ComputeOffsetInContainerNode(), 1,
776 NonBreakingSpaceString()); 776 NonBreakingSpaceString());
777 } 777 }
778 } 778 }
779 779
780 // If a selection starts in one block and ends in another, we have to merge to 780 // If a selection starts in one block and ends in another, we have to merge to
781 // bring content before the start together with content after the end. 781 // bring content before the start together with content after the end.
782 void DeleteSelectionCommand::MergeParagraphs(EditingState* editing_state) { 782 void DeleteSelectionCommand::MergeParagraphs(EditingState* editing_state) {
783 if (!merge_blocks_after_delete_) { 783 if (!merge_blocks_after_delete_) {
784 if (prune_start_block_if_necessary_) { 784 if (prune_start_block_if_necessary_) {
785 // We aren't going to merge into the start block, so remove it if it's 785 // We aren't going to merge into the start block, so remove it if it's
786 // empty. 786 // empty.
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 visitor->Trace(delete_into_blockquote_style_); 1244 visitor->Trace(delete_into_blockquote_style_);
1245 visitor->Trace(start_root_); 1245 visitor->Trace(start_root_);
1246 visitor->Trace(end_root_); 1246 visitor->Trace(end_root_);
1247 visitor->Trace(start_table_row_); 1247 visitor->Trace(start_table_row_);
1248 visitor->Trace(end_table_row_); 1248 visitor->Trace(end_table_row_);
1249 visitor->Trace(temporary_placeholder_); 1249 visitor->Trace(temporary_placeholder_);
1250 CompositeEditCommand::Trace(visitor); 1250 CompositeEditCommand::Trace(visitor);
1251 } 1251 }
1252 1252
1253 } // namespace blink 1253 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698