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

Side by Side Diff: Source/core/editing/markup.cpp

Issue 124943003: Remove 'String::append' from some of the blink source. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removing the CustomFilterValidatedProgram.cpp from the patch(File is deleted in r164847) Created 6 years, 11 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 | « no previous file | Source/core/fetch/CSSStyleSheetResource.cpp » ('j') | 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) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved.
4 * Copyright (C) 2011 Igalia S.L. 4 * Copyright (C) 2011 Igalia S.L.
5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. 5 * Copyright (C) 2011 Motorola Mobility. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 747
748 if (string.isEmpty()) { 748 if (string.isEmpty()) {
749 paragraph->appendChild(createBlockPlaceholderElement(document)); 749 paragraph->appendChild(createBlockPlaceholderElement(document));
750 return; 750 return;
751 } 751 }
752 752
753 ASSERT(string.find('\n') == kNotFound); 753 ASSERT(string.find('\n') == kNotFound);
754 754
755 Vector<String> tabList; 755 Vector<String> tabList;
756 string.split('\t', true, tabList); 756 string.split('\t', true, tabList);
757 String tabText = emptyString(); 757 StringBuilder tabText;
758 bool first = true; 758 bool first = true;
759 size_t numEntries = tabList.size(); 759 size_t numEntries = tabList.size();
760 for (size_t i = 0; i < numEntries; ++i) { 760 for (size_t i = 0; i < numEntries; ++i) {
761 const String& s = tabList[i]; 761 const String& s = tabList[i];
762 762
763 // append the non-tab textual part 763 // append the non-tab textual part
764 if (!s.isEmpty()) { 764 if (!s.isEmpty()) {
765 if (!tabText.isEmpty()) { 765 if (!tabText.isEmpty()) {
766 paragraph->appendChild(createTabSpanElement(document, tabText)); 766 paragraph->appendChild(createTabSpanElement(document, tabText.to String()));
767 tabText = emptyString(); 767 tabText.clear();
768 } 768 }
769 RefPtr<Node> textNode = document.createTextNode(stringWithRebalanced Whitespace(s, first, i + 1 == numEntries)); 769 RefPtr<Node> textNode = document.createTextNode(stringWithRebalanced Whitespace(s, first, i + 1 == numEntries));
770 paragraph->appendChild(textNode.release()); 770 paragraph->appendChild(textNode.release());
771 } 771 }
772 772
773 // there is a tab after every entry, except the last entry 773 // there is a tab after every entry, except the last entry
774 // (if the last character is a tab, the list gets an extra empty entry) 774 // (if the last character is a tab, the list gets an extra empty entry)
775 if (i + 1 != numEntries) 775 if (i + 1 != numEntries)
776 tabText.append('\t'); 776 tabText.append('\t');
777 else if (!tabText.isEmpty()) 777 else if (!tabText.isEmpty())
778 paragraph->appendChild(createTabSpanElement(document, tabText)); 778 paragraph->appendChild(createTabSpanElement(document, tabText.toStri ng()));
779 779
780 first = false; 780 first = false;
781 } 781 }
782 } 782 }
783 783
784 bool isPlainTextMarkup(Node *node) 784 bool isPlainTextMarkup(Node *node)
785 { 785 {
786 if (!node->isElementNode() || !node->hasTagName(divTag) || toElement(node)-> hasAttributes()) 786 if (!node->isElementNode() || !node->hasTagName(divTag) || toElement(node)-> hasAttributes())
787 return false; 787 return false;
788 788
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 return; 1077 return;
1078 1078
1079 RefPtr<Text> textNode = toText(node.get()); 1079 RefPtr<Text> textNode = toText(node.get());
1080 RefPtr<Text> textNext = toText(next); 1080 RefPtr<Text> textNext = toText(next);
1081 textNode->appendData(textNext->data()); 1081 textNode->appendData(textNext->data());
1082 if (textNext->parentNode()) // Might have been removed by mutation event. 1082 if (textNext->parentNode()) // Might have been removed by mutation event.
1083 textNext->remove(exceptionState); 1083 textNext->remove(exceptionState);
1084 } 1084 }
1085 1085
1086 } 1086 }
OLDNEW
« no previous file with comments | « no previous file | Source/core/fetch/CSSStyleSheetResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698