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

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

Issue 2175163004: Add a plain space instead of   between text nodes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix a test fail in Win Created 4 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 | « third_party/WebKit/Source/core/editing/EditingUtilities.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, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2005, 2006, 2007, 2008 Apple 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 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 VisiblePosition visibleUpstreamPos = createVisiblePosition(Position(textNode , upstream)); 728 VisiblePosition visibleUpstreamPos = createVisiblePosition(Position(textNode , upstream));
729 VisiblePosition visibleDownstreamPos = createVisiblePosition(Position(textNo de, downstream)); 729 VisiblePosition visibleDownstreamPos = createVisiblePosition(Position(textNo de, downstream));
730 730
731 String string = text.substring(upstream, length); 731 String string = text.substring(upstream, length);
732 String rebalancedString = stringWithRebalancedWhitespace(string, 732 String rebalancedString = stringWithRebalancedWhitespace(string,
733 // FIXME: Because of the problem mentioned at the top of this function, we 733 // FIXME: Because of the problem mentioned at the top of this function, we
734 // must also use nbsps at the start/end of the string because this function 734 // must also use nbsps at the start/end of the string because this function
735 // doesn't get all surrounding whitespace, just the whitespace in the 735 // doesn't get all surrounding whitespace, just the whitespace in the
736 // current text node. 736 // current text node.
737 isStartOfParagraph(visibleUpstreamPos) || upstream == 0, 737 isStartOfParagraph(visibleUpstreamPos) || upstream == 0,
738 isEndOfParagraph(visibleDownstreamPos) || (unsigned)downstream == text.l ength()); 738 (isEndOfParagraph(visibleDownstreamPos) || (unsigned)downstream == text. length())
739 && !(textNode->nextSibling() && textNode->nextSibling()->isTextNode()));
739 740
740 if (string != rebalancedString) 741 if (string != rebalancedString)
741 replaceTextInNodePreservingMarkers(textNode, upstream, length, rebalance dString); 742 replaceTextInNodePreservingMarkers(textNode, upstream, length, rebalance dString);
742 } 743 }
743 744
744 void CompositeEditCommand::prepareWhitespaceAtPositionForSplit(Position& positio n) 745 void CompositeEditCommand::prepareWhitespaceAtPositionForSplit(Position& positio n)
745 { 746 {
746 if (!isRichlyEditablePosition(position)) 747 if (!isRichlyEditablePosition(position))
747 return; 748 return;
748 Node* node = position.anchorNode(); 749 Node* node = position.anchorNode();
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after
1643 } 1644 }
1644 1645
1645 DEFINE_TRACE(CompositeEditCommand) 1646 DEFINE_TRACE(CompositeEditCommand)
1646 { 1647 {
1647 visitor->trace(m_commands); 1648 visitor->trace(m_commands);
1648 visitor->trace(m_composition); 1649 visitor->trace(m_composition);
1649 EditCommand::trace(visitor); 1650 EditCommand::trace(visitor);
1650 } 1651 }
1651 1652
1652 } // namespace blink 1653 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/EditingUtilities.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698