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

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

Issue 1780413002: Editing: Skip TestRendering in ReplaceSelectionCommand if the editing host is plain-text editable a… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: accept only last interchangenewline Created 4 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, 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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 } 655 }
656 656
657 bool CompositeEditCommand::shouldRebalanceLeadingWhitespaceFor(const String& tex t) const 657 bool CompositeEditCommand::shouldRebalanceLeadingWhitespaceFor(const String& tex t) const
658 { 658 {
659 return containsOnlyWhitespace(text); 659 return containsOnlyWhitespace(text);
660 } 660 }
661 661
662 bool CompositeEditCommand::canRebalance(const Position& position) const 662 bool CompositeEditCommand::canRebalance(const Position& position) const
663 { 663 {
664 Node* node = position.computeContainerNode(); 664 Node* node = position.computeContainerNode();
665 if (!position.isOffsetInAnchor() || !node || !node->isTextNode()) 665 if (!position.isOffsetInAnchor() || !node || !node->isTextNode() || !node->l ayoutObjectIsRichlyEditable())
666 return false; 666 return false;
667 667
668 Text* textNode = toText(node); 668 Text* textNode = toText(node);
669 if (textNode->length() == 0) 669 if (textNode->length() == 0)
670 return false; 670 return false;
671 671
672 LayoutText* layoutText = textNode->layoutObject(); 672 LayoutText* layoutText = textNode->layoutObject();
673 if (layoutText && !layoutText->style()->collapseWhiteSpace()) 673 if (layoutText && !layoutText->style()->collapseWhiteSpace())
674 return false; 674 return false;
675 675
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 // current text node. 726 // current text node.
727 isStartOfParagraph(visibleUpstreamPos) || upstream == 0, 727 isStartOfParagraph(visibleUpstreamPos) || upstream == 0,
728 isEndOfParagraph(visibleDownstreamPos) || (unsigned)downstream == text.l ength()); 728 isEndOfParagraph(visibleDownstreamPos) || (unsigned)downstream == text.l ength());
729 729
730 if (string != rebalancedString) 730 if (string != rebalancedString)
731 replaceTextInNodePreservingMarkers(textNode.release(), upstream, length, rebalancedString); 731 replaceTextInNodePreservingMarkers(textNode.release(), upstream, length, rebalancedString);
732 } 732 }
733 733
734 void CompositeEditCommand::prepareWhitespaceAtPositionForSplit(Position& positio n) 734 void CompositeEditCommand::prepareWhitespaceAtPositionForSplit(Position& positio n)
735 { 735 {
736 if (!isRichlyEditablePosition(position))
737 return;
736 Node* node = position.anchorNode(); 738 Node* node = position.anchorNode();
737 if (!node || !node->isTextNode()) 739 if (!node || !node->isTextNode())
738 return; 740 return;
739 Text* textNode = toText(node); 741 Text* textNode = toText(node);
740 742
741 if (textNode->length() == 0) 743 if (textNode->length() == 0)
742 return; 744 return;
743 LayoutText* layoutText = textNode->layoutObject(); 745 LayoutText* layoutText = textNode->layoutObject();
744 if (layoutText && !layoutText->style()->collapseWhiteSpace()) 746 if (layoutText && !layoutText->style()->collapseWhiteSpace())
745 return; 747 return;
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 } 1615 }
1614 1616
1615 DEFINE_TRACE(CompositeEditCommand) 1617 DEFINE_TRACE(CompositeEditCommand)
1616 { 1618 {
1617 visitor->trace(m_commands); 1619 visitor->trace(m_commands);
1618 visitor->trace(m_composition); 1620 visitor->trace(m_composition);
1619 EditCommand::trace(visitor); 1621 EditCommand::trace(visitor);
1620 } 1622 }
1621 1623
1622 } // namespace blink 1624 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698